Page MenuHomeVyOS Platform

<regex> constraints in XML are partially broken
Closed, ResolvedPublicBUG

Description

The backslash \ symbol in <regex> definitions inside XML templates will be ignored during comparison, this makes unusable any regex which contains it, like:

\d
\b
\w
\\

The problem exists because all regex are converting into node.def as-is. And later, configuration parser considers \ as an escape symbol. So, we need to add escaping of \ before saving it to node.def.

Example:
XML: <regex>^\d\w123$</regex>
node.def: syntax:expression: exec "${vyos_libexec_dir}/validate-value.py --regex \'^\d\w123$\' --value \'$VAR(@)\'"; "Invalid value"
Scripts arguments: ['/usr/libexec/vyos/validate-value.py', '--regex', '^dw123$', '--value', 'test']

Details

Version
1.2-rolling-201910250117
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

syncer closed this task as Unknown Status.Nov 16 2019, 10:53 PM
syncer assigned this task to jestabro.
syncer triaged this task as Low priority.
syncer moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
syncer moved this task from Needs Triage to Backlog on the VyOS 1.2 Crux (VyOS 1.2.4) board.
jestabro changed the task status from Unknown Status to Resolved.Nov 22 2019, 2:05 PM