mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-06 18:28:39 +01:00
fix(api): consolidate grant deletes and harden API v1 auth after review
- GrantRepository keeps three deletes: DeleteForUser, DeleteStaleEpochs
(replaces DeleteOtherEpochs and DeleteIfEpoch) and DeleteIdle. Delete(id)
is gone; the idle path in ResolveGrant now calls DeleteIdle, so a grant
renewed by another node between the read and the delete survives.
settleEpoch deletes the user's grants below the snapshot's epoch, which
is safe outside the transaction because epochs only move forward.
- The "dead grants on an older epoch are only deleted when presented"
policy note moves from the repository to core ListGrants.
- SQL trace logging no longer prints the args of property writes (signing
keys) or user password writes, both encrypted with a key that may be the
public default. The SQL statement is still logged.
- The spec gate rejects JSON body keys that differ from a declared property
only in case. kin-openapi validates exact names while encoding/json
decodes case-insensitively, so {"scopes":[],"Scopes":null} minted a
token with every scope and a "Client" key skipped maxLength.
It also rejects data after the first JSON value, which the handlers'
decoder ignores and which let a body skip the alias check.
- The liveness cache trims its eviction log on evict, not only on put, so
evict-only traffic stays bounded; the floor still drops stale fills.
- createAccessToken, login and setupFirstAdmin declare Cache-Control:
no-store on their success responses.
This commit is contained in:
parent
d368eef3ce
commit
8789561b60
26 changed files with 493 additions and 72 deletions
4
api/openapi/components/headers/CacheControlNoStore.yaml
Normal file
4
api/openapi/components/headers/CacheControlNoStore.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
description: Always `no-store`, because the response carries a secret or a token.
|
||||
schema:
|
||||
type: string
|
||||
enum: [no-store]
|
||||
|
|
@ -17,6 +17,9 @@ token:
|
|||
responses:
|
||||
'200':
|
||||
description: The new access token.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers/CacheControlNoStore.yaml
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
|
@ -130,6 +133,9 @@ login:
|
|||
responses:
|
||||
'200':
|
||||
description: The new grant.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers/CacheControlNoStore.yaml
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
|
@ -163,6 +169,9 @@ setup:
|
|||
responses:
|
||||
'201':
|
||||
description: The admin was created.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers/CacheControlNoStore.yaml
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue