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

feat: SES lockdown v1.0.0 (Android Hermes) #8161

Conversation

leotm
Copy link
Member

@leotm leotm commented Dec 19, 2023

Description

packages/ses/src/module-load.js

packages/ses/src/get-anonymous-intrinsics.js

  • Refactor to exclude various Async parts

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

Related issues

Manual testing steps

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.

Copy link
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 leotm force-pushed the feature/ses-1.0.0-mod-lockdown-hermes branch from 3569ff3 to d8c6ce4 Compare December 19, 2023 16:30
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (feature/ses-1.0.0-lockdown-hermes@345ac1e). Click here to learn what that means.

Additional details and impacted files
@@                         Coverage Diff                          @@
##             feature/ses-1.0.0-lockdown-hermes    #8161   +/-   ##
====================================================================
  Coverage                                     ?   39.46%           
====================================================================
  Files                                        ?     1227           
  Lines                                        ?    29796           
  Branches                                     ?     2833           
====================================================================
  Hits                                         ?    11759           
  Misses                                       ?    17345           
  Partials                                     ?      692           

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

@leotm leotm force-pushed the feature/ses-1.0.0-mod-lockdown-hermes branch from d5356d7 to 85c5041 Compare December 19, 2023 17:53
@@ -7663,7 +7663,7 @@ function tameErrorConstructor(
})()
,
// === functors[38] ===
({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let ReferenceError,TypeError,Map,Set,arrayJoin,arrayMap,arrayPush,create,freeze,mapGet,mapHas,mapSet,setAdd,promiseCatch,promiseThen,values,weakmapGet,assert;$h‍_imports([["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["promiseCatch", [$h‍_a => (promiseCatch = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]);
({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let ReferenceError,TypeError,Map,Set,arrayJoin,arrayMap,arrayPush,create,freeze,mapGet,mapHas,mapSet,setAdd,promiseThen,values,weakmapGet,assert;$h‍_imports([["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]);

Copy link
Member Author

@leotm leotm Dec 20, 2023

Choose a reason for hiding this comment

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

only promiseCatch removed in refactor

Copy link

sonarcloud bot commented Dec 20, 2023

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

@leotm leotm changed the title feat: SES lockdown v1.0.0 (Android Hermes) feat: SES lockdown v1.1.0 (Android Hermes) Feb 23, 2024
@leotm leotm changed the title feat: SES lockdown v1.1.0 (Android Hermes) feat: SES lockdown v1.0.0 (Android Hermes) Feb 23, 2024
@leotm
Copy link
Member Author

leotm commented Feb 26, 2024

closing as async/await to Promises refactors not needed

move following changes into #8009 (now on latest ses@1.1.0)

@leotm leotm closed this Feb 26, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2024
@leotm leotm added the android Android specific issue label Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
android Android specific issue team-lavamoat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants