Skip to content

fix(wework): compile browser data clearing on Windows - #2473

Merged
qdaxb merged 4 commits into
mainfrom
fix/windows-webview2-data-clearing
Aug 6, 2026
Merged

qdaxb merged 4 commits into
mainfrom
fix/windows-webview2-data-clearing

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • fix the Windows WebView2 data-clearing callback to preserve the required windows::core::Result boundary
  • add a Windows Rust check for Wework src-tauri changes before packaging
  • classify the check separately as wework_rust so TypeScript-only Wework changes do not run it

Root cause

The WebView2 completion callback inferred webview2_com::Error while the application completion channel uses String, causing Windows-only E0277 and E0308 compilation failures during the release bundle build.

Validation

  • cargo check in wework/src-tauri
  • cargo test data_clearing --lib in wework/src-tauri
  • rustfmt --edition 2021 --check wework/src-tauri/src/embedded_browser/data_clearing.rs
  • bash .github/scripts/test-classify-ci-changes.sh
  • actionlint .github/workflows/test.yml

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows browsing-data clearing callback handling while preserving existing completion and error behavior.
  • Chores

    • Added dedicated Windows Rust validation to CI, including dependency caching and locked checks.
    • Updated change detection so Rust-specific updates trigger the appropriate validation workflows.
    • Expanded automated tests to cover the new change classification and CI checks.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@qdaxb, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e232397-fee7-4146-8424-c1be0345b257

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5b387 and e1f2096.

📒 Files selected for processing (1)
  • wework/src-tauri/src/embedded_browser/data_clearing.rs
📝 Walkthrough

Walkthrough

The PR adds wework_rust change detection, a conditional Windows Rust CI job, test-summary validation, and explicit Windows callback result typing.

Changes

Wework Windows Rust validation

Layer / File(s) Summary
Rust change classification
.github/scripts/classify-ci-changes.sh, .github/scripts/test-classify-ci-changes.sh
The classifier tracks and emits wework_rust. Tests cover Rust changes under wework/src-tauri and expected false outputs.
Windows Rust CI check
.github/workflows/test.yml, wework/src-tauri/src/embedded_browser/data_clearing.rs
The workflow runs a conditional locked Windows cargo check and validates it in the test summary. The Windows completion handler uses explicit windows::core::Result<()> types.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Classifier
  participant GitHubActions
  participant Cargo
  Classifier->>GitHubActions: Emit wework_rust
  GitHubActions->>Cargo: Run locked cargo check on Windows
  Cargo-->>GitHubActions: Return check result
  GitHubActions->>GitHubActions: Validate result in test summary
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing Windows compilation for Wework browser data clearing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-webview2-data-clearing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qdaxb
qdaxb marked this pull request as ready for review August 6, 2026 14:41
@qdaxb
qdaxb enabled auto-merge August 6, 2026 14:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Around line 400-401: Update the job containing the Rust compilation step to
set permissions to contents: read, and configure the actions/checkout@v4 step
with persist-credentials: false. Preserve the existing checkout behavior while
preventing untrusted build scripts or macros from accessing persisted
credentials.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d862505-e682-4061-aa98-3a54a414306a

📥 Commits

Reviewing files that changed from the base of the PR and between 6b601d8 and 9c5b387.

📒 Files selected for processing (4)
  • .github/scripts/classify-ci-changes.sh
  • .github/scripts/test-classify-ci-changes.sh
  • .github/workflows/test.yml
  • wework/src-tauri/src/embedded_browser/data_clearing.rs

Comment on lines +400 to +401
- name: Checkout code
uses: actions/checkout@v4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow outline matching lines =="
if [ -f .github/workflows/test.yml ]; then
  wc -l .github/workflows/test.yml
  sed -n '360,430p' .github/workflows/test.yml
  echo "== workflow trigger and permissions nearby =="
  sed -n '1,80p' .github/workflows/test.yml
else
  echo ".github/workflows/test.yml not found"
  git ls-files .github/workflows
fi

echo "== checkout usages in workflow =="
rg -n "actions/checkout|persist-credentials|permissions:|contents:|cargo check|wework_rust" .github/workflows/test.yml || true

Repository: wecode-ai/Wegent

Length of output: 5693


🌐 Web query:

actions/checkout persist-credentials default true README

💡 Result:

In the actions/checkout GitHub Action, the persist-credentials input determines whether the authentication token or SSH key used for the checkout is configured with the local git config [1][2][3]. Key details include: - Default Value: The default is true [1][2][3]. - Functionality: When set to true, the action configures the local git environment with the necessary credentials, allowing your workflow steps to execute authenticated git commands (e.g., git push or git pull) without additional manual configuration [1][4][3]. - Security: Credentials are automatically removed during the post-job cleanup process [1][4][3]. Recent updates have improved security by storing these credentials in a file under $RUNNER_TEMP rather than directly within the.git/config file [5][6]. - Opt-out: You can disable this behavior by setting persist-credentials to false [1][4][3]. This is recommended if you do not need to run authenticated git commands in subsequent steps or wish to manage credentials manually [1][4][3].

Citations:


🌐 Web query:

GitHub Actions GITHUB_TOKEN permissions persisted credentials Rust build scripts procedural macros unsafe code documentation

💡 Result:

In the context of GitHub Actions and Rust development, the primary security concern involves the potential for malicious code execution during the compilation phase to access and exfiltrate sensitive environment credentials, such as the GITHUB_TOKEN [1]. Key Security Considerations: 1. GITHUB_TOKEN Permissions: GitHub Actions automatically provides a short-lived GITHUB_TOKEN for every job [2][3]. By default, this token may have broad permissions depending on repository settings [4][5]. To mitigate risk, you should follow the principle of least privilege: - Set default permissions to read-only at the organization or repository level [5][6]. - Use the permissions key in your workflow YAML to explicitly grant only the necessary permissions for each job [3][7][8]. - Use permissions: {} at the workflow level to disable all permissions by default, then elevate them only as required for specific jobs [4][8]. 2. Rust Build Scripts and Procedural Macros: Both build.rs scripts and procedural macros are executed at compile time by the host machine (the CI runner) with the same privileges as the cargo process [9][1]. If a dependency in your project includes malicious code within these components, it can execute arbitrary commands in your CI environment [1]. This allows it to: - Access environment variables, including the GITHUB_TOKEN and other secrets [1]. - Exfiltrate source code or sensitive data [1]. - Inject backdoors or malicious logic into your project [1]. 3. Mitigation Strategies: - Audit Dependencies: Because procedural macros run during compilation, they are essentially privileged dependencies [1]. Consider using tools like cargo-vet to manage and audit the security of your dependencies, especially those that include procedural macros [1]. - Isolate CI Runners: Avoid using CI runners that have access to production credentials for building untrusted or unverified code [1]. - Limit Exposure: Minimize the scope of the GITHUB_TOKEN to prevent attackers from using it to modify repository contents or publish releases if a build script or macro is compromised [4][8]. - Review Build Scripts: Manually review build.rs files for suspicious network activity or file system access, as these are often overlooked compared to standard application code [1]. Because there is currently no native sandboxing for procedural macros or build scripts within the Rust toolchain, relying on strict environment isolation and thorough dependency auditing is essential to maintaining the security of your CI/CD pipeline [9][1].

Citations:


Disable persisted checkout credentials before Rust compilation.

This workflow runs untrusted PR code in cargo check, and actions/checkout@v4 preserves credentials for later steps. Set permissions: { contents: read } on the job and persist-credentials: false on checkout to reduce token access by build scripts or macros.

🧰 Tools
🪛 zizmor (1.29.0)

[warning] 400-401: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 400 - 401, Update the job containing
the Rust compilation step to set permissions to contents: read, and configure
the actions/checkout@v4 step with persist-credentials: false. Preserve the
existing checkout behavior while preventing untrusted build scripts or macros
from accessing persisted credentials.

Source: Linters/SAST tools

@qdaxb
qdaxb disabled auto-merge August 6, 2026 15:46
@qdaxb
qdaxb merged commit 9442998 into main Aug 6, 2026
71 of 86 checks passed
@qdaxb
qdaxb deleted the fix/windows-webview2-data-clearing branch August 6, 2026 15:46
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.

1 participant