Skip to content

feat: add application key management#151

Open
goanpeca wants to merge 11 commits into
mainfrom
feat/issue-99-application-keys
Open

feat: add application key management#151
goanpeca wants to merge 11 commits into
mainfrom
feat/issue-99-application-keys

Conversation

@goanpeca

@goanpeca goanpeca commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add create-key, list-keys, and delete-key actions backed by the B2 SDK key-management APIs.
  • Harden create-key with deterministic-name duplicate checks, required scope/duration by default, and explicit opt-ins for account-level, non-expiring, or privileged-capability keys.
  • Harden delete-key with expected name/prefix validation, current-key refusal, dry-run support, idempotent already-absent no-ops, and key-deleted output.
  • Bound key safety scans, thread cancellation signals into key-management dispatch, and tolerate deprecated bucketId-only key metadata from SDK-shaped responses.
  • Refine list-keys with the B2 1000-key page limit, clearer truncation warnings, and shared pagination constants.
  • Narrow key command result contracts and key summary-json projection so secrets, accountId, and deprecated bucketId are not emitted.
  • Add secondary redaction for key-shaped secret field names, label key-management step-summary rows, document the safety surface, and regenerate dist.

Linked issue

Closes #99

Tests run

  • pnpm typecheck
  • pnpm lint
  • pnpm docs:check-action-yml
  • pnpm vitest run __tests__/commands/keys.test.ts __tests__/main.test.ts
  • pnpm test __tests__/inputs.test.ts __tests__/commands/keys.test.ts __tests__/main.test.ts __tests__/main-output-contract.test.ts __tests__/outputs.test.ts
  • pnpm vitest run __tests__/main-output-contract.test.ts
  • pnpm test
  • pnpm build
  • pnpm verify-dist
  • pnpm all
  • pre-commit hook: lint, release provenance, typecheck, tests, dist build, spellcheck
  • pre-push hook: coverage

Follow-up notes

  • create-key refuses to create a duplicate when the requested key-name already exists; B2 does not let the one-time secret be recovered from an existing key, so reruns fail safely and log the existing key ID for revocation.
  • B2 does not enforce key-name uniqueness atomically; same-name concurrent creates are documented as best-effort and should be serialized when a workflow requires one live key.
  • The application-key output is masked in logs but remains plaintext to later steps; the docs warn not to propagate it as a job, composite, or reusable-workflow output.
  • bucket remains required at runtime for file actions, but is no longer required for key-management actions.
  • summary-json for key actions intentionally omits one-time key secrets and account-level inventory fields; use dedicated scalar outputs where available.

Copilot AI review requested due to automatic review settings July 16, 2026 15:46
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

@goanpeca goanpeca added enhancement New feature or request security Security hardening or vulnerability sdk-parity SDK capability not yet exposed by the action labels Jul 16, 2026
@goanpeca goanpeca self-assigned this Jul 16, 2026
@goanpeca goanpeca added the control-plane Bucket administration / provisioning (scope decision) label Jul 16, 2026
@goanpeca goanpeca added this to the v1.2.0 milestone Jul 16, 2026

Copilot AI 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.

Pull request overview

This PR expands the action’s surface area to support B2 application key management (create/list/delete) using the B2 SDK, including new inputs/outputs, summaries, and tests, while also updating lint schema metadata.

Changes:

  • Add new dispatcher verbs: create-key, list-keys, delete-key, including step summary + summary-json support that omits the one-time key secret.
  • Extend input parsing and action metadata so bucket is only required for bucket-scoped file operations (not key-management).
  • Add command implementation + simulator-backed tests for key creation/listing/deletion, and update Biome schema metadata.

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main.ts Adds key-management dispatch paths, defers bucket resolution for non-bucket actions, and emits key-specific outputs/summaries.
src/inputs.ts Introduces key-management actions/inputs and makes bucket optional when the action doesn’t need it.
src/commands/keys.ts Implements createKey, listKeys, and deleteKey commands using the SDK.
src/client.ts Allows bucket to be absent at authorization time; enforces bucket requirement only when resolving it.
README.md Documents the new verbs, inputs/outputs, and provides examples for key management.
dist/index.js Updates built distribution to match source changes.
biome.json Updates schema URL and migrates linter config keying to the newer schema format.
action.yml Adds inputs/outputs for key management and makes bucket not globally required.
tests/main.test.ts Extends dispatcher tests for key actions, including bucket non-resolution and secret masking behavior.
tests/main-output-contract.test.ts Adds expected output contracts for key-management actions.
tests/inputs.test.ts Adds parsing tests for new key inputs and optional bucket requirement.
tests/commands/keys.test.ts Adds integration-style tests for key creation/listing/deletion against the simulator fixture.
tests/_parsed-inputs.ts Updates parsed-input fixtures with key-management fields/defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/keys.ts Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 16:07
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.

Comment thread action.yml
Copilot AI review requested due to automatic review settings July 16, 2026 16:12
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.

Comment thread src/outputs.ts Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 16:18
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.

Comment thread src/main.ts Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 16:25
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.

Comment thread src/commands/keys.ts Outdated
Comment thread src/main.ts
Copilot AI review requested due to automatic review settings July 16, 2026 16:41
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.

Comment thread __tests__/main-output-contract.test.ts
Copilot AI review requested due to automatic review settings July 16, 2026 16:46
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 16, 2026 17:10
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.

Comment thread src/commands/keys.ts Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 17:17
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.

Comment thread src/main.ts
Comment thread src/inputs.ts Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 17:22
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI 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.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated no new comments.

@goanpeca
goanpeca marked this pull request as ready for review July 16, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

control-plane Bucket administration / provisioning (scope decision) enhancement New feature or request sdk-parity SDK capability not yet exposed by the action security Security hardening or vulnerability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keys: create, list, and delete scoped application keys

2 participants