Skip to content

fix(agent-os): bound email and basic auth scan complexity - #4070

Open
Ricky Gummadi (Ricky-G) wants to merge 2 commits into
mainfrom
fix/agent-os-bound-email-auth-complexity
Open

Ricky Gummadi (Ricky-G) wants to merge 2 commits into
mainfrom
fix/agent-os-bound-email-auth-complexity

Conversation

@Ricky-G

Copy link
Copy Markdown
Contributor

Summary

This independently-authored replacement PR bounds the email and Basic-auth credential-redaction scans so separator-dense or padded input cannot trigger unbounded regex work. It preserves fail-closed detection for readable email addresses and long scheme-like Basic-auth URIs.

Problem

Issue #3566 identified quadratic behavior in Agent-OS PII scanning on separator-dense input. The original implementation also left the Basic-auth URI scan unbounded on the same input shape. This PR supersedes stale PR #3575 with a fresh commit authored by Ricky Gummadi and keeps the issue linkage on the replacement PR.

Changes

File What changed
agent-governance-python/agent-os/src/agent_os/credential_redactor.py Bound the email local-part and Basic-auth scheme-like scan while retaining fail-closed matching, including padded and punctuation-heavy values.
agent-governance-python/agent-os/tests/test_credential_redactor.py Added correctness and performance regressions for padded email/Basic-auth values and separator-dense near misses.

Testing

  • python -m pytest tests\\test_credential_redactor.py -q -k "not trailing_lookahead_patterns_handle_adversarial_input_quickly" — 136 passed, 4 deselected.
  • Affected auth/email/performance selection — 30 passed.
  • python -m ruff check src\\agent_os\\credential_redactor.py tests\\test_credential_redactor.py — passed.
  • The four deselected tests are existing Windows-only parameter-ID cases whose generated environment variable exceeds Windows' 32,767-character limit; they are unrelated to this change.

Fixes #3566

Supersedes #3575.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Ricky Gummadi <ricky.gummadi@outlook.com>
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

Comment thread agent-governance-python/agent-os/tests/test_credential_redactor.py Fixed
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Microsoft Corporation <agentgovtoolkit@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR (< 200 lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PII detection regexes scale quadratically on digit-heavy input

1 participant