-
Notifications
You must be signed in to change notification settings - Fork 3.7k
preinstall 3 versions of awf for agentic workflow #13937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/bin/bash -e | ||
| ################################################################################ | ||
| ## File: install-awf.sh | ||
| ## Desc: Install Agent Workflow Firewall JS bundle (most recent 3 versions) | ||
| ## Supply chain security: AWF - checksum validation | ||
| ################################################################################ | ||
|
|
||
| # Source the helpers for use with the script | ||
| source $HELPER_SCRIPTS/install.sh | ||
|
|
||
| # Number of versions to install (current + 2 previous) | ||
| NUM_VERSIONS=3 | ||
|
|
||
| # Get the most recent stable releases (exclude pre-releases, beta and release without assets) | ||
| releases=$(curl -fsSL "https://api.github.com/repos/github/gh-aw-firewall/releases?per_page=10") | ||
| versions=$(echo "$releases" | jq -r '[.[] | select(.assets | length > 0) | select(.prerelease == false) | select(.tag_name | test(".*-[a-z]|beta") | not)] | .[:'"$NUM_VERSIONS"'] | .[].tag_name') | ||
|
|
||
| if [[ -z "$versions" ]]; then | ||
| echo "Error: Unable to find AWF releases." | ||
| exit 1 | ||
| fi | ||
|
|
||
| for tag in $versions; do | ||
| version="${tag#v}" | ||
| echo "Installing AWF JS bundle version $version to toolcache..." | ||
|
|
||
| # Download the JS bundle | ||
| bundle_url="https://github.com/github/gh-aw-firewall/releases/download/${tag}/awf-bundle.js" | ||
| bundle_path=$(download_with_retry "$bundle_url") | ||
|
|
||
| # Supply chain security - AWF | ||
| checksums_url="https://github.com/github/gh-aw-firewall/releases/download/${tag}/checksums.txt" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious, how do we enforce the security here? If someone was able to update release artifacts then they could equally update the checksum file too.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah good point. I think we need to verify signature to be fully protected, although this check sum validation is an existing pattern in our install scripts |
||
| external_hash=$(get_checksum_from_url "$checksums_url" "awf-bundle.js" "SHA256") | ||
| use_checksum_comparison "$bundle_path" "$external_hash" | ||
|
|
||
| # Install to toolcache | ||
| awf_toolcache_path="$AGENT_TOOLSDIRECTORY/agentic-workflow-firewall-js/$version/x64" | ||
| mkdir -p "$awf_toolcache_path" | ||
| cp "$bundle_path" "$awf_toolcache_path/awf-bundle.js" | ||
|
|
||
| # Mark installation complete | ||
| touch "$AGENT_TOOLSDIRECTORY/agentic-workflow-firewall-js/$version/x64.complete" | ||
| done | ||
|
|
||
| invoke_tests "Tools" "AWF" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GitHub release query uses per_page=10 and only checks that a release has some assets, not that it includes awf-bundle.js/checksums.txt. This can lead to caching fewer than NUM_VERSIONS versions or failing downloads if a release is missing the expected files. Prefer using helpers/install.sh (get_github_releases_by_version + resolve_github_release_asset_url) or filter releases by the required asset name and increase the page size so you can reliably install 3 stable versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
já verifiquei as mudanças a serem feitas.