Skip to content

fix: reject --domain-id when --permission is not sending_access#215

Merged
felipefreitag merged 4 commits intomainfrom
fix/domain-id-validation-ba79
Apr 10, 2026
Merged

fix: reject --domain-id when --permission is not sending_access#215
felipefreitag merged 4 commits intomainfrom
fix/domain-id-validation-ba79

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Reject using --domain-id unless --permission is sending_access in the resend api-keys create command. Prevents unintended full-access keys and fulfills Linear BU-655.

  • Bug Fixes
    • Fail fast with invalid_flags when --domain-id is provided without --permission sending_access; skip SDK call.
    • Update documented error codes; add tests covering rejection and valid domain-scoped creation.

Written for commit 10d76f1. Summary will update on new commits.

Domain-scoped API key creation could silently mint full-access keys
when --domain-id was provided without --permission sending_access.
The Resend API only applies domain_id to sending_access keys, so
passing it with full_access (the default) would create a key broader
than the operator intended.

Add a validation guard that exits with error code invalid_flags when
--domain-id is used without --permission sending_access, preventing
accidental creation of overly-permissive API keys.

Resolves BU-655

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@bukinoshita
Copy link
Copy Markdown
Member Author

@cubic-dev-ai can you review?

@bukinoshita bukinoshita marked this pull request as ready for review April 10, 2026 16:16
@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 10, 2026

@cubic-dev-ai can you review?

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

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/api-keys/create.ts">

<violation number="1" location="src/commands/api-keys/create.ts:98">
P2: Use an explicit presence check for `--domain-id` instead of a truthy check. The current condition misses provided empty-string values and can bypass the new `invalid_flags` rejection.

(Based on your team's feedback about checking Commander option presence with `!== undefined`.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread src/commands/api-keys/create.ts Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
felipefreitag and others added 2 commits April 10, 2026 14:54
…ion tests

outputError writes to console.error, not console.log, so the test
assertions were checking an empty string.
@felipefreitag felipefreitag merged commit 797d629 into main Apr 10, 2026
7 checks passed
@felipefreitag felipefreitag deleted the fix/domain-id-validation-ba79 branch April 10, 2026 18:09
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.

3 participants