Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
Botframework (Node) - dialogData stripping out regex

Does the BotBuilder Node SDK actively strip out anything that is stored the dialogData object?

For example, I have created a simple loop and I am storing a regex in session.dialogData.questions. When I console log this after storing it, I can see that my regex is stored as expected:

  { 
    validation: /^[0-9]{19}$/,
  } 

However, when I try and log the same session.dialogData.questions object in the next step of my waterfall, then the regex seems to have been converted into an empty object:

  {
    validation: {}
  }

I presume this a deliberate attempt to prevent XSS and other types of exploitation?

The code for this example can be found below:

const builder = require('botbuilder')
const lib = new builder.Library('FormBuilder')

lib.dialog('/', [
    (session, args) => {
      session.dialogData.questions = {
        validation: /^[0-9]{19}$/
      }
      console.log(session.dialogData.questions)
      builder.Prompts.confirm(session, 'Would you like to proceed?')
    },
    (session, results) => {
      console.log(session.dialogData.questions)
    }
])

module.exports.createLibrary = () => {
  return lib.clone()
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Regarding your initial question, no the SDK doesn't actively strip anything out of the dialogData object. Anything that is, except for regexp...

I'm not sure why this is, but for the time being I recommend storing your pattern as a string, '^[0-9]{19}$', and then constructing a new regexp via new RegExp(session.dialogData.questions.validation) when needed.

I tried storing a method to construct a new RegExp using this.questions.validation, but likewise this was also stripped out.


Edit:

Per Ezequiel's comment, this isn't a Bot Framework issue in the end. It is not possible to store non-serializable data inside JSON.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!