-
Notifications
You must be signed in to change notification settings - Fork 0
fix(review): keep gateway bearer out of step environments #1369
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
Changes from all commits
e95fed3
e98d08e
f73486e
2e1db52
3af96b4
6a2eddb
2a904b1
198db58
5ff0e96
5b37c9b
48f893b
6beae6b
4c2bdcb
5f1c1da
2ef49da
30540d2
cc6bb05
4a694d5
4112970
dd46e76
0dabda5
d9ecfaf
986cfc2
7d24923
dc03010
7b3c3b2
2c9588e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
devin-ai-integration[bot] marked this conversation as resolved.
|
|
seonghobae marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
| # Source inside a model-consuming GitHub Actions step. The provisioner exports | ||
| # only this file path across steps so the raw bearer cannot appear in a later | ||
| # step's rendered environment header before masking takes effect. | ||
|
|
||
| _contextual_orchestrator_token_fail() { | ||
| printf '::error::%s\n' "$*" >&2 | ||
| return 1 | ||
| } | ||
|
|
||
| _contextual_orchestrator_load_token() { | ||
| local token_file token_size | ||
|
|
||
| token_file="${CONTEXTUAL_ORCHESTRATOR_TOKEN_FILE:-}" | ||
| if [ -z "$token_file" ]; then | ||
| _contextual_orchestrator_token_fail "CONTEXTUAL_ORCHESTRATOR_TOKEN_FILE is required; the review sidecar was not provisioned." || return 1 | ||
| fi | ||
| if [ ! -f "$token_file" ] || [ -L "$token_file" ]; then | ||
| _contextual_orchestrator_token_fail "CONTEXTUAL_ORCHESTRATOR_TOKEN_FILE must name a regular, non-symlink file." || return 1 | ||
| fi | ||
| if [ "$(stat -c %u -- "$token_file")" != "$(id -u)" ]; then | ||
| _contextual_orchestrator_token_fail "CONTEXTUAL_ORCHESTRATOR_TOKEN_FILE must be owned by the current runner user." || return 1 | ||
| fi | ||
| if [ "$(stat -c %a -- "$token_file")" != "600" ]; then | ||
| _contextual_orchestrator_token_fail "CONTEXTUAL_ORCHESTRATOR_TOKEN_FILE must have mode 600." || return 1 | ||
| fi | ||
| token_size="$(wc -c < "$token_file")" | ||
| if [ "$token_size" -lt 1 ] || [ "$token_size" -gt 4096 ]; then | ||
| _contextual_orchestrator_token_fail "CONTEXTUAL_ORCHESTRATOR_TOKEN must contain between 1 and 4096 bytes." || return 1 | ||
| fi | ||
| if [ "$(wc -l < "$token_file")" -ne 0 ] || grep -q $'\r' -- "$token_file"; then | ||
| _contextual_orchestrator_token_fail "CONTEXTUAL_ORCHESTRATOR_TOKEN must not contain CR or LF." || return 1 | ||
| fi | ||
|
|
||
| CONTEXTUAL_ORCHESTRATOR_TOKEN="$(cat -- "$token_file")" | ||
| if [ "${GITHUB_ACTIONS:-}" = "true" ]; then | ||
| printf '::add-mask::%s\n' "$CONTEXTUAL_ORCHESTRATOR_TOKEN" | ||
| fi | ||
|
Comment on lines
+36
to
+38
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. 📝 Info: Job-wide mask already covers the fresh bearer The loader's per-step re-mask is defensive: the sidecar generates a fresh per-job token and registers Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| export CONTEXTUAL_ORCHESTRATOR_TOKEN | ||
| } | ||
|
|
||
| _contextual_orchestrator_load_token || { | ||
| _contextual_orchestrator_status=$? | ||
| unset -f _contextual_orchestrator_load_token _contextual_orchestrator_token_fail | ||
| return "$_contextual_orchestrator_status" | ||
| } | ||
| unset -f _contextual_orchestrator_load_token _contextual_orchestrator_token_fail | ||
|
Comment on lines
+42
to
+47
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. 📝 Info: Loader fail-closed semantics under set -e The worker runs as Was this helpful? React with 👍 or 👎 to provide feedback. |
||
Uh oh!
There was an error while loading. Please reload this page.