Expand description
What the added lines of a change do (ADR-055): the content checks of
openmoat policy check-diff, on top of its path checks (ADR-050).
Each check is a pure function over one changed file: its path, the lines
it adds with their numbers in the new file, and the blocks of lines it
removes and adds together (Block). Nothing is read from disk or the
network: the same change gives the same findings on every machine.
- Supply chain (
manifest.rs,lockfile.rs): a new dependency that is a near miss of a popular name (the bundled lists ofpackages.rs, the ones the shell classifier uses), an npm install script, a dependency or a locked package fetched from outside its registry, and a lockfile hash that changes while the version stays. - CI takeover (
ci.rs): GitHub workflow and action files. - Backdoors (
backdoor.rs): a downloaded or decoded script that runs, a Python start-up file, a DockerfileADDfrom a URL, a long encoded blob in source code. - Secrets (
keys.rs): a private key, a real-looking value in a.envfile. Known token formats are the push check’s scanner, which the CLI already runs on every added line (diff-secret). - New network endpoints (
hosts.rs): one finding per host the change adds that the policy’s network allow list does not name; the caller decides that with the compiled policy (new_hosts).
Every rule is in RULES, with its default level; the policy’s
check_diff.levels (Settings) sets another one, or off.
Structs§
- Block
- One run of removed and added lines with no kept line between them.
- Change
- One file a change writes, as the checks see it.
- Hit
- One thing a check found.
- Rule
- One content check: its stable id, the level it reports at, and what it finds.
- Settings
- The policy’s
check_diff:section: a level for any content check.
Enums§
- Level
- How much a content finding holds up a merge.
Constants§
- CI_
INJECTION ${{ github.event.* }},${{ inputs.* }}or${{ github.head_ref }}inside a script.- CI_
PERMISSIONS permissions: write-allor a write scope.- CI_
PR_ TARGET pull_request_target, and with it a checkout of the pull request’s code.- CI_
SECRET_ OUT - A secret printed into the log or handed to
curl/wgetin a script. - CI_
UNPINNED uses:an action at a tag or branch, not a full commit SHA.- DECODE_
EXEC - Decoded text (base64, hex, compressed) run as code.
- DOCKER_
REMOTE_ ADD - A Dockerfile
ADDof a URL without--checksum. - ENCODED_
BLOB - A long base64 blob in source code.
- ENV_
SECRET - A real-looking secret value in a
.envfile. - INSTALL_
SCRIPT - An npm
preinstall,installorpostinstallscript. - LOCK_
INTEGRITY - A lockfile hash changed or removed while the package’s version stays.
- NEW_
HOST - A host the policy’s network allow list does not name.
- PACKAGE_
NEAR_ MISS - A dependency name one typo or trick away from a popular package’s.
- PACKAGE_
SOURCE - A dependency or a locked package fetched from git, plain http or another host.
- PIPE_
TO_ SHELL - A downloaded script piped into a shell or an interpreter.
- PRIVATE_
KEY - A private key (PEM or
PuTTY). - PYTHON_
STARTUP - A
.pthfile with animportline, which every Python start runs. - RULES
- Every content check, in the order the docs list them.