Repository navigation
ateapi: reject unknown fields on the request, not just the resource - #1216
Merged
Tim Hockin (thockin) merged 1 commit intoAug 26, 2026
Merged
Tim Hockin (thockin) merged 1 commit into
Tim Hockin (thockin) merged 1 commit into
Conversation
Haven Xia (HavenXia)
requested a review
from Julian Gutierrez Oschmann (juli4n)
August 25, 2026 23:42
Collaborator
|
Needs rebase, sorry |
Tim Hockin (thockin)
left a comment
Collaborator
There was a problem hiding this comment.
Should we do this on EVERY incoming request? E.g. as an interceptor?
| var fldPath *field.Path | ||
| var errs field.ErrorList | ||
|
|
||
| errs = append(errs, validateNoUnknownFields(req, fldPath)...) |
Collaborator
There was a problem hiding this comment.
The fldPath is nil - when you rebase you will find it easier to just say nil
Collaborator
There was a problem hiding this comment.
Or just skip that argument - if we validate every request, it will always start as nil.
Haven Xia (HavenXia)
force-pushed
the
reject-request-unknown-fields
branch
3 times, most recently
from
August 26, 2026 04:31
d241e53 to
0ff1e90
Compare
Member
Author
Refactor into an ate interceptor. |
Member
Author
|
green |
| // Use "request" for the root message which has no field path. | ||
| path = field.NewPath("request") | ||
| } | ||
| errs = append(errs, field.Invalid(path, field.OmitValueType{}, "")) |
Collaborator
There was a problem hiding this comment.
We almost never use the last arg to "Invalid()" but this may be the exception -- should we say something like "unknown field with protobuf tag 99" ?
Tim Hockin (thockin)
left a comment
Collaborator
There was a problem hiding this comment.
Small points then LGTM
Haven Xia (HavenXia)
force-pushed
the
reject-request-unknown-fields
branch
from
August 26, 2026 17:19
0ff1e90 to
d68340b
Compare
Member
Author
|
green again |
Tim Hockin (thockin)
merged commit Aug 26, 2026
7e33913
into
agent-substrate:main
10 of 11 checks passed
1 of 2 tasks
Luiz Oliveira (laoj2)
pushed a commit
that referenced
this pull request
Sep 2, 2026
An old server replica doing Read-Modify-Write should drop unknown fields
on read and serve the reduced object.
Here we add `proto.UnmarshalOptions{DiscardUnknown: true}` because when
we read an unknown field in storage layer, it must mean a newer replica
has written such a field. Since we have declined requests with unknown
fields with interceptors in #1216.
Fixes #1205
- [ ] Tests pass
- [x] Appropriate changes to documentation are included in the PR
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.
Fix #1213, we should also reject unknown fields at request level.
Refactor all functionality back into a gRPC interceptor to check every incoming request, no need to handle every new request method.