Repository navigation
Description
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.mdARCHITECTURE.mdSECURITY.mdCONTRIBUTING.mdsrc/devops_cli/ai/tasks/*.mdsrc/devops_cli/ai/knowledge_base/.devops/review.tomlsrc/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-reportreads the changed paths of the pull request - THEN it reports the pull request hardened and names
tests/andopenspec/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_keyto a value - THEN the report lists the leak as
:service.github_app.private_keyand 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:andok:cases - THEN the rule flags each
ruleid:case and flags nook: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-keysso that it finds a plaintext secret at any depth: the scanner_scan_yaml_for_secret_keysexamined only., so a three-level credential such asservice.github_app.private_keywas 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 is19b740ein release 0.57.0, and the change is archived as2026-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. Bothtests/andopenspec/specs/are surfaces thataudit_pr_hardeningcounts, so the hardening report names the guardrail. A defect that other files can repeat also gets a Semgrep rule insrc/devops_cli/review/rules/with passingruleid:andok: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 specpr-hardening-auditcounts an addition undertests/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.
- Chosen: A test in
- Which command proves the guardrail offline?:
uv run devops ci fail-to-pass --basereplays the changed tests on the base commit,uv run devops ci testruns one test file, anduv run devops ciruns 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_hardeninginsrc/devops_cli/github/defect_classifier.pyreads the surface table,openspec/specs/pr-hardening-audit/spec.mdholds its requirements, and.github/workflows/defect-pr-hardening-audit.ymlwrites 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/andcommon_hallucinations.json, andtests/andopenspec/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 onpull_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
devops-cli-service commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.hardening, and .github/labels.yml declares no scope/hardening label. Add the label to the file to give the scope to this item.A process invariant is unmet, but no user-facing defect is active.Adding guardrails prevents recurrent regressions from the same root cause.The work is to add guardrail text to one or more existing declared surfaces.Both are hardening audit findings for unhardened defect PRs, but each targets a different PR and requires different root-cause guardrails.devops-cli-service commentedon Nov 6, 2026
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_codeat 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"dan-petty commentedon Nov 11, 2026
Closed as not planned. The check that filed this item passes now.
uv run devops pr hardening-report --pr 3546is_hardened: true. The hardened surfaces aretests/andopenspec/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.