Skip to content

Reject colons in HTTP agent usernames before hashing - #494

Open
Alphasite wants to merge 1 commit into
mainfrom
tnz-129825-reject-colon-http-agent-username
Open

Alphasite wants to merge 1 commit into
mainfrom
tnz-129825-reject-colon-http-agent-username

Conversation

@Alphasite

Copy link
Copy Markdown
Contributor

A percent-encoded colon in an HTTPS mbus username currently passes HashURL, but the agent splits Basic Auth credentials at the first colon and cannot authenticate that username. Reject the decoded username before generating a verifier, with an error that contains no credentials.

Adds a regression test for user%3Aextra. This is defensive validation for custom manifests; normal vcap usernames are unaffected. This follow-up to #487 is independent of cloudfoundry/bosh-cli#742 and is not a prerequisite for merging that PR.

Validation:

  • The new regression test fails before the fix and passes afterward.
  • go test ./agentpassword/... ./mbus/... ./app/...
  • golangci-lint run ./agentpassword/... (0 issues)
  • git diff --check

TNZ-129825

Fail early when an HTTPS mbus username contains a decoded colon, since
Basic Auth treats it as the username/password separator. Return a
credential-free error before creating an unusable password verifier.

Add a regression test covering a percent-encoded colon in the username.

ai-assisted=yes
TNZ-129825
Copilot AI balanced review requested due to automatic review settings October 21, 2026 20:28
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T20:28:57.602290Z 8a47689 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a436df6c-b701-4117-b308-436c72d17f34
📥 Commits

Reviewing files that changed from the base of the PR and between 52d5577 and 8a47689.

📒 Files selected for processing: 2
  • agentpassword/agentpassword.go
  • agentpassword/agentpassword_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

HashURL now rejects HTTPS URL usernames that contain a colon. A test checks this behavior with a percent-encoded colon and expects the specified error and empty return values.

Suggested reviewers: aramprice

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 8a476

The change presents no identified merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description explains the change, motivation, context, affected users, and validation performed. It does not explicitly provide release notes, breaking-change status, team tags, or AI review feedba…
Title check Passed The title clearly and concisely describes the main change: rejecting colons in HTTP agent usernames before hashing.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, motivation, context, affected users, and validation performed. It does not explicitly provide release notes, breaking-change status, team tags, or AI review feedback status, but the core information is complete.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow validation matches Basic Auth constraints and has targeted regression coverage, with no unresolved findings.

No open issues 🎉

What changed in this PR

Adds defensive validation to HashURL so HTTPS usernames incompatible with Basic Auth are rejected before password hashing.

Changes:

  • Rejects colons in decoded usernames with a credential-free error.
  • Adds regression coverage for a percent-encoded colon and an empty result on failure.
File Description
agentpassword/​agentpassword.go Validates decoded usernames before hashing.
agentpassword/​agentpassword_test.go Tests rejection and the credential-free error.

Review effort: Balanced

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

Labels

None yet

Projects

Status: Pending Review | Discussion

Development

Successfully merging this pull request may close these issues.

3 participants