fix: fail safely in registry admin scripts (#1622)

The takedown script previously treated any nonempty `ALL_VERSIONS`
value, including `false`, as permission to delete every version. Require
exactly `true` when the variable is set, and reject other values before
sending a request.

Enable strict shell error handling in the auth helper so a failed
identity-token command stops execution before exchanging an empty token.

Validation: `bash -n` and `git diff --check` passed. Mocked command
checks confirmed that `false`, `1`, and `TRUE` are rejected before
network access, and that identity-token retrieval failure stops before
the token exchange. The updated scripts also completed the authorized
takedown associated with #1563; public API reads confirmed the deleted
record and removal from default results.
This commit is contained in:
Radoslav Dimitrov 2026-09-06 01:13:09 +03:00 • committed by GitHub
commit 739b70e8bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,6 +34,10 @@ fi
# Require an explicit choice, so that a forgotten VERSION cannot silently take
# down every version of a server.
if [ -n "$ALL_VERSIONS" ] && [ "$ALL_VERSIONS" != "true" ]; then
echo "Error: ALL_VERSIONS must be exactly true when set." >&2
exit 1
fi
if [ -n "$VERSION" ] && [ -n "$ALL_VERSIONS" ]; then
echo "Error: set either VERSION or ALL_VERSIONS, not both." >&2
exit 1