Skip to content

redact: mask secrets embedded in URL query strings and connection strings - #196

Open
CyberSunil wants to merge 2 commits into
OWASP:mainfrom
CyberSunil:fix/redact-embedded-url-connstring-secrets
Open

CyberSunil wants to merge 2 commits into
OWASP:mainfrom
CyberSunil:fix/redact-embedded-url-connstring-secrets

Conversation

@CyberSunil

Copy link
Copy Markdown

redact.py masks creds in URL userinfo (postgres://user:pw@host) but the same password leaks as a URL query param or connection-string field:

ENV SPRING_DATASOURCE_URL=jdbc:postgresql://db/app?user=sa&password=Sup3rSecret
ENV ConnectionStrings__Default=Server=db;User Id=sa;Password=P@ssw0rd123;

Both return count 0 on main — password goes to the LLM in clear. Common in JDBC/Spring/.NET.

Fix: one pass masking a secret field's value after a compound delimiter (? & ; , or quote). Key stays visible, top-level assignments not double-counted, interpolations left alone.

2 tests fail on main and pass after; 1 regression guard. Full redact suite 13/13.

@github-actions github-actions Bot added the tests Changes to the test suite label Sep 23, 2026
@advaitpatel
advaitpatel self-requested a review September 23, 2026 16:58
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.06%. Comparing base (a2fe184) to head (b3018fd).
⚠️ Report is 98 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #196      +/-   ##
==========================================
+ Coverage   78.95%   86.06%   +7.10%     
==========================================
  Files          26       53      +27     
  Lines        4158     8145    +3987     
==========================================
+ Hits         3283     7010    +3727     
- Misses        875     1135     +260     
Flag Coverage Δ
unittests 86.06% <100.00%> (+7.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Labels

tests Changes to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants