hyperhive/hive-c0re/src/forge
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 2c066cc871 hive-c0re: pin the two security boundaries that had no test
`is_forbidden` and the webhook-secret load/regenerate path were the last two
entries on the shortlist in hyperhive/hyperhive#3950; the other three landed in
hyperhive/hyperhive#4650. Both are classification logic whose failure mode is
silence, which is why they are worth a test rather than a coverage line.

`is_forbidden` gates the arms that tell an operator a Forgejo admin PATCH was
refused for want of a scope, and which credential to delete and re-mint to fix
it. One of those PATCHes is `ensure_repo_creation_disabled` — the lockdown that
stops an agent creating a repo it owns and self-merging in it. Two tests: a 403
is recognised in both shapes the typed client produces (the spec-listed
`Forbidden` kind and the bare `UnexpectedStatusCode`), and nothing else is —
not a 401, whose remedy is the automatic re-mint one function down, and not a
transport error that never reached the forge at all.

`load_or_generate` grows the path-taking half `load_or_generate_at`, the same
seam `swarm-controller`'s `webhook::load_or_generate_at` already has and for
the same stated reason. Three tests over it: a valid stored secret is returned
verbatim and never rotated (the newline this module writes itself makes the
trim load-bearing, not defensive); a malformed one is replaced by a secret that
reaches *disk*, not just the caller, and is then stable; and each near miss —
empty, whitespace, 63 chars, 65 chars, right length with a non-hex char — is
refused. That last one is the security case: `Hmac::new_from_slice` accepts a
key of any length, empty included, so a relaxed check fails nowhere and just
keys every signature off a guessable value.

Every test was confirmed able to fail: six mutations of the code under test,
each watched red, then reverted. The two halves of the validity check and the
two arms of `is_forbidden` were broken separately, so neither test passes on
one arm alone.
2026-09-23 17:00:44 +02:00
..
ci_runner.rs deploy: move the forge CI runner toggle out of swarm 2026-08-30 16:07:21 +02:00
config_pr_poll.rs hive-sh4re: split approval-queue schema into its own topic module 2026-08-10 23:05:18 +02:00
mod.rs hive-c0re: fast-forward applied/<name>/main too, not just the one-shot relock 2026-09-13 17:33:58 +02:00
pr_merge.rs fix(#2911): keep the forge token out of argv 2026-08-02 13:21:42 +02:00
reconcile.rs fix(#2911): keep the forge token out of argv 2026-08-02 13:21:42 +02:00
repos.rs hive-c0re: fast-forward applied/<name>/main too, not just the one-shot relock 2026-09-13 17:33:58 +02:00
users.rs hive-c0re: pin the two security boundaries that had no test 2026-09-23 17:00:44 +02:00