simplesamlphp / SAML-tracer

Browser extension for examining SAML messages
https://addons.mozilla.org/nl/firefox/addon/saml-tracer/
BSD 2-Clause "Simplified" License
141 stars 39 forks source link

Manifest V3 update. #80

Closed kellenmurphy closed 2 weeks ago

kellenmurphy commented 2 years ago

I took a stab at Issue #79. For the most part this was a straightforward, following the Chrome Migration Path.

Changes

Notes

khlr commented 2 years ago

Thank you so much for this PR, @kellenmurphy! I really like your detailed explanations!

Regarding the reviseRedirectedRequestMethod-issue:

IIRC case 1 affected Chrome and Firefox. At least at that time. Since case 2 is/was a FF-only special treatment we can ignore it for the moment. So I focused on case 1. And yep, I can't reproduce it either! But have a try using Firefox (without your MV3-changes). Then you can activate the mentioned lines! Maybe have a try, too. Go here and then select Academisch Medisch Centrum (AMC). If you set a breakpoint within the if, you'll reach that line! But only in FF and not in Chrome...

Possibly Chrome changed "something" in the meantime... So maybe both cases are FF-only speacial treatments by now ¯\_(ツ)_/¯

Hence I think at the moment we can't clarify if altering the method will break something in the future...

kellenmurphy commented 2 years ago

@khlr great insights! I will check this out later this week to see if I can replicate, and I will also update the keyboard-shortcut code.

Thanks!!! I'll have more soon... (my week is very front-heavy).

kellenmurphy commented 2 years ago

Just an update... I'm still planning to work on this, I've just had to be away for a bit due to a death in the family. I'll be circling back to this soon!

tvdijen commented 2 years ago

My sincerest condolences @kellenmurphy ! First things first!

kellenmurphy commented 2 years ago

Thanks @tvdijen...

FWIW I just fixed the keyboard shortcut, but I do still need to do some digging in line with @khlr's comment above. We also obviously need to wait for Firefox to start supporting MV3.

khlr commented 11 months ago

Hello @kellenmurphy 👋

How are you? Do you think you'll find the time picking up this issue again?

kellenmurphy commented 11 months ago

Sure! I can probably get to that next week. 😀

Kellen Murphy @.***


From: Jan Köhler @.> Sent: Thursday, September 28, 2023 9:51:45 AM To: simplesamlphp/SAML-tracer @.> Cc: Kellen Murphy @.>; Mention @.> Subject: Re: [simplesamlphp/SAML-tracer] Manifest V3 update. (PR #80)

Hello @kellenmurphyhttps://github.com/kellenmurphy 👋

How are you? Do you think you'll find the time picking up this issue again?

— Reply to this email directly, view it on GitHubhttps://github.com/simplesamlphp/SAML-tracer/pull/80#issuecomment-1739251224, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHHM43YIFPNKCURY4FIFFVLX4V6HDANCNFSM55AWDX5Q. You are receiving this because you were mentioned.Message ID: @.***>

kellenmurphy commented 11 months ago

@khlr I'm picking this back up this week. I've rebased onto simplesamlphp/main to pick up the recently approved PC, and squashed the previous commits to clean up the PR (and amended the commit message text).

I'm planning to carve out some time this week to thoroughly test this... it's been over a year (!) since I last looked at this so I want to vet this thoroughly.

kellenmurphy commented 11 months ago

@khlr I inadvertently requested review. Disregard. Mis-click. See my last message this isn't ready to review yet.

rileyw commented 1 month ago

Any thoughts on next steps for this PR recognizing that this extension will stop working in Chrome with manifest-v2 extensions will stop working "soon?"

thijskh commented 2 weeks ago

I've given it a test on Chrome and my scenarios seem to work just fine, including several different SAML flows, a WSFED flow and import/export. So that's already looking great 👍

When trying to load the zip built from this PR into Firefox 129 I get an error that the extension is damaged (without meaningful information to me what is exactly wrong).

It might be nice to rebase this PR since there's a (simple) merge conflict now in manifest.json.

tvdijen commented 2 weeks ago

I've taken care of the rebase.. I've also figured out what is wrong with the extension to be able to use it in Firefox. Mozilla provides a web-ext npm-package that can be used to verify your extension and sign it. The tools reports the following issues:

afbeelding

Also see: https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/#Automatic_extension_reloading

tvdijen commented 2 weeks ago

OK, so apparently Chrome stopped using the scripts in v3 and only supports service workers, and Firefox never adopted the service workers and still requires scripts. Firefox will refuse any manifest file that has content it doesn't recognize.. Long story short: I think there's no other solution than to create separate builds for Chrome & Firefox with their own specific manifest.json ...

Update: It is possible to use both! See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support

I can however still not load it in Firefox.. Maybe this is because xpinstall.signatures.required can only be set to false in the developer- & nightly editions of Firefox. I will try this later tonight.

tvdijen commented 2 weeks ago

Ok, second update: I can install the addon in Firefox developer edition. Apparently Firefox doesn't allow disabling signature-checking on regular versions.. Everything works fine, so I think we can just merge this and get it released

tvdijen commented 2 weeks ago

@khlr With your permissions I'm merging this and tagging a new 1.8 release. I understand you have the ability to upload this release to the app stores? I think we should just try it and see what next bump in the road we hit, but I'm fairly confident with it now.

khlr commented 2 weeks ago

I could check out the code tomorrow and test it a bit. Is there any interest? Wouldn't hurt imho. 🤓

tvdijen commented 2 weeks ago

Sure, take your time and test. Just make sure to use Firefox Developer edition.. Chrome is fine with loading unsigned unpacked add-ons.

khlr commented 2 weeks ago

I can't download the Firefox Developer Edition right now. That's why I only looked at it with Chrome by now.

Chrome lists 2 warnings (no errors, “just” warnings"):

  1. 'background.scripts' requires manifest version of 2 or lower.
  2. Unrecognized manifest key 'browser_specific_settings'.

Warning 2 can probably be ignored as Chrome just seems to be unaware of this option. It's not particularly “nice” that it becomes a warning. But we can certainly live with it if you can't somehow teach Chrome not to complain here?

Regarding warning 1: Can't we just drop the line "scripts": ["bootstrap.js"] since it's not required for mv3 extensions anyway?

tvdijen commented 2 weeks ago

Yes it is required.. Firefox never implemented service workers in their implementation of manifest v3. That's the entire point I made in my comments yesterday and the day before.. Also see my screenshot above and this comment.

khlr commented 2 weeks ago

Oh boy... Sorry, I didn't reall take note of that 🫣

khlr commented 2 weeks ago

I just tested it using FF. Looks good, everything seems to run as expected :)

As expected, however, FF ‘warns’ of the unknown background.service_worker... 😉 At some point, FF will surely catch up with Chrome, and hopefully we will no longer have to use the different properties.

From my point of view, there is now nothing to be said against merging this PR 👍