Repository navigation
feat: v0.2.0 three commands, three config blocks - #2
Conversation
`sdlc commit` (the pre-commit hook), `sdlc push` (the pre-push hook) and `sdlc ci` (the CI job) are configured by [tool.sdlc.commit], [tool.sdlc.push] and [tool.sdlc.ci] in the consuming repo's pyproject.toml. Each runs its defaults; `checks` adds and `skip` removes; a check's settings live in its own [tool.sdlc.<command>.<check>] table. Constitution XII v1.30.0 requires the shape. ci is push minus Gourmand and Gatehouse, which CI already runs through their own workflows, plus the repo's own checks. Those are named kinds -- image-build and pytest-in-image at launch -- and never shell; a repo that needs something new gets a new kind here. A path a kind takes (containerfile, context, mounts) must stay inside the repository, since it reaches a host bind mount or a build context. The hooks file exports two hooks instead of eleven. bin/sdlc is shell and cannot read TOML, so it asks the image for a plan and carries it out, refusing any host step that is not `podman build` or `podman run`. The host contract is held by the launcher, not trusted to a repo's config. Paths come from each tool's own config; the old flat keys are gone and a stray key is refused rather than ignored. CodeQL fails on findings not in the committed .sdlc/codeql-baseline.json instead of reporting and passing. Trivy is removed from this image's build (RT #1551 replaces image scanning fleet-wide), and the image build is gone from this repo's own pre-push. tests/test_plan.py pins the resolution rules; it and test_codeql_globs.py, which CI never ran, now run in the built image on every build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2
|
|
||
| TAB=$(printf '\t') | ||
|
|
||
| run_host() { |
There was a problem hiding this comment.
CRITICAL (Security Scan): The launcher evaluates a host-step payload before checking that it is a permitted Podman command. The plan is generated from repository configuration, and the line-based plan format does not escape embedded newlines or tabs. A crafted configuration value can therefore inject another host plan record whose payload runs arbitrary shell commands; eval executes that payload before the podman check. This can turn a CI run on a repository change into host command execution.
Suggestion: Do not use eval to parse plan payloads. Pass host steps in a structured, safely encoded format and construct the permitted Podman argument vector without invoking a shell; validate the command and subcommand before any execution.
Evidence:
run_host() {
eval "set -- $1"
[ "${1:-}" = podman ] || die "a host step may only run podman; refused: $1"
There was a problem hiding this comment.
fixed in 584463d. A host step is now an argv joined by the ASCII unit separator; the launcher splits it with IFS (globbing off), never evals it, and checks podman build|run before anything runs. The plan refuses any field containing a tab, newline, CR or the separator, so a config value cannot forge a second line. tests/test_host_contract.sh proves a non-podman step is refused and a $(...)-shaped word is never executed; tests/test_plan.py proves the forged values are refused at the source.
v0.1.0 rebuilt on a tool release, which changed nothing: the Containerfile pins both tools exactly, so the rebuild pulled the version it already had. A release has to MOVE THE PIN. Three steps now do that end to end: 1. update-tools.yml, on the tools' `parent-image-updated` dispatch and weekly, runs scripts/update_tools.py: if a release tag is newer than the pin, it moves both ARG copies, bumps this image's patch version in IMAGE_TAG, pyproject.toml and the version label, adds a CHANGELOG entry, and opens a PR that merges itself when green. Tags, not GitHub Releases: gourmand has none. 2. release.yml tags a merged version that has a CHANGELOG heading and no tag. 3. container.yml, after a tag's image is promoted, runs scripts/bump_consumers.py: one auto-merging rev bump PR in every repo that pins python-sdlc, each gated by that repo's own CI, with the failures named for a rerun -- fleet-bump.py's shape. Only a 404 on a repo's config means "does not pin"; any other API failure fails the run rather than skipping the repo silently. All three use the crunchtools-ci App token: a PR or tag made with GITHUB_TOKEN starts no workflow, so it could never go green, be promoted or reach anyone. Auto-merge is now enabled on this repo, which it was not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2
bin/sdlc ran `eval "set -- $1"` on a host step BEFORE checking it was podman, and the plan is line-based, so a config value containing a newline could inject a second plan line whose payload the eval would run -- command substitution and all -- ahead of the check. Gatehouse found it. A host step is now its argv joined by the ASCII unit separator (0x1f). The launcher splits on it with IFS and globbing off, so no word is ever read as shell, then checks `podman build|run`. The plan refuses any field holding a tab, a newline, a carriage return or the separator, so a value cannot forge a line. tests/test_host_contract.sh now proves a non-podman step is refused and that a podman word shaped like `$(...)` is never run; tests/test_plan.py proves the forged values are refused at the source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2
There was a problem hiding this comment.
Gatehouse found 2 issues (2 low)
Reviewed 2 commits since 91132a8 (incremental).
10 finding(s) dropped: their evidence is not in the diff.
| continue | ||
| try: | ||
| print(f" {bump(repo, args.version)}") | ||
| except subprocess.CalledProcessError as command_error: |
There was a problem hiding this comment.
LOW (Consistency Check): This CalledProcessError handler formats the exception and its raw stderr, while the other CalledProcessError handler in this file strips and prints the stderr text directly (lines 108–110). Here the exception output can duplicate the error and render stderr as a bytes representation, making failure messages inconsistent.
Suggestion: Format command_error.stderr consistently with the handler at lines 108–110: strip it, decode it if needed, and print the reason once.
Evidence:
140 | except subprocess.CalledProcessError as command_error:
141 | print(f" FAILED: {command_error}: {command_error.stderr}", file=sys.stderr)
108 | except subprocess.CalledProcessError as exc:
109 | reason = exc.stderr.strip()
110 | print(f" warning: {repo}: auto-merge not queued: {reason}", file=sys.stderr)
| set -eu | ||
| v=$(sed -n 's/^version = "\(.*\)"$/\1/p' pyproject.toml | head -1) | ||
| [ -n "$v" ] || { echo "pyproject.toml names no version" >&2; exit 1; } | ||
| if gh release view "v$v" >/dev/null 2>&1; then |
There was a problem hiding this comment.
LOW (General Review): This suppresses every error from gh release view, making an existing release indistinguishable from an authentication, API, or network failure. The workflow then proceeds as though the version were untagged, obscuring the original failure and potentially producing a less informative error later.
Suggestion: Capture the command result and treat only a confirmed not-found response as an untagged version; report or fail on other errors.
Evidence:
if gh release view "v$v" >/dev/null 2>&1; then
Summary
The shape constitution XII v1.30.0 requires:
sdlc commit[tool.sdlc.commit]sdlc push[tool.sdlc.push]sdlc cisdlc ci[tool.sdlc.ci]checksadds,skipremoves; a check's settings live in[tool.sdlc.<command>.<check>].sdlc tiersprints what runs.image-buildandpytest-in-image— never shell.bin/sdlcasks the image for a plan and carries it out, and refuses any host step that isn'tpodman buildorpodman run..sdlc/codeql-baseline.json.SDLC_SKIP=<check>skips one check once.Test plan
tests/test_plan.py— resolution, refusals, path confinement, CodeQL baseline (all pass)tests/test_host_contract.sh— every command needs only git/podman; a non-podman host step is refused and never runstests/contract.shon a dev image — passes, including the plan order and ci leaving out the reviewersimage-buildapplied@project.versionand@git.shalabels;pytest-in-imageran inside a Hummingbird image with no network; a failing test → 1, no tests → 2, a broken build → 1, an unknown check → 2Gatehouse findings not changed
actions/checkout@v7in the README example: the fleet pins GitHub Actions at the major tag and Dependabot moves them (constitution XV); not a violation.verify-digest, which is the profile's requirement; the pre-push run is an earlier, cheaper failure, not a replacement.🤖 Generated with Claude Code
https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2