Skip to content

Deny local credential-printing gcloud commands by default#419

Open
fsabiu wants to merge 1 commit into
googleapis:mainfrom
fsabiu:fix/deny-local-credential-printing
Open

Deny local credential-printing gcloud commands by default#419
fsabiu wants to merge 1 commit into
googleapis:mainfrom
fsabiu:fix/deny-local-credential-printing

Conversation

@fsabiu

@fsabiu fsabiu commented May 6, 2026

Copy link
Copy Markdown

Title

Deny local credential-printing gcloud commands by default

Body

This change adds local credential extraction commands to the default denylist used by gcloud-mcp.

The MCP tool returns stdout from allowed gcloud commands to the client/model. Commands such as auth print-access-token, auth application-default print-access-token, auth print-identity-token, and config config-helper can directly print transferable local credential material, so they should be denied by default in the same way that SSH, interactive, and meta command groups are denied by default.

The patch also adds regression coverage that:

  • verifies the default denylist contains the credential-printing commands;
  • verifies a denylisted credential-printing command does not invoke gcloud;
  • verifies fake token stdout is not returned when the command is denied.

Tests run:

npx vitest run src/index.test.ts src/tools/run_gcloud_command.test.ts src/denylist.test.ts --reporter=verbose --coverage=false
npm run build
npx prettier --check src/index.ts src/index.test.ts src/tools/run_gcloud_command.test.ts
npx eslint src/index.ts src/index.test.ts src/tools/run_gcloud_command.test.ts --max-warnings 0

@fsabiu fsabiu requested a review from a team as a code owner May 6, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant