@supacloud/admin 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +38 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25951,11 +25951,46 @@ supacloud_record_integrity_mode() {
25951
25951
  chmod 600 "$record_file" 2>/dev/null || true
25952
25952
  }
25953
25953
 
25954
- supacloud_verify_attestation() {
25954
+ supacloud_fetch_attestation_bundle() {
25955
+ local artifact_file="$1"
25956
+ local bundle_file="$2"
25957
+ local digest response
25958
+ digest=$(sha256sum "$artifact_file" | awk '{print $1}') || return 1
25959
+ [[ "$digest" =~ ^[0-9a-fA-F]{64}$ ]] || {
25960
+ echo "Unable to calculate the artifact digest for attestation lookup" >&2
25961
+ return 1
25962
+ }
25963
+ digest=$(printf '%s' "$digest" | tr '[:upper:]' '[:lower:]')
25964
+ response=$(supacloud_fetch_release_json \\
25965
+ "https://api.github.com/repos/\${SUPACLOUD_GITHUB_REPOSITORY}/attestations/sha256:\${digest}") || {
25966
+ echo "Unable to download the public GitHub artifact attestation bundle" >&2
25967
+ return 1
25968
+ }
25969
+ if ! jq -ce '
25970
+ .attestations
25971
+ | if type != "array" or length == 0 or any(.[]; (.bundle | type) != "object")
25972
+ then error("no valid attestation bundles returned")
25973
+ else .[].bundle
25974
+ end
25975
+ ' <<< "$response" > "$bundle_file"; then
25976
+ echo "GitHub artifact attestation response did not contain a valid bundle" >&2
25977
+ return 1
25978
+ fi
25979
+ }
25980
+
25981
+ supacloud_verify_attestation() (
25955
25982
  local artifact_file="$1"
25956
25983
  if supacloud_attestation_verifier_available; then
25957
- local verification_output
25984
+ local verification_output bundle_dir bundle_file
25985
+ bundle_dir=$(mktemp -d "\${TMPDIR:-/tmp}/supacloud-attestation.XXXXXX") || return 1
25986
+ trap 'rm -rf -- "$bundle_dir"' EXIT
25987
+ trap 'trap - EXIT HUP INT TERM; rm -rf -- "$bundle_dir"; exit 1' HUP INT TERM
25988
+ bundle_file="\${bundle_dir}/bundle.jsonl"
25989
+ if ! supacloud_fetch_attestation_bundle "$artifact_file" "$bundle_file"; then
25990
+ return 1
25991
+ fi
25958
25992
  if ! verification_output=$(gh attestation verify "$artifact_file" \\
25993
+ --bundle "$bundle_file" \\
25959
25994
  --repo "$SUPACLOUD_GITHUB_REPOSITORY" \\
25960
25995
  --signer-workflow "$SUPACLOUD_ATTESTATION_SIGNER_WORKFLOW" 2>&1); then
25961
25996
  echo "GitHub artifact attestation verification failed: \${verification_output}" >&2
@@ -25973,7 +26008,7 @@ supacloud_verify_attestation() {
25973
26008
 
25974
26009
  echo "Artifact attestation verification is required, but gh attestation verify is unavailable. Install GitHub CLI or explicitly set SUPACLOUD_ALLOW_UNVERIFIED_RELEASE=true for emergency break-glass use." >&2
25975
26010
  return 1
25976
- }
26011
+ )
25977
26012
 
25978
26013
  supacloud_attestation_verifier_available() {
25979
26014
  local version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/admin",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Platform administration CLI for SupaCloud operators",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",