mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
Narrow a spent email budget to the field, and record both refusals
A refused address change returned before the update was built, so every other field in the same request went with it. The settings form posts the whole profile at once, so somebody who had spent the budget could not save a timezone or a height for an hour and was told it was about email addresses. The address is now dropped and the rest of the save lands, reported through the existing rejectedFields key with the code `rate_limited`; the 429 is kept for a request that asked for nothing else, where a partial success would be a lie. The comment claiming an audit row beside each question was inverted: both refusals returned before the row is written, so only the answers that told the caller nothing were being recorded. The two answers worth detecting write their own rows now. The stored address is normalised before the "has it changed" comparison. Registration writes it as typed, so an account created with capitals did not match its own address and paid for its first ordinary save.
This commit is contained in:
1 parent
3ace3aad35
commit
625763982b
16 files changed
+243
-38
No files matched your search
+35
-8
@@ -3099,13 +3099,16 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorEnvelope"
|
||||
"429": &a14
|
||||
description: "Too many email-address changes. The address change shares one per-account bucket across both profile
|
||||
routes — `profile-email:<accountId>`, 10 requests per 3600 seconds — keyed on the ACTING account, so an
|
||||
account cannot collect a fresh allowance by probing a different address. Nothing was written.
|
||||
description: "Too many email-address changes, and the request asked for nothing else. The address change shares one
|
||||
per-account bucket across both profile routes — `profile-email:<accountId>`, 10 requests per 3600 seconds —
|
||||
keyed on the ACTING account, so an account cannot collect a fresh allowance by probing a different address.
|
||||
`meta.errorCode` is `profile.update.emailRateLimited`. Only a request whose `email` actually differs from
|
||||
the address on file is counted: re-saving a form that carries the unchanged address is free, and so is any
|
||||
update that does not touch `email` at all. The `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`
|
||||
and `X-RateLimit-Reset` headers describe that bucket; back off on `Retry-After` rather than guessing."
|
||||
update that does not touch `email` at all. A request that carries other fields beside the refused address
|
||||
does NOT get this response — it answers 200, saves those fields, and names `email` in `rejectedFields` with
|
||||
code `rate_limited`, so one spent budget cannot block an unrelated profile edit for an hour. The
|
||||
`Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers describe that
|
||||
bucket; back off on `Retry-After` rather than guessing."
|
||||
headers: *a8
|
||||
content:
|
||||
application/json:
|
||||
@@ -37916,9 +37919,11 @@ components:
|
||||
description: Whether an insurance number is stored. The number itself is encrypted at rest and is never returned — only
|
||||
its presence.
|
||||
rejectedFields:
|
||||
description: "Present only on a PARTIAL success: the fields that failed validation and were skipped while the rest of
|
||||
the patch was written. A 200 carrying this key means the save was incomplete — surface it, do not treat the
|
||||
response as a clean save."
|
||||
description: "Present only on a PARTIAL success: the fields that were skipped while the rest of the patch was written. A
|
||||
200 carrying this key means the save was incomplete — surface it, do not treat the response as a clean save.
|
||||
`code` is the validator code for a field that failed validation, or `rate_limited` for an email-address
|
||||
change that has spent the account's hourly budget; that one is not a bad value and the same address will be
|
||||
accepted once the window rolls over."
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
@@ -46812,6 +46817,28 @@ components:
|
||||
hasInsuranceNumber:
|
||||
type: boolean
|
||||
description: Whether a KVNR is on file (the value itself is not echoed).
|
||||
rejectedFields:
|
||||
description: "Present only on a PARTIAL success: the fields that were skipped while the rest of the patch was written. A
|
||||
200 carrying this key means the save was incomplete — surface it, do not treat the response as a clean save.
|
||||
`code` is the validator code for a field that failed validation, or `rate_limited` for an email-address
|
||||
change that has spent the account's hourly budget; that one is not a bad value and the same address will be
|
||||
accepted once the window rolls over. The handler has always been able to answer with this key on this path;
|
||||
it was published only on PUT /api/auth/profile."
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
code:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
- code
|
||||
- message
|
||||
additionalProperties: false
|
||||
required:
|
||||
- username
|
||||
- email
|
||||
|
||||
Reference in new issue
Block a user