NetSparkleUpdater / NetSparkle

NetSparkle is a C#, cross-platform, highly-configurable software update framework with pre-built UI for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 signatures. View basic usage here in the README and try the samples for yourself.
https://netsparkleupdater.github.io/NetSparkle/
MIT License
606 stars 84 forks source link

appcast.xml file format issue when using netsparkle-generate-appcast #440

Closed RyanG2016 closed 9 months ago

RyanG2016 commented 1 year ago

I have Netsparkle up and running in my Avalonia project but I am having an issue with the appcast format. I use Sparkle for macOS for another project and Sparkle generates a well formed XML that I can open and tweak as necessary and it works fine. When I open an appcast created by netsparkle-generate-appcast, the file isn't formatted and is all squished together. I can use something like XML Tools and prettify it and it looks fine but if I save it, the application can't read the file and I get an error saying can't read version. Maybe this is a non issue and I shouldn't be manually updating the appcast.xml file and letting the netsparkle-generate-appcast do all of the work and if that's the case then fine. I just don't want to get in a position where there is actually a problem with the appcast file that will cause issues.

Here is an example of an appcast generated from netsparke-generate-appcast;

Command:

 netsparkle-generate-appcast -a "C:\Users\user\Desktop\Output" -e exe -b "C:\Users\user\Desktop\Output" -n "My Application" -o windows

Raw output:

<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"><channel><title>My Application</title><description>Most recent changes with links to updates</description><language>en</language><item><title>My Application 1.3.4.7</title><pubDate>Sat, 29 Apr 2023 14:07:33 -05:00</pubDate><enclosure url="tvwsetup.exe" sparkle:version="1.3.4.7" sparkle:shortVersionString="1.3.4" length="39293464" sparkle:os="windows" type="application/octet-stream" sparkle:signature="XXXzHvY0vdVb2BJNmXW6kdmy2fdotXlL3CXlc0V0Aed5XKbjfFEUIWm44f/vHjaXajwaGQ1Rc+5OpmnJUXXX==" /></item></channel></rss>

If I prettify it to look formatted as I expect it;

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
     xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
    <channel>
        <title>My Application</title>
        <description>Most recent changes with links to updates</description>
        <language>en</language>
        <item>
            <title>My Application 1.3.4.7</title>
            <pubDate>Sat, 29 Apr 2023 14:07:33 -05:00</pubDate>
            <enclosure url="tvwsetup.exe"
                       sparkle:version="1.3.4.7"
                       sparkle:shortVersionString="1.3.4"
                       length="39293464"
                       sparkle:os="windows"
                       type="application/octet-stream"
                       sparkle:signature="XXXzHvY0vdVb2BJNmXW6kdmy2fdotXlL3CXlc0V0Aed5XKbjfFEUIWm44f/vHjaXajwaGQ1Rc+5OpmnJUXXX=="/>
        </item>
    </channel>
</rss>

and if I save this, even without making any changes, the update checking fails.

All of the documentation that refers to appcast for Netsparkle show well formed xml files. I know it shouldn't matter but I am running this from PowerShell and tried running from a command prompt just to make sure.

Deadpikle commented 1 year ago

Hi @RyanG2016,

Have you tried the --human-readable flag to put it in a nicer format? How does that output look for you?

RyanG2016 commented 1 year ago

@Deadpikle That makes it in a much nicer output for sure however if I use that flag, the application cannot read it. It reports Appcast is not valid. Is that expected?
Again if so, that's fine. I can just do a visual check and leave it. Just for confirmation I created one with --human-readable and one without. The one without works fine.

Deadpikle commented 1 year ago

Ah...if the software cannot read one that is setup to be human readable, that would be a bug, as the software should be able to parse the app cast regardless. Will try to look into it today unless someone else beats me to it. Sorry about that and thanks for reporting!

Deadpikle commented 1 year ago

@RyanG2016 I have tried to replicate your error and have been unable to, both from a unit test standpoint (https://github.com/NetSparkleUpdater/NetSparkle/blob/2a1ff4916e44670a5d15dc8d5c04217998bd49dd/src/NetSparkle.Tests.AppCastGenerator/AppCastMakerTests.cs#L636-L707) and a smoke test using one of the samples and an app cast I uploaded to one of my sites for a test.

Can you please post the debug console output that happens when you try to use the human readable one? Were you sure to upload your .signature file to your host as well for any verification that was needed? Does it work with SignatureMode.Unsafe but doesn't work with another SignatureMode?

RyanG2016 commented 1 year ago

@Deadpikle I set the appcast to generate in human readable and set signaturemode to unsafe and it was able to check but when I reenabled signaturemode to strict. It failed. I regenerated appcast without human readable and it passed with both strict and unsafe. Does that help at all?

Deadpikle commented 1 year ago

So, yeah, a human readable (formatted) app cast and a non-human readable (un-formatted) app cast have different signatures. I'm guessing the .signature file for your app cast on your server was put up there for your unformatted app cast. When you generate an app cast that is human readable, you need to upload the new/different .signature file to your server and overwrite the old one. The fact that SignatureMode.Unsafe fails tells you that the issue is with the cryptographic signature.

tl;dr: Upload both the human readable app cast XML doc AND .signature file to your server.

Deadpikle commented 1 year ago

@RyanG2016 Have you been able to resolve the problem you had here?

Deadpikle commented 1 year ago

@RyanG2016 I'm going to go ahead and close this issue because it seems to be an issue with not uploading the updated .signature file and not necessarily a bug with this lib (and/or it's resolved per your lack of response). If this is not the case, please comment again or whatnot to continue discussions. :-) Thanks. Again, I appreciate your feedback and reporting the issue.

RyanG2016 commented 9 months ago

@Deadpikle Sorry for delay. The project to implement netsparkle was shelved for a while. The issue has to do with multiline .md files. I was looking through #466 which is identical to my issue and I just can't get this to work with a multiline .md file. Single line, no problems. I've tried everything I can think of. Here is the command that I'm using;

netsparkle-generate-appcast -n "My Product" -a "C:\Users\me\Desktop\Output" -e exe -b "C:\Users\me\Desktop\Output" -o windows -p "C:\Users\me\Desktop\Output" --critical-versions "1.5.12" --reparse-existing

My .md file is;

- Added: Sparkle Testing
- Another Line
- This is a multiline format test

The appcast.xml output is; (Image from notepad++ showing line breaks

Screenshot 2023-12-05 at 6 32 39 PM

This is the output from the client;

netsparkle: Downloading and checking appcast
netsparkle: About to start downloading the app cast...
netsparkle: Downloading app cast data...
netsparkle: Downloading app cast signature data...
netsparkle: Signature check of appcast failed
netsparkle: Appcast is not valid
netsparkle: No version information in app cast found

Any suggestions would be super appreciated

RyanG2016 commented 9 months ago

@Deadpikle Sorry that screenshot isn't correct. That was formatted for readability. Here is the raw file;

Screenshot 2023-12-05 at 6 42 20 PM

The only CRLF are from the .md file.

Deadpikle commented 9 months ago

🤔 Interesting. It sounds like the signature generating functionality is not reading in the right data for creating the signature or something because it should just be generating the signature based on the output data...? Not sure here...hmm...

You have verified that the file on disk (when you generate the appcast) is the exact same as the file you upload to your server, right? And that the .signature file is up on your server?

Needs investigation/fixing.

RyanG2016 commented 9 months ago

@Deadpikle You know one thing I didn't check if the actual transfer. I am using FileZilla to transfer local files to remove. Maybe there something happening there. I will check that now. Thx

RyanG2016 commented 9 months ago

@Deadpikle You were right and I'm sorry I didn't even think of checking this. File transfer type was set to auto. I changed to Binary and that fixed it..... Thanks for the reply. This can be closed.

Deadpikle commented 9 months ago

No problem. :) Thanks for letting future people know what helped to fix the issue! Glad you got it working.