fix: fail safely in registry admin scripts - #1622
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
With strict mode enabled, current JSON parsing can cause the auth script to exit on a non-JSON response before emitting the intended failure message/diagnostics.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Tightens safety checks in the registry admin bash scripts to prevent accidental broad takedowns and to stop authentication flows earlier when prerequisites fail, aligning with the operational need to perform reliable moderation/takedown actions (e.g., for #1563).
Changes:
- Rejects any non-empty
ALL_VERSIONSvalue other than the literaltruebefore proceeding in the takedown script. - Enables strict bash error handling (
set -euo pipefail) in the auth helper and fixes an output-line formatting issue.
File summaries
| File | Description |
|---|---|
| tools/admin/takedown.sh | Adds explicit validation so ALL_VERSIONS must be exactly true when provided. |
| tools/admin/auth.sh | Enables strict error handling and corrects the token export output formatting. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The takedown script previously treated any nonempty
ALL_VERSIONSvalue, includingfalse, as permission to delete every version. Require exactlytruewhen 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 -nandgit diff --checkpassed. Mocked command checks confirmed thatfalse,1, andTRUEare 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.