Skip to content

fix(hardening): defect PR #3676 missing declared surface hardening #3682

Closed as not planned

Description

@github-actions

Unhardened Defect PR Audit Finding

Defect Pull Request #3676 was merged without adding guardrails or lessons to any declared hardening surface.

Declared Hardening Surfaces

  • docs/TESTING.md
  • ARCHITECTURE.md
  • SECURITY.md
  • CONTRIBUTING.md
  • src/devops_cli/ai/tasks/*.md
  • src/devops_cli/ai/knowledge_base/
  • .devops/review.toml
  • src/devops_cli/review/rules/

Per project invariants (AGENTS.md), defect fixes must codify root-cause guardrails into at least one declared surface to prevent recurrent regressions.

Proposed design

Problem statement

PR #3676 fixed issue #2662: redact_text and mask_uri_credentials left the user name of a URL as written when the URL had no password, so a token used as the user name reached error output. The defect pull request did add regression tests, and its change records the rule in openspec/specs/secret-masking/spec.md; since #3684 made tests/ and openspec/specs/ declared hardening surfaces, the audit now counts #3676 as hardened. The gap that remains is the lesson: no owning document tells the next author the rule. This change adds that sentence to SECURITY.md item 1 and names the two tests that fail when the defect returns.

Acceptance criteria

Requirement: Security document states the URL user-name rule

SECURITY.md item 1 (Zero Secret Leakage) MUST state that the user name of a URL is masked when the URL has no password.

Scenario: The rule is searched in the security document

  • WHEN A check runs grep -n 'user name of a URL' SECURITY.md.
  • THEN The match lies in item 1 and the sentence says that the user name is masked when the URL has no password.

Requirement: The lesson names the merged checks

The sentence in SECURITY.md MUST name the two regression tests that fail when the masker leaves a URL user name as written.

Scenario: The check names are searched

  • WHEN A check searches SECURITY.md for test_redact_text_masks_a_url_user_with_no_password and for test_a_url_user_with_no_password_is_masked_and_the_rest_stays.
  • THEN Both names are found in the sentence of item 1.

Requirement: The named checks pass

The two tests that the lesson names SHALL pass on the head.

Scenario: The named tests run

  • WHEN uv run devops ci test tests/security/test_secret_redaction.py tests/security/test_redaction_properties.py runs.
  • THEN The command exits 0 and both named tests pass.

Requirement: The documentation checks pass

The documentation checks SHALL pass after the edit to SECURITY.md.

Scenario: The documentation checks run

  • WHEN uv run devops docs check runs on the head.
  • THEN The command exits 0.

Requirement: The changed file is a declared surface

The changed file SECURITY.md MUST lie under a declared hardening surface.

Scenario: The changed path is matched

  • WHEN A test passes SECURITY.md to match_hardening_surface.
  • THEN The function returns SECURITY.md.

Requirement: No spec delta for a documentation change

The change MUST set skip_specs: true and MUST carry no spec delta, because it alters no behavior that a consumer observes.

Scenario: The change folder is validated

  • WHEN openspec validate --strict runs on the change folder.
  • THEN The validation passes, .openspec.yaml holds skip_specs: true, and the folder holds no specs/ delta.

Existing Tool Considered

None. No open, maintained tool writes a project security rule into the project's own document, and the rule is project-specific: AGENTS.md sends the subject of secrets to SECURITY.md. The change is one sentence in an existing Markdown file and builds no code, so it needs no library and replaces no tool. Cost: about 1,500 tokens to write, about 300 tokens per quarter to keep, and about 15 minutes of elapsed time. The guardrail it names is kept by the existing tests/, so no internal code is deleted.

Key questions

  • Which defect did PR fix(security): mask the user name of a URL with no password #3676 fix, and what is its root cause?: PR fix(security): mask the user name of a URL with no password #3676 fixed issue fix(security): redact_text leaves the user name of a URL with no password, so a token used as the user name shows in text #2662: redact_text and mask_uri_credentials left the user name of a URL as written when the URL had no password. The root cause was the guard on the userinfo: _mask_url_candidate masked it only when parts.password is not None, and mask_uri_credentials only when u.password was set, so http://<token>@example.com:11434/api/embed came back unchanged. The fix added the branch for a user name with no password, which shows <masked-user> in redact_text and *** in mask_uri_credentials. [sources: CHANGELOG.md:316, openspec/changes/archive/2026-11-05-2662-mask-url-user-name-without-password/proposal.md:7, src/devops_cli/security/sanitizer.py:90, src/devops_cli/security/sanitizer.py:97, src/devops_cli/security/sanitizer.py:512]
  • Does PR fix(security): mask the user name of a URL with no password #3676 already add guardrails under a declared hardening surface?: Yes. It added test_redact_text_masks_a_url_user_with_no_password and the property test_a_url_user_with_no_password_is_masked_and_the_rest_stays, and its archived change records the rule in openspec/specs/secret-masking/spec.md. fix(ci): count tests and specs as hardening guardrails #3684 added tests/ and openspec/specs/ to the surface table, so a replay of the audit now counts PR fix(security): mask the user name of a URL with no password #3676 as hardened. The issue's premise that it hardened no surface is out of date. [sources: tests/security/test_secret_redaction.py:176, tests/security/test_redaction_properties.py:66, openspec/specs/secret-masking/spec.md:110, src/devops_cli/github/defect_classifier.py:38, CHANGELOG.md:315]
  • Which declared hardening surface holds the lesson of PR fix(security): mask the user name of a URL with no password #3676?: SECURITY.md item 1 (Zero Secret Leakage). One sentence states that the user name of a URL is masked even when the URL has no password, because a parser cannot tell a token from a harmless name, and it names the two merged tests. The sentence points at the checks; it does not replace them. (best practice) [sources: AGENTS.md:33, SECURITY.md:17, docs/SELF_IMPROVEMENT.md:165, src/devops_cli/github/defect_classifier.py:32]
    • Chosen: A sentence in SECURITY.md item 1. AGENTS.md sends the subject of secrets to SECURITY.md, item 1 already owns Zero Secret Leakage, and SECURITY.md is a declared surface, so the change also hardens its own pull request.
    • Rejected: A new test that pins the defect. The tests that pin the defect already exist and pass; a second test would pin the same behavior twice, and docs/TESTING.md puts a regression test in the file of the behaviour it pins, not in a hardening pass.
    • Rejected: A bullet in ARCHITECTURE.md. ARCHITECTURE.md owns code architecture, and AGENTS.md routes secret handling to SECURITY.md. docs(architecture): add the guardrail of #2504 to a declared hardening surface #2660 used ARCHITECTURE.md for a model rule, which is a different subject.
    • Rejected: A line in docs/TESTING.md. docs/TESTING.md owns test conventions, not the masking rule; it already says that a regression test joins the file of the behaviour it pins.
    • Rejected: An entry in src/devops_cli/ai/knowledge_base/. The knowledge base teaches a subsystem to a model; it is not the security guarantee that a person reads, and the rule is one sentence in the owning document.
  • Which paths count as declared hardening surfaces?: docs/TESTING.md, ARCHITECTURE.md, SECURITY.md, CONTRIBUTING.md, src/devops_cli/ai/tasks/*.md, src/devops_cli/ai/knowledge_base/, .devops/review.toml, src/devops_cli/review/rules/, tests/ and openspec/specs/. [sources: src/devops_cli/github/defect_classifier.py:29, src/devops_cli/github/defect_classifier.py:112]
  • What does the hardening audit read to decide that a pull request is hardened?: The files of the pull request and their addition counts. audit_pr_hardening matches each path with match_hardening_surface, sums the additions of each path that lies under a surface, and reports the pull request as hardened when any surface count is above zero. The workflow writes the report in the job summary and files no issue. [sources: src/devops_cli/github/defect_classifier.py:139, src/devops_cli/github/defect_classifier.py:149, src/devops_cli/github/defect_classifier.py:167]
  • Does the audit block the merge of a defect pull request that hardens no surface?: No. The workflow runs after the pull request closes, writes the report to the job summary, passes no --fail-on-missing, files no issue and holds no issues: write permission. A required check is a repository setting, and only a person sets it. [sources: .github/workflows/defect-pr-hardening-audit.yml:4, .github/workflows/defect-pr-hardening-audit.yml:50, openspec/specs/pr-hardening-audit/spec.md:47, AGENTS.md:23]
  • Does the change carry a spec delta?: No. The change adds one sentence to a document and alters no behavior that a consumer observes, so it sets skip_specs: true and carries no delta; ADR 0010 reserves a delta for a change to a command, option, message, manifest or service behavior, and the rule is already recorded in openspec/specs/secret-masking/spec.md. (best practice) [sources: docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md:81, openspec/specs/secret-masking/spec.md:110]
    • Chosen: No spec delta, skip_specs: true. ADR 0010 names documentation as a change that alters nothing a consumer observes, and the rule is already recorded in openspec/specs/secret-masking/spec.md.
    • Rejected: A delta on secret-masking. The behavior and its requirement are unchanged; a delta would restate a requirement that the living spec already holds and would make the change look like a behavior change.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-08: none.
Tool: none found.

Activity

  1. added
    type/bug
    status/new
    value/medium
    effort/low
    on Nov 5, 2026
  2. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: none. The title has the scope hardening, and .github/labels.yml declares no scope/hardening label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. A required process step was skipped, but no user-facing defect is active.
    • Value: Medium. It closes a compliance gap and prevents a known regression class from recurring.
    • Effort: Low. The work is to add guardrails to one or more declared surfaces for a single PR.
    • Related: fix(hardening): defect PR #3663 missing declared surface hardening #3674, which asks for a different change. Both are hardening audit findings for a specific defect PR, but the candidate covers PR #3676 while item 3674 covers PR #3663.
  3. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  4. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9ca54d1 (see proposed design in issue body).

  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches turned up only general documentation and PR-review guidance (MDN pages) and nothing that writes a project-specific security rule plus the names of two repository tests into the project's own SECURITY.md. The remaining need is a single sentence in a declared surface owned by AGENTS.md, with the regression tests already present under tests/, so no open, maintained tool or library covers it.

    Tool: none found

    Lacks:

    • No tool found that records a project-specific masking rule in the project's own SECURITY.md
    • No tool found that names the project's two regression tests inside that document
    • The searches returned only general contributor and writing guidance, not a maintained library or checker for this rule

    Searches run:

    • open source library mask URL username credentials in error output redaction, results: 5
    • tool that enforces documentation updates when a bug fix pull request changes source code, results: 5
    • Python library scrubadub redact URL credentials from text, results: 5
    • danger-js rule require changelog or docs change in pull request, results: 5
    • Vale prose linter enforce documentation rules repository CI, results: 5

    Sources:

    Checked on 2026-11-08. A person decides what this means for the item. The check changes no label and closes no issue.

  6. dan-petty commented on Nov 11, 2026

    @dan-petty
    Owner

    Closed as not planned. The check that filed this item passes now.

    • Command: uv run devops pr hardening-report --pr 3676
    • Result: is_hardened: true. The hardened surfaces are tests/ and openspec/specs/.

    #3684 (merged 2026-11-05) counts tests and specs as hardening guardrails. Thus PR #3676 has the guardrail that the audit did not find. #3661 closes this family of items under the issue stewards plan #4780 (AGENTS.md rule 2). If the check fails again, reopen this item.

  7. removed
    status/ready
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions