Loading
Add a validity check for EasyPost test API tokens
🤖 AI wrote this code from my instructions.Unreviewed AI output often lands on reviewers and costs them time.
This MR is human verified: I read the full diff and ran the tests myself, because your time is as valuable as mine.
This merge request adds a validity check for EasyPost test API tokens.
Resolves #632650 (closed). Stacked on !260411 (merged), which adds the EasyPost API token check this one mirrors.
Gap
- GitLab detects
EasyPost test API token(rule), but validity checks did not verify it.
Fix
- We generated
EasypostTestClientand its spec from a vendor definition using the generator. - The check calls
GET /v2/addresseswith the key as the Basic auth username, and is only enabled for GSS findings. - It shares the endpoint, status mapping and
partner_easypost_apirate limit with the EasyPost API token check. - Every mapping decision was measured against real production and test keys:
- Live production keys return
200. - Disabled, deleted and unknown keys return
403withAPIKEY.INACTIVE.
- Live production keys return
Notes
401stays unmapped and reads asunknown:- EasyPost returned it only for requests without a key.
- EasyPost errors guide also uses
UNAUTHORIZEDfor credentials that "do not permit access".
/v2/userswas rejected:- A live test key gets
403withMODE.UNAUTHORIZEDthere, so this check would read every live test key as inactive.
- A live test key gets
MR acceptance checklist
I have evaluated this MR against the MR acceptance checklist.
Edited by Ahmed Hemdan