Closed Samlant closed 8 months ago
Hi @Samlant , thanks for taking an interest in tufup.
To answer this, we'll need a bit more detail regarding your configuration and workflow.
However, there is one thing you could check first, based on the KeyError: 'signed'
above:
Did you inspect the contents of the timestamp.json
file you are hosting on github? It should look similar to this:
{
"signatures": [
{
"keyid": "****",
"sig": "****"
}
],
"signed": {
"_type": "timestamp",
"expires": "2023-10-17T08:02:36Z",
"meta": {
"snapshot.json": {
"version": 1
}
},
"spec_version": "1.0.29",
"version": 1
}
}
Based on your stack trace, it looks like the "signed"
field is missing.
If not, could you confirm that the "expires"
value is in the future?
Could you also confirm that you are using the tufup-example app with all default settings? (except for the github url)
Thanks @dennisvang , much appreciated!
Sometimes, pressure to do good by others is all you need. In this case, in my pursuit to give you a well-rounded answer, I found my issue (when debugging line by line via VS code).
When the app checks for updates and JSONDeserializer.deserialize()
is called for the timestamp.json
file, the raw data is the entire Github webpage, so using this stack overflow post about using https://raw.githubusercontent.com
rather than github.com..., this grabbed solely the contents of the JSON file, rather than a response containing it and other elements of the page!
Using the https://raw.githubusercontent.com address path makes the app run successfully in its production env; thank you very much for all your work on tufup, I'll reach out if I have any other questions!
To just answer your questions since it was already written out:
Confirming that the timestamp.json hosted on Github is similar to your above example, and that the
"expires"
value reads future at the time the client ran.Double-checked & confirming also that I'm using default code per the example. However, note that I use VS Code, so I need to add "src" to
myapp
imports, as well as to theapp_version_attr
in repo_init.py (so it readsapp_version_attr = "src.myapp.__version__"
).I've received the above "failed to deserialize JSON" error both when ran via main.exe and within VS code.
@Samlant Thanks for coming back with such a detailed explanation, that will certainly help others as well. :-)
I'll close the issue now.
When the app checks for updates and JSONDeserializer.deserialize() is called for the timestamp.json file, the raw data is the entire Github webpage, so using this stack overflow post about using https://raw.githubusercontent.com rather than github.com..., this grabbed solely the contents of the JSON file, rather than a response containing it and other elements of the page!
Using the https://raw.githubusercontent.com/ address path makes the app run successfully in its production env
@Samlant It would also be great if you could post this as an answer to your question on stackoverflow.
Only posting here because I couldn't add "tufup" tag to my stack overflow question, located here.
0
I'm just trying to get my hands around a simple version of updating an app that I have its repo targets & metadata hosted on a separate Github repo. I got it working great when locally hosted per the tufup_example guide... The issue I'm running into is that whenever I start main.exe (created by following tufup_example on windows) is that (I think) the timestamp.json isn't correctly being deserialized...
I've ran through tuf's & tufup's docs and have been at this for a week, so now I'm earnestly asking for help or guidance on this. Am I overlooking something? Do I need to do something special to sign metadata now that it's hosted on Github?
Copy of my error is below, I hope it's just something simple I'm overlooking:
I created a working app that would auto-update itself from a localhost server as described in the tufup_example, however when I created a new repo from github and hosted fresh files that had the metadata and target files pointing to that Github repo, I received the above error(s).
I tried creating several "clean" repos and clients but have not been able to figure out this error.