[quality] test: pin contributor token-reissue rotation semantics (src/pkg/dashboard/api_contribute.go handleContributeReissueToken) - #6348
Conversation
…oard/api_contribute.go handleContributeReissueToken / reissueContributorToken) Existing tests only pinned the two 401 refusals. This pins the security-relevant branches: the success path actually rotates (new plaintext returned, only its sha256 stored, TokenPlain cleared, old hash invalidated), the legacy 'token <t>' Authorization scheme, 404 for authenticated-but-unregistered identities (no profile conjured), 403 for revoked contributors WITHOUT rotating their stored credential, and 401 for unknown Authorization schemes. Coverage: handleContributeReissueToken 51.9% -> 100%, reissueContributorToken -> 100%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Test Improvement
Adds
src/pkg/dashboard/contribute_reissue_token_test.gopinning the untested branches ofhandleContributeReissueTokenandreissueContributorTokeninsrc/pkg/dashboard/api_contribute.go— the authenticated credential-rotation endpoint (POST /api/contribute/reissue-token).Existing tests covered only the two 401 refusals. Newly pinned:
TokenPlaincleared, old token hash invalidated.token <t>Authorization scheme accepted alongsideBearer.Basic), with the stored token untouched.Coverage:
handleContributeReissueToken51.9% → 100%;reissueContributorToken→ 100%. Tests are hermetic (tempHIVE_CONTRIBUTORS_DIR, mock GitHub /user via the existingv1Server/userMockhelpers; unique tokens per test to sidestep the process-wide ghTokenCache).Overlap preflight
Disjoint from all open hold-gated PRs: #6343 (terminal_handoff), #6342 (github IssueClosedAt), #6330 (agent thrash poller), #6292 (contribute local-mode warning / relay), #6327 (pkg/hub).
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5