Repository navigation
Description
Problem Description
redact_text and mask_uri_credentials in src/devops_cli/security/sanitizer.py mask the userinfo of a URL only when it holds a password. _mask_url_candidate tests parts.password is not None. A URL whose userinfo is a user name alone is left as it is.
Some services take a token as the user name, with an empty password. httpx2 sends such a URL as Basic authentication, and a token can be in ai.ollama_urls. Then an error text that quotes the URL shows the token. A masked text with a password shows <masked-user>:<masked-password>, so the two cases differ.
The same line cannot tell a token from a harmless user name such as git in an SSH clone URL. A person must choose the rule. #2481 does not depend on the choice, because the benchmarks and the embedding engine now name a URL without its userinfo.
Reproduction Steps
- Run
redact_textin Python on a text that quoteshttp://example.com:11434/api/embedwith a fake token before the host, as a user name only. - Run it again on the same text with a fake user name and a fake password before the host.
- Compare the two results.
Expected vs Actual Behavior
Expected: a person decides whether a user name alone is masked. The decision is written in the docs of the sanitizer and in its tests.
Actual: the text with a password shows <masked-user>:<masked-password>, and the text with a user name alone shows the user name.
Environment Diagnostics
- DevOps CLI Version: 0.16.1 (
origin/main9f6ace18) - Python Version: 3.14.10
- OS & Architecture: Linux x86_64 (WSL2)
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
user name only: the text comes back unchanged
user name and password: the userinfo shows as <masked-user>:<masked-password>The redaction of intake refuses a literal URL with userinfo, so this report describes the two texts.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #2481
Proposed design
Problem statement
redact_text and mask_uri_credentials mask URL userinfo only when a password is present. A URL whose userinfo is a user name alone is left unchanged. Some services send a token as the user name with an empty password, so the token appears in masked text. The rule for masking a user name without a password is not stated in the docs or the tests.
Acceptance criteria
Requirement: Mask user-name-only userinfo in redact_text
redact_text SHALL mask the user name of a URL that has a user name but no password.
Scenario: URL with user name only
- WHEN redact_text processes a text that contains a URL with a user name and no password
- THEN the user name is replaced with a masked placeholder and the host and path are unchanged
Requirement: Mask user-name-only userinfo in mask_uri_credentials
mask_uri_credentials SHALL mask the user name of a URL that has a user name but no password.
Scenario: URI with user name only
- WHEN mask_uri_credentials processes a URI with a user name and no password
- THEN the user name is replaced with a masked placeholder and the scheme, host and path are unchanged
Requirement: Document the masking rule
The sanitizer module documentation SHALL state the rule for masking a user name without a password.
Scenario: Documentation states the rule
- WHEN a reader consults the docstring or module doc of the sanitizer
- THEN the rule for user-name-only masking is stated
Requirement: Test the user-name-only case
The test suite SHALL include a test that asserts a user name without a password is masked.
Scenario: Test covers user-name-only URL
- WHEN the sanitizer test suite runs
- THEN a test asserts that a URL with a user name and no password has its user name masked
Existing Tool Considered
No check has run. The project already maintains its own sanitizer in src/devops_cli/security/sanitizer.py. The fix changes one condition in _mask_url_candidate and one in mask_uri_credentials, and adds tests and a doc line. No open, maintained library provides this masking as a drop-in. The written cost is a few lines of condition change, a few test lines, and one doc sentence.
Key questions
- Should a user name alone (no password) in a URL be masked?: Yes. Mask the user name. RFC 7235 treats the user-id as part of the credentials. The principle of least exposure says: when you cannot tell a token from a harmless name, mask it. The existing code already masks userinfo when a password is present, which shows the project treats userinfo as sensitive. The body states that a person must choose this rule. (a person decides) [sources: src/devops_cli/security/sanitizer.py:54]
Open questions
- Should a user name alone (no password) in a URL be masked? (a person decides)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-04: none.
Tool: none found.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
A token used as a URL user name can leak in output text, which is a security gap.The leak is real but narrow, and a human decision is needed before the fix.It prevents a token from appearing in error text when used as a URL user name.The code change is small, but it needs a documented decision and tests.Both address URL credential masking in sanitizer.py, but 1109 fixes the parsing mechanism while this candidate addresses the policy gap for user-name-only URLs.fix(ai): name benchmark servers and models by host and port (#2666)
devops-cli-service commentedon Oct 30, 2026
Refine cannot set this item to Ready at 46fd02d until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
devops-cli-service commentedon Nov 4, 2026
Alternatives check: none
Tool: none found
Lacks:
_mask_url_candidatecondition stay in the project's own sanitizer.redact_text/mask_uri_credentialsover free text.Searches run:
Sources:
Checked on 2026-11-04. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 5, 2026
Released in v0.63.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.63.0
devops-cli-service commentedon Nov 5, 2026
Live since 2026-11-05 19:48 UTC