jdecool/scaleway-runtimepublic Fork
⑂ e9c211e
Commits
⬇ Clone ▾
git clone https://git.rickub.com/jdecool/scaleway-runtime.git
git clone ssh://git@rickub.com/jdecool/scaleway-runtime.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

test(e2e): keep the CRON secret off command linesUnverified

The scenarios also run against the deployment, whose real secret was
visible to other local users in the php and curl arguments.
Jérémy DECOOL committed 2026-11-14T02:07:44+01:00 Browse files
e9c211e parent: ee88812
modified example/e2e/run.sh +4 -3
@@ -123,14 +123,15 @@ expect "command without the CRON secret stays HTTP" "$status $(field forged args
123123
124124 if [[ -n "${SCALEWAY_CRON_SECRET:-}" ]]; then
125125 # command_body <name> <args JSON>: the arguments a CRON trigger running a command carries.
126+ # The secret goes through the environment and stdin, as command lines are visible to other local users.
126127 command_body() {
127- php -r 'echo json_encode(["command" => $argv[1], "args" => json_decode($argv[2]), "secret" => $argv[3]]);' "$1" "$2" "$SCALEWAY_CRON_SECRET"
128+ php -r 'echo json_encode(["command" => $argv[1], "args" => json_decode($argv[2]), "secret" => getenv("SCALEWAY_CRON_SECRET")]);' "$1" "$2"
128129 }
129- status=$(request command -X POST --data "$(command_body app:greet '{"name":"Scaleway","--yell":true}')" "$base_url/")
130+ status=$(command_body app:greet '{"name":"Scaleway","--yell":true}' | request command -X POST --data-binary @- "$base_url/")
130131 expect "Command Invocation status" "$status" 200
131132 expect "Command Invocation output" "$(cat "$tmp/command.body")" "HELLO SCALEWAY!"
132133
133- status=$(request failed -X POST --data "$(command_body app:greet '{"--fail":true}')" "$base_url/")
134+ status=$(command_body app:greet '{"--fail":true}' | request failed -X POST --data-binary @- "$base_url/")
134135 expect "failed command status" "$status" 500
135136 expect "failed command output" "$(grep -c 'Failing on purpose.' "$tmp/failed.body")" 1
136137
@@ -123,14 +123,15 @@ expect "command without the CRON secret stays HTTP" "$status $(field forged args
123 123
124 if [[ -n "${SCALEWAY_CRON_SECRET:-}" ]]; then124 if [[ -n "${SCALEWAY_CRON_SECRET:-}" ]]; then
125 # command_body <name> <args JSON>: the arguments a CRON trigger running a command carries.125 # command_body <name> <args JSON>: the arguments a CRON trigger running a command carries.
126+ # The secret goes through the environment and stdin, as command lines are visible to other local users.
126 command_body() {127 command_body() {
127- php -r 'echo json_encode(["command" => $argv[1], "args" => json_decode($argv[2]), "secret" => $argv[3]]);' "$1" "$2" "$SCALEWAY_CRON_SECRET"128+ php -r 'echo json_encode(["command" => $argv[1], "args" => json_decode($argv[2]), "secret" => getenv("SCALEWAY_CRON_SECRET")]);' "$1" "$2"
128 }129 }
129- status=$(request command -X POST --data "$(command_body app:greet '{"name":"Scaleway","--yell":true}')" "$base_url/")130+ status=$(command_body app:greet '{"name":"Scaleway","--yell":true}' | request command -X POST --data-binary @- "$base_url/")
130 expect "Command Invocation status" "$status" 200131 expect "Command Invocation status" "$status" 200
131 expect "Command Invocation output" "$(cat "$tmp/command.body")" "HELLO SCALEWAY!"132 expect "Command Invocation output" "$(cat "$tmp/command.body")" "HELLO SCALEWAY!"
132 133
133- status=$(request failed -X POST --data "$(command_body app:greet '{"--fail":true}')" "$base_url/")134+ status=$(command_body app:greet '{"--fail":true}' | request failed -X POST --data-binary @- "$base_url/")
134 expect "failed command status" "$status" 500135 expect "failed command status" "$status" 500
135 expect "failed command output" "$(grep -c 'Failing on purpose.' "$tmp/failed.body")" 1136 expect "failed command output" "$(grep -c 'Failing on purpose.' "$tmp/failed.body")" 1
136 137