Skip to content
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

Update README.md to talk about non-root user for firefox per #938 in the github-action repo #900

Merged
merged 9 commits into from
Aug 15, 2023

Conversation

alexjyong
Copy link
Contributor

Per the discussion here

And here

I have been asked to move my changes from the first link into this PR here to help others troubleshoot potential issues when using firefox in these images.

@CLAassistant
Copy link

CLAassistant commented Jun 14, 2023

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link

@MikeMcC399
Copy link
Collaborator

@alexjyong

I suggest to include the error messages into your text:

Browser: firefox was not found on your system or is not supported by Cypress.
Can't run because you've entered an invalid browser name.

@alexjyong
Copy link
Contributor Author

alexjyong commented Jun 14, 2023 via email

@alexjyong
Copy link
Contributor Author

@MikeMcC399 added in the error message per your request. :)

@MikeMcC399
Copy link
Collaborator

  • https://bugzilla.mozilla.org/show_bug.cgi?id=1460297 confirms that Mozilla Firefox blocks running as root user due to their security considerations
  • I'm not sure that user 1001 is a general case, although it does fit the bill of being a non-root user. On GitHub actions, a regular workflow (with no container specified) runs under the user 1001 (runner), group 123 (docker). If a Docker container is specified, then it runs by default under user 0 (root), group 0 (root), which will not work with Firefox.

I couldn't find documentation for the GitHub runner internals, so I have just been experimenting and looking at the code to find out a bit more.

@MikeMcC399
Copy link
Collaborator

MikeMcC399 commented Jun 23, 2023

@alexjyong

Do you know if this issue only appears when using a Cypress Docker container with GitHub Actions or does it also happen with other CI providers which can work with Docker containers?

I am slowly beginning to understand it a bit better!

On GitHub Actions if the default root user is used, then Cypress tries to get the version of Firefox installed using
firefox --version and apparently receives nothing back, although if firefox --version is executed stand-alone, it responds with:

Running Firefox as root in a regular user's session is not supported. ($HOME is /github/home which is owned by uid 1001.)

It does not pass this message on, and instead reports:

Can't run because you've entered an invalid browser name.

Browser: firefox was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:

  • electron
  • chrome
  • chromium
  • chrome:canary
  • edge
  • firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:

  • chrome
  • electron

I would now like to submit a bug report against Cypress for this incorrect error message. Edit: I changed it to a feature request instead, which is just a question of priority.

@MikeMcC399
Copy link
Collaborator

@alexjyong
Copy link
Contributor Author

Do you know if this issue only appears when using a Cypress Docker container with GitHub Actions or does it also happen with other CI providers which can work with Docker containers?

Not sure. I've only tried it with Cypress Docker and Github Actions. But I presume it would happen with other CI providers as well.

@mschile mschile assigned cacieprins and unassigned mschile Jun 23, 2023
@alexjyong
Copy link
Contributor Author

Any updates needed from me on this?

README.md Outdated Show resolved Hide resolved
@alexjyong
Copy link
Contributor Author

Added in your suggestion @MikeMcC399

@MikeMcC399
Copy link
Collaborator

MikeMcC399 commented Jun 28, 2023

@alexjyong

I've been looking at this in the background and Firefox is quite curious. Sometimes it will actually run under a root user in a Docker container! The advice to add the options: --user 1001 is fine though, since that always works.

It should work on

cypress/base:latest
cypress/browsers:latest
cypress/included:latest

however due to issue #893 cypress/base:latest is broken as far as running under GitHub Actions is concerned. I did test it on an earlier version cypress/base:16.13.2 though where it does work.

Edit: The various tests I did are in https://github.com/MikeMcC399/cy-firefox-docker

I think it is fine to go ahead with this PR. It should help Firefox / Docker users.

README.md Outdated Show resolved Hide resolved
@alexjyong
Copy link
Contributor Author

Hello! Anything else needed from me on this?

@nagash77 nagash77 merged commit 66da716 into cypress-io:master Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants