Skip to content

fix: fail closed on os_check grant violations - #38

Draft
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/critical-correctness-bugs-321b
Draft

fix: fail closed on os_check grant violations#38
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/critical-correctness-bugs-321b

Conversation

@cursor

@cursor cursor Bot commented Jun 6, 2026

Copy link
Copy Markdown

Summary

  • Make os_check return a tool error when refactor-mode grant violations are detected.
  • Fail closed when lex check --output json is missing or malforms data.required_effects instead of reporting a passing grant check.
  • Format the changed tool file.

Validation

  • lex check src/tools/os_check.lex
  • lex fmt --check src/tools/os_check.lex
  • Python source regression checks for fail-closed violation/malformed-output paths

Note: a full src/ Lex check currently fails in unrelated src/server/api.lex with an effect-row mismatch.

Open in Web View Automation 

alpibrupa and others added 4 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>
@cursor cursor Bot mentioned this pull request Jun 6, 2026

@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 complete. I found one medium-confidence supply-chain issue introduced by this PR. No prior automation review threads were present, and I did not find an exploitable injection/authz issue in the added os_check path.

Open in Web View Automation 

Sent by Cursor Automation: PR Lex

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.

Severity: Medium. These new Git dependencies are floating: there is no tag/rev pin here and no lockfile in the repo, so builds can resolve whatever is on each dependency repo's default branch. If one dependency repo or maintainer account is compromised, attacker-controlled package code can run inside lex-code's process/tool boundary, including code that defines providers, tools, or permission-gate behavior. Pin each Git dependency to an immutable commit/tag and commit the resolver 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.

Found a critical grant-bypass bug and opened a minimal fix in #39.

Bug and impact: os_check only rejected bare net for refactor/test grants. Upstream Lex treats mcp and llm_cloud as network egress effects too, so a refactor-mode file declaring [llm_cloud] or [mcp] could pass os_check even though the grant says net=none.

Root cause: the new deny list duplicated only part of the Lex trust lattice instead of covering every network-effect name.

Fix and validation: PR #39 adds a shared network-effect deny list (net, http, mcp, llm_cloud) for all network: none modes. I validated with lex 0.9.7: lex check src/tools/os_check.lex passes, a targeted fixture emits required_effects: ["llm_cloud"], and a temporary wrapper calling os_check.execute returns grant_violation for llm_cloud under refactor mode.

Open in Web View Automation 

Sent by Cursor Automation: Quality of PR Lex

Comment thread src/tools/os_check.lex
["net", "proc"]
} else {
if mode == "test" or mode == "refactor" {
["net"]

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.

This only forbids the bare net effect for refactor/test, but Lex's trust lattice also classifies mcp and llm_cloud as network egress effects. A refactor-mode generated file that declares [llm_cloud] or [mcp] will appear in lex check --output json as that effect name, miss this exact-match deny list, and pass despite the net=none grant. I opened #39 to reject the full network-effect set.

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