Skip to content

Accept default-branch credential exposure in yolo mode - #1390

Merged
max-sixty merged 5 commits into
mainfrom
codex/yolo-main-credentials
Sep 23, 2026
Merged

max-sixty merged 5 commits into
mainfrom
codex/yolo-main-credentials

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Yolo permits Tend to merge ordinary code into the default branch, so a generic deployment credential available to that branch is already exposed to bot-merged code. Accept that exposure without requiring a reviewer for every deploy. Keep Tend's own operational credential checks, admin-gated tags, and reviewer gates for credentials restricted to bot-inaccessible refs.

The credential sweep still requires a reviewer for payload-driven triggers, including on the default branch: a fixed workflow can pass the bot's event payload to a credential-bearing step without running bot-merged code. Tests cover default-branch deploys, tag-only release credentials, and both trigger cases; the full generator suite passes.

This was written by Codex on behalf of max-sixty

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

_policy_gate now drops the steerable-trigger rule for a whole environment whenever its policy names the default branch, and docs/security-model.md justifies that with "A yolo policy admitting the default branch already exposes its generic credentials to bot-merged code, so these triggers do not add a new boundary." The premise holds for a job that executes repo content: the bot merges to the default branch, the job checks it out, and the credential is spent on bot-authored code either way. It does not hold for a job whose variable part comes from the event payload rather than the tree — on: repository_dispatch, environment: deploy, one pinned uses: step parameterised from client_payload. .github/** stays CODEOWNER-gated under yolo, so the bot cannot change what that job runs; the required reviewer was the only thing stopping it from dispatching a payload of its choosing into that credential, and the exemption removes it with nothing in its place. test_yolo_main_credentials_accept_a_steerable_trigger is exactly that shape — a repository_dispatch workflow whose job has no steps — and asserts the check passes.

Deciding whether a job runs repo content is the workflow analysis the rule immediately above deliberately declines ("deciding what a pattern covers would re-implement GitHub's matcher"), so narrowing the exemption mechanically looks like it would cost more than it buys. Naming the residual in docs/security-model.md instead would keep the claim true — a payload-only job deploying from an admitted default branch reaches the credential through no gate at all — and give a consumer with that workflow shape something to recognise.

Comment thread generator/src/tend/checks.py Resolved

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

docs/security-model.md still summarises the yolo acceptance without the exception this commit restores. Boundary 2 reads "a deployment from that branch needs no additional reviewer", and the "Environment-gated secrets" paragraph repeats it as "A generic environment may admit the default branch without a reviewer" — but a deploy environment whose policy is branch main, with no reviewer, on a workflow triggered by workflow_dispatch with inputs now fails credential-environments with "is reached by a workflow running on workflow_dispatch". That is what test_yolo_main_credentials_reject_a_steerable_trigger asserts. The bullet under "The credential boundary is the conjunction of three checks" is the only place in the file that names the exception, so a maintainer reading the summary configures something tend check refuses. Suggestions inline on both sentences.

Comment thread docs/security-model.md Resolved
Comment thread docs/security-model.md Resolved
@max-sixty
max-sixty merged commit a108d8c into main Sep 23, 2026
12 checks passed
@max-sixty
max-sixty deleted the codex/yolo-main-credentials branch September 23, 2026 03:34
@max-sixty max-sixty mentioned this pull request Sep 23, 2026
max-sixty added a commit that referenced this pull request Sep 23, 2026
Release Tend 0.3.1 from the validated `release` branch. This includes
the yolo default-branch credential policy in #1390, installer and Worker
credential guidance, and Claude/Codex harness pin updates. The PR
changes the package version, lockfile, and changelog section used
verbatim for GitHub Release notes.

The release branch passed `wt test` (1,315 Python tests, 32 Worker
tests, Worker typecheck) and pre-commit before this metadata update;
pre-commit passes after it.

> _This was written by Codex on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 23, 2026
…its the default branch (#1398)

`tend check --fix` can't switch a repo to `merge: yolo` when the repo
has a reviewer-less credential environment (e.g. `deploy`) whose policy
admits the default branch. The fix accepts the default branch for the
credential audit whenever it passes the maintainer protection check, so
activation goes ahead.

**Why it looped.** Before activation, `main` still has maintainer's
`never` bypass, so `branch-protection:main` fails against yolo's
`pull_requests_only` expectation.
[`operational_refs`](https://github.com/max-sixty/tend/blob/522820d3e03bfdcb07851e0e29a8083e19c48d67/generator/src/tend/checks.py#L2124-L2139)
only admits branches whose check passed, so `main` drops out and
`_policy_gate` rejects the environment ("admits 'main', which tend has
not verified the bot cannot write"). `credential-environments` isn't in
`_yolo_activation_blockers`'s fixable set, so `--fix` falls back to
maintainer rulesets, and the final yolo re-run fails the same way. Every
later `--fix` repeats that. #1390 made this environment shape acceptable
under yolo, but its test only covered a repo where yolo was already
active.

**Why this is safe.** A default branch that passes the maintainer check
can't be written by the bot at all, so an environment admitting it is
gated even more tightly than under active yolo. The extra
maintainer-expectation read runs only when yolo is configured and the
default branch failed its yolo check. `check_environment` for the `tend`
environment is unchanged: it's fixable and is re-derived after the
rulesets are applied.

**Verification.** The new
`test_run_all_checks_yolo_accepts_main_deploy_before_activation` runs
the existing yolo deploy fixture with `main` at the `never` bypass. It
fails before the change, and after it `credential-environments` passes
while `branch-protection:main` still fails, which is what `--fix`
repairs. The full Python suite passes, apart from the two
`test_refresh_consumers.py` tests that need network.

Co-authored-by: tend-agent <[email protected]>
Co-authored-by: Claude <[email protected]>
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Sep 23, 2026
Regenerates the nine `tend-*.yaml` workflows from tend 0.3.1, up from
0.2.15. Behavior here is unchanged: the only substantive diff is two new
action inputs, `merge: maintainer` and `control_plane_owner: ""`, both
of which are the action's own defaults. `maintainer` is the merge
authority this repo already runs under — the bot proposes, a maintainer
merges.

What the upgrade changes for this repo:

- **`tend check` audits protected refs and credential environments more
strictly**
([max-sixty/tend#1382](max-sixty/tend#1382)). A
protected branch must now restrict creation, update and deletion
together rather than update alone, and the credential audit no longer
treats a ref-qualified reusable workflow as this tree's copy. This repo
does not clear the new bar yet — the nightly filed #4242 with the single
ruleset gap and the remediation.
- **Yolo merge mode exists, and is off**
([max-sixty/tend#1172](max-sixty/tend#1172),
[#1390](max-sixty/tend#1390)). The new inputs
are how a repo would opt into letting the bot merge its own PRs; leaving
them at the defaults keeps the current arrangement, and the `merge:
maintainer` value is what the mitmproxy cache step is now gated on.
- **`review-runs` sees the whole night**
([max-sixty/tend#1377](max-sixty/tend#1377)).
Run listing now pages to the Actions ceiling instead of stopping at the
first page, so a busy night's early runs stop falling out of the census;
[#1374](max-sixty/tend#1374) keeps each
correction row's author alongside it.
- **CI polling is bounded by elapsed time, not iteration count**
([max-sixty/tend#1376](max-sixty/tend#1376),
reinstating [#1371](max-sixty/tend#1371) after
[#1375](max-sixty/tend#1375) reverted it). A
settle loop against slow checks now stops on a sleep budget, so a long
matrix can't quietly stretch a session.
- **Install-test drift detection tightened**
([max-sixty/tend#1381](max-sixty/tend#1381)):
generator output a PR never committed now fails tend's own drift check,
which is the check that makes a regeneration PR like this one
trustworthy.

Full comparison:
[0.2.15...0.3.1](max-sixty/tend@0.2.15...0.3.1).

This PR does not touch `.config/tend.yaml`, whose `sandbox_setup:` key
0.3.1 now warns "will be refused in a later release". That migration is
a separate change.


#4240 overlaps this completely: it was generated with the same 0.3.1, so
it carries the identical headers and the identical `merge: maintainer` /
`control_plane_owner: ""` on the same lines, underneath a Claude → Codex
harness swap. The only thing that distinguishes the two is which harness
the action runs. Whichever lands first leaves the other conflicting on
the eight `uses:` lines, resolved by regeneration rather than by hand.
So this PR is worth landing on its own only for as long as the Codex
cutover stays in draft — if that lands first, close this one.

Verified by regenerating in the merged tree: `uvx [email protected] init`
reproduces these nine files byte-for-byte, and the action declares
`default: maintainer` and `default: ""` for the two new inputs at
`0.3.1`, so neither changes behavior.

Co-authored-by: worktrunk-bot <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 23, 2026
…urity model (#1412)

Two docs say Tend always checks for exact generated workflows, but it
only does that in yolo mode. This puts the "in yolo" back. It also fills
in yolo's list of CODEOWNER-reserved paths in the security model's
summary.

- **Yolo-only workflow checks.** a108d8c (#1390) rewrote the credential
paragraphs in `README.md` and `docs/security-model.md` and dropped the
yolo qualifier. Both now say Tend "verifies the exact generated
workflows, reserves its environment for them, and rejects" other
workflows whose environment use is dynamic or hidden. That check is
`check_yolo_workflows`, and it runs only under
`requires_control_plane_review`
([`checks.py`](https://github.com/max-sixty/tend/blob/fbb3d33f6324467bac95656b571692a25f91db13/generator/src/tend/checks.py#L2564-L2585)).
So a `restricted` consumer never gets it. `AGENTS.md` and install-tend's
`references/security-model.md` already say this is yolo-only.
- **Control-plane paths.** The security model's "Merge authority" item
listed only `.github/**` and `.config/tend.yaml` as needing CODEOWNER
approval.
[`CONTROL_PLANE_PATHS`](https://github.com/max-sixty/tend/blob/fbb3d33f6324467bac95656b571692a25f91db13/generator/src/tend/workflows.py#L111-L124)
also reserves the CODEOWNERS files and the agent-instruction paths.
#1399 fixed the same list in the example config, and the same doc's
detailed section further down already has the full list.

Docs only, so there's no regression test. The pre-commit hooks for both
files pass, and so does the Python suite apart from the two
network-bound `test_refresh_consumers.py` tests.

---------

Co-authored-by: tend-agent <[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.

2 participants