Skip to content

feat(credentials): set up keyless credentials from the v2 API, CLI and Sim MCP - #9875

Merged
waleedlatif1 merged 1 commit into
stagingfrom
feat/v2-keyless-subject
Nov 11, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
feat/v2-keyless-subject

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Keyless (workload identity) credentials for AWS, Databricks, Snowflake, Microsoft and Google could only be set up in the web connect dialog. Platform teams that script their cloud trust can now do it from the v2 API, the CLI and the Sim MCP server. It is the same two-step pattern as Datadog's AWS external-ID flow: issue an identifier, configure trust, then create.

  • Step 1: POST /api/v2/credentials/workload-identity/subjects (sim credentials keyless-subject <providerId> --output json).
    • It issues a random, per-credential subject, plus a proof that expires after 24 hours and is bound to the caller and provider.
    • It also returns the issuer, the audience (Google's is per credential), a keylessConfig to fill in, and the provider's requiredConfigFields.
    • Nothing is stored at this step, so no half-configured credential shows up in lists or permissions.
  • Step 2: the existing create (sim credentials create <providerId> --credentials @keyless.json).
    • It submits the completed config, and Sim verifies the trust before saving.
    • The CLI wraps a keyless config as serviceAccountJson on its own. It does this only when the input carries a subject and proof, or the provider's keyless authType, so a mistyped field still gets "unsupported field".
  • Who can call step 1. The existing prepare use case now also admits personal API keys and OAuth tokens with api:write. Workspace API keys and delegated (Copilot) callers stay refused, because the subject has to belong to a person. The checks are unchanged: write role and integrations.manage, publicApi rate limit, and workspace concealment.
  • One refusal code. Every keyless refusal from create, reconnect or step 1 carries a stable error.details.code:
    • WORKLOAD_IDENTITY_NOT_CONFIGURED, _PROOF_EXPIRED, _PROOF_INVALID and _SUBJECT_REQUIRED return 400.
    • _SUBJECT_IN_USE and _SUBJECT_UNVERIFIABLE return 409.
    • The code travels on a single KeylessCredentialRefusedError. Refusals that aren't keyless keep details.providerErrorCode as before.
  • Discovery matches the deployment. The provider catalog includes a keyless object (authType, required and optional config fields) only when the deployment can sign tokens. Agents are never told keyless is available where it isn't. The CLI reads this from the catalog instead of keeping its own provider table, which also makes Snowflake's keyless config work from the CLI.
  • Docs and agents. The OpenAPI descriptions, the generated MCP tool, CLI --help and the five credential docs pages all describe the flow the same way, with one generic example. The CLI retry hint names the command to run for a new subject.

Type of Change

  • New feature

Testing

  • Route tests for the new route. A personal-key proof verifies for its own user, and is refused for another user or another provider. Google gets no audience. Workspace keys are refused, and so are tokens without api:write. An unknown or inaccessible workspace returns 404. A caller over the rate limit gets 429. An unconfigured deployment returns NOT_CONFIGURED.
  • Create and reconnect. Both return the same codes and statuses, and a refused reconnect writes nothing.
  • Catalog. It advertises keyless only when the deployment can sign, and only what the API accepts.
  • CLI. Tests pin the step 1 request and JSON, the wrapping rule (passthrough, wrap, raw key file refused, misspelled field) and the retry hint.
  • Revert checks. Each guard was reverted to confirm its test fails.
  • Commands run:
    • bun run lint; type-check for apps/sim and packages/sim-cli.
    • Targeted Vitest: 15 credential files, 223 tests. The full sim-cli suite: 539 tests.
    • check:openapi, check:cli-api, check:mcp-operations, check:cli-docs, check:v2-route-table, check:api-validation:strict, check:boundaries, check:test-patterns, check:comment-hygiene, check:client-boundary, check:explicit-any, check:docs.
  • Reviews. Independent audits ran before and after /simplify and /cleanup.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 11, 2026 3:37am UTC

Request Review

@gitguardian

gitguardian Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable issues remain.

Summary

Adds keyless credential setup through the v2 API, CLI, and Sim MCP.

  • API callers can request a signed subject before creating a keyless credential.
  • Credential creation checks keyless trust and returns stable refusal codes.
  • The provider catalog shows keyless setup only when the deployment can sign tokens.
  • The CLI can request a keyless subject and create credentials from the completed config.

Diagram

sequenceDiagram
  participant Client as API, CLI, or MCP client
  participant Sim
  participant Cloud
  Client->>Sim: Request subject for workspace and provider
  Sim->>Sim: Check caller, permissions, and rate limit
  Sim-->>Client: Subject, proof, issuer, and config fields
  Client->>Cloud: Configure trust for the subject
  Client->>Sim: Create credential with completed config
  Sim->>Cloud: Verify trust
  Sim->>Sim: Check subject is unused and save
  Sim-->>Client: Credential metadata
Loading

Reviews (3) · Last reviewed commit: "feat(credentials): set up keyless creden..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 48 files

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 53 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

…d Sim MCP

Keyless (workload identity) credentials could only be set up in the web
connect dialog. Platform teams scripting their cloud trust now get the
same two steps as an API:

1. POST /api/v2/credentials/workload-identity/subjects
   (`sim credentials keyless-subject <providerId>`) issues a random,
   per-credential subject and a 24-hour proof bound to the caller, plus
   the keylessConfig to fill in and the provider's required fields.
2. The existing create (`sim credentials create … --credentials
   @keyless.json`) submits the completed config; Sim verifies the trust
   before saving.

- The existing prepare use case now also admits personal API keys and
  OAuth tokens with api:write. Workspace keys and delegated callers stay
  refused, because the subject must belong to a person.
- Every keyless refusal carries one stable `error.details.code`
  (WORKLOAD_IDENTITY_NOT_CONFIGURED, _PROOF_EXPIRED, _PROOF_INVALID,
  _SUBJECT_REQUIRED, _SUBJECT_IN_USE, _SUBJECT_UNVERIFIABLE) on a single
  refusal error, from create, reconnect and the subjects route alike.
- The provider catalog advertises a `keyless` object (authType and
  required/optional config fields) only when the deployment can sign,
  and the CLI reads it instead of keeping its own provider table.
  Snowflake's keyless config is now accepted by the CLI.
- Provider hints, OpenAPI, MCP tool descriptions, CLI help and the five
  credential docs pages describe the flow the same way.

- AWS and Databricks keyless create and reconnect also refuse with
  WORKLOAD_IDENTITY_NOT_CONFIGURED when the deployment cannot sign, and
  their verification steps pass keyless refusals through unchanged. Each
  provider's refusal names a fallback credential type.
- The Google Cloud keyless hint says it covers Cloud services (BigQuery,
  Vertex AI), not Google Workspace.
@waleedlatif1
waleedlatif1 force-pushed the feat/v2-keyless-subject branch from 06850ac to 804f968 Compare November 11, 2026 03:32
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 54 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

This branch was successfully deployed

1 active deployment
Preview — 804f9685 Deployed Nov 11, 2026 by vercel[bot]
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