Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/agent-guides/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ required CI. Legacy recovery must refuse prebuilt-marked evidence even when the
new mode input is omitted. Caller/verifier adoption remains separate; #684 owns
the finite rollout gate review and retirement.

**Caller-signed publication (`actions/publish-app`):** The composite signs as the
calling workflow, so its admission is the boundary. Before any registry contact it
requires a `refs/tags/v<semver>` ref, the caller's own workflow ref at that tag, the
tagged commit checked out at the workspace root without a persisted credential, and
that commit on the explicitly fetched default branch; unknown ancestry refuses.
`deploy-path` and `app-manifest` are plain names without links, and `deploy-path`
holds only regular files equal to the tagged source. It keeps the occupied-version
guard before the first write and twice more, signs by digest, and verifies both
digests against `https://github.com/$GITHUB_WORKFLOW_REF` before exposing version or
stable `latest`. No credential reaches any argv: flux uses the docker login and the
action's own version check gives curl private config files (the retiring workflows'
shared guard and `--creds` stay unchanged). The prebuilt mode reuses
`prepare-prebuilt-webapp.sh`. Keep `.github/tests/test-publish-app-action.sh`, its
composite simulation, argv record and mutation controls in required CI. Recovery is
not carried yet.

Normal publication's public CI evidence reads remain credential-free. The standalone
verifier additionally supports explicit `PREBUILT_CI_AUTH_MODE=job-token` for
isolated GitHub-hosted CI, with an explicitly supplied `PREBUILT_CI_READ_TOKEN`.
Expand Down
7 changes: 4 additions & 3 deletions .github/scripts/ci-selection/inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test-enable-auto-merge-queue", "test-free-disk-space", "test-free-disk-space-keep",
"test-govulncheck-allowlist-honored", "test-govulncheck-strict-blocks", "test-govulncheck-timeout-retry-live",
"test-lint-blocks", "test-login-to-ghcr", "test-login-to-ghcr-empty-token",
"test-prepare-fixes", "test-retry-script", "test-run-dotnet-tests", "test-run-dotnet-tests-blocks",
"test-prepare-fixes", "test-publish-app", "test-retry-script", "test-run-dotnet-tests", "test-run-dotnet-tests-blocks",
"test-run-dotnet-tests-coverage-inline-lockstep", "test-run-dotnet-tests-gate-lockstep",
"test-run-dotnet-tests-missing-working-directory", "test-run-dotnet-tests-preserves-source-mapping",
"test-setup-go-toolchain",
Expand Down Expand Up @@ -46,7 +46,7 @@
"test-enable-auto-merge-on-pr": {"if": "github.event_name != 'merge_group' && !startsWith(github.event.head_commit.message, 'chore(main): release ') && startsWith(github.event_name, 'pull_request') && (\n github.event.pull_request.user.login == 'dependabot[bot]' ||\n github.event.pull_request.user.login == 'renovate[bot]' ||\n github.event.pull_request.user.login == 'botantler[bot]' ||\n github.event.pull_request.user.login == 'devantler'\n)"},
"test-zizmor": {"if": "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(main): release ') }}"},
"test-run-dotnet-tests-workflow-authenticated": {"if": "${{\n github.event_name != 'merge_group' &&\n !startsWith(github.event.head_commit.message, 'chore(main): release ') &&\n github.event_name == 'pull_request' &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n github.event.pull_request.user.login == 'devantler'\n}}"},
"test-publish-app": {"if": "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(main): release ') }}"},
"test-publish-app-workflow": {"if": "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(main): release ') }}"},
"test-publish-app-caller-pin": {"if": "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(main): release ') }}"},
"test-publish-caller-pin-live": {"if": "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(main): release ') }}"},
"test-publish-manifests": {"if": "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(main): release ') }}"},
Expand Down Expand Up @@ -75,6 +75,7 @@
"test-free-disk-space-keep": ["actions/free-disk-space/"],
"test-login-to-ghcr": ["actions/login-to-ghcr/"],
"test-login-to-ghcr-empty-token": ["actions/login-to-ghcr/"],
"test-publish-app": ["actions/publish-app/"],
"test-aggregate-job-checks-empty": ["actions/aggregate-job-checks/"],
"test-aggregate-job-checks-success": ["actions/aggregate-job-checks/"],
"test-aggregate-job-checks-failure": ["actions/aggregate-job-checks/"],
Expand Down Expand Up @@ -118,7 +119,7 @@
"test-publish-release-recovery-disabled": [],
"test-create-release-config": [],
"test-release-please-semantics": [],
"test-publish-app": [],
"test-publish-app-workflow": [],
"test-publish-app-caller-pin": [],
"test-publish-caller-pin-live": [],
"test-publish-manifests": [],
Expand Down
32 changes: 23 additions & 9 deletions .github/scripts/prepare-prebuilt-webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,30 @@ esac
[[ -n "${GITHUB_OUTPUT:-}" ]] || fail 'missing workflow output file'
path="${DEPLOY_PATH#./}"
[[ -n "$path" && "$path" != /* && "$path" != */ && "$path" != *//* ]] || fail 'require a relative deployment directory'
# The WebApp manifest is named relative to the deployment directory; empty keeps webapp.yaml.
manifest="${APP_MANIFEST:-webapp.yaml}"
[[ "$manifest" != *$'\n'* && "$manifest" != *$'\r'* && "$manifest" != /* && "$manifest" != */ && "$manifest" != *//* ]] ||
fail 'require a relative app manifest inside the deployment directory'
# Walk <path> below the cursor one component at a time; every directory must be a regular source
# directory and no component may be `.`, `..`, hidden or unusual.
walk() {
local component components
IFS=/ read -r -a components <<< "$1"
for component in "${components[@]}"; do
[[ "$component" =~ ^[A-Za-z0-9_-][A-Za-z0-9_.-]*$ && "$component" != . && "$component" != .. ]] || fail "unsafe $2"
cursor="$cursor/$component"
[[ -d "$cursor" && ! -L "$cursor" ]] || fail 'deployment directories must be regular source directories'
done
}
cursor=.
IFS=/ read -r -a components <<< "$path"
for component in "${components[@]}"; do
[[ "$component" =~ ^[A-Za-z0-9_-][A-Za-z0-9_.-]*$ && "$component" != . && "$component" != .. ]] || fail 'unsafe deployment directory'
cursor="$cursor/$component"
[[ -d "$cursor" && ! -L "$cursor" ]] || fail 'deployment directories must be regular source directories'
done
file="$cursor/webapp.yaml"
[[ -f "$file" && ! -L "$file" ]] || fail 'require a regular webapp.yaml'
unsafe="$(find "$cursor" ! -type f ! -type d -print -quit)" || fail 'cannot inspect the complete deployment directory'
walk "$path" 'deployment directory'
deploy_dir="$cursor"
manifest_name="${manifest##*/}"
[[ "$manifest_name" =~ ^[A-Za-z0-9_-][A-Za-z0-9_.-]*$ ]] || fail 'unsafe app manifest path'
[[ "$manifest" == "$manifest_name" ]] || walk "${manifest%/*}" 'app manifest path'
file="$cursor/$manifest_name"
[[ -f "$file" && ! -L "$file" ]] || fail "require a regular $manifest"
unsafe="$(find "$deploy_dir" ! -type f ! -type d -print -quit)" || fail 'cannot inspect the complete deployment directory'
[[ -z "$unsafe" ]] || fail 'deployment artifacts cannot contain linked or special files'
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
Expand Down
2 changes: 1 addition & 1 deletion .github/tests/test-ci-catalogue-scope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jq -e 'index("test-validate-go-postgresql-fixture") != null' <<<"${selected}" >/
jq -e 'index("test-go-cache-native-observer") != null' <<<"${selected}" >/dev/null || fail 'native Go cache observer left the independent coverage floor'
jq -e 'index("test-go-workflow-guards") != null' <<<"${selected}" >/dev/null || fail 'grouped Go guards left the independent coverage floor'
jq -en --argjson selected "${selected}" --slurpfile inventory "${repo_root}/.github/scripts/ci-selection/inventory.json" '
($inventory[0].catalogue_optional | length == 37) and
($inventory[0].catalogue_optional | length == 38) and
all($selected[]; . as $id | ($inventory[0].catalogue_optional | index($id)) == null) and
($selected | index("test-approve-pr-credential-boundary") != null) and
($selected | index("test-validate-go-project-apply-signed-fixes") != null)
Expand Down
4 changes: 2 additions & 2 deletions .github/tests/test-ci-selection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ EVENT_NAME=push RUN_CATALOGUE=true CATALOGUE_SCOPE=true GITHUB_OUTPUT="$work/out
go -C "$root/.github/scripts/ci-selection" run . "$root" "$root/.github/scripts/ci-selection/inventory.json" "$work/workflow.json"
selected="$(sed -n 's/^selected=//p' "$work/output")"
# The skill action executions moved with their standalone repositories; all remaining executions stay selected.
jq -e 'length == 61 and index("test-lint-workflow") == null and
jq -e 'length == 62 and index("test-lint-workflow") == null and
index("test-lint-workflow-manual-fixes") == null' <<< "$selected" >/dev/null
jq -e 'index("test-validate-go-postgresql-fixture") != null' <<<"$selected" >/dev/null
jq -e 'index("test-go-cache-native-observer") != null' <<<"$selected" >/dev/null
Expand Down Expand Up @@ -280,7 +280,7 @@ jq -e --argjson a "$action_only" --argjson r "$readme_readers" '. == ($a + $r |
{ echo 'FAIL: README with a recognized action lost a reader or an owner' >&2; exit 1; }
for kinds in 'agents' 'readme agents' 'readme unknown' 'action agents unknown' 'readme-renamed'; do
# shellcheck disable=SC2086 # Each kinds word is one fixture change.
jq -e 'length == 61' <<<"$(select_docs $kinds)" >/dev/null ||
jq -e 'length == 62' <<<"$(select_docs $kinds)" >/dev/null ||
{ echo "FAIL: root-document change '$kinds' narrowed full coverage" >&2; exit 1; }
done
for kinds in 'readme' 'action readme agents'; do
Expand Down
74 changes: 74 additions & 0 deletions .github/tests/test-prebuilt-webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,78 @@ reset_fixture
ln -s "$work/run.json" "$work/deploy/unrelated.yaml"
if invoke none > "$work/log" 2>&1; then fail 'accepted a linked file in the packaged deployment directory'; fi
[[ ! -s "$work/output" && ! -s "$work/reads" ]] || fail 'linked deployment file reached verification'
rm "$work/deploy/unrelated.yaml"

# app-manifest names the WebApp manifest inside the deployment directory; omitted, webapp.yaml is
# used as above, even beside a base/ copy.
reset_split_fixture() { # <app-manifest> — the healthy WebApp moved to deploy/<app-manifest>
rm -rf "$work/deploy" "$work/outside" "$work/outside.yaml" "$work/webapp.yaml"
mkdir -p "$work/deploy"
reset_fixture
mkdir -p "$(dirname "$work/deploy/$1")"
[[ "$1" == webapp.yaml ]] || mv "$work/deploy/webapp.yaml" "$work/deploy/$1"
cp "$work/deploy/$1" "$work/before.yaml"
printf 'resources: [prod]\n' > "$work/deploy/kustomization.yaml"
}
pinned_only() { # <file> — the selected image is pinned and every other document value is kept
yq -o=json -I=0 '.' "$1" | jq -s -e --arg image "ghcr.io/devantler-tech/app@$image_digest" '
. == [
{apiVersion:"v1",kind:"ConfigMap",metadata:{name:"unrelated"},data:{literal:"keep me"}},
{apiVersion:"kro.run/v1alpha1",kind:"WebApp",metadata:{name:"app",namespace:"app"},
spec:{name:"app",image:$image,host:"example.invalid"}}
]' > /dev/null
}
reset_split_fixture webapp.yaml
mkdir -p "$work/deploy/base"
cp "$work/before.yaml" "$work/deploy/base/webapp.yaml"
invoke none > "$work/log" 2>&1 || fail "flat WebApp beside base/ refused: $(cat "$work/log")"
pinned_only "$work/deploy/webapp.yaml" || fail 'default did not pin the flat webapp.yaml'
cmp -s "$work/before.yaml" "$work/deploy/base/webapp.yaml" || fail 'default pinned a base/ manifest nobody named'
for manifest in base/webapp.yaml overlays/base/webapp.yaml app.yaml; do
reset_split_fixture "$manifest"
invoke none APP_MANIFEST="$manifest" > "$work/log" 2>&1 || fail "healthy WebApp at $manifest refused: $(cat "$work/log")"
pinned_only "$work/deploy/$manifest" || fail "did not pin only the selected image in $manifest"
[[ "$manifest" == app.yaml || ! -e "$work/deploy/webapp.yaml" ]] || fail "$manifest created a flat webapp.yaml"
grep -qx "digest=$image_digest" "$work/output" || fail "$manifest omitted the verified image output"
done
# Unsafe, linked or missing app-manifest values are refused before any external observation and
# change no file. A valid WebApp sits wherever each path would lead.
for case in \
'../webapp.yaml|unsafe app manifest path' \
'/webapp.yaml|require a relative app manifest inside the deployment directory' \
'base/./webapp.yaml|unsafe app manifest path' \
'base/../webapp.yaml|unsafe app manifest path' \
'base//webapp.yaml|require a relative app manifest inside the deployment directory' \
'base/|require a relative app manifest inside the deployment directory' \
'.hidden/webapp.yaml|unsafe app manifest path' \
"base/webapp.yaml"$'\n'"x|require a relative app manifest inside the deployment directory" \
"base/webapp.yaml"$'\r'"|require a relative app manifest inside the deployment directory" \
'linked-dir|deployment directories must be regular source directories' \
'linked-file|require a regular base/webapp.yaml' \
'missing|require a regular base/webapp.yaml' \
'linked-sibling|deployment artifacts cannot contain linked or special files'; do
manifest="${case%%|*}"
expected="${case#*|}"
reset_split_fixture base/webapp.yaml
cp "$work/before.yaml" "$work/deploy/webapp.yaml"
cp "$work/before.yaml" "$work/webapp.yaml"
mkdir -p "$work/deploy/.hidden"
cp "$work/before.yaml" "$work/deploy/.hidden/webapp.yaml"
case "$manifest" in
linked-dir) mv "$work/deploy/base" "$work/outside" && ln -s ../outside "$work/deploy/base" ;;
linked-file) mv "$work/deploy/base/webapp.yaml" "$work/outside.yaml" &&
ln -s ../../outside.yaml "$work/deploy/base/webapp.yaml" ;;
missing) rm "$work/deploy/base/webapp.yaml" ;;
# The whole packaged directory is scanned, not only the named manifest's directory.
linked-sibling) mkdir -p "$work/deploy/prod" && ln -s ../../run.json "$work/deploy/prod/linked.yaml" ;;
esac
case "$manifest" in linked-dir | linked-file | missing | linked-sibling) manifest=base/webapp.yaml ;; esac
find "$work" -type f -name '*webapp.yaml' -exec shasum {} + | sort > "$work/sums-before"
[[ -s "$work/sums-before" ]] || fail 'the refusal fixture has no manifests to compare'
if invoke none APP_MANIFEST="$manifest" > "$work/log" 2>&1; then fail "accepted app-manifest: $manifest"; fi
[[ ! -s "$work/output" && ! -s "$work/reads" ]] || fail "app-manifest $manifest reached verification"
grep -qF "$expected" "$work/log" || fail "app-manifest $manifest refused for the wrong reason: $(grep '::error::' "$work/log")"
find "$work" -type f -name '*webapp.yaml' -exec shasum {} + | sort | cmp -s - "$work/sums-before" ||
fail "refused app-manifest $manifest changed manifests"
done
echo 'prebuilt-webapp: real YAML pinning and source/CI/provenance/partial-observation refusals pass'
Loading
Loading