Skip to content

fix: reject all network effects in os_check - #39

Draft
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/critical-correctness-bugs-7047
Draft

fix: reject all network effects in os_check#39
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/critical-correctness-bugs-7047

Conversation

@cursor

@cursor cursor Bot commented Jun 6, 2026

Copy link
Copy Markdown

Bug and impact

os_check only treated bare net as forbidden for refactor/test grants even though the Lex trust lattice classifies mcp and llm_cloud as network egress effects too. A refactor-mode generated Lex file declaring [llm_cloud] or [mcp] could pass the grant check despite net=none, creating a policy bypass for cloud LLM/MCP calls.

Root cause

The deny list in src/tools/os_check.lex duplicated only part of upstream lex-types::trust::effect_requirement instead of covering every network-effect name.

Fix

Added a shared network_effects() helper containing net, http, mcp, and llm_cloud, and use it for all modes with network: none.

Validation

  • Downloaded lex 0.9.7 and ran lex pkg install.
  • Ran lex check src/tools/os_check.lex successfully.
  • Verified lex --output json check emits required_effects: ["llm_cloud"] for a targeted fixture.
  • Ran a temporary wrapper through os_check.execute and confirmed it returns grant_violation for llm_cloud under refactor mode.
Open in Web View Automation 

alpibrupa and others added 5 commits June 6, 2026 09:23
- lex.toml: switch to git deps
- src/agents/*: build, explore, plan, refactor, review, spec, test agents updated
- src/permissions/rules.lex, manifests.lex: permission rules and manifests
- src/tools/index.lex, os_check.lex: tool index and OS check tool
- src/server/web.lex: web server
- src/web/index.html: updated UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: alpibrupa <alpibrupa@users.noreply.github.com>
Co-authored-by: alpibrupa <alpibrupa@users.noreply.github.com>
Co-authored-by: alpibrupa <alpibrupa@users.noreply.github.com>
Co-authored-by: alpibrupa <alpibrupa@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Security review found two medium-confidence supply/permission-boundary issues in the changed code. I found no existing review threads to re-validate before posting this assessment.

Open in Web View Automation 

Sent by Cursor Automation: PR Lex

Comment thread src/tools/os_check.lex
}

fn network_effects() -> List[Str] {
["net", "http", "mcp", "llm_cloud"]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Medium: this network denylist misses the real llm effect name used elsewhere in the project ([env, net, llm, ...]). A refactor-mode change that introduces LLM access can pass os_check because llm_cloud is never emitted, bypassing the intended no-network/no-cloud grant and enabling prompt/data exfiltration or unintended model calls.

Comment thread lex.toml
Comment on lines +7 to +13
lex-llm = { git = "https://github.com/alpibrusl/lex-llm" }
lex-agent = { git = "https://github.com/alpibrusl/lex-agent" }
lex-trail = { git = "https://github.com/alpibrusl/lex-trail" }
lex-spec = { git = "https://github.com/alpibrusl/lex-spec" }
lex-schema = { git = "https://github.com/alpibrusl/lex-schema" }
lex-os-manifest = { git = "https://github.com/alpibrusl/lex-os-manifest" }
lex-web = { git = "https://github.com/alpibrusl/lex-web" }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Medium: these dependencies now resolve from Git default branches without a pinned rev/tag or lockfile. Anyone who can alter one of those upstream repos, or a compromised upstream account, can change the code pulled into builds after review, creating a supply-chain code execution path. Pin immutable revisions or commit a lockfile.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No critical correctness bugs found.

Reviewed the PR diff and traced the os_check/permission-gate path through tools_for_spec, with_permission_gate, and runtime dispatch. Validation performed:

  • lex check passed for src/tools/os_check.lex, src/tools/index.lex, src/agents/refactor.lex, and src/permissions/manifests.lex with Lex 0.9.7 after lex pkg install.
  • Confirmed scoped network effects still report base net in lex --output json check, so the new os_check forbidden list catches scoped network use.
  • Confirmed refactor tool exposure includes os_check and excludes network VCS push/pull.

Caveats below the critical bar: the full src/ check still fails at the pre-existing src/server/api.lex effect-row mismatch noted in repo memory, and lex fmt --check would reformat src/permissions/manifests.lex. I did not open a fix PR because neither is a newly confirmed critical issue from this review.

Open in Web View Automation 

Sent by Cursor Automation: Quality of PR Lex

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