Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve sql obfuscation regular expressions #2861

Open
jsumners-nr opened this issue Jan 3, 2025 · 2 comments
Open

Improve sql obfuscation regular expressions #2861

jsumners-nr opened this issue Jan 3, 2025 · 2 comments

Comments

@jsumners-nr
Copy link
Contributor

jsumners-nr commented Jan 3, 2025

// eslint-disable-next-line sonarjs/slow-regex
const singleQuote = /'(?:''|[^'])*?(?:\\'.*|'(?!'))/
// eslint-disable-next-line sonarjs/slow-regex
const doubleQuote = /"(?:[^"]|"")*?(?:\\".*|"(?!"))/
const dollarQuote = /(\$(?!\d)[^$]*?\$).*?(?:\1|$)/
const oracleQuote = /q'\[.*?(?:\]'|$)|q'\{.*?(?:\}'|$)|q'<.*?(?:>'|$)|q'\(.*?(?:\)'|$)/
// eslint-disable-next-line sonarjs/slow-regex
const comment = /(?:#|--).*?(?=\r|\n|$)/

// ( ` database` . ` table ` )
// eslint-disable-next-line sonarjs/slow-regex
const CLEANER = /^\(?(?:([`'"]?)(.*?)\1\.)?([`'"]?)(.*?)\3\)?$/

These regular expressions are triggering sonar-js's "slow regex" rule. We need to investigate what the regular expressions do, and see if we can improve them.

@workato-integration
Copy link

@jsumners-nr
Copy link
Contributor Author

These may already be solved if we agree that #2714 is an acceptable change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage Needed: Unprioritized Features
Development

No branches or pull requests

1 participant