Skip to content

feat(cli): create keys by preset or custom permission list - #1185

Merged
dazip merged 5 commits into
mainfrom
nate/prod-3005-cli-key-creation-combined
Oct 12, 2026
Merged

dazip merged 5 commits into
mainfrom
nate/prod-3005-cli-key-creation-combined

Conversation

@dazip

@dazip dazip commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

fal keys create took a required --scope of ADMIN or API. It now takes --preset (FULL, API, DEPLOY, READONLY) or --permission for an explicit permission list, and prompts for one when neither flag is given. --scope stays as a deprecated alias mapped to its equivalent preset. Presets and permission lists go out as policy_preset and policy; nothing is sent on the deprecated scope field any more.

Why: ADMIN-or-API is too coarse to hand someone a key that can only deploy, or only read.

Do not merge until the server reads these fields. An older server sees no scope and treats that as admin, so a READONLY request would come back as a full-access key.

Supersedes #1178, #1179, #1180, which this replaces in one release.


Note

High Risk
Changes how API keys are minted and authorized on the wire; older servers that ignore policy_preset/policy may mis-grant access, and scope deprecation affects auth-related client paths.

Overview
API key creation now uses permission presets (FULL, API, DEPLOY, READONLY) or an explicit permissions list instead of the old required ADMIN/API scope. The Python client (KeysNamespace.create), SDK gRPC (create_user_key), and fal keys create all send policy_preset or policy on the wire and no longer populate the deprecated scope field. --scope remains as a deprecated alias mapped via KeyPreset.from_scope().

The CLI adds --preset, repeatable --permission, an interactive Rich preset/custom picker when neither is set, and --alias as a synonym for description. Listing keys tolerates scopeless keys (e.g. DEPLOY/READONLY) by allowing UserKeyInfo.scope to be None.

Credential resolution for API keys with an explicit --team now treats a 403 “Insufficient permissions” on owner lookup as non-fatal (keys without account:settings:read still work). Dependency isolate-proto is bumped to >=0.34.4.

Reviewed by Cursor Bugbot for commit c547d3d. Bugbot is set up for automated code reviews on this repo. Configure here.

@linear-code

linear-code Bot commented Sep 22, 2026

Copy link
Copy Markdown

PROD-3005

dazip and others added 3 commits October 9, 2026 13:51
`fal keys create` took a required --scope of ADMIN or API. Add --preset,
naming the permission preset to mint the key with, and pick one
interactively when neither flag is given. --scope stays as a deprecated
alias mapped to its equivalent preset.

Presets go out as policy_preset rather than riding on the deprecated
scope field, so raise the isolate-proto floor to the release that carries
it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Neither has a v1 scope equivalent, so a key minted from one lists with no
scope. Let listing render that rather than fail on every key in the
account.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add --permission for a key no preset covers, repeatable and accepting a
comma separated list, and a CUSTOM entry in the interactive picker that
prompts for the permissions. CUSTOM is only a picker sentinel; what goes
out is the permission list. The server validates the names.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dazip
dazip force-pushed the nate/prod-3005-cli-key-creation-combined branch from c77c2f7 to 4f19050 Compare October 9, 2026 20:51
@dazip
dazip requested a review from jim-fal October 9, 2026 21:12
@dazip
dazip marked this pull request as ready for review October 9, 2026 21:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4f19050. Configure here.

Comment thread projects/fal/src/fal/cli/keys.py

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread projects/fal/src/fal/sdk.py
Comment thread projects/fal/src/fal/sdk.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jim-fal
jim-fal previously approved these changes Oct 12, 2026

@jim-fal jim-fal 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.

looks good. please test E2E after server deploys (especially the cases where a full access/admin user creates a READ_ONLY key, to make sure the created key does get more permissions than what was requested

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dazip

dazip commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

E2E against prod (SDK + CLI, all passing)

  • Mint: FULL, API, DEPLOY, READONLY, a custom permission list, and deprecated --scope API all mint; unknown permission names are rejected with INVALID_ARGUMENT.
  • Grants: each key was probed on apps, secrets, key listing and key creation; every allow/deny matched its preset or permission list. Only FULL can mint keys.
  • CLI: --preset, --permission (comma list) and --scope work; fal keys list renders with v2 keys present.
  • Revoke: revoked keys are rejected immediately on both gRPC and REST.

One SDK fix came out of this: with a default team configured, a key without account:settings:read failed at client setup on the owner lookup. That lookup now tolerates the permission denial; included in the next push.

@dazip
dazip merged commit 9e61e6c into main Oct 12, 2026
23 of 38 checks passed
@dazip
dazip deleted the nate/prod-3005-cli-key-creation-combined branch October 12, 2026 20:39
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.

2 participants