Skip to content

fix(hardening): defect PR #3546 missing declared surface hardening #3551

Closed as not planned

Description

@github-actions

Unhardened Defect PR Audit Finding

Defect Pull Request #3546 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

The defect pull request 3546 fixed a plaintext-secret scan that only read two levels of the config file, but it recorded no guardrail on a hardening surface that the project counted at the time, so the same regression can return unnoticed. This change adds the missing root-cause guardrail on a surface that the current hardening audit counts, and proves that it fails on the commit before the fix.

Acceptance criteria

Requirement: The guardrail fails on the base

The change MUST add a test that fails on the commit before the fix of pull request 3546.

Scenario: Replay on the base commit

  • WHEN uv run devops ci fail-to-pass --base 19b740e^ replays the changed tests
  • THEN the added test fails on the base and passes on the head.

Requirement: The audit counts the guardrail

The change SHALL put the guardrail on a path that audit_pr_hardening counts as a declared surface.

Scenario: The audit classifies the change

  • WHEN devops pr hardening-report reads the changed paths of the pull request
  • THEN it reports the pull request hardened and names tests/ and openspec/specs/.

Requirement: The scan keeps its depth

devops config audit-keys MUST report a plaintext secret under a key of three or more levels, such as service.github_app.private_key.

Scenario: A three-level credential is present

  • WHEN the audit scans a config file that sets service.github_app.private_key to a value
  • THEN the report lists the leak as :service.github_app.private_key and exits 1.

Requirement: A repeatable pattern gets a review rule

When the defect is a pattern that other files can repeat, the change MUST add a Semgrep rule to src/devops_cli/review/rules/ with passing ruleid: and ok: tests.

Scenario: The rule passes its cases

  • WHEN the rule tests run over the ruleid: and ok: cases
  • THEN the rule flags each ruleid: case and flags no ok: case.

Existing Tool Considered

Semgrep (open, maintained) covers a code-pattern rule in src/devops_cli/review/rules/, and pytest covers a behavior test that devops ci fail-to-pass replays, but neither holds the knowledge of the defect: the audit's secret-key walk and the secret_keys() registry are devops-cli's own. The project's hardening audit (openspec/specs/pr-hardening-audit) covers the report of a hardened pull request and lacks the guardrail. Write only the regression test and, when the pattern repeats, one Semgrep rule with its cases: about 4,000 tokens to build, about 1,000 tokens a month to keep and fix, and about 30 minutes.

Key questions

  • What defect did pull request 3546 fix, at which commit, and what is its root cause?: Pull request 3546 fixed devops config audit-keys so that it finds a plaintext secret at any depth: the scanner _scan_yaml_for_secret_keys examined only ., so a three-level credential such as service.github_app.private_key was reported compliant. The fix replaced the two-level loop with _plaintext_secret_keys, a walk of the parsed YAML at any depth. The merge commit is 19b740e in release 0.57.0, and the change is archived as 2026-11-04-2511-audit-keys-nested-secret. [sources: CHANGELOG.md:171, openspec/changes/archive/2026-11-04-2511-audit-keys-nested-secret/proposal.md:5, openspec/changes/archive/2026-11-04-2511-audit-keys-nested-secret/tasks.md:8, src/devops_cli/commands/config.py:693, src/devops_cli/commands/config.py:708]
  • Which declared hardening surface holds the guardrail?: A regression test in the file that already tests the audit's scan, tests/commands/test_config_audit_keys.py, plus the living-spec requirement that records the behavior. Both tests/ and openspec/specs/ are surfaces that audit_pr_hardening counts, so the hardening report names the guardrail. A defect that other files can repeat also gets a Semgrep rule in src/devops_cli/review/rules/ with passing ruleid: and ok: cases. (best practice) [sources: openspec/specs/pr-hardening-audit/spec.md:8, openspec/specs/pr-hardening-audit/spec.md:15, docs/TESTING.md:89, docs/TESTING.md:153]
    • Chosen: A test in tests/commands/test_config_audit_keys.py. The living spec pr-hardening-audit counts an addition under tests/ as a guardrail, and the file already tests the audit's scan, so the test runs the failing behavior on the base commit.
    • Rejected: A requirement under openspec/specs/. The second counted surface, and it states the behavior that the test checks. It is added beside the test, not in place of it, because a requirement alone runs no check.
    • Rejected: A Semgrep rule in src/devops_cli/review/rules/. The declared surface for a pattern that many files can repeat. The defect is one recursion in one function, which no other file repeats, so a rule would match nothing.
    • Rejected: A lesson in docs/TESTING.md. Prose runs no check, and the invariant asks for a check that fails if the problem returns.
    • Rejected: A manual in src/devops_cli/ai/knowledge_base/. A manual states facts and versions for a model. It runs no check.
  • Which command proves the guardrail offline?: uv run devops ci fail-to-pass --base replays the changed tests on the base commit, uv run devops ci test runs one test file, and uv run devops ci runs every row. [sources: CONTRIBUTING.md, docs/TESTING.md:153, openspec/specs/ci-fail-to-pass/spec.md]
  • Where does the regression test go?: In the file that already tests the behavior, tests/commands/test_config_audit_keys.py, flat or in its mirror directory until the mirror migration ends. The test is named after the behavior, never after the issue or the pull request. [sources: docs/TESTING.md:89, docs/TESTING.md:153, openspec/changes/archive/2026-11-04-2511-audit-keys-nested-secret/tasks.md:7]
  • Does the hardening audit exist, so that it reports this pull request hardened?: Yes. audit_pr_hardening in src/devops_cli/github/defect_classifier.py reads the surface table, openspec/specs/pr-hardening-audit/spec.md holds its requirements, and .github/workflows/defect-pr-hardening-audit.yml writes its report to the job summary. [sources: openspec/specs/pr-hardening-audit/spec.md:8, src/devops_cli/github/defect_classifier.py:149, .github/workflows/defect-pr-hardening-audit.yml:53]
  • Did the hardening audit run on pull request 3546, and what did it report?: The pull request 3546 predates the surfaces that now count: the audit's table counted AGENTS.md, src/devops_cli/ai/tasks/*.md, src/devops_cli/ai/knowledge_base/ and common_hallucinations.json, and tests/ and openspec/specs/ joined only with fix(ci): the hardening audit files no issue for a tested fix #3479/fix(ci): count tests and specs as hardening guardrails #3684. The fix added a test and a spec but no line under a surface that the audit then counted, which is the finding. The workflow runs on pull_request: closed, so it never audits the pull request again, and its check output is not in this repository. The guardrail is the whole fix here. [sources: CHANGELOG.md:2050, CHANGELOG.md:30, openspec/changes/archive/2026-11-05-3479-hardening-audit-counts-tests-and-specs/proposal.md:11, .github/workflows/defect-pr-hardening-audit.yml:9, openspec/changes/archive/2026-11-04-2511-audit-keys-nested-secret/tasks.md:7]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

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 process invariant is unmet, but no user-facing defect is active.
    • Value: Medium. Adding guardrails prevents recurrent regressions from the same root cause.
    • Effort: Low. The work is to add guardrail text to one or more existing declared surfaces.
    • Related: fix(hardening): defect PR #3526 missing declared surface hardening #3531, which asks for a different change. Both are hardening audit findings for unhardened defect PRs, but each targets a different PR and requires different root-cause guardrails.
  3. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at c1191e2. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • ignores_existing_code at key_questions, question 6 and acceptance criteria 1 and 3: The plan says the fix of fix(config): find a plaintext secret at any depth in audit-keys #3546 already added a test and a spec. A new test for the same three-level scan therefore duplicates the existing guardrail. Evidence: "The fix added a test and a spec but no line under a surface that the audit then counted"
  4. 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 3546
    • 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 #3546 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.

  5. removed
    status/new
    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