Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .github/actions/contract/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ runs:
TARGET: ${{ inputs.target }}
OUTPUT: ${{ inputs.output }}
AT: ${{ inputs.at }}
# Passed through the environment like every other value here.
# A ${{ }} expression interpolated straight into the script is the
# shape actions/code-injection flags, and this file already avoids
# it everywhere else; the runner sets this one, but the rule is
# about the shape, and one exception is what makes a habit unreliable.
ACTION_PATH: ${{ github.action_path }}
run: |
set -euo pipefail
valid_path() {
[[ "$1" =~ ^[A-Za-z0-9._/-]+$ && "$1" != /* && "$1" != *..* ]]
}
valid_path "$PLAN"
root="$(cd -- "${{ github.action_path }}/../../.." && pwd)"
root="$(cd -- "$ACTION_PATH/../../.." && pwd)"
case "$COMMAND" in
seal)
valid_path "$OUTPUT"
Expand Down
8 changes: 7 additions & 1 deletion .github/actions/lifecycle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ runs:
APPROVAL: ${{ inputs.approval }}
STATE_OUTPUT: ${{ inputs.state_output }}
EVIDENCE_OUTPUT: ${{ inputs.evidence_output }}
# Passed through the environment like every other value here.
# A ${{ }} expression interpolated straight into the script is the
# shape actions/code-injection flags, and this file already avoids
# it everywhere else; the runner sets this one, but the rule is
# about the shape, and one exception is what makes a habit unreliable.
ACTION_PATH: ${{ github.action_path }}
run: |
set -euo pipefail
valid_path() {
Expand All @@ -43,7 +49,7 @@ runs:
valid_path "$STATE_OUTPUT"
valid_path "$EVIDENCE_OUTPUT"
[[ "$OPERATION" =~ ^(apply|verify|resume|rollback)$ ]]
root="$(cd -- "${{ github.action_path }}/../../.." && pwd)"
root="$(cd -- "$ACTION_PATH/../../.." && pwd)"
python3 "$root/scripts/cd_contract.py" validate-plan "$PLAN"
python3 "$root/scripts/cd_contract.py" validate-state "$PLAN" "$STATE"
adapter_args=("$OPERATION" --plan "$PLAN" --state "$STATE" --state-output "$STATE_OUTPUT" --evidence-output "$EVIDENCE_OUTPUT")
Expand Down