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

fix: Fix LavaMoat build failures and restore RegExp OOM mitigation #29637

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jan 10, 2025

Description

LavaMoat was updated recently, but the patch we had of lavamoat-core was not updated with it. This restores the changes made in that patch.

Note that the old patch still exists because we're still using the older version of lavamoat-core for the lavamoat-viz tool.

The patch had three changes; the third was upstreamed already so it was not required, but the first two (RegExp cache and skipping policy write) were still required.
Open in GitHub Codespaces

Related issues

Fixes #29482

Manual testing steps

There is no consistent way to test the intermittent build failure issue, though we could try running this over and over.

For the RegExp cache, we never had a clear reproduction for the OOM error that was meant to mitigate either.

Screenshots/Recordings

N/A

Pre-merge author checklist

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

socket-security bot commented Jan 10, 2025

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

🚮 Removed packages: npm/[email protected]

View full report↗︎

LavaMoat was updated recently, but the patch we had of `lavamoat-core`
was not updated with it. This restores the changes made in that patch.

Note that the old patch still exists because we're still using the
older version of `lavamoat-core` for the `lavamoat-viz` tool.

The patch had three changes; the third was upstreamed already so it was
not required, but the first two (RegExp cache and skipping policy
write) were still required.

Fixes #29482
@Gudahtt Gudahtt force-pushed the migrate-lavamoat-patch branch from bf515a9 to b431bc0 Compare January 10, 2025 16:53
opts.scuttlerFunc = globalRef[opts.scuttlerName]
}
+
+ // cache regular expressions to work around https://github.com/MetaMask/metamask-extension/issues/21006
Copy link
Member Author

Choose a reason for hiding this comment

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

The scuttling logic was refactored between these releases; it used to be in kernelCoreTempalte, but in v16 it was moved to scuttle.js. I had to move this cache along with it.

@Gudahtt
Copy link
Member Author

Gudahtt commented Jan 10, 2025

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@Gudahtt Gudahtt marked this pull request as ready for review January 10, 2025 18:15
@Gudahtt Gudahtt requested review from a team as code owners January 10, 2025 18:15
@Gudahtt Gudahtt added team-extension-platform team-lavamoat needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jan 10, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [9d023d4]
Page Load Metrics (1770 ± 98 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint46921961699346166
domContentLoaded14932151173619292
load15012166177020398
domInteractive228039188
backgroundConnect982322311
firstReactRender1692452813
getState56519199
initialActions01000
loadScripts10621620129416680
setupStore65212126
uiStartup173025752059255122
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Gudahtt Gudahtt enabled auto-merge January 13, 2025 13:30
@Gudahtt Gudahtt added this pull request to the merge queue Jan 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 13, 2025
@Gudahtt Gudahtt added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit 9344d0a Jan 13, 2025
85 checks passed
@Gudahtt Gudahtt deleted the migrate-lavamoat-patch branch January 13, 2025 15:40
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 13, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2025
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Jan 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-extension-platform team-lavamoat team-wallet-framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: Flaky LavaMoat build policy failures
4 participants