Skip to content

Proposal format ​

Every hook package describes how the hub proposes it in hooks/<language>/<package>/proposals/*.toml, one file per way in. The hub bundles these files (and each package's package.toml) into its binary when it is built, detects which proposal fits each container of a service, and renders it into a change the team reviews. The same files generate the cheat sheets. This page is the format's specification; crates/hub/src/proposals/format.rs implements it, and a test checks every proposal file in the repository against it.

Every table refuses keys it does not know: a misspelt key is an error, not a silently ignored line.

Files ​

  • hooks/<language>/<package>/package.toml: id (P1), name, language, status (planned, in-development or ready), optional build and build_outputs, and [[install]] tables with from and to. Only proposals of ready packages are offered; the others still get cheat sheets.
  • hooks/<language>/<package>/proposals/<name>.toml: one proposal. Its id is <PACKAGE>:<name> (H1:ext), which requires refers to.
  • Files a proposal names under [source] examples (diffs, sample sources), relative to the package directory.

Top level ​

KeyType
kind"zero-code", "compose", "config", "source"how the hook gets in; see below
titlestringone line, shown in the review
summarystringwhat the change does and why, shown in the review
rankinteger, default 10higher is preferred among the candidates for one runtime
warningstring, optionalshown with the proposal before it is approved
requireslist of proposal ids, optionalthis proposal is a companion: offered only when one of these is the proposal of a container of the same service
[detect]table, requiredwhen the proposal fits
[vars.<name>]tables, optionalvalues the hub works out before rendering
[compose]tablecompose changes
[config]tableconfig files mounted from the hook directory
[source]tablethe steps of a source change

What each kind needs:

kind[compose][config][source]The hub
zero-codenononoshows that nothing needs to change
composerequirednonorenders and pushes the compose change
configoptional (mounts, environment)required, with filesnorenders and pushes the mounts and compose change
sourceoptional (usually the hook mount)norequired, with stepspushes the compose part, shows the steps

[detect] ​

Detection works per container (compose service), never per repository. File rules look only inside that container's build context and the directories bind-mounted into it from the service directory; image and command look only at that container.

KeyTypeMatches
filesglobsa file of the container exists. A glob without / matches the file name at any depth (*.py); ** is any number of directories. A Dockerfile or Containerfile matching is not evidence: every built container has one
imageregexesthe container's image: compose image for a service that is not built, else the base of the final build stage (the target stage, following FROM <stage> back to an external image, ARGs substituted), and the image of the running container; then the other build stages' images (where a binary was built). Each is tried as written and without its registry (mirror.gcr.io/library/python:3.12 is also python:3.12)
commandregexesthe container's command: compose entrypoint + command, else the Dockerfile's ENTRYPOINT + CMD; tried as the words joined by spaces, as a JSON list, as a shell-form string, as the running main process's command line, and as each line of a shell script the command runs (CMD ["/bin/sh", "start.sh"], found in the container's files; one level)
dependencynamesa dependency in the container's manifests and lockfiles for the proposal's runtime (below), or a package a Dockerfile RUN installs with a package manager (also without a distribution's wrapping: lua5.4-copas is copas, py3-flask is flask, libmojolicious-perl is mojolicious). A name matches the same name (case and _/- ignored) or one it is a prefix of up to ., -, / or : (spring-boot matches spring-boot-starter-web); a name with : must match whole
contentregexesa source file of the container: the files matching files, or every file of the container when files is empty
contentslist of { files = glob, regex }gate: every entry must match a file of its glob
not_contentslist of { files = glob, regex }gate: no entry may match any file of its glob
version{ runtime, min }gate: the runtime's version, read from the image tag (bun, deno), is at least min; an unknown version fails the gate
requires_factsnamesgate: each fact is known to hold (below)
source_patternsregexesnot evidence: where in the sources the change goes, shown with the proposal

Manifests by runtime: Python requirements*.txt, pyproject.toml, Pipfile(.lock), poetry.lock, uv.lock, setup.py, setup.cfg; JavaScript package.json and lockfiles, deno.json(c); Go go.mod and the imports of *.go; Rust Cargo.toml, Cargo.lock; JVM pom.xml, Gradle and sbt files, project.clj, deps.edn; .NET project files and Directory.*.props; Ruby Gemfile(.lock); PHP composer.json/.lock; Perl cpanfile, Makefile.PL; Lua *.rockspec; BEAM mix.exs/.lock, rebar.config/.lock; C/C++ CMakeLists.txt, conanfile.*, vcpkg.json, meson.build, Makefile; and each other language's own manifest (build.zig.zon, *.nimble, shard.yml, dub.*, v.mod, pubspec.*, Package.*, *.cabal, dune-project/*.opam, Project.toml, DESCRIPTION).

Evidence and selection ​

Each matched key counts as evidence: image 5 (1 for a plain OS image such as debian or alpine), command 5, dependency 4, contents 4, content 2, files 1. Evidence is strong when it includes anything but files and a plain OS image. Then, per container:

  1. A container whose image is one the kernel already covers (databases, Redis, plain nginx, HAProxy, …) or whose command starts a process per connection (socat … fork, xinetd, ncat --exec) needs no hook.
  2. The proposal's gates must hold, and every variable must be determined (below). A proposal that matched strongly but failed a gate is listed with the reason.
  3. Proposals are grouped by runtime (Python, Node.js, Bun, Deno, Go, Rust, JVM, .NET, Ruby, PHP, Perl, OpenResty, Lua, Erlang/Elixir, C/C++, and each other native language). The runtime whose best candidate (strong evidence, no requires) scores highest wins, a runtime with evidence beyond the command first (a binary called server fits several compiled languages' patterns); a tie is no decision. When the runtime is clear but every proposal for it failed a gate, the container gets none, with the gates' reasons.
  4. Within the runtime the proposal is the candidate with the highest rank, then the least invasive kind (zero-code, compose, config, source), then the highest score. Candidates with exactly the same change are folded into it ("also covers"); the others are alternatives the player may pick. When candidates with different changes are equal on all three, none is chosen: the player picks one of them.
  5. Candidates with requires whose required proposal is the proposal of any container of the service are added as companions (their steps are shown with it).
  6. Without strong evidence for any runtime, the container gets no proposal, only a link to the cheat sheets: detection never guesses.

[vars.<name>] ​

Values written as {name} in any string of [compose] and [config] (and filled into [source] steps where they appear). {workdir} is built in: the container's working directory (compose working_dir, else the final stage's WORKDIR); a proposal using it is not offered when it is unknown.

Key
detectthe detector (below)
defaultused when the detector finds nothing; "" leaves the setting empty. Without a default, the proposal is not offered when the value cannot be determined
must_equalthe proposal is offered only when the value is exactly this

Detectors (PHP's, documented with their values in H1):

DetectorValue
php_conf_dthe scanned ini directory: $PHP_INI_DIR/conf.d, /usr/local/etc/php/conf.d for the official and Swoole/FrankenPHP images, /etc/php/<v>/<sapi>/conf.d for Debian packages, /etc/php<vv>/conf.d for Alpine packages
php_ini:<directive>the directive's value in the container's ini files, a RUN, or a -d flag
php_worker_userthe user PHP-FPM workers run as: a pool file's user, or www-data for the official images and Debian packages
php_image_libcalpine or debian, from the image
php_ext_triplephp<major.minor>-<nts|zts>-<arch> from the image tag (7.4–8.5) and the vulnbox's architecture

Facts for requires_facts: php_has_ffi (the Dockerfile installs ext-ffi or a php*-ffi package, or the running container loaded ffi.so) and php_opcache_enabled (installed or enabled in the Dockerfile, opcache.enable=1 in an ini file, or opcache.so loaded).

[compose] ​

Changes to the container's compose entry only.

KeyType
mountslist of { source, target, read_only }bind mounts; source must be inside /usr/local/lib/vulnboxd/trace, read_only must be true. A mount whose target the container already mounts is left out
envtable of variable → valuesee below
command{ after, insert, unless = { present, drop } }insert insert right after the first command element matching the regex after; when the command has any of present, the items in drop are left out of insert

Environment values:

FormMeaning
NAME = "value"set it
NAME = { append = "x", separator = " " }append x to the value it has (the compose file's, else the Dockerfile's ENV), with the separator; nothing when x is there already. PYTHONPATH and DOTNET_STARTUP_HOOKS use :; NODE_OPTIONS, BUN_OPTIONS, JAVA_TOOL_OPTIONS, PERL5OPT, RUBYOPT and the BEAM's flags a space
NAME = { value = "x", omit_empty = true }set it; left out when x comes out empty
NAME = { set = "x", previous_to = "OTHER" }for variables that hold one value (LUA_INIT): set it to x, and move a value it had to OTHER. A version-specific variable the service sets (LUA_INIT_5_4) is changed instead

The mount always goes with the variable: a runtime told to preload a file it cannot find may refuse to start.

The command is changed where it is set: compose entrypoint, compose command, or the Dockerfile's exec-form ENTRYPOINT (written to compose entrypoint, with the image's CMD copied to command) or CMD (written to compose command). A shell-form command is not changed: the proposal is not offered.

[config] ​

KeyType
fileslist of { source, target }a file of the hook directory (source, relative to it) mounted read-only at target in the container. A target under {workdir} that would hide a file the service has is refused
mountslist of mountsas in [compose]

[source] ​

KeyType
stepslist of stringsthe source change, in order, as the review and the cheat sheet show it. Plain text with code (paths, identifiers, config lines, commands) in backticks: the hub's review shows the text as it is, the cheat sheets render the spans as code and escape everything else
exampleslist of pathsfiles relative to the package directory, shown with the steps; the cheat sheets inline them (a .diff in the diff viewer, a sample source folded away)

The hub does not edit sources or Dockerfiles: it pushes the compose part of a source proposal and lists the steps for the team.

How a proposal becomes a change ​

The compose file is edited as text, line by line, so comments, order and quoting stay as they were: a variable is added to or changed in the service's environment (in the map or list style it already uses), an item appended to its volumes, command replaced on its own line. Each edit goes into the compose file (inside the service directory) that sets the key already, else the last one that defines the service. A service written in flow style, a key inherited through a YAML merge key (<<:), or a multi-line value are refused with the reason rather than rewritten. Every edited file is then read back and compared with the original plus exactly the intended change.

Each approved container's change is its own commit, so one container's hook can be reverted alone. Containers whose changes touch the same or adjacent lines of a file share one commit, and the review says so.