Repository navigation
Deploy code-managed edge rules (CLI 6.3.0) #17
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
746824d
Deploy code-managed edge rules with CLI 6.3.0
stooit 74deafc
Rules: refuse inputs that could become CLI flags; pin the CLI image b…
stooit 4f4b0a3
CI: pin actions/checkout to a commit SHA (semgrep mutable-tag rule)
stooit b97fde5
Potential fix for pull request finding 'CodeQL / Workflow does not co…
stooit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env bash | ||
| # Refuse rules inputs that could become extra CLI arguments. | ||
| # | ||
| # A docker:// step passes `args:` to the container as one string that is split | ||
| # on whitespace, so a value such as "r.json --api-base-url=https://x/api/v2" | ||
| # would become flags; CLI flags override QUANT_API_TOKEN/QUANT_BASE_URL and | ||
| # could send the portal token to another host. Values reach this script only | ||
| # through the environment, never through the command line. | ||
| set -euo pipefail | ||
|
|
||
| fail() { echo "::error::$1"; exit 1; } | ||
|
|
||
| path_ok() { [[ "$1" =~ ^[A-Za-z0-9_./][A-Za-z0-9_./-]*$ ]]; } | ||
| slug_ok() { [[ "$1" =~ ^[A-Za-z0-9][A-Za-z0-9_-]*$ ]]; } | ||
|
|
||
| path_ok "${RULES:-}" || fail "rules must be a plain file path (letters, digits, '.', '_', '-', '/'), not '${RULES:-}'." | ||
| if [ -n "${FUNCTIONS:-}" ]; then | ||
| path_ok "$FUNCTIONS" || fail "functions must be a plain file path when rules is set." | ||
| fi | ||
| slug_ok "${CUSTOMER:-}" || fail "customer must be an organisation slug when rules is set." | ||
| slug_ok "${PROJECT:-}" || fail "project must be a project machine name when rules is set." | ||
| [[ "${RULES_FORCE:-false}" =~ ^(true|false)$ ]] || fail "rules-force must be true or false." | ||
| [ -n "${API_TOKEN:-}" ] || fail "rules requires api-token (the project-scoped QUANT_API_TOKEN), never the content token." | ||
| [ -n "${API_BASE_URL:-}" ] || fail "rules requires api-base-url (the portal /api/v2 URL, QUANT_BASE_URL)." | ||
| echo "Rules inputs validated." |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.