Feat: Improved ACL robustness with semantic and fuzzy matching#665
Feat: Improved ACL robustness with semantic and fuzzy matching#665neel04 merged 3 commits intofeat/acls-approvalsfrom
Conversation
|
All contributors have signed the CLA. Thank you! |
|
I have read the CLA Document and I hereby sign the CLA |
cf46377 to
eb15d92
Compare
Greptile SummaryThis PR ports the enhanced Python-based ACL (fuzzy + semantic matching) to TypeScript, introducing a new weighted scoring pipeline ( Three correctness issues need attention before merging:
Confidence Score: 3/5Not safe to merge — three P1 logic bugs can cause disabled rules to block, selector-scoped rules to over-match, and unrelated button elements to be falsely blocked when the embedding model is unavailable. Three distinct P1 issues exist on the changed paths, all of which can produce incorrect blocking behavior in production. The disabled-rule bug is a one-line fix; the compound-selector and generic-token issues require small but non-trivial changes to selectorMatchesProps and the term-scoring approach. Focus on acl-scorer.ts (compound selector parsing, generic token exact-matching) and acl-guard.ts (enabled check on site-only rule early exit). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Tool invocation] --> B{Tool in GUARDED_TOOLS?}
B -- No --> Z[Allow]
B -- Yes --> C{aclRules present?}
C -- No --> Z
C -- Yes --> D[refreshPageInfo]
D --> E{matchesSitePattern?}
E -- No rules match --> Z
E -- Match found --> F{Site-only rule?}
F -- Yes --> G[Block - enabled not checked]
F -- No --> H[resolveTargetElementId]
H -- undefined --> Z
H -- ID found --> I[resolveElementProperties]
I -- null --> Z
I -- props found --> J[scoreFixture]
J --> K[scoreRule per siteRule]
K --> L{rule.enabled === false?}
L -- skip --> M[null]
L -- enabled --> N{Has content filter?}
N -- No --> R[blocked=true site-only]
N -- Yes --> V[exactScore + fuzzyScore + semanticScore]
V --> W{confidence >= 0.4?}
W -- Yes --> X[blocked=true]
W -- No --> Y[blocked=false]
J --> AA{top candidate blocked?}
AA -- Yes --> BB[highlightBlockedElement + error response]
AA -- No --> Z
|
* feat: Add enhanced python-based ACL * fix: Port enhanced ACL to TypeScript * fix: greptile suggested bugs
Summary
This adds an enhanced, python-based ACL with fuzzy and semantic matching. It's gated behind
BROWSEROS_ACL_PYTHONfor the time being,We compute a weighted sum with the individual scores of exact, fuzzy and semantic matches to output an overall "confidence" in blocking some request. However, the coefficients need to be tuned further based on user feedback.
Run
From
packages/browseros-agent/python/acl_lab:From packages/browseros-agent:
Notes
BROWSEROS_ACL_PYTHONis unset, the server uses the existing TypeScript matcher.Future
Integrating a UI wherein if ACL blocks an action, it should just come up in the UI and the user should be able to override that.
This feedback should be reported back to us, which we can use to setup a pipeline and automatically adjust coefficients to balance False positive/True negatives