8000 gcloud: build-time assert that the bundle LICENSE stays Apache (inbox#284) by bryan-minimal · Pull Request #437 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content
Closed
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
10 changes: 10 additions & 0 deletions packages/gcloud/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ esac

tar -xof "google-cloud-cli-${MINIMAL_ARG_VERSION}-linux-${PLATFORM}.tar.gz"

# Redistribution guard (gominimal/inbox#284): serving this bundle from the
# public cache is fine because the bundle's own LICENSE is Apache-2.0 — its
# ToS clauses govern *use of GCP services*, not redistribution of the CLI.
# If Google ever changes the bundle license, fail loudly so the
# redistribution question gets re-audited instead of silently shipping.
grep -q "Apache License" google-cloud-sdk/LICENSE || {
echo "gcloud bundle LICENSE no longer mentions the Apache License — re-audit redistribution (gominimal/inbox#284)" >&2
exit 1
}
Comment on lines +17 to +20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Check for Apache License 2.0 specifically.

The PR objective is to detect any change away from Apache-2.0, but grep -q "Apache License" also passes licenses or notices that mention Apache License without declaring Version 2.0. Match the canonical Apache License, Version 2.0 marker (or an equivalent authoritative SPDX marker) so a changed license cannot bypass the re-audit.

Proposed fix
-grep -q "Apache License" google-cloud-sdk/LICENSE || {
+grep -Fq "Apache License, Version 2.0" google-cloud-sdk/LICENSE || {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
grep -q "Apache License" google-cloud-sdk/LICENSE || {
echo "gcloud bundle LICENSE no longer mentions the Apache License — re-audit redistribution (gominimal/inbox#284)" >&2
exit 1
}
grep -Fq "Apache License, Version 2.0" google-cloud-sdk/LICENSE || {
echo "gcloud bundle LICENSE no longer mentions the Apache License — re-audit redistribution (gominimal/inbox#284)" >&2
exit 1
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/gcloud/build.sh` around lines 17 - 20, Update the license validation
grep in the build script to require the canonical “Apache License, Version 2.0”
marker or an equivalent authoritative SPDX identifier, rather than the generic
“Apache License” text. Preserve the existing failure message and exit behavior
when the specific Apache-2.0 declaration is absent.


mkdir -p $OUTPUT_DIR/usr/{bin,lib}
mv google-cloud-sdk $OUTPUT_DIR/usr/lib/google-cloud-sdk

Expand Down
0