Skip to content
Merged
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
21 changes: 16 additions & 5 deletions metal/makefile/app.mk
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,22 @@ run-cli:
*) printf '<redacted>';; \
esac`; \
printf " DB_SECRET_DBNAME=%s\n\n" "$$DB_SECRET_DBNAME_DISPLAY"
@DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" docker compose run --rm api-runner go run ./metal/cli/main.go || { \
status=$$?; \
printf "\n$(RED)❌ CLI exited with status $$status.$(NC)\n"; \
exit $$status; \
}
@status=0; \
if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then \
printf "Using docker compose to run the CLI.\n"; \
DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" docker compose run --rm api-runner go run ./metal/cli/main.go || status=$$?; \
elif command -v docker-compose >/dev/null 2>&1; then \
printf "Using docker-compose to run the CLI.\n"; \
DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" docker-compose run --rm api-runner go run ./metal/cli/main.go || status=$$?; \
Comment on lines +105 to +108

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Suppress command echo to avoid leaking secret values

The new compose detection block no longer prefixes the docker compose run and docker-compose run lines with @. make will now echo these recipe lines, including the literal values of DB_SECRET_USERNAME, DB_SECRET_PASSWORD, and DB_SECRET_DBNAME. When callers override these variables with real credentials (instead of file paths), the credentials will be printed to the console and to any captured logs, undermining the redaction logic above. Restoring the leading @ (or otherwise silencing these commands) keeps secrets from being disclosed while executing make run-cli.

Useful? React with 👍 / 👎.

else \
printf "\n$(RED)❌ Neither 'docker compose' nor 'docker-compose' is available.$(NC)\n"; \
printf " Install Docker Compose or run the CLI locally without containers.\n\n"; \
exit 1; \
fi; \
if [ $$status -ne 0 ]; then \
printf "\n$(RED)❌ CLI exited with status $$status.$(NC)\n"; \
exit $$status; \
fi
run-cli-docker:
make run-cli DB_SECRET_USERNAME=$(DB_SECRET_USERNAME) DB_SECRET_PASSWORD=$(DB_SECRET_PASSWORD) DB_SECRET_DBNAME=$(DB_SECRET_DBNAME)

Expand Down
Loading