Repository navigation
Conversation
|
Claude finished @mbevc1's task in 1m 25s —— View job Follow-up review complete
Scope of new commit ( Status of prior findings:
New inline comments: 0 — this commit only touches comments and test data; no bug, security issue, or regression surfaced in the changed lines. Note: I was unable to execute |
LoadJsonData unmarshalled into any, so every number became a float64 and an integer above 2^53 was sent as a different number, e.g. 12345678901234567890 became 12345678901234567000. Decoding with UseNumber keeps each number as json.Number, which marshals back exactly as written. This covers --user-data on the attest and trail commands and JSON files given to attest custom --attestation-data. Fixes #1430
A YAML file given to attest custom --attestation-data went through yaml.v3, which decodes a number to an int64, a uint64 or a float64. A decimal lost digits beyond float64 precision and its written form (1.10 was sent as 1.1), and an integer beyond 64 bits was rejected, while the same numbers in a JSON file are now sent exactly. yaml.v3 has no hook to decode a scalar into another type, and walking the tree by hand would mean reimplementing its alias, merge key and duplicate key handling. So a number node is turned into a string behind a random marker before decoding, and turned into a json.Number after. Spellings JSON does not have (+1.5, .5, 1., 1_000) are respelled without changing a digit. Also covers 1.0 and 1e2 in the JSON loader tests, as the review of the JSON fix suggested. Refs #1430
722c844 to
e4f05d1
Compare
The YAMLDocuments godoc said decimals keep their digits whatever their size, but yaml.v3 resolves a decimal beyond float64's range to a string, so it is sent as one. It also left out that a leading zero is dropped from a decimal such as 01.50 while 089 is an error. Tests pin a signed exponent and the beyond-float64 integer. Refs #1430
|
The CLI side looks right to me. My concern is what the server does with the new bytes, because the same file now produces a different payload. Whole-number floats change type on the wire. Two client errors became server inputs.
If the server can't hold these, the user gets a server error where they used to get a clear CLI message. The tests stop at
If 1 fails, this is a breaking change for existing custom types and should be labelled as one in the release notes. If 2 or 3 fail, I'd keep the client-side errors for those cases. |
Send numbers from JSON and YAML data files exactly as written.
--user-dataandkosli attest custom --attestation-datadecoded every number as a float64, so an integer above 2^53 reached Kosli as a different number (12345678901234567890became12345678901234567000).Numbers now keep their written form too:
1.0stays1.0and1e2stays1e2, where they were sent as1and100. In a YAML file, an integer beyond 64 bits is now sent where it was rejected, and spellings JSON lacks are respelled with the same digits (+.50becomes0.50).Closes #1430
Checklist
attest customhelp now says YAML decimal numbers keep every digit)charts/k8s-reporter/) updated, if needed. Note: these changes live in a separate PR (n/a: the k8s reporter is untouched)