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

[Bug]: '"Cypress.app" is damaged and can't be opened.' error on mac. #43

Closed
mikelikespie opened this issue Jul 18, 2023 · 4 comments · Fixed by #55
Closed

[Bug]: '"Cypress.app" is damaged and can't be opened.' error on mac. #43

mikelikespie opened this issue Jul 18, 2023 · 4 comments · Fixed by #55
Labels
bug Something isn't working untriaged Requires traige

Comments

@mikelikespie
Copy link

What happened?

When running a cypress test on macos, I am seeing a security error that won't let the app being run from the command line (without a pretty intrusive workaround).

This error comes up when running a cypress test and doesn't
Screenshot 2023-07-17 at 5 09 52 PM

This appears in settings. One can work around it by hitting the "Open Anyway" button, but that isn't really tenable for having other engineers do it.
Screenshot 2023-07-17 at 5 11 23 PM

Version

Development (host) and target OS/architectures:
m1 mac
macos 13.4.1 (c) (22F770820d)

Output of bazel --version:
saw in both bazel 6.2.0 and aspect 5.2.1 (from rules_cypress clone)

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

* Clone rules_cypress
* run `bazel test //cypress/tests/cli_test:cli_test`
* It hangs and you see app is damaged warning (see screenshot above)

Any other information?

No response

@mikelikespie mikelikespie added the bug Something isn't working label Jul 18, 2023
@github-actions github-actions bot added the untriaged Requires traige label Jul 18, 2023
@mrmeku
Copy link
Contributor

mrmeku commented Jul 18, 2023

Yeah I hear you @mikelikespie. I'm honestly not sure how to fix this from within the bazel rule since this is a operating system level security setting. If you have any ideas of what can be done to address this in code please let me know and I'll implement it. But I'm sort of stuck at the ideation phase

@doncollins
Copy link

doncollins commented Jul 22, 2023

I encountered this problem as well and, after some experimentation, came to the conclusion that macOS refuses to run the binary because the copying that's done here mangles the internal structure of the Cypress.app binary directory in some way so that macOS doesn't like it anymore, possibly by dereferencing symlinks instead of preserving them as symlinks.

We're working around this for now by patching BUILD.cypress to just use a filegroup instead of copy_directory. That causes macOS to run the binary without complaint (but going by the comment on that file, I assume that that will break RBE).

Do you think there's a way to copy it while keeping it intact enough to satisfy macOS?

@mrmeku
Copy link
Contributor

mrmeku commented Jul 23, 2023

That's a wonderful discovery! That gives me something to play around with at least. We can try a couple things to start

  1. Using experimental hardlinks via a bazel flag
  2. Copying a parent directory rather than the Cypress.app directory
  3. Not copying on Mac OS (and giving up the ability to do RBE on Mac remote executors)

I'll run some experiments and see which option works. In the worst case, it seems like you've proven that #3 works :)

@KatSick
Copy link

KatSick commented Oct 19, 2023

here is a minimal reproduce for the issue https://github.com/KatSick/rules_cypress_bug_macos
not sure it is needed (discovered issue after creating the repo :) )

jbedard pushed a commit that referenced this issue Oct 25, 2023
jbedard added a commit that referenced this issue Oct 25, 2023
jbedard added a commit that referenced this issue Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants