Skip to content

normalizeGitHubActor: not idempotent — strips only one trailing [bot] #574

Closed

Description

@anagnorisis2peripeteia

normalizeGitHubActor(login) in src/repair/comment-router-utils.ts:185 strips a single trailing [bot] via /\[bot\]$/i, so a doubled suffix leaves a residual that a second pass strips again.

Repro:

normalizeGitHubActor("x[bot][bot]") === "x[bot]"
normalizeGitHubActor("x[bot]")      === "x"        // => not idempotent

A normalizer should be idempotent. Loop/global-strip the suffix (though a doubled [bot] is rare in practice). Related: stripEnvPrefix in repair/validation-command-utils.ts has the same single-pass shape.

Activity

  1. clawsweeper commented on Jul 15, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 18, 2026, 10:36 PM ET / July 19, 2026, 02:36 UTC.

    Summary
    Keep this issue open for deliberate security-boundary triage: the current main merge intentionally excluded this hardening, and the reported non-idempotent actor normalization may affect mutation-authorization identity matching.

    Reproducibility: yes. from source: the reported one-suffix replacement produces different results for x[bot][bot] across successive calls. Live GitHub delivery of such an actor value has not been established.

    Next step
    Do not queue a duplicate repair while the protected security signal and explicit human request for deliberate authorization-boundary review remain active.

    Maintainer decision needed

    • Question: Should mutation authorization treat repeated trailing [bot] suffixes as the same bot identity and strip them to a fixed point, or reject/retain malformed repeated suffixes instead?
    • Rationale: The code change is mechanically small, but this helper participates in actor normalization near mutation authorization; maintainer intent is needed to avoid silently broadening identity equivalence.
    • Likely owner: steipete — They most recently clarified that this exact change remains unmerged and is the strongest available decision-routing contact.
    • Options:
      • Normalize to a fixed point (recommended): Remove all consecutive trailing [bot] suffixes in the centralized actor helper and add authorization-focused regression coverage for repeated and ordinary bot identities.
      • Reject repeated suffixes: Preserve the current canonical single suffix but make callers fail closed when repeated suffixes are encountered, if malformed identities must never map to a trusted actor.

    Security
    Needs attention: The report concerns actor normalization at a mutation-authorization boundary, so its identity-equivalence semantics need deliberate security review before a mechanical helper change.

    Review details

    Best possible solution:

    Choose and document the trusted-actor equivalence rule, then centralize an idempotent implementation in the authorization path with focused tests for repeated bot suffixes and unchanged ordinary human and bot identities.

    Do we have a high-confidence way to reproduce the issue?

    Yes, from source: the reported one-suffix replacement produces different results for x[bot][bot] across successive calls. Live GitHub delivery of such an actor value has not been established.

    Is this the best way to solve the issue?

    Unclear until maintainers choose the authorization equivalence rule. A fixed-point normalizer is the narrowest code path if repeated suffixes should represent the same bot identity; otherwise fail-closed handling is safer.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Repeated [bot] suffixes have not been shown to occur in live GitHub actor metadata, so the practical authorization impact remains unquantified.
    • Replacing the single-suffix rule with unconditional repeated stripping could broaden trusted-identity equivalence unless all authorization and mutation callers are checked together.
    • The analogous stripEnvPrefix helper may share the shape but should not be changed as part of this security decision without proving that its semantics match actor normalization.

    Codex review notes: model internal, reasoning high; reviewed against f8d5393f5894.

    Label changes

    Label changes:

    • add P2: This is a bounded hardening issue in internal mutation authorization rather than an observed emergency or user-facing outage.
    • remove P3: Current review triage priority is P2, so this older priority label is no longer current.
    • remove clawsweeper:linked-pr-open: Current issue advisory state no longer selects this label.

    Label justifications:

    • P2: This is a bounded hardening issue in internal mutation authorization rather than an observed emergency or user-facing outage.
    • impact:security: The reported helper normalizes actor identity near authorization for repository mutations, so inconsistent normalization may affect a security boundary.
    Evidence reviewed

    Security concerns:

    • [low] Confirm repeated-suffix identity semantics — src/repair/comment-router-utils.ts:185
      A fixed-point strip would make x[bot][bot] equivalent to x; verify that this is the intended trusted-actor mapping across every authorization caller before changing the helper.
      Confidence: 0.84

    What I checked:

    • Current-main status: The July 19, 2026 maintainer comment states that merged PR fix(text): bound compactText for tiny caps #576 was deliberately narrowed to the compactText fix and that this issue's implementation was removed before merge, so current main did not receive this change. (f8d5393f5894)
    • Source-reproducible defect: The report identifies a single trailing-suffix expression in normalizeGitHubActor; with x[bot][bot], one pass leaves x[bot] while another leaves x, demonstrating non-idempotence from the described implementation. (src/repair/comment-router-utils.ts:185, 572f84a365f2)
    • Merged PR scope: The merged PR body documents only the compactText boundary fix and closes compactText: overflows maxLength for small caps (returns bare '...') #573; its final scope is not provenance for this issue's requested normalization change. (src/repair/text-utils.ts:1, f8d5393f5894)
    • Security-sensitive review context: A prior reviewer explicitly distinguished this report from the publication-stability incident and requested deliberate assessment because actor normalization intersects mutation-authorization boundaries. (src/repair/comment-router-utils.ts:185)

    Likely related people:

    • steipete: Reopened this issue on July 19, 2026 and documented that the current-main merge intentionally excluded the actor-normalization change, making this the clearest available routing contact for the remaining decision. (role: recent decision participant; confidence: medium; commits: f8d5393f5894; files: src/repair/comment-router-utils.ts)
    • brokemac79: Their discussion explicitly identified the actor-normalization and mutation-authorization boundary as requiring deliberate review before further changes. (role: recent security-triage contributor; confidence: medium; files: src/repair/comment-router-utils.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P3
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    on Jul 15, 2026
  3. added a commit that references this issue on Jul 15, 2026
    37c14fb
  4. brokemac79 commented on Jul 16, 2026

    @brokemac79
    Contributor

    Thanks for the report. We?ve confirmed this is separate from the recent ClawSweeper review/publication stability incident.

    We will review this carefully with its linked implementation once the immediate stability work is complete. Because it intersects with actor normalisation and mutation-authorisation boundaries, we need to assess the final behaviour deliberately rather than rush a decision during recovery.

    Please do not treat this as a request for further changes at present.

  5. added
    impact:security
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-security-review
    on Jul 16, 2026
  6. brokemac79 commented on Jul 18, 2026

    @brokemac79
    Contributor

    @clawsweeper re-review

  7. clawsweeper commented on Jul 18, 2026

    @clawsweeper
    Contributor

    🦞🧹
    ClawSweeper re-review requested.

    I asked ClawSweeper to review this item again.
    Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
    Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

    Re-review progress:

  8. steipete commented on Jul 19, 2026

    @steipete
    Contributor

    Reopening: #576 was deliberately narrowed before merge to the compactText fix for #573 only. This issue's implementation was removed from the final diff, so the merge did not fix it. GitHub nevertheless applied the PR's older closing relationship at merge time.

    No new contributor changes requested. This restores the pre-merge open state for separate maintainer triage.

  9. added
    P2
    and removed
    P3
    clawsweeper:linked-pr-open
    on Jul 19, 2026
  10. added a commit that references this issue on Jul 19, 2026
    f8d5393
  11. added a commit that references this issue on Sep 21, 2026
    38ddba6
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

    P2clawsweeper:needs-security-reviewclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:securityissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions