Skip to content

Commit b34bfc5

Browse files
committed
fix(devbox): remove default infisical secret path
1 parent 63338bb commit b34bfc5

5 files changed

Lines changed: 45 additions & 38 deletions

File tree

docs/devbox.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ or 1Password service-account refresh stacks.
3838

3939
For services and agents:
4040

41-
1. Create or choose the correct Infisical project, environment, and folder path
42-
for the runtime.
41+
1. Create or choose the correct Infisical project and environment for the
42+
runtime.
4343
2. Create a machine identity in the same Infisical organization and grant it
4444
access to that project/path.
4545
3. Configure the devbox user once with
@@ -69,16 +69,17 @@ One-time setup:
6969
```
7070

7171
The helper prompts locally for the Infisical domain, project ID, environment,
72-
default secret path, machine identity client ID, and machine identity client
72+
machine identity name, machine identity client ID, and machine identity client
7373
secret. Humans should source the initial client ID/secret from their secret
7474
manager, usually 1Password or Infisical, and enter them locally. Do not paste
7575
them into agent chat.
7676

7777
It writes non-secret selectors to `~/.config/uinaf/devbox.env` and machine
7878
credentials to `~/.config/uinaf/infisical-machine.env`. Both files must be mode
7979
`0600`. The helper refuses to continue when the Infisical CLI has an
80-
authenticated human `user` session, mints a machine token, and verifies the
81-
machine identity can read the configured secret path before writing config.
80+
authenticated human `user` session and verifies the machine identity can mint a
81+
token before writing config. It does not persist a default secret path; paths
82+
belong at the command boundary.
8283

8384
Routine command-boundary use:
8485

@@ -89,7 +90,7 @@ Routine command-boundary use:
8990
--token "$INFISICAL_TOKEN" \
9091
--projectId "$INFISICAL_PROJECT_ID" \
9192
--env "$INFISICAL_ENV" \
92-
--path "$INFISICAL_SECRET_PATH" \
93+
--path "/example-devbox/openclaw-env" \
9394
--format dotenv \
9495
--output-file "$HOME/.openclaw/.env" \
9596
--silent
@@ -159,10 +160,12 @@ Before treating a devbox as agent-ready:
159160
4. Verify runtime dotenv files are owner-only and are not workspace symlinks.
160161

161162
`./scripts/verify/devbox-services.sh` checks the Infisical CLI, local
162-
runtime-file boundary, owner-only config modes, and machine identity access. A
163-
missing persistent machine identity config fails by default. Set
164-
`INFISICAL_MACHINE_AUTH_REQUIRED=0` only for repo-local smoke checks on a
165-
machine that is not acting as an agent devbox.
163+
runtime-file boundary, owner-only config modes, and machine identity token
164+
minting. Set `INFISICAL_SECRET_PATH=/some/path` only when you want that check
165+
to also prove access to a specific command-boundary path. A missing persistent
166+
machine identity config fails by default. Set `INFISICAL_MACHINE_AUTH_REQUIRED=0`
167+
only for repo-local smoke checks on a machine that is not acting as an agent
168+
devbox.
166169

167170
## Secret Topology
168171

@@ -214,7 +217,6 @@ PROCESS_COMPOSE_SOCKET="/Users/example/.local/run/process-compose.sock"
214217
INFISICAL_DOMAIN=https://eu.infisical.com/api
215218
INFISICAL_PROJECT_ID=example-project-id
216219
INFISICAL_ENV=dev
217-
INFISICAL_SECRET_PATH=/example-devbox/ssh
218220
```
219221

220222
The file should be mode `0600`. Persistent machine credentials live separately

scripts/secrets/configure-infisical-devbox.sh

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Usage:
1414
scripts/secrets/configure-infisical-devbox.sh
1515
1616
Prompts for Infisical machine identity settings, verifies the machine identity
17-
can read the selected secret path, then writes owner-only local config files.
17+
can mint a token, then writes owner-only local config files.
1818
USAGE
1919
}
2020

@@ -109,7 +109,6 @@ write_devbox_config() {
109109
quote_assignment INFISICAL_DOMAIN "$infisical_domain"
110110
quote_assignment INFISICAL_PROJECT_ID "$infisical_project_id"
111111
quote_assignment INFISICAL_ENV "$infisical_env"
112-
quote_assignment INFISICAL_SECRET_PATH "$infisical_secret_path"
113112
} >> "$tmp_path"
114113
}
115114

@@ -147,33 +146,21 @@ printf 'Configuring Infisical devbox machine auth. Press Enter to accept default
147146
infisical_domain="$(prompt_value "Infisical domain" "${INFISICAL_DOMAIN:-https://eu.infisical.com/api}")"
148147
infisical_project_id="$(prompt_value "Infisical project ID" "${INFISICAL_PROJECT_ID:-}")"
149148
infisical_env="$(prompt_value "Infisical env" "${INFISICAL_ENV:-dev}")"
150-
infisical_secret_path="$(prompt_value "Default secret path" "${INFISICAL_SECRET_PATH:-}")"
151149
infisical_machine_identity="$(prompt_value "Machine identity name" "${INFISICAL_MACHINE_IDENTITY:-}")"
152150
infisical_client_id="$(prompt_value "Machine identity client ID" "${INFISICAL_CLIENT_ID:-}")"
153151
infisical_client_secret="$(prompt_secret "Machine identity client secret")"
154152

155153
[ -n "$infisical_domain" ] || fail "Infisical domain is required"
156154
[ -n "$infisical_project_id" ] || fail "Infisical project ID is required"
157155
[ -n "$infisical_env" ] || fail "Infisical env is required"
158-
[ -n "$infisical_secret_path" ] || fail "Default secret path is required"
159156
[ -n "$infisical_client_id" ] || fail "Machine identity client ID is required"
160157
[ -n "$infisical_client_secret" ] || fail "Machine identity client secret is required"
161158

162159
check_no_human_infisical_session "$infisical_domain"
163160

164-
infisical_token="$(infisical_mint_machine_token "$infisical_domain" "$infisical_client_id" "$infisical_client_secret")" \
161+
infisical_mint_machine_token "$infisical_domain" "$infisical_client_id" "$infisical_client_secret" >/dev/null \
165162
|| fail "could not mint Infisical machine identity token"
166163

167-
infisical export \
168-
--domain "$infisical_domain" \
169-
--token "$infisical_token" \
170-
--projectId "$infisical_project_id" \
171-
--env "$infisical_env" \
172-
--path "$infisical_secret_path" \
173-
--format json \
174-
--silent >/dev/null \
175-
|| fail "machine identity cannot read $infisical_secret_path"
176-
177164
config_dir="$(dirname "$config_path")"
178165
machine_config_dir="$(dirname "$machine_config_path")"
179166
mkdir -p "$config_dir"
@@ -183,7 +170,7 @@ chmod 700 "$machine_config_dir"
183170

184171
tmp_config="$(mktemp "${TMPDIR:-/tmp}/uinaf-devbox-env.XXXXXX")"
185172
tmp_machine="$(mktemp "${TMPDIR:-/tmp}/uinaf-infisical-machine.XXXXXX")"
186-
trap 'rm -f "$tmp_config" "$tmp_machine"; unset infisical_token infisical_client_secret' EXIT
173+
trap 'rm -f "$tmp_config" "$tmp_machine"; unset infisical_client_secret' EXIT
187174

188175
write_devbox_config "$tmp_config" "$config_path"
189176
chmod 600 "$tmp_config"
@@ -195,8 +182,8 @@ chmod 600 "$tmp_machine"
195182
mv "$tmp_machine" "$machine_config_path"
196183
chmod 600 "$machine_config_path"
197184

198-
unset infisical_token infisical_client_secret
185+
unset infisical_client_secret
199186

200187
printf 'wrote %s\n' "$config_path"
201188
printf 'wrote %s\n' "$machine_config_path"
202-
printf 'verified machine identity access to %s\n' "$infisical_secret_path"
189+
printf 'verified machine identity token mint\n'

scripts/secrets/infisical-devbox-run.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ fi
9595
: "${INFISICAL_ENV:=dev}"
9696

9797
[ -n "${INFISICAL_PROJECT_ID:-}" ] || fail "INFISICAL_PROJECT_ID is required in $config_path"
98-
[ -n "${INFISICAL_SECRET_PATH:-}" ] || fail "INFISICAL_SECRET_PATH is required in $config_path"
9998
[ -n "${INFISICAL_CLIENT_ID:-}" ] || fail "INFISICAL_CLIENT_ID is required in $machine_config_path"
10099
[ -n "${INFISICAL_CLIENT_SECRET:-}" ] || fail "INFISICAL_CLIENT_SECRET is required in $machine_config_path"
101100

@@ -113,7 +112,6 @@ env \
113112
INFISICAL_DOMAIN="$INFISICAL_DOMAIN" \
114113
INFISICAL_PROJECT_ID="$INFISICAL_PROJECT_ID" \
115114
INFISICAL_ENV="$INFISICAL_ENV" \
116-
INFISICAL_SECRET_PATH="$INFISICAL_SECRET_PATH" \
117115
"$@"
118116
status=$?
119117
set -e

scripts/verify/devbox-services.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,24 @@ check_infisical() {
171171
return
172172
fi
173173

174-
if [ -z "$infisical_project_id" ] || [ -z "$infisical_secret_path" ]; then
174+
if [ -z "$infisical_project_id" ]; then
175175
if [ "$machine_auth_required" = "1" ]; then
176-
fail "missing INFISICAL_PROJECT_ID or INFISICAL_SECRET_PATH"
176+
fail "missing INFISICAL_PROJECT_ID"
177177
fi
178-
printf 'warn skipped Infisical machine identity path proof; set INFISICAL_PROJECT_ID and INFISICAL_SECRET_PATH in %s\n' "$config_path"
178+
printf 'warn skipped Infisical machine identity token proof; set INFISICAL_PROJECT_ID in %s\n' "$config_path"
179179
return
180180
fi
181181

182182
access_token="$(infisical_mint_machine_token "$infisical_domain" "$INFISICAL_CLIENT_ID" "$INFISICAL_CLIENT_SECRET")" \
183183
|| fail "could not mint Infisical machine identity token"
184184

185+
printf 'ok Infisical machine identity can mint token for project %s\n' "$infisical_project_id"
186+
187+
if [ -z "$infisical_secret_path" ]; then
188+
printf 'warn skipped Infisical path proof; set INFISICAL_SECRET_PATH for a command-boundary path check\n'
189+
return
190+
fi
191+
185192
infisical export \
186193
--domain "$infisical_domain" \
187194
--token "$access_token" \

scripts/verify/infisical-devbox-auth.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ write_file_600 "$custom_config" \
155155
"INFISICAL_DOMAIN=https://eu.infisical.com/api" \
156156
"INFISICAL_PROJECT_ID=custom-project" \
157157
"INFISICAL_ENV=dev" \
158-
"INFISICAL_SECRET_PATH=/custom/path" \
159158
"PROCESS_COMPOSE_ENABLED=0"
160159
write_file_600 "$machine_config" \
161160
"INFISICAL_CLIENT_ID=file-client" \
@@ -169,7 +168,7 @@ runner_output="$(
169168
INFISICAL_MACHINE_CONFIG="$machine_config" \
170169
"$repo_root/scripts/secrets/infisical-devbox-run.sh" -- sh -c 'printf "%s|%s|%s\n" "$INFISICAL_PROJECT_ID" "$INFISICAL_SECRET_PATH" "${INFISICAL_CLIENT_ID-unset}"'
171170
)"
172-
[ "$runner_output" = "custom-project|/custom/path|unset" ] \
171+
[ "$runner_output" = "custom-project||unset" ] \
173172
|| fail "runner did not honor DEVBOX_CONFIG and strip client credentials: $runner_output"
174173
printf 'ok runner honors DEVBOX_CONFIG and strips client credentials\n'
175174

@@ -252,11 +251,25 @@ required_happy_output="$(
252251
INFISICAL_FAKE_LOG="$fake_log" \
253252
"$repo_root/scripts/verify/devbox-services.sh"
254253
)"
255-
assert_contains "$required_happy_output" "Infisical machine identity can read /custom/path"
254+
assert_contains "$required_happy_output" "Infisical machine identity can mint token for project custom-project"
256255
fake_log_output="$(cat "$fake_log")"
257256
assert_contains "$fake_log_output" "login client-id=file-client client-secret=file-secret"
257+
printf 'ok devbox verifier proves machine token mint in required mode\n'
258+
259+
: > "$fake_log"
260+
path_check_output="$(
261+
HOME="$tmp_dir/home" \
262+
PATH="$fake_bin:$PATH" \
263+
DEVBOX_CONFIG="$custom_config" \
264+
INFISICAL_MACHINE_CONFIG="$machine_config" \
265+
INFISICAL_SECRET_PATH=/custom/path \
266+
INFISICAL_FAKE_LOG="$fake_log" \
267+
"$repo_root/scripts/verify/devbox-services.sh"
268+
)"
269+
assert_contains "$path_check_output" "Infisical machine identity can read /custom/path"
270+
fake_log_output="$(cat "$fake_log")"
258271
assert_contains "$fake_log_output" "export token=fake-token projectId=custom-project env=dev path=/custom/path"
259-
printf 'ok devbox verifier proves machine token export wiring in required mode\n'
272+
printf 'ok devbox verifier proves command-boundary path wiring when requested\n'
260273

261274
set +e
262275
verify_ambient_output="$(

0 commit comments

Comments
 (0)