Skip to content

feat(getchitty-creds): add zones input + fix API-key payload shape#54

Draft
chitcommit wants to merge 1 commit intomainfrom
feat/getchitty-creds-zones
Draft

feat(getchitty-creds): add zones input + fix API-key payload shape#54
chitcommit wants to merge 1 commit intomainfrom
feat/getchitty-creds-zones

Conversation

@chitcommit
Copy link
Copy Markdown
Contributor

Summary

Adds zones and type inputs to the getchitty-creds composite action and corrects the API-key path to match the server contract for /api/credentials/provision.

This is the chittyops half of the broader zones-support effort. The chittyconnect-side follow-up (teaching the OIDC route to honor context.zones) is filed separately.

Why

  • EnhancedCredentialProvisioner already honors context.zones for zone-scoped permissions (e.g. Workers Routes Write) on the cloudflare_workers_deploy type, but the action exposed no input to forward zone IDs.
  • The API-key payload was shape-wrong: action sent {credentials, purpose, service, repo, run_id}; the route expects {type, context: {service, purpose, ...}} and returns a single credential under .credential (not .credentials.X). This silently failed for any caller relying on it.

Changes

New input zones Comma-separated CF zone IDs. Empty → omitted from payload.
New input type Default cloudflare_workers_deploy.
API-key payload Rewritten to {type, context: {service, purpose, repo, run_id, zones?}}.
API-key response parsing Reads .credential.value / .credential.account_id.
Multi-cred outputs (npm/github/neon/register) on API-key path Explicitly empty (matches prior de-facto behavior — server returns one credential per call on this route).
OIDC payload Also forwards zones (server-side support is the chittyconnect follow-up — that route bypasses the provisioner today).
Error handling HTTP-status + error-envelope handling unified across both paths.

Notes for reviewers

  • Workflows that need npm_token / github_token / neon_* / register_token must use the OIDC path. Under API-key auth the server returns one credential at a time; the prior code parsed .credentials.X keys that were never present, so those outputs were already empty in practice.
  • The only in-repo consumer is reusable-package-publish.yml, which calls via API key for cloudflare_token + account_id — those continue to work.

Validation

  • ✅ YAML lint (python3 -c \"import yaml; yaml.safe_load(...)\")
  • ✅ jq syntax + payload shape verified locally (with and without zones)
  • ⚠️ Live endpoint validation blockedconnect.chitty.cc is currently returning Cloudflare error 1101 (Worker exception) on every route, including /, /api, /api/credentials/provision, and /api/github-actions/credentials. This is a separate upstream outage and is not introduced by this PR. Holding as draft until the worker is back up so the new payload can be validated against the real backend per CLAUDE.md ("No Mocks, Fake Data, or Placeholder Endpoints").

Test plan

  • Confirm connect.chitty.cc is healthy
  • Run a workflow that uses getchitty-creds with zones: <zone_id> via API key, confirm CF token policy includes a zone-scoped block
  • Run without zones, confirm zone-scoped permissions are dropped server-side (existing provisioner behavior)
  • Run via OIDC, confirm payload accepted (zones currently no-op via OIDC route — by design)

Follow-up

  • chittyconnect: teach /api/github-actions/credentials to route cloudflare_workers_deploy through EnhancedCredentialProvisioner so zones works end-to-end via OIDC.

🤖 Generated with Claude Code

Adds two inputs to the composite action and corrects the API-key path to
match the server contract for /api/credentials/provision.

Why:
- Server-side EnhancedCredentialProvisioner already honors context.zones
  for zone-scoped permissions (e.g. Workers Routes Write) on the
  cloudflare_workers_deploy type, but the action had no way to forward
  zone IDs.
- The API-key path was sending {credentials, purpose, service, repo,
  run_id} — the route expects {type, context: {service, purpose, ...}}
  and returns a single credential under .credential, not .credentials.X.

Changes:
- New `zones` input (comma-separated CF zone IDs).
- New `type` input (default cloudflare_workers_deploy).
- API-key payload rewritten to {type, context: {service, purpose, repo,
  run_id, zones?}}; zones is omitted when empty.
- API-key response parsing reads .credential.value/.credential.account_id.
- Multi-credential outputs (npm/github/neon/register) explicitly empty
  on the API-key path — they were already non-functional there; the OIDC
  path remains the source of truth for those.
- HTTP status + error envelope handling unified across both paths.
- OIDC payload also forwards zones (server-side support on that route is
  a chittyconnect follow-up — the OIDC handler bypasses the provisioner).

Follow-up (chittyconnect): teach /api/github-actions/credentials to route
cloudflare_workers_deploy through EnhancedCredentialProvisioner so zones
work end-to-end via OIDC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f1261a4-c021-49bb-93ea-81eedee0b595

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/getchitty-creds-zones

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

@coderabbitai review
@copilot review
Adversarial review request: evaluate security, policy bypass paths, and regression risk.

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