Harden token mode against installation properties and run-dir loss

Closes #58 (closed)

Four token-mode gaps, each with a self-test case that goes red when its fix is reverted.

  • gcloud reads the SDK installation properties file, which a fresh CLOUDSDK_CONFIG does not hide. prov_token_setup and token_env.py now export CLOUDSDK_AUTH_IMPERSONATE_SERVICE_ACCOUNT, CLOUDSDK_AUTH_AUTHORITY_SELECTOR and CLOUDSDK_AUTH_AUTHORIZATION_TOKEN_FILE as empty strings. In properties.py the environment is checked before the property file and an empty value is not None, so it wins; transport.py treats it as unset. A real-gcloud check in token-selftest seeds auth/impersonate_service_account in a config and shows it reads unset with the empty override.
  • Each run directory records its owner pid, prov_token_setup touches it, and the prune removes only directories whose owner fails kill -0 (directories with no pid file fall back to the two-day mtime).
  • token_env.py creates its config directory under SIM_STATE_DIR/token-config and removes it with atexit.
  • The provider-selftest copy of the gate runs in a temp dir with the new PROVIDER_GATE_ROOT override. A second case removes the ALLOWED scan from the copy and expects green, so the test is red only when the scan is gone.

Gates: just word-budget ok at 40489 (ceiling unchanged), just vale-check pass, token-selftest, provider-selftest, preflight-selftest and state-dir-selftest pass.

Merge request reports

Loading
Loading