-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox 49 works with my signed WebDriver but it does not with Selenium's unsigned one #2942
Comments
Please read this comment it explains how to sign your webdriver without passing Mozilla's code review. Sorry for making another bug since I think that people don't look at closed issues. |
@andreicristianpetcu if you replace the webdriver.xpi in the standalone.jar (it's basically a zip file, you can unpack and re-zip up). You'll be able to run with your own customized extension instead. @AutomatedTester @andreastt @davehunt is this an acceptable method to bypass mozilla's extension signing and do it ourselves? from the other issue comment: You don't need Mozilla's review in order to get the addon signed. Change the UUID in install.rdf of the addon to a new generated value and run JPM sign like so. <Description RDF:about="urn:mozilla:install-manifest" em:id="{681B9050-93CA-11E6-827B-DB5CC7AD2208}" jpm sign --api-key $MY_AMO_API_KEY_COPIED_FROM_AMO --api-secret $MY_AMO_API_SECRET_COPIED_FROM_AMO --xpi firefox-driver.xpi |
I'll leave others to comment of if we should do this, but I doubt there will be any support from Mozilla or Selenium if the legacy FirefoxDriver is broken by changes in Firefox releases. All effort is now going into Marionette and GeckoDriver. |
@lukeis replacing it does not work :( If I delete webdriver.xpi I get no error and each new run will still have it. It must be somewhere in some cache, profile or something. If I delete the file from node-modules I should get an error but I don't. @davehunt I know time working on Free Software projects is very little and should not be wasted but this is a popular issue (it's put in the template of all the new issues) and it can be fixed in 10 minutes. This is not an API change. The file only needs to get signed, it's a trivial operation. From what I understand FirefoxDriver is the stable and GeckoDriver is the beta. Lots of people are using FirefoxDriver still. This is not bypassing Mozilla's addons signature, it's using Mozilla's addon signature. This is not a trick or a hack. Mozilla supports unlisted addons for quite some time now. There are APIs for this. Mozilla cares only about addon integrity for unlisted addons. You can do whatever you want in the addon if it unlisted, you only need to sign it. It's a small requirement. |
If its using jpm then it should be fine to do. I want to make something explicitly clear on this though, since Mozilla has put a lot of effort into the specification and getting GeckoDriver up to speed, that if we do this and FirefoxDriver stops working, which could happen at the release of 50, Mozilla won't be putting any effort into fixing it and neither will the Selenium project. This will have to be wholly community driven. |
@andreicristianpetcu so... it's not working for me... getting a weird error: jpm sign --api-key $AMO_API_KEY --api-secret $AMO_API_SECRET --xpi build/javascript/firefox-driver/webdriver.xpi that temp folder doesn't exist... no idea where it's going wrong. |
strange...... jpm is a nodejs tool..... try running it with node-debug or node-inspector. For me it worked fine. I signed several unmaintained addons this way |
i tried a few steps in with node debug... and I'm not familiar enough with jpm to understand where to step into. So, I logged a bug with them and hopefully someone there knows more. I'm hoping for some simple user error on my part :) |
@lukeis Are you trying to sign v3.0.0? Why not try v2.53.x? I signed v2.53.0 I think and it worked.... |
Why would I try signing the old version? Also there should be much / anything different with the one in 3.0 |
The current stable works with 2.53.0 right? 3.0 is beta. Am I wrong? This is a bug with the current issue, not a feature request. |
3.0 is not beta anymore , we released 3.0.0 (and 3.0.1) |
I signed this new extension and here is how I did it. |
@lukeis if you manage to sign the extenssion, please put |
@lukeis I'm replying you here for this comment. Please create the initial xpi file with another tool. Or unzip it and rezip it again with something else. This worked for me. What zipping tool are you using? What OS? It's obvious that decompress-zip works with some zips and not with all. Maybe it is a compression leve thing issue. |
we are using java :) (well 'jar') https://github.com/SeleniumHQ/selenium/blob/master/rake-tasks/zip.rb#L42 |
oops, wrong one.. this is the one that's used for xpi's https://github.com/SeleniumHQ/selenium/blob/master/rake-tasks/crazy_fun/mappings/common.rb#L195 |
Should I guess the OS that are you using? :) What JDK, architecture? |
So you are using rake, to call jar, to make a zip. I will investigate this when I have time. I'm no guru in rake :) |
the build system is called crazy-fun :) which happens to be the former and much less the latter. |
Is there any documentation on building the extension with the current rake build system? I want to try a ruby-native zipping instead of jar. |
I created a rakefile that zips the contents of the folder using pure ruby. It's still a work in progress but I hope that I will be able to get rid of the jar dependency and have a working, signable archive. require 'rake/packagetask'
require 'zip/zip'
namespace :my_namespace do
def zip(src, dest)
path = src
path.sub!(%r[/$],'')
archive = File.join(path,File.basename(path))+'.zip'
archive = dest
FileUtils.rm archive, :force=>true
puts "Making archive " + archive
Zip::ZipFile.open(archive, 'w') do |zipfile|
Dir["#{path}/**/**"].reject{|f|f==archive}.each do |file|
zipfile.add(file.sub(path+'/',''),file)
end
end
end
desc "Make xpi"
task :make_xpi do
puts "Making a Firefox extension file"
zip("firefox_webdriver-3.0.0-fx.xpi_FILES", "firefox_webdriver-3.0.0-fx.xpi")
end
end Right now signing fails with this error: $jpm sign --api-key $AMO_API_KEY --api-secret $AMO_API_SECRET --xpi firefox_webdriver-3.0.0-fx.xpi
JPM [info] Signing XPI: firefox_webdriver-3.0.0-fx.xpi
Server response: Invalid archive. (status: 400)
JPM [info] FAIL |
I'm giving up. I see very little effort from Selenium devs to fix this. Your build process is too complicated for me. I signed 2 addons of yours to show you how and you can sign each new release manually. It takes 1 minute. It does not need to be part of the build system. Selenium devs have little interest for their Firefox users. I know, I know future versions will work with marionette or geckodriver or whatever but until then latest stable Firefox does not work with latest stable Selenium and it's a 1 minute manual job for each release in order for this to work. It has been so since August and there was very little effort to fix this. I know working on Free Software projects is hard and everybody wants you do implement their "very important" feature but I think this was quite important for a lot of people. You can close this ticket if you want. Sorry I don't have more time to invest in this. |
@andreicristianpetcu following your lead I was able to get this working. The patch for creating the XPI is: diff --git a/rake-tasks/crazy_fun/mappings/common.rb b/rake-tasks/crazy_fun/mappings/common.rb
index 523d8e7..f267c22 100644
--- a/rake-tasks/crazy_fun/mappings/common.rb
+++ b/rake-tasks/crazy_fun/mappings/common.rb
@@ -1,4 +1,3 @@
-
# Modify String to add start_with and end_with methods
if (!"".methods.include? :start_with)
class String
@@ -187,14 +186,20 @@ class Tasks
end
end
- def zip(src, dest)
- out = Platform.path_for(File.expand_path(dest))
- Dir.chdir(src) {
- # TODO(jari): something very weird going on here on windows
- # the 2>&1 is needed for some reason
- ok = system(%{jar cMf "#{out}" * 2>&1})
- ok or raise "could not zip #{src} => #{dest}"
- }
+ def zip(path, dest)
+ gem 'rubyzip'
+ require 'zip/zip'
+ require 'zip/zipfilesystem'
+
+ path.sub!(%r[/$], '')
+ archive = Platform.path_for(File.expand_path(dest))
+ FileUtils.rm archive, :force=>true
+
+ Zip::ZipFile.open(archive, 'w') do |zipfile|
+ Dir["#{path}/**/**"].reject{|f|f==archive}.each do |file|
+ zipfile.add(file.sub(path+'/', ''), file)
+ end
+ end
end
def to_filelist(dir, src) I generated a unique UUID and use my own AMO credentials to then sign the extension: $ jpm sign --api-key <KEY> --api-secret <SECRET> --xpi build/javascript/firefox-driver/webdriver.xpi
JPM [info] Signing XPI: build/javascript/firefox-driver/webdriver.xpi
Validating add-on [...............................................................................................................................................................................]
Validation results: https://addons.mozilla.org/en-US/developers/upload/7a9a98e5699a477392d247dd5881877c
Downloading signed files: 100%
Downloaded:
./firefox_webdriver-3.0.1-fx.xpi
JPM [info] SUCCESS I think it would be great to get this into the next release. I do think we should make it clear that this is not the recommended approach, and that any issues encountered using Firefox 48+ without geckodriver would likely not be resolved. So what remains is:
I'm happy to help, however I'm not sure how much time I can commit. |
Thank you @davehunt I'm glad you are interested in this. What makes you think this is not a recommended way? Is geckodriver stable and fully functional? My understanding is that webdriver is stable and geckodriver is beta. Lastpass is a popular Firefox addon that is signed but unlisted, just as I propose webdriver should be until geckodriver has all the features that webdriver has. Mozilla supports unlisted addons. |
@andreicristianpetcu I just spotted this issue and immediately tried to get a signed 3.4 xpi myself. But that seems not to work anymore since it uses legacy API and is not a WebExtension. Is there still a way to get a signed 3.4 xpi that works with 53.0 or at least the latest ESR? |
@phoenix384 You can't sign a new legacy addon. You can create a new WebExtension and "upgrade" it to a legacy addon :D. The most trivial webextension is a zipped manifest.json. It needs to have a new guuid. After you signed the webextension then upload a "new version" for signing that is the legacy one with the webextension's uuid and a different version. If you have issues I can help. This is tested and it works. |
That worked. Thank you |
@phoenix384 Glad it worked :) |
Yes I do. I took the webdriver.xpi from the Java lib .jar, signed it and put it to a folder of the project and started Firefox with |
Hello, |
@masterseo2000 this is to conform with the suggestion in the WebDriver specification's security considerations:
|
Please read the issue an not mark it as duplicate of #2559
Meta -
OS:
Ubuntu 16.04
Selenium Version:
2.53.1
Browser:
Firefox
Browser Version:
49.0 (64-bit)
Expected Behavior -
Firefox 48+ should work with Selenium's WebDriver just as it works with my signed WebDriver
Actual Behavior -
Selenium replaces my WebDriver which works with v49 with the unsigned one which does not work with Firefox v48+
Steps to reproduce -
Install my signed web driver and start Protractor or Selenium.
The text was updated successfully, but these errors were encountered: