Password Reset Email Evidence: Auditing API Retry Decisions After 429
A gaming signup service needs to explain why a verification link was delayed without turning its telemetry into a second store of account credentials. The same constraint applies to its password reset email API: a 429 ra
A gaming signup service needs to explain why a verification link was delayed without turning its telemetry into a second store of account credentials. The same constraint applies to its password reset email API: a 429 rate limit response requires a controlled delivery decision, while the evidence should contain neither the reset link nor the recipient's address.
TL;DR: In a Node.js transactional email service, handle Retry-After in the delivery worker, enforce a separate resend cooldown at the application boundary, and preserve a small decision record for each logical request. Keep signup verification and password recovery as distinct purposes. Sample diagnostic detail separately from the evidence needed to reconstruct throttling decisions.
The design criterion here is compliance evidence: can a reviewer reconstruct which rule delayed a message, which retry became eligible, and why delivery stopped? This is an engineering objective, not a claim that any particular retention period satisfies a legal obligation.
What evidence should a password reset email API retain after a 429?
RFC 6585 defines 429 as Too Many Requests and permits a Retry-After header. It does not require the server to disclose how it counts requests. RFC 9110 defines Retry-After as either an HTTP date or a nonnegative number of seconds. Therefore, a worker should not assume that every rejection includes an integer delay, or that the same cooldown applies to every account and every sender.
Preserve the decision.
For a proposed evidence record, retain an opaque logical request identifier, purpose, attempt number, decision timestamp, response status, parsed eligibility time, policy version, and terminal outcome. These are design fields, not a commercial API schema. They distinguish a delayed attempt from a new user request and allow policy changes to be reconstructed without preserving the message body. A policy version matters because a later configuration snapshot cannot explain an earlier decision.
Keep the recipient, raw token, full verification URL, authorization header, and message body out of that record. OWASP's Logging Cheat Sheet identifies access tokens and sensitive personal information as data that generally require exclusion, masking, or special treatment. If an operational investigation needs recipient correlation, put the protected lookup behind separate access controls and an explicit deletion policy. An opaque identifier still deserves protection when another system can resolve it to a person.
There is a sharp evidentiary boundary: an accepted send request does not prove that the player received the email. Record acceptance as acceptance. Only record a later delivery event when an authenticated source supplies one, and avoid converting that event into an unsupported claim about inbox placement or user action.
Derive retry timing from the evidence boundary
The browser's resend countdown and the worker's delivery schedule solve different problems. The countdown limits repeated requests from a player; the worker schedule controls attempts against an upstream service. One cannot substitute for the other. In particular, refreshing the signup page should not create a second logical delivery while the first is waiting.
Use server-side coordination for the cooldown. An illustrative policy could impose a 60-second cooldown, subject to evaluation against abuse risk and player support requirements. This is a proposed setting, not a standard. The public response should avoid revealing whether an account exists; OWASP's Forgot Password Cheat Sheet recommends consistent responses and protections against excessive submissions.
A worker receiving a valid Retry-After should schedule no earlier than the indicated time. It can add positive jitter to spread work. For a missing or invalid header, define a bounded backoff policy and record that a local policy supplied the delay. Treat clock skew as an explicit concern when parsing HTTP dates. In a Node.js implementation, persist the next eligible time instead of relying solely on a process-local timer, so deployment or worker restart does not erase the scheduling decision.
Expiry wins.
Before retrying, compare eligibility with the verification token's expiry and the request's terminal state. A message whose link will already be invalid should end with an explicit expiry outcome. Do not extend token validity merely to accommodate a queue. For password recovery, OWASP recommends time-limited, single-use tokens; the signup flow should define its own corresponding verification policy rather than silently inheriting recovery semantics.
A 429 is also different from a lost response. An ambiguous timeout may leave the worker unable to tell whether the send was accepted. A local logical identifier alone cannot guarantee exactly-once delivery across that boundary. Where the receiving interface documents idempotency, follow its scope and lifetime; otherwise, define an ambiguity policy and record the uncertainty before retrying.
Count labels before counting storage
Audit evidence and performance telemetry should have different collection rules. An evidence event answers what happened to a particular request. A metric answers how often a class of decisions occurred. Putting a request identifier into a metric label confuses those roles and gives each request its own time series.
Consider a hypothetical metric with 2 purposes, 4 decision outcomes, 3 attempt bands, and 2 deployment regions. Those dimensions permit 2 × 4 × 3 × 2 = 48 combinations before any additional labels. Adding 100,000 possible account identifiers expands the theoretical space to 4,800,000 combinations. Actual populated series depend on traffic, but the multiplication explains why player identifiers belong outside metric labels. OpenTelemetry's metrics data model describes metric streams in terms of their attributes; that structure makes label selection an architectural decision.
Keep the dimensions bounded.
Retention math is similarly concrete. Suppose a planning model assumes 100,000 logical requests per day, 3 retained decision events per request, and 300 serialized bytes per event. Thirty days then contains 2.7 billion bytes, or 2.7 GB in decimal units, before indexing, replication, compression, and storage overhead. These are illustrative inputs, not measured production results. Changing retention from 30 days to 7 days changes the modeled payload to 630 million bytes. Whether that shorter period is acceptable depends on the actual evidence obligation and investigation window.
Sampling introduces another boundary. A random sample of debug traces can help diagnose worker behavior, but it cannot establish the outcome of an omitted account request. For this design, retain the minimal decision record for every in-scope request during the approved evidence window, and sample richer diagnostic traces separately. If evidence volume remains too high, first review unnecessary fields and repeated events; silently dropping terminal outcomes makes the original audit question unanswerable.
Compare collection policies against the audit question
The relevant comparison is between evidence policies. Acquisition price contributes little to deciding whether a reviewer can reconstruct a delayed verification link.
| Collection policy | What it can explain | Boundary to accept |
|---|---|---|
| Aggregate counters only | Frequency of throttling by bounded dimensions | Cannot reconstruct one player's request |
| Sampled diagnostic traces | Detailed paths for selected attempts | Missing traces leave individual outcomes unresolved |
| Minimal per-request decision records | Recorded policy decisions and terminal states | Requires protected correlation and a defined retention window |
| Full request and response capture | Detailed payload context | Can retain credentials and personal data unnecessarily |
For the gaming signup workflow, the minimal decision record best matches the stated reconstruction objective. Combine it with bounded counters for operations and selective traces for diagnosis. This choice incurs evidence storage and access-control work, while keeping token-bearing payloads out of routine telemetry.
This approach has a limitation: decision records cannot recover payload details that were deliberately excluded. The trade-off is narrower diagnostic context in exchange for less sensitive retained data. A separate, access-controlled staging reproduction is appropriate when the investigation requires message contents.
Neither an unsubscribe mechanism nor a browser SMS retrieval mechanism resolves this email scheduling problem. RFC 8058 specifies one-click unsubscribe for list email, and the WebOTP API concerns retrieving one-time passwords. Neither should be treated as evidence that a password reset email was delivered or that retry timing was enforced. Keep those protocol boundaries explicit during review.
Roll out with reconstructable decisions
Begin with a staging replay covering an integer Retry-After, an HTTP-date Retry-After, a missing header, repeated resend clicks, an ambiguous timeout, and expiry before eligibility. Use synthetic recipients. Inspect the resulting evidence and verify that a reviewer can connect attempts without finding a token or email address in the records.
The following curl request illustrates a proposed staging contract, not an existing product API. Replace the reserved example hostname with a controlled test service, implement the route in that fixture, and configure the synthetic player there. The response headers make an application-level cooldown observable; inject upstream 429 responses separately at the delivery boundary to test worker scheduling. Do not enable automatic retries in this probe, because each attempt needs an explicit place in the test evidence.
curl --include --max-time 10 \
--request POST \
--header 'Content-Type: application/json' \
--data '{"purpose":"signup_verification","player_fixture":"synthetic-player-01"}' \
'https://signup.example/verification-requests'
Then introduce the policy to a limited traffic cohort. Track bounded counts for throttling, expiry, suppression, and acceptance; compare queue age with remaining token lifetime. Restrict evidence access and exercise deletion before expanding retention or traffic.
The release criterion is specific: a delayed signup link or password recovery request must have an explainable scheduling decision and an honest terminal state. Keep enough evidence to answer that question, and give additional telemetry its own justification.
Sources
References:
- RFC 6585, section 4, 429 Too Many Requests: https://datatracker.ietf.org/doc/html/rfc6585#section-4
- RFC 9110, section 10.2.3, Retry-After: https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3
- OWASP Forgot Password Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Forgot_Password_Cheat_Sheet.html
- OWASP Logging Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html
- OpenTelemetry metrics data model: https://opentelemetry.io/docs/specs/otel/metrics/data-model/
- RFC 8058, One-Click Unsubscribe: https://datatracker.ietf.org/doc/html/rfc8058
- MDN WebOTP API: https://developer.mozilla.org/en-US/docs/Web/API/WebOTP_API
- IANA reserved example domains: https://www.iana.org/help/example-domains
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.