Rotate Pinpoint keys
How to rotate the Pinpoint API key and the webhook signing secret that Luna uses to receive and act on hires from Pinpoint, our applicant tracking system.
Neither value expires, so rotate them when someone with access leaves, when a value may have leaked, or on whatever schedule security policy sets.
Requirements
- Pinpoint admin access for the account you are rotating (the sandbox for lower environments and staging, production for production).
- AWS access to the matching account (
luna-non-prodorluna-production) with permission to write SSM parameters.
Where the values live
| Value | SSM parameter | Read by |
|---|---|---|
| API key | /luna/<env>/pinpoint/api-key (SecureString) | The onboarding subscriber, through @bhag-business-platform/luna-connectors (hired flow, ANDi id write-back, rejection and the start-date poll). The employee-gateway scheduler (<env>-employee-gateway-scheduler-function) for the 02:00 UTC daily poll and the 05:30 UTC reference-data sync |
| Subdomain | /luna/<env>/pinpoint/subdomain | The same callers, to build https://<subdomain>.pinpointhq.com/api/v1 |
| Webhook signing secret | /luna/<env>/pinpoint/webhook-signing-secret (SecureString) | The employee-gateway subscriber, to verify the pinpoint-hmac-sha256 header on POST /webhooks/pinpoint |
The values are read from SSM on every call, except in the reference-data sync, which reads them once at the start of each run. Nothing is cached between runs, so a new value takes effect on the next request or run and no redeploy is needed.
Pinpoint screens not verified
The Pinpoint UI steps below follow Pinpoint's documentation and haven't been checked step by step. If a screen differs, follow Pinpoint's current UI and update this page.
Rotate the API key
In Pinpoint, create a new API key. Don't delete the old one yet.
Check the new key works:
bashcurl -s -o /dev/null -w "%{http_code}\n" \ -H "X-API-KEY: <new-key>" \ "https://<subdomain>.pinpointhq.com/api/v1/applications?page%5Bnumber%5D=1"Expect
200.Switch Luna to the new key:
bashaws ssm put-parameter \ --name "/luna/<env>/pinpoint/api-key" \ --type SecureString \ --value "<new-key>" \ --overwriteCheck the new key works in Luna. The quickest check is the next daily poll: the employee-gateway scheduler logs (
<env>-employee-gateway-scheduler-function) showQueued <n> hired Pinpoint applications updated in the last 7 daysafter 02:00 UTC. Then check the onboarding subscriber logs (<env>-onboarding-subscriber-function) for errors from Pinpoint calls.Delete the old key in Pinpoint.
Rotate the webhook signing secret
Expect a short gap during the swap. While Pinpoint and SSM disagree, webhook deliveries fail signature verification and return 401, and the signature-failure alarm posts to #<env>-error-alerts. Pinpoint's documentation says it retries failed deliveries, which hasn't been tested, so keep the gap to seconds and let the channel know beforehand.
Open the Luna webhook in Pinpoint's webhook settings and regenerate or set its signing secret. Copy the new value.
Straight away, overwrite the SSM parameter:
bashaws ssm put-parameter \ --name "/luna/<env>/pinpoint/webhook-signing-secret" \ --type SecureString \ --value "<new-secret>" \ --overwriteConfirm the signature-failure alarm goes back to
OKand the employee-gateway subscriber logs showReceived Pinpoint webhook eventagain.
If Pinpoint retries give up before the swap completes, Pinpoint may disable the endpoint. Follow Re-enable a disabled endpoint.
