Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

256
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda