To fix the problem, we need to ensure that all occurrences of the wildcard character * in record.name are replaced. This can be achieved by using a regular expression with the global flag (g). This ensures that every instance of the wildcard character is replaced, not just the first one.
Modify the replace method call on record.name to use a regular expression with the global flag.
Specifically, change the replace('*', '') to replace(/\*/g, '') and replace('*.', '') to replace(/\*\./g, '').
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Fixes https://github.com/jafayer/DinoDNS/security/code-scanning/2
To fix the problem, we need to ensure that all occurrences of the wildcard character
*
inrecord.name
are replaced. This can be achieved by using a regular expression with the global flag (g
). This ensures that every instance of the wildcard character is replaced, not just the first one.replace
method call onrecord.name
to use a regular expression with the global flag.replace('*', '')
toreplace(/\*/g, '')
andreplace('*.', '')
toreplace(/\*\./g, '')
.Suggested fixes powered by Copilot Autofix. Review carefully before merging.