Replies: 2 comments 3 replies
-
We can concat all the fields (as string literal) in a defined order then hash. This will allow us, as you mentioned, to include other types of policy file but they all have the same hash. I believe we can add a |
Beta Was this translation helpful? Give feedback.
-
Before we decided whether to do this we need to know what real problems we are solving. I understand and share the theoretical distaste for allowing whitespace or ordering changes to affect the hash, but in what ways do we expect users to experience this? I don't imagine users are going to be editing the order of a file themselves after the policy is agreed upon (why would they?). One real-world case that comes to mind is line-endings getting mangled by editors/transport mechanisms/etc Any others? |
Beta Was this translation helpful? Give feedback.
-
Just an idea for improving user interaction with policy files.
One of the underlying ideas of Veracruz is that we can use the hash of the policy file to ensure that all participants in the system are following the same rules. But the way this is currently implemented includes whitespace/formatting, meaning policy files like these are treated as different:
Instead of hashing the formatted json, what if we first minified the json, then hashed. Giving us a sort of "canonical" hash that shouldn't change unless the underlying data changes.
This would also make is fairly straightforward to add other formats such as toml and yaml.
It could also be possible to define a canonical representation for all fields, ensuring semantically equivalent policies hash to the same hash, but this would require a bit more work. Though it would have the benefit of moving those corner cases into a single policy parser.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions