Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ci): mask the Namespace sccache token in workflow logs (#5005)

teo6a07fe2a2812
diff --git a/.github/workflows/preview-fly.yml b/.github/workflows/preview-fly.yml
index e84629f17e..6b71a78d4a 100644
--- a/.github/workflows/preview-fly.yml
+++ b/.github/workflows/preview-fly.yml
@@ -53,6 +53,20 @@ jobs:
set -euo pipefail
env_file="$RUNNER_TEMP/namespace-sccache.env"
if nsc cache sccache setup --cache_name fly-preview > "$env_file"; then
+ # Register credential values as masked BEFORE exporting: GitHub only
+ # masks `secrets.*`, so without this SCCACHE_WEBDAV_TOKEN — a broad,
+ # ~24h Namespace workspace token (registry + cache write) — printed
+ # verbatim in every subsequent step's env dump. Masking is selective by
+ # key name: masking non-secrets like the endpoint URL or key prefix
+ # would redact those strings everywhere in the logs.
+ while IFS= read -r line; do
+ k="${line%%=*}"
+ v="${line#*=}"
+ [ -n "$v" ] && [ "$k" != "$line" ] || continue
+ case "$k" in
+ *TOKEN*|*SECRET*|*PASSWORD*) echo "::add-mask::$v" ;;
+ esac
+ done < "$env_file"
cat "$env_file" >> "$GITHUB_ENV"
# Force the next compiler invocation to start a server with the new remote
# backend even if a setup hook happened to launch one already.
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/steps.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/steps.rs
index 96b3ac9383..a684a75216 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/steps.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/steps.rs
@@ -139,6 +139,20 @@ pub fn configure_namespace_sccache(cache_name: &str) -> Step<Run> {
r#"set -euo pipefail
env_file="$RUNNER_TEMP/namespace-sccache.env"
if nsc cache sccache setup --cache_name {cache_name} > "$env_file"; then
+ # Register credential values as masked BEFORE exporting: GitHub only
+ # masks `secrets.*`, so without this SCCACHE_WEBDAV_TOKEN — a broad,
+ # ~24h Namespace workspace token (registry + cache write) — printed
+ # verbatim in every subsequent step's env dump. Masking is selective by
+ # key name: masking non-secrets like the endpoint URL or key prefix
+ # would redact those strings everywhere in the logs.
+ while IFS= read -r line; do
+ k="${{line%%=*}}"
+ v="${{line#*=}}"
+ [ -n "$v" ] && [ "$k" != "$line" ] || continue
+ case "$k" in
+ *TOKEN*|*SECRET*|*PASSWORD*) echo "::add-mask::$v" ;;
+ esac
+ done < "$env_file"
cat "$env_file" >> "$GITHUB_ENV"
# Force the next compiler invocation to start a server with the new remote
# backend even if a setup hook happened to launch one already.