Open technosophos opened 5 years ago
I'm hitting the same thing. I get even more odd behavior. Some JSON is accepted depending on some magic combination of JSON key names. So this works:
{
"customType": "OSTREE",
"theUrl": "https://github.com/foundriesio/lmp-manifest/releases/tag/37"
}
But this fails:
{
"customType": "OSTREE",
"theUrl": "https://github.com/foundriesio/lmp-manifest/releases/tag/37",
"osTree": "https://api.foundries.io/lmp/treehub/release/api/v2/"
}
I'm starting to get the feeling it will only accept custom data with < 3 key names.
Cc @riyazdf
On Tue, 8 Jan 2019 at 09:55, Andy Doan notifications@github.com wrote:
I'm hitting the same thing. I get even more odd behavior. Some JSON is accepted depending on some magic combination of JSON key names. So this works:
{ "customType": "OSTREE", "theUrl": "https://github.com/foundriesio/lmp-manifest/releases/tag/37" }
But this fails:
{ "customType": "OSTREE", "theUrl": "https://github.com/foundriesio/lmp-manifest/releases/tag/37", "osTree": "https://api.foundries.io/lmp/treehub/release/api/v2/" }
I'm starting to get the feeling it will only accept custom data with < 3 key names.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/theupdateframework/notary/issues/1411#issuecomment-452391989, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdcPNXQO4OXh05md9P8yOgpz_kpSctdks5vBNubgaJpZM4ZjTuX .
I'm wondering if there is some additional canonicalization that must happen to the JSON data in order for the hashing to match on repeat tests.
I can confirm @technosophos theory is correct. I've found that by changing the order of the keys, I can eventually get my custom data to publish.
It may need to be Canonical JSON. Sorry at an offsite this week so haven’t had a chance to look at the code. There is a canonical json library Notary uses that you can use, or try doing it by hand...
On Wed, 9 Jan 2019 at 08:59, Matt Butcher notifications@github.com wrote:
I'm wondering if there is some additional canonicalization that must happen to the JSON data in order for the hashing to match on repeat tests.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/theupdateframework/notary/issues/1411#issuecomment-452760113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdcPPxSvIa22mPNZNLxcqbMK7JJchpXks5vBh_kgaJpZM4ZjTuX .
Thanks guys. That's my issue specifically quoting http://wiki.laptop.org/go/Canonical_JSON:
The members production in object must consist of keys in lexicographically sorted order
I was testing out the
--custom
feature when I ran into a problem that seems to stem from the fact that my custom data is JSON.If I add simple data with
--custom
, things work fine. For example, the following target was added without a problem:This produces the JSON:
Note that custom is just
123
now.I can see the custom data in the
targets.json
file:But if I try to add a file that contains JSON data, things fail in an interesting way:
In the changelist, the data looks like this:
For convenience, here's the decoded data, formatted:
But now if I try to publish this, I get an error:
I see the following errors in the notary server log:
Version Info
Client version:
Servers were built from master at 6e8cc6e54bb1fb140c97698993509aa5dfb1b9b8 using
docker-compose build
.