Repository navigation
fix(checks): report only org secrets the repo can actually read - #994
Conversation
`repo-secret-allowlist` listed every org-level secret in the organization, ignoring each secret's visibility scoping. A repo already at the tightest scoping GitHub offers — the secret is not shared with it at all — got a FAIL no repo-side change could clear, since the only lever left, a `secrets.allowed` entry, would assert the opposite of the truth and mute that name permanently. Filter the org listing to what the repo can read: a `selected` secret whose repository list omits it, a `private` secret against a public repo, and any org secret against a private repo in a GitHub Free org are all unreachable. Filtering is one-directional — a secret whose reach cannot be determined stays reported, since under-reporting hides real exposure while over-reporting is only noise. Closes #993
tend-agent
left a comment
There was a problem hiding this comment.
Two findings below, both mechanical. The PR is bot-authored, so I'll push them as a follow-up commit rather than leave one-click suggestions waiting on an author who won't return.
One thing I couldn't verify from CI: _org_secret_repos's docstring claims --paginate covers an org that shares a secret with more repos than one page holds. gh api --paginate follows Link headers, and I have no admin:org token here to confirm orgs/{org}/actions/secrets/{name}/repositories emits them. If it doesn't, the call silently stops at the default 30 and produces exactly the under-report the filter exists to prevent. -f per_page=100 would make the question moot; I've left it out rather than add a knob on a guess.
`full_name` comes back canonical while `repo` is whatever `--repo` was
given, so a casing difference made every `selected` org secret look
unshared and dropped it — the under-reporting direction `_list_org_secrets`
is written to avoid.
Also drops the dead non-visibility branch from the test helper: the org
secret listing has one reader and it always asks for `{name, visibility}`.
|
Both findings are on the branch as c22238b (case-folded membership test plus its own case, dead On the open question from the review — whether So no What stays unverified is the specific endpoint: reading it needs |
Bumps the generator to 0.1.18 and adds the CHANGELOG section the release workflow publishes as the GitHub Release notes. 8 commits since 0.1.17. The two fixes: `repo-secret-allowlist` now reports only the org secrets the repo can actually read, instead of flagging every org secret as available to all workflows (#994); and both halves of the 👀 reaction sit in one job on `tend-mention`, with a paginated removal lookup (#990). Two bundled-skill changes go out with them — `running-in-ci` scopes PR-description claims to the merge base (#992), and tells a fork-PR session that no successor will pick up its own review's findings (#985). `uv run pytest` (564), the worker's vitest suite (31) and typecheck, and `pre-commit run --all-files` all pass on the branch. > _This was written by Claude Code on behalf of max-sixty_
…n 0.1.18 The FAIL the section described is gone: max-sixty/tend#993 was fixed by max-sixty/tend#994 and shipped in tend 0.1.18, which this repo picked up in #380. Delete the section rather than rewriting it as history.
Automated nightly regeneration of tend's workflow files, picking up tend 0.1.18. **tend version:** 0.1.17 → 0.1.18 Notable changes: - `tend-mention`: both halves of the 👀 reaction now live in the `handle` job. Previously `verify` added the eyes and `handle` removed them, so a burst of mentions on one thread could cancel a queued `handle` — which allocates no runner and runs no steps, `always()` included — leaving the reaction stranded (max-sixty/tend#990). - `tend-review` / `tend-triage`: the eyes-removal lookup now paginates (`--paginate`, `per_page=100`). A thread with more than 30 reactions could push the bot's own eyes off the first page, so the removal silently found nothing (max-sixty/tend#990). - `tend check`: the secret audit now reports only org secrets this repo can actually read, instead of every org secret (max-sixty/tend#994). - `running-in-ci` skill: notes that fork PR reviews reach no successor session, and scopes PR-description claims to the merge base (max-sixty/tend#985, max-sixty/tend#992). Full comparison: max-sixty/tend@0.1.17...0.1.18 Co-authored-by: worktrunk-bot <[email protected]>
Problem
repo-secret-allowlistenumerated every org-level secret in the organization and flagged each one, without consulting whether that secret's visibility actually admits the repo being checked. On a repo where all ten org secrets arevisibility: selectedand none list it, the check reported all ten as "available to all workflows".Nothing clears that. The repo is already at the tightest scoping GitHub offers — the secrets are not shared with it at all — so the only remaining lever is a
secrets.allowedentry, whose documented meaning ("a deliberate acceptance that any workflow the repo runs can read that token") is false in that state, and which would mute those names permanently: if one were later shared with the repo, the sweep would stay silent about the one case it exists to catch.It also penalized the grant it asks for. The check hints at
admin:orgto complete the sweep; granting it converted a pass into an unclearable FAIL, while the same ten secrets were equally unreachable before.Solution
_list_org_secretsnow takes the repo and returns only the org secrets that repo can read. It reads each secret'svisibilityalongside its name and drops:selectedwhose/orgs/{org}/actions/secrets/{name}/repositorieslist omits the repo (paginated — an org sharing a secret past one page would otherwise look like it omits this one);privatewhen the repo is public;The per-secret repositories endpoint needs
admin:org, which the sweep already requires to enumerate org secrets at all, so no new scope is involved.Filtering is deliberately one-directional: a secret whose reach can't be determined — the repositories list fails, the repo's visibility won't read, the plan field is absent — stays in the reported set. Under-reporting hides real exposure; over-reporting is only noise.
_org_plan_is_freereturns False on any read failure for the same reason.check_secretsreads the same helper, so it gains the same correction: an org copy scoped away from the repo no longer gets named as the thing keeping its workflows running.Testing
uv run pytest— 563 pass. Seven new cases ingenerator/tests/test_checks.pydrive_list_org_secretsend-to-end through a fakeghserving the real endpoint shapes, rather than mocking the helper out. Four reproduced the reported FAIL before the fix: aselectedsecret omitting the repo,privateagainst a public repo, a free-org private repo, andcheck_secretsnaming an unreachable org copy. The other three pin the directions that must keep failing —selectedincluding the repo,visibility: all, and a repositories lookup that errors.Not covered
Pagination of the org secret listing itself is untouched —
orgs/{org}/actions/secretsstill reads one page, so an org with more secrets than a page holds under-reports. That is pre-existing and independent of visibility; separate change if it matters.The free-plan rule rests on
.plan.name, which GitHub returns only to org owners. For a non-owner token the field is absent and the rule simply doesn't fire, leaving the pre-fix behavior forvisibility: allon a free org.selectedandprivateare unaffected — they're filtered from data anyadmin:orgtoken can read.Closes #993 — automated triage