Skip to content

354 fix redos vulnerable regex patterns#398

Open
heathdutton wants to merge 1 commit intoNASA-AMMOS:mainfrom
heathdutton:354-fix-redos-vulnerable-regex
Open

354 fix redos vulnerable regex patterns#398
heathdutton wants to merge 1 commit intoNASA-AMMOS:mainfrom
heathdutton:354-fix-redos-vulnerable-regex

Conversation

@heathdutton
Copy link
Copy Markdown

Fixes: #354

Replaces two regex patterns that were vulnerable to catastrophic backtracking (ReDoS) with equivalent patterns using negated character classes.

  • BaseMCWSPersistenceProvider.js: .*/(.*?)$ replaced with ([^/]*)$ -- eliminates backtracking on the greedy .* while still capturing the last path segment.
  • Dataset.js: \/.*Dictionary\/?$ replaced with \/[^/]*Dictionary\/?$ -- constrains the wildcard to a single path segment, which is all it ever needs to match.

Both patterns produce identical results for all valid inputs.

@davetsay
Copy link
Copy Markdown
Collaborator

davetsay commented Mar 5, 2026

@heathdutton , thanks for your interest and contribution. We haven't yet established the process for outside contributions. We'll check with the AMMOS program office and get back to you. Stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure the regex used here, which is vulnerable to super-linear runtime due to backtracking, cannot lead to denial of service.

2 participants