Skip to content

feat(workflow_audit): WF030 forge mirror without a source-visibility guard - #1072

Merged
hyperpolymath merged 4 commits into
mainfrom
claude/mirror-visibility-guard
Nov 13, 2026
Merged

hyperpolymath merged 4 commits into
mainfrom
claude/mirror-visibility-guard

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Owner ruling, 2026-11-13, relayed by the SysArch session: "add a guard". The estate's forge mirror runs git push --force to every forge whose *_MIRROR_ENABLED variable is true, on every push to main. It never checks the source repo's visibility, so a private repo can be pushed to a public forge copy.

New check WF030 (hypatia/workflow_audit/mirror_without_visibility_guard) flags a workflow that matches all three:

  • it force- or mirror-pushes (git push --force, -f or --mirror),
  • the push is gated on a *_MIRROR_ENABLED variable,
  • it has no visibility check (github.event.repository.private, repository.visibility, or a forge visibility read).

Severity is high and the action is report: a referral, never an autofix. The ruled fix is to refuse, or skip loudly with an error, when the source is private and the forge copy isn't confirmed private, and to escalate when the forge's visibility can't be read. That fix belongs in the mirror workflow itself.

Evidence

A static run over the workflows I can read:

  • metadatastician/standards mirror-reusable.yml and github-backup-mirror-reusable.yml are flagged: git push --force <forge> main per forge, with no visibility check.
  • hypatia, gitbot-fleet and cicd-squabbler are clean. Hypatia's own mirror.yml only calls the reusable workflow.

Tests

New test/rules/mirror_visibility_guard_test.exs covers: an unguarded mirror fires; a !github.event.repository.private guard suppresses it; an ungated force push and a plain push don't fire; and the check is part of audit/3. Locally 77 tests pass with workflow_audit_test.exs, mix format is clean, and the module compiles with no warnings.


Generated by Claude Code

…guard

Owner ruling 2026-11-13 ('add a guard'): a mirror that force-pushes to every
forge whose *_MIRROR_ENABLED variable is true, with no check of the source
repo's visibility, can push a private repo to a public forge copy. WF030
flags that shape (high, action report: a referral, never an autofix).

Static run: flags metadatastician/standards mirror-reusable.yml and
github-backup-mirror-reusable.yml (git push --force, no visibility check);
hypatia, gitbot-fleet and cicd-squabbler workflows are clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f6e30194-e07b-4d28-b628-a3ca754fc351
Commits

Reviewing files that changed from the base of the PR and between e061f46 and e5f3250.

Files selected for processing: 2

  • lib/rules/workflow_audit.ex
  • test/rules/mirror_visibility_guard_test.exs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Owner Author

Build Test Images fails here, but it fails on main too, and the cause isn't in this PR. The container build at Containerfile:58 runs cargo build on a Rust toolchain older than the host CI's, and hits error[E0658]: atomic_try_update and TARGET not defined in hypatia-cli. This PR only changes lib/rules/workflow_audit.ex and adds an Elixir test.

The rollups Integration Status and Security Status, plus Rust Dependency Audit (RUSTSEC-2026-0538, quinn-udp), are red on main for the same reasons. They need a separate PR that aligns the Containerfile toolchain and bumps quinn-udp.


Generated by Claude Code

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 13, 2026 15:02
@hyperpolymath
hyperpolymath enabled auto-merge (squash) November 13, 2026 15:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T15:05:58.630984Z bbd0905 Draft marked ready
🔒 Security Review ❌ Failed 2026-11-13T15:02:35.984117Z
We couldn’t complete this review. Comment @codex security review to try again.
bbd0905 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

…'s gate

The guard regex accepted any bare 'visibility' word, so a comment such as
'TODO: add a visibility check' suppressed the finding. It now needs
repository.private/visibility, a per-forge *_MIRROR_PRIVATE_CONFIRMED gate
(the shape metadatastician/standards#1513 adds), or an API visibility read.

Experiment: standards main mirror-reusable.yml and
github-backup-mirror-reusable.yml are flagged; the same files at #1513 are
clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT
@sonarqubecloud

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbd09051c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/rules/workflow_audit.ex Resolved
Comment thread lib/rules/workflow_audit.ex Resolved
Comment thread lib/rules/workflow_audit.ex Resolved
@hyperpolymath
hyperpolymath merged commit 58ec1da into main Nov 13, 2026
85 of 88 checks passed
@hyperpolymath
hyperpolymath deleted the claude/mirror-visibility-guard branch November 13, 2026 15:07
hyperpolymath pushed a commit that referenced this pull request Nov 13, 2026
…inuations

Codex review on #1072:
- A condition that SELECTS private sources (if: github.event.repository.private)
  is no longer a guard; only a negated/compared repository.private, a
  repository.visibility test, a *_MIRROR_PRIVATE_CONFIRMED gate or an API
  visibility read count.
- Scoped per job: the force push, the *_MIRROR_ENABLED gate and the guard
  must be in the same job, or the guard in a job it needs.
- Shell line continuations are joined, so 'git push \\' + '--force' on the
  next line is a force push.

Experiment: standards main mirror-reusable.yml flags each forge job (6) and
github-backup-mirror-reusable.yml; both are clean at standards#1513;
hypatia, gitbot-fleet and cicd-squabbler stay clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT
hyperpolymath added a commit that referenced this pull request Nov 13, 2026
…inuations (#1073)

## What

A follow-up to #1072, which merged before these fixes. It answers the
three Codex findings left open on #1072.

- **Blocking guards only (P1).** A condition that *selects* private
sources, such as `if: github.event.repository.private`, no longer counts
as a guard. Only these do: a negated or compared `repository.private`, a
`repository.visibility` test, a per-forge `*_MIRROR_PRIVATE_CONFIRMED`
gate (the shape metadatastician/standards#1513 adds), or a visibility
read from an API.
- **Per job (P2).** The force push, the `*_MIRROR_ENABLED` gate and the
guard must be in the same job, or the guard in a job it `needs`. An
unrelated gate or `git push --force origin` elsewhere in the file
neither creates nor hides a finding. Findings now carry `job` and
`line`.
- **Line continuations (P1).** Shell `\` continuations are joined, so
`git push \` followed by `--force …` on the next line is a force push.
YAML comments are stripped per job before matching.

## Experiment

- metadatastician/standards `main`: `mirror-reusable.yml` is flagged
once per forge job (6), and `github-backup-mirror-reusable.yml` is
flagged.
- The same two files at standards#1513 (the source fix): clean.
- hypatia, gitbot-fleet and cicd-squabbler: clean.

## Tests

`test/rules/mirror_visibility_guard_test.exs` adds four cases: a
selecting condition still fires; a continued `--force` still fires; a
gate and a force push in different jobs don't fire; and a guard job that
the mirror job `needs` counts as its guard. 83 tests pass, and `mix
format` is clean.

---
_Generated by [Claude
Code](https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT)_

Co-authored-by: Claude <[email protected]>
hyperpolymath pushed a commit that referenced this pull request Nov 13, 2026
main gained WF030 (#1072, #1073) after this branch was cut. CI checks out
the merge of the branch and main, so the staleness check failed: the
deed lacked hypatia/workflow_audit/WF030. Regenerated with
scripts/gen-rules-praxis.sh after merging main.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
hyperpolymath added a commit that referenced this pull request Nov 13, 2026
…test) (#1081)

## Summary

Owner ruling R6 (2026-11-13): auto-merge only when all review threads
are resolved. Today nothing checks threads, so #1072 and #1073 merged
with open bot findings.

- New `pr_threads_ready FULL NUM` in
`scripts/sweeps/lib/merge-ready.sh`. It reads the PR's review threads
through GraphQL (resolution state is not in REST) and is called by
`scripts/sweeps/estate-pr-automerge.sh` for every `auto_merge` row at
`--execute`, right after `merge_ready`.
- Blocks with `unresolved_review_threads:<n>`. Fails closed with
`check_unavailable:review_threads` when the answer is unreadable or
there are more than 100 threads.
- `docs/operations/estate-automerge.adoc`: the execute-time gate list
names it.

**Limit:** this covers the estate sweep at the moment it queues a merge.
GitHub's native auto-merge (`--auto`) waits for threads opened later
only if the ruleset requires conversation resolution. That is an owner
setting, not part of this PR.

R3 (the template upgrade wave never auto-merges) needs no code: the
sweep already blocks every PR not authored by a dependency bot
(`not_a_dependency_bot`). This PR adds a test that pins it.

## Test plan

- [x] `test/pr-automerge-sweep-test.sh` (the stub `gh` now serves
GraphQL per PR number): an open thread, a GraphQL 502 and an unread
second page each stop the merge with the reason logged; all threads
resolved merges again; R3: a non-bot PR is flagged and never merged.
- [x] Removing the call from the sweep makes the first R6 case fail.
- [x] `bash -n` on the changed scripts. ShellCheck is not installed in
this session; CI runs it.

---
_Generated by [Claude
Code](https://claude.ai/code/session_0136P7Zo6VBPrBWYUmDJZR1H)_

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants