Skip to content

feat: SES lockdown v1.1.0 on Android (Hermes)#8009

Closed
leotm wants to merge 5 commits into
mainfrom
feature/ses-lockdown-hermes
Closed

feat: SES lockdown v1.1.0 on Android (Hermes)#8009
leotm wants to merge 5 commits into
mainfrom
feature/ses-lockdown-hermes

Conversation

@leotm

@leotm leotm commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

Description

SES running on Hermes, follow-up to

Previous async bundling errors (fixed except load) no longer relevant

metamask-mobile/android/app/build/ASSETS/createBundleProdDebugJsAndAssets/index.android.bundle: error: async functions are unsupported
      const loadWithoutErrorAnnotation = async (compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, pendingJobs, moduleLoads, errors) => {

metamask-mobile/android/app/build/ASSETS/createBundleProdDebugJsAndAssets/index.android.bundle: error: async functions are unsupported
      const memoizedLoadWithErrorAnnotation = async (compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, pendingJobs, moduleLoads, errors) => {

metamask-mobile/android/app/build/ASSETS/createBundleProdDebugJsAndAssets/index.android.bundle: error: async functions are unsupported
      const load = async (compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier) => {

mobile/android/app/build/ASSETS/createBundleProdDebugJsAndAssets/index.android.bundle:1233 error: async generators are unsupported
        async function* AsyncGeneratorFunctionInstance() {}

Runtime

  • // assertDirectEvalAvailable(); // SES TypeError
  • // addIntrinsics(tameRegExpConstructor(regExpTaming)); // SES TypeError
  • // addIntrinsics(tameSymbolConstructor()); // Metro exception
  • // addIntrinsics(getAnonymousIntrinsics()); // SES TypeError
  • // completePrototypes(); // SES TypeError
  • // whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction); // SES TypeError
  • // hardenIntrinsics(); // no error, app hangs loading, under investigation

Testing

  • SES enabled on Android/Hermes
  • locally: SES enabled in debug-mode
  • SES ft toggle enabled (default), UI (exp menu) hidden on Android currently
  • Hermes: build from source (custom tarball, new arch) -> bundled Hermes (default)
  • RN bumps: 0.71.14-16->.72.10->.73.4->.74.0(0.74.0-rc.0)->nightly
  • prototype pollution: Object.defineProperty(Object.prototype, 'test', { value: true });

Related issues

Manual testing steps

App functions as normal

yarn watch:clean
yarn start:android # react-native run-android --variant=prodDebug
# cd android
# adb uninstall io.metamask
./gradlew clean # after changes to ses
./gradlew :app:createBundleProdDebugJsAndAssets # bundle only
./gradlew :app:installProdDebug -PreactNativeArchitectures=arm64-v8a # bundle & build

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • 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.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

- Bundling with Metro
  - Gradle task: createBundleProdDebugJsAndAssets
- Building
- Running w/o SES hardenIntrinsics()

Likely revert and start again, too many invasive changes that could be causingn problems elsewhere
@github-actions

github-actions Bot commented Dec 5, 2023

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.

leotm added 2 commits December 5, 2023 16:04
- More minimal
- Less invasive
- Cleaner
- Code comments
@leotm

leotm commented Dec 5, 2023

Copy link
Copy Markdown
Contributor Author

prev initial iteration: 9f4d987

current: 6de1055

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@codecov-commenter

codecov-commenter commented Dec 19, 2023

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.47%. Comparing base (667d8c8) to head (b7fd07c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8009   +/-   ##
=======================================
  Coverage   41.47%   41.47%           
=======================================
  Files        1263     1263           
  Lines       30605    30605           
  Branches     3008     3008           
=======================================
  Hits        12694    12694           
  Misses      17157    17157           
  Partials      754      754           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@leotm leotm changed the title feat: SES lockdown v0.18.8 (Android Hermes) feat: SES lockdown v1.1.0 (Android Hermes) Feb 23, 2024
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues

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

See analysis details on SonarCloud

@leotm leotm changed the title feat: SES lockdown v1.1.0 (Android Hermes) feat: SES lockdown v1.1.0 on Android (Hermes) Feb 26, 2024
@github-actions

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 May 26, 2024
@github-actions

github-actions Bot commented Jun 2, 2024

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 Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Issues that have not had activity in the last 90 days team-lavamoat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants