Skip to content

chore: Add packages introduced by rn-nodeify as dependencies; fix rn-nodeify install - #9396

Closed
legobeat wants to merge 10 commits into
mainfrom
fix-rn-nodeify-install
Closed

legobeat wants to merge 10 commits into
mainfrom
fix-rn-nodeify-install

Conversation

@legobeat

@legobeat legobeat commented Apr 25, 2024 •

Copy link
Copy Markdown
Contributor

Description

This is the current behavior AIUI:

  • yarn setup calls rn-nodeify --install crypto,buffer,react-native-randombytes,vm,stream,http,https,os,url,net,fs --hack
  • This installs a bunch of packages using npm install.
  • However, this is not visible in yarn.lock due to the usage of npm instead of yarn.

The changes in this PR:

  • The --yarn flag is added to the invocation of rn-nodeify, so that any packages added are also made present in lockfile.
  • The packages added by rn-nodeify have been added as dependencies and the changes made to the manifest applied.
  • rn-nodeify is now run after patch-package instead of before, in order to have any patches made to rn-nodeify or any of its dependencies be effective.
  • A new validation step in yarn setup will exit with error if rn-nodeify introduces any new dependencies not already declared.

Out of scope

  • I have not done any assessment as to which if any of these packages/patches/polyfills are actually still required. In any case, this aims to capture what is already pulled in.
  • Some of the packages introduced here have newer versions available and look like they could/should be updated. Leaving that to be addressed as follow-up.
  • rn-nodeify seems unmaintained and haven't seen updates in years. We could just remove the install part entirely once this has been committed. Also saving for a follow-up.

Related issues

Manual testing steps

  • Run yarn setup
  • Build and run mobile app

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@legobeat legobeat added dependencies Pull requests that update a dependency file team-application-security Application security team labels Apr 25, 2024
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@socket-security

socket-security Bot commented Apr 25, 2024 •

Copy link
Copy Markdown

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/browserify-zlib@0.1.4 None +1 884 kB devongovett
npm/dns.js@1.0.1 network 0 15.5 kB indutny
npm/path-browserify@0.0.0 None 0 7.94 kB substack
npm/react-native-udp@2.7.0 None +2 300 kB tenaciousmv
npm/timers-browserify@1.4.2 None 0 20.8 kB jryans

View full report↗︎

@socket-security

socket-security Bot commented Apr 25, 2024 •

Copy link
Copy Markdown

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/dns.js@1.0.1

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

Comment thread scripts/setup.mjs Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this comment in place as the current approach could still be improved.

@legobeat

Copy link
Copy Markdown
Contributor Author
@SocketSecurity ignore npm/dns.js@1.0.1

not typosquatting; network access ok

@github-actions

github-actions Bot commented Apr 25, 2024 •

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 8f3c42a258f759834a2215e8bb2b2f92510e6cf0
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c9ee4f5b-fcf4-42ee-8574-2b012ab62809

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@legobeat
legobeat marked this pull request as ready for review April 25, 2024 01:48
@legobeat
legobeat requested a review from a team as a code owner April 25, 2024 01:48
@legobeat legobeat mentioned this pull request Apr 25, 2024
5 of 8 tasks
@legobeat
legobeat requested a review from rickycodes April 25, 2024 01:52
this is so that any patches applied to rn-nodeify or any of its
dependencies get applied proeprly.
These were added by rn-nodeify but not visible in lockfile because it
used npm instead yarn to do so.

This adds the changes made by rn-nodeify to source-control and the
installed packages as dependencies.
@legobeat
legobeat force-pushed the fix-rn-nodeify-install branch from 8f3c42a to effabf7 Compare April 25, 2024 17:32
@legobeat legobeat added the DO-NOT-MERGE Pull requests that should not be merged label May 1, 2024
@sonarqubecloud

sonarqubecloud Bot commented May 1, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@rickycodes
rickycodes removed their request for review June 6, 2024 22:18
@legobeat
legobeat marked this pull request as draft June 11, 2024 05:10
@github-actions

github-actions Bot commented Sep 9, 2024

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

@github-actions github-actions Bot added the stale Issues that have not had activity in the last 90 days label Sep 9, 2024
@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed because there has been no follow up activity in 7 days. Thank you for your contributions.

@github-actions github-actions Bot closed this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file DO-NOT-MERGE Pull requests that should not be merged needs-research stale Issues that have not had activity in the last 90 days team-application-security Application security team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant