Skip to content

id: keep ids server-owned - #34

Merged
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:reject-create-ids
Aug 30, 2026
Merged

id: keep ids server-owned#34
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:reject-create-ids

Conversation

@aberoham

@aberoham aberoham commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Every create schema accepted an id, so a caller could choose an auto-increment
value and the store would honour it:

POST /zone_record {id: 999111, zid, owner, type, address, ttl}
-> 201, record created with id 999111

POST now forbids id for group, nameserver, permission, user, zone and zone
record.

zone_record.PUT inherited an optional id from the v3 object. Every other
PUT schema names its fields and never listed the key. An update reads the
record named in the URL, so an id in the body is at best ignored. In api it
was worse: the handler merged the path id first and let the body overwrite it,
so the write landed on a record the caller never named. NicTool/api#71 fixes
that order. Refusing the key here closes it whatever the handler does.

The v2 REST bridge sends no id in a PUT body. Transport/REST.pm deletes the
path parameter from the call vars before it builds the body. The multi-put path
serves only the move actions.

Ids belong to the store. Defining that here rather than in the api means every
layer inherits it, instead of each one remembering to strip the field.

Ticks "verify the API won't permit setting auto-increment fields" in
NicTool/api#6.

Every POST schema took an id from the caller. A create is the store's
chance to hand one out, so the schemas now refuse the key.

zone_record's PUT inherited an optional id from the v3 object. The
route reads the record named in the URL, so an id in the body is at
best ignored and at worst a write to another record. The other PUT
schemas never listed the key.

The v2 REST bridge sends no id in a PUT body: Transport/REST.pm deletes
the path parameter from the call vars before it builds the body, and
the multi-put path serves only the move actions.
@aberoham aberoham changed the title create: reject caller-supplied ids id: keep ids server-owned Aug 30, 2026
@msimerson
msimerson merged commit 4503776 into NicTool:main Aug 30, 2026
9 checks passed
@msimerson msimerson mentioned this pull request Aug 31, 2026
msimerson added a commit that referenced this pull request Aug 31, 2026
- zone: run 3 disabled validation cases (#33)
- id: keep ids server-owned (#34)
- user: accept an email at any syntax-valid domain (#32)
- zone: nameservers are nameserver ids (#31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants