Skip to content

fix(hardening): add guardrails to hardening surfaces #2526

Closed as not planned
Closed as not planned

Description

@dan-petty

Problem Description

Five defect pull requests that merged on 2026-10-28 add no guardrail or lesson to a declared hardening surface. The audit .github/workflows/defect-pr-hardening-audit.yml (devops pr hardening-report) found each one, but its intake step crashed before it filed the finding (#2524: the ZeroDivisionError in the embedder). This issue holds the five findings in one item, because they have one cause and one change surface.

PR Issue Change
#2446 #2106 scan_uv_audit runs one uv audit --frozen adapter
#2470 #1632 Loki runs from the grafana-community chart on Loki 3.7.9 (CVE-2026-21729)
#2488 #1110 a reply names its server by the origin of the URL called, with no userinfo
#2521 #2431 the sandbox metrics scrape and the whitelist NetworkPolicy resolve each host one time, through the egress check
#2522 #1652 a pod that does not call the Kubernetes API mounts no service account token

The declared hardening surfaces are docs/TESTING.md, ARCHITECTURE.md, SECURITY.md, CONTRIBUTING.md, src/devops_cli/ai/tasks/*.md, src/devops_cli/ai/knowledge_base/, .devops/review.toml and src/devops_cli/review/rules/.

Reproduction Steps

  1. Run uv run devops pr hardening-report for each PR in the table (read its --help).
  2. See that each PR is reported as unhardened.

Expected vs Actual Behavior

Expected: each defect fix adds its root-cause lesson to at least one declared surface, for example a SECURITY.md rule for the egress check of every client, a review rule for userinfo in a display string, or a docs/TESTING.md rule, so that the defect class does not return.

Actual: the five PRs changed code, tests and other documents only.

Environment Diagnostics

main at 2026-10-28.

Logs, Traces, or Terminal Output

Audit runs 40726982400, 40739487773, 40747696823, 40758319104 and 40758364472 (step "Audit defect PR hardening" failed, then the intake step crashed).

Source: https://github.com/dan-petty/devops-cli/actions/workflows/defect-pr-hardening-audit.yml

Proposed design

Problem statement

Six defect pull requests merged on 2026-10-28 changed code, tests and documents, but none added its root-cause lesson to a declared hardening surface. The audit found each one, but its intake step crashed before it filed the finding. This issue holds the six findings in one item because they share one cause and one change surface. The change adds a guardrail for each defect class to the declared surface that best fits it, so the defect class does not return.

Acceptance criteria

Requirement: guardrail_per_defect

Each of the six defect PRs SHALL have its root-cause lesson recorded in at least one declared hardening surface.

Scenario: hardening_report_passes

Requirement: guardrail_names_defect_class

Each guardrail entry SHALL name the defect class it prevents and the rule that prevents it.

Scenario: guardrail_text_is_specific

  • WHEN a reviewer reads each guardrail entry in its surface
  • THEN the entry names the defect class, the prevention rule, and the surface where it is enforced

Requirement: guardrail_in_best_fit_surface

Each guardrail SHALL appear in the declared surface that best fits its defect class, not in every surface.

Scenario: single_surface_per_guardrail

  • WHEN a guardrail is added to a surface
  • THEN it appears in exactly one declared surface, and that surface has existing content that the guardrail extends

Existing Tool Considered

No open, maintained tool or library covers this need. The project writes its own guardrail text into its declared surfaces. The cost is the tokens to write, keep and fix six guardrail entries across the declared surfaces, and the elapsed time for a person to review each entry.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/docs
    status/new
    value/medium
    effort/medium
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/docs. The change adds root-cause lessons and rules to declared documentation and review-rule surfaces.
    • Priority: P2-Medium. The code fixes are merged; this prevents recurrence of five defect classes but is not an active outage. The failed run 40726982400 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Value: Medium. Guardrails stop five known defect classes from returning, which protects long-term reliability.
    • Effort: Medium. Five distinct guardrails must be written across multiple surfaces, but each is a focused addition.
    • Related: feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697, which asks for a different change. Both concern defect PR hardening; #697 delivers the audit mechanism that detects missing guardrails, while this candidate delivers the guardrail content itself.
  3. added
    priority/p2-medium
    on Oct 28, 2026
  4. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    A sixth defect PR has the same finding: #2516 (issue #2426, devops config audit-keys scans each config file that the settings merge). Audit run 40761500518 failed on 2026-10-28 at 20:14 UTC, and its intake step crashed with the same ZeroDivisionError (#2524), so the finding was not filed. This issue holds it with the other five.

  5. added
    status/ready
    and removed
    status/new
    on Oct 29, 2026
  6. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 0f7bc26 (see proposed design in issue body).

  7. added
    type/bug
    and removed
    type/docs
    on Oct 30, 2026
  8. devops-cli-service commented on Nov 1, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/2526-the-five-defect-fixes-merged-on, draft pull request #2994. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Add four guardrails to SECURITY.md: 3798 tokens
    2. Add one guardrail to CONTRIBUTING.md: 3561 tokens
  9. added a commit that references this issue on Nov 1, 2026
  10. added
    status/planned
    and removed
    status/ready
    on Nov 1, 2026
  11. added
    owner/agent
    on Nov 1, 2026
  12. added a commit that references this issue on Nov 1, 2026
  13. removed
    owner/agent
    on Nov 1, 2026
  14. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    The plan of this item must change before an implement run takes it. A second finding of the same kind joins it from #2660, and the plan has two other defects.

    Open a docs(openspec) pull request that edits openspec/changes/2526-the-five-defect-fixes-merged-on/:

    1. Add design.md. The folder holds only proposal.md and tasks.md, and plan_read.py:121 reads all three.
    2. Correct the metrics sentence. Task 1.4 says that the metrics scrape looks up through vet_addresses. src/devops_cli/sandbox/metrics.py holds no vet_addresses and no getaddrinfo. Read the code, and state what it does.
    3. Add the guardrail of fix(security): a failed shodan internetdb lookup has outcome failed, so a review never shows its address as safe #2504 (PR fix(security): a failed shodan internetdb lookup is no ok record #2647). The root cause: NetworkReputationRecord.outcome defaulted to ok, so a client that forgot the outcome gave a record that read as verified. The fix made the field required. The sentence: the result model of a lookup or a check has no default that reads as clean. The model names how the lookup ended, and a missing value is an error. The surface is section 7.2 of ARCHITECTURE.md (End-to-End Pydantic Resource Model Interoperability), beside the Strict Typing bullet at line 171. A search finds no such line on any surface today.
    4. Widen the plan. Add ARCHITECTURE.md to ## Impact, which now says "No other file changes", and to a task group. Add #2504 to the grep of task 2.3, and change its expected count from six lines to seven.
    5. Widen the title of this item. It says five defect fixes of 2026-10-28. The plan holds six, and this change makes seven.

    Do not take the scenario that the audit exits 0. The plan already shows that a later pull request cannot change the report of an old pull request: audit_pr_hardening sums the additions of the audited pull request.

    Check the plan against the result of the new issue fix(ci): the hardening audit files no issue for a tested fix, because that issue can change what the audit asks for. The pull request of this item delivers only this item.

  15. changed the title [-]fix(hardening): the five defect fixes merged on 2026-10-28 add their root-cause guardrail to a declared hardening surface[/-] [+]fix(hardening): add guardrails to hardening surfaces[/+] on Nov 6, 2026
  16. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 105 characters, and the limit is 60. The type and the scope stay.

  17. added
    owner/agent
    on Nov 6, 2026
  18. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    Closed as superseded by #3479 (fixed in #3684). The premise of this item is no longer true.

    Evidence, from main at c714551 on 2026-11-06:

    No code was written and no branch was pushed. The worktree of this run is removed. If the owner still wants a prose lesson in a declared document for one class, file a new item for that class alone.

  19. removed
    status/planned
    owner/agent
    on Nov 6, 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/mediumpriority/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