Skip to content

Add request authentication header injection #9

Open

Description

@codebestia

Description

Every outgoing request must carry an Authorization: Bearer <secret_key> header derived from the active config. This logic must live in the HTTP client, not scattered across resource methods, so it is impossible to accidentally omit it.

Proposed Steps

  • In _SyncHTTPClient and _AsyncHTTPClient, accept api_key in the constructor.
  • Merge {"Authorization": f"Bearer {api_key}"} into the default headers on every request.
  • Never log or include the full key in debug output — mask to sk_live_****xxxx.
  • Ensure public key (pk_) cannot be used for mutating requests (POST/PATCH/DELETE) — raise AuthenticationError.

Acceptance Criteria

  • Every request carries an Authorization header with the correct bearer token.
  • Debug logs show a masked key, never the full secret.
  • Using a public key for a write request raises AuthenticationError before the network call.
  • Changing api_key on the client causes subsequent requests to use the new key.

Activity

  1. Awointa commented on Jun 20, 2026

    @Awointa

    Hi, I’m interested in this issue. I have experience building SDKs and API clients with secure authentication and request middleware design.

    I can implement centralized bearer token handling in both sync and async HTTP clients, enforce automatic Authorization headers on every request, mask secret keys in logs, block public keys from mutating requests, and add tests to verify secure key handling and request behavior.

  2. grantfox-oss commented on Jun 24, 2026

    @grantfox-oss

    🦊 GrantFox — @Awointa has been assigned to this issue as part of the Official Campaign campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #9)
    2. Your PR will be reviewed by the ShadeProtocol maintainers

    Good luck! Track your progress on GrantFox.

  3. codebestia commented on Jun 29, 2026

    @codebestia
    ContributorAuthor

    Hello @Awointa
    What is the update with this task?
    Please raise a PR within 6 hours.

  4. grantfox-oss commented on Jul 24, 2026

    @grantfox-oss

    🦊 GrantFox — @Awointa has been assigned to this issue as part of the Official Campaign | FWC26 campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #9)
    2. Your PR will be reviewed by the ShadeProtocol maintainers

    Good luck! Track your progress on GrantFox.

  5. added
    GrantFox OSSIssue tracked in GrantFox OSS
    Maybe RewardedIssue may be eligible for a GrantFox reward
    and removed
    Maybe RewardedIssue may be eligible for a GrantFox reward
    GrantFox OSSIssue tracked in GrantFox OSS
    on Aug 21, 2026
  6. guptakumarranjeet150 commented on Sep 13, 2026

    @guptakumarranjeet150

    Hey team,

    I would love to take this on. My planned approach:

    • Deliver a clean, modular solution for Add request authentication header injection strictly following ShadeProtocol/shade-python conventions.
    • Cover changes with automated tests ensuring CI passes smoothly.

    Excited to work on this—please assign to me and I'll submit a clean PR shortly!

  7. rupesh-kumar-sah commented on Sep 30, 2026

    @rupesh-kumar-sah

    Hey team,

    I would love to take this on. My planned approach:

    • Provide a structured solution for Add request authentication header injection addressing all stated requirements.
    • Include automated test coverage verifying the implementation meets expected requirements.

    I am ready to start immediately—please feel free to assign this to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions