Skip to main content

Module push_scan

Module push_scan 

Source
Expand description

POST /api/v1/github/push-scan: a container agent’s push, judged by the host’s publish guard.

A container’s pre-push hook (agentmux-bashwrap git-hook pre-push) collects what the push publishes with the container’s own git (per ref: the commits’ messages, the added paths and the added lines) and posts it here as data. srv gives it, on stdin, to the host’s gh-agent scan-push --repo OWNER/REPO and answers with its verdict.

The material is data: nothing here opens the container’s clone or runs git in it, and the request carries no path. Whether the repository is public is decided by gh-agent asking GitHub about the owner/repo, never by a flag in the request.

Callable with a container agent’s own token only. Every field is checked and capped before anything runs; the checks are the pure functions below.

Structs§

Changeset 🔒
Limiter 🔒
A sliding window per agent.
Part 🔒
PushScanRequest 🔒
What the container sends: one push, the same for every ref it updates.

Constants§

MAX_BODY_BYTES 🔒
The most a request may carry, in bytes. The route’s body limit is this.
MAX_CHANGESETS 🔒
MAX_CHANGESET_BYTES 🔒
MAX_FIELD_BYTES 🔒
MAX_MATERIAL_BYTES 🔒
The most the pushed material may weigh once read; a bigger push is refused with what to do about it.
MAX_PARTS 🔒
MAX_REF_BYTES 🔒
MAX_RUNNING 🔒
Judgements running at once on this machine.
RATE_LIMIT 🔒
Pushes one agent may ask to have judged in a window, and the window.
RATE_WINDOW 🔒

Functions§

handle_push_scan 🔒
POST /api/v1/github/push-scan
is_name 🔒
A GitHub account or repository name: nothing that could be read as an option or a path.
is_ref 🔒
A ref name as git writes one: printable, no control characters, a bounded length.
limiter 🔒
no_guard 🔒
The answer when there is no guard to run here: the hook does nothing and says nothing.
repo_slug 🔒
owner/repo in lowercase, or why the request names no repository.
running 🔒
validate 🔒
Every field of the request checked and capped, or the first thing wrong with it.