Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

=== [Unreleased]

==== Changed — evidence hash is platform-independent

* The attestation evidence hash now feeds `+files_read+` to SHA-256 as an 8-byte
little-endian `+u64+`, like the other counts, instead of a platform-sized
`+usize+`. Hashes are unchanged on 64-bit platforms; 32-bit builds now agree
with them. The computation lives in `+attestation::evidence::evidence_hash+`,
with a known-answer test whose value comes from coreutils `+sha256sum+`.
==== Fixed — JCS numbers on decimal ties

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the evidence-hash changelog entry

This replaces the existing Unreleased section for the platform-independent evidence hash instead of inserting the new JCS section alongside it. The evidence-hash change remains part of the unreleased code, so this omission would produce incomplete release notes; retain the prior section below the new entry.

Useful? React with 👍 / 👎.


* `+ijson-jcs+` is bumped from 3a9a4ee to 03df9ed, which formats numbers with
`+ryu-js+` (ECMAScript `+Number::toString+`). The old pin printed RFC 8785
Appendix B vector 0x43143ff3c1cb0959 as `+1424953923781206.3+`; JCS requires
`+1424953923781206.2+` (ties to even). Any report or attestation holding such a
float now hashes to the value other JCS implementations compute. A test in
`+crate::json+` pins the vector.

==== Fixed — KYAML keys holding a line separator

Expand Down
9 changes: 8 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# JCS (RFC 8785) for JSON artefacts: the estate tool behind JSON-POLICY rule
# J-1. Not on crates.io, so pinned to a full commit SHA.
ijson-jcs = { git = "https://github.com/hyperpolymath/ijson-jcs", rev = "3a9a4ee326a968a32b2f152b4faec243a2d00765" }
ijson-jcs = { git = "https://github.com/hyperpolymath/ijson-jcs", rev = "03df9ed20c1a2e1d6d913b8b20cf0874651bb61a" }
# Pure safe-Rust YAML (replaces serde_yaml + unsafe-libyaml, RUSTSEC-2024-0449).
serde-saphyr = "2.0"
regex = "1.10"
Expand Down
8 changes: 8 additions & 0 deletions src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ mod tests {
);
}

#[test]
fn numbers_follow_rfc_8785_on_decimal_ties() {
// RFC 8785 Appendix B: binary64 0x43143ff3c1cb0959 must print as
// ECMAScript does, choosing the even digit on a decimal tie.
let tie = f64::from_bits(0x4314_3ff3_c1cb_0959);
assert_eq!(to_canonical_string(&tie).unwrap(), "1424953923781206.2\n");
}

#[test]
fn rejects_integers_outside_i_json_range() {
// I-JSON safe integers: [-(2^53 - 1), 2^53 - 1].
Expand Down
Loading