id: keep ids server-owned - #34
Merged
Merged
Conversation
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
force-pushed
the
reject-create-ids
branch
from
August 30, 2026 14:10
508309a to
c7d2776
Compare
Merged
msimerson
added a commit
that referenced
this pull request
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every create schema accepted an
id, so a caller could choose an auto-incrementvalue and the store would honour it:
POSTnow forbidsidfor group, nameserver, permission, user, zone and zonerecord.
zone_record.PUTinherited an optionalidfrom the v3 object. Every otherPUTschema names its fields and never listed the key. An update reads therecord named in the URL, so an id in the body is at best ignored. In
apiitwas 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.pmdeletes thepath 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.