Skip to content

Conversation

@rekmarks
Copy link
Member

Summary

Move console message forwarding functionality from the extension package to @metamask/kernel-browser-runtime as reusable utilities. This enables log capture from offscreen documents and other contexts via DuplexStream.

Changes

  • Create console-forwarding utilities with types and validators in kernel-browser-runtime
  • Update extension to import console-forwarding functions and types from kernel-browser-runtime
  • Add new exports to kernel-browser-runtime index for:
    • ConsoleForwardMessage type
    • isConsoleForwardMessage type guard
    • makeConsoleForwardingValidator factory function
    • setupConsoleForwarding function
    • handleConsoleForwardMessage function

Benefits

  • Eliminates code duplication between extension and other potential consumers
  • Makes console forwarding reusable across different packages
  • Enables log capture from contexts not directly accessible by Playwright (like offscreen documents)

Test Plan

  • kernel-browser-runtime tests pass (including new export validation)
  • extension imports work correctly
  • Console forwarding still works as expected

🤖 Generated with Claude Code

rekmarks and others added 5 commits January 20, 2026 14:23
…e tests

Add log capture for background service worker, offscreen document, and
popup page console output during e2e tests. Logs are written to a
timestamped file in <package>/logs/ and the path is attached to
Playwright test results for easy access.

Co-Authored-By: Claude <noreply@anthropic.com>
…ames

Log files are now named with a run ID (timestamp of Playwright invocation)
and test name to allow grouping logs from the same test run and easily
identifying which test produced which logs.

Format: <runId>-<testName>.log

Co-Authored-By: Claude <noreply@anthropic.com>
Update yarn constraints to enforce ./logs in all workspace clean scripts,
ensuring e2e test log files are cleaned up with other build artifacts.

Co-Authored-By: Claude <noreply@anthropic.com>
Move console message forwarding functionality from the extension package to
@metamask/kernel-browser-runtime as reusable utilities. This enables log
capture from offscreen documents and other contexts via DuplexStream.

- Create console-forwarding utilities with types and validators
- Update extension to import from kernel-browser-runtime
- Add console-forwarding exports to kernel-browser-runtime index

Co-Authored-By: Claude <noreply@anthropic.com>
@rekmarks rekmarks force-pushed the rekm/playwright-console-logs branch from 382c044 to cad4772 Compare January 20, 2026 22:29
@socket-security
Copy link

socket-security bot commented Jan 20, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​playwright/​test@​1.54.2 ⏵ 1.57.010010010099100
Updatedplaywright@​1.54.2 ⏵ 1.57.0100100 +1610099100

View full report

@socket-security
Copy link

socket-security bot commented Jan 20, 2026

Warning

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Warn Low
Potential code anomaly (AI signal): npm playwright-core is 100.0% likely to have a medium risk anomaly

Notes: This is a legitimate browser installation helper script that is part of Microsoft Playwright's testing framework. The script downloads and installs Microsoft Edge Dev browser packages on macOS systems. While the script does have security weaknesses (downloads packages from user-supplied URLs without integrity checks and installs them with sudo privileges), this appears to be intentional functionality for automated testing environments where the URL would be controlled and trusted. The script is not malware but rather a utility for test automation that assumes it will be used in controlled environments with trusted package sources.

Confidence: 1.00

Severity: 0.60

From: ?npm/playwright@1.57.0npm/playwright-core@1.57.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: 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@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/playwright-core@1.57.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Ignoring alerts on:

  • playwright@1.57.0

View full report

@rekmarks
Copy link
Member Author

@SocketSecurity ignore npm/playwright@1.57.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants