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 EasypostTestClient and its spec from a vendor definition using the generator.
  • The check calls GET /v2/addresses with the key as the Basic auth username, and is only enabled for GSS findings.
  • It shares the endpoint, status mapping and partner_easypost_api rate 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 403 with APIKEY.INACTIVE.

Notes

  • 401 stays unmapped and reads as unknown:
    • EasyPost returned it only for requests without a key.
    • EasyPost errors guide also uses UNAUTHORIZED for credentials that "do not permit access".
  • /v2/users was rejected:
    • A live test key gets 403 with MODE.UNAUTHORIZED there, so this check would read every live test key as inactive.

MR acceptance checklist

I have evaluated this MR against the MR acceptance checklist.

Edited by Ahmed Hemdan

Merge request reports

Loading
Loading