Skip to content

feat: add scoped API key guard - #762

Merged
nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
edehvictor:feat/scoped-api-key-701
Oct 17, 2026
Merged

nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
edehvictor:feat/scoped-api-key-701

Conversation

@edehvictor

@edehvictor edehvictor commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #701
Closes #700
Closes #699
Closes #689

Summary

This contribution adds a reusable scoped API-key guard for protected backend endpoints. API keys are loaded from the API_KEYS configuration as a key-to-scopes map, compared using fixed-length timing-safe digests, and attached to the request with their granted scopes.

Changes

  • Added endpoint metadata through RequireApiKeyScopes.
  • Added scope enforcement with wildcard support for administrative keys.
  • Added per-key request windows so one API key cannot consume another key quota.
  • Added explicit unauthorized, forbidden, and rate-limit responses.
  • Added focused coverage for valid keys, missing and invalid keys, insufficient scopes, per-key throttling, and scope metadata.

Configuration

Set API_KEYS to a JSON object mapping each key to its allowed scopes, for example: {"key-value":["oracle:read","claims:write"]}. Endpoints can opt into enforcement with RequireApiKeyScopes.

Testing

  • Not run, per request. No install, build, test, or CI check was performed.

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@edehvictor Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nonsobethel0-dev
nonsobethel0-dev merged commit 9b63c1a into Parashield-Protocol:main Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants