-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core): separate Chrome permissions from Agent authority #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cursor
wants to merge
19
commits into
main
Choose a base branch
from
cursor/bc-fb7d6c9e-f364-4c0a-bda6-ab0afe7b6b31-cfc4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f6c089b
feat(core): refuse Chrome downloads as Agent download
cursoragent 52e4237
docs(traceability): keep Chrome permission guard active-PR only
seonghobae a295616
test(core): isolate Chrome permission imports for main convergence
seonghobae 6818982
docs(adr): preserve current-main extension authority decision
seonghobae 1cff725
chore(core): preserve current-main authority docs while converging Ch…
seonghobae 1cc58cf
test(core): reconcile Chrome permission guard onto current main
seonghobae a144c30
feat(core): refuse Chrome permission as Agent authority
seonghobae db724d4
docs(changelog): record Chrome permission authority separation
seonghobae 4b36b53
test(core): classify commands and windows as compatibility only
seonghobae 6b7cfd7
fix(core): classify commands and windows as compatibility only
seonghobae e697b31
test(core): require standard Chrome permission authority errors
seonghobae 87a49dc
fix(core): expose standard Chrome permission authority errors
seonghobae 1dc2222
test(core): classify nativeMessaging as compatibility-only
seonghobae cabe4df
fix(core): keep nativeMessaging compatibility non-authoritative
seonghobae 7fc96f8
docs(changelog): record native messaging authority separation
seonghobae 765c88f
Merge remote-tracking branch 'origin/main' into pr-175
seonghobae 1a2094c
fix(core): register mcp routing module in crate root after main recon…
seonghobae 7e5fcf5
Merge remote-tracking branch 'origin/main' into pr175
seonghobae 0ecfa76
Merge commit '542ca1e9c0a863595b8b6697790005d2471f5413' into HEAD
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
crates/originweave-core/src/chrome_permission_authority.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| //! Separation between Chrome extension compatibility permissions and Agent authority. | ||
|
|
||
| use crate::ActionKind; | ||
| use std::fmt; | ||
|
|
||
| /// Why a Chrome extension permission cannot authorize an OriginWeave Agent action. | ||
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub enum ChromePermissionAuthorityError { | ||
| /// The permission names a reviewed Chrome compatibility surface, not Agent authority. | ||
| CompatibilitySurfaceOnly, | ||
| /// The permission is not a reviewed Chrome surface and still grants no Agent capability. | ||
| UnrecognizedPermission, | ||
| } | ||
|
|
||
| impl fmt::Display for ChromePermissionAuthorityError { | ||
| fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
| let message = match self { | ||
| Self::CompatibilitySurfaceOnly => { | ||
| "Chrome compatibility permission cannot authorize an OriginWeave Agent action" | ||
| } | ||
| Self::UnrecognizedPermission => { | ||
| "Chrome permission is not a reviewed compatibility surface and cannot authorize an OriginWeave Agent action" | ||
| } | ||
| }; | ||
| formatter.write_str(message) | ||
| } | ||
| } | ||
|
|
||
| impl std::error::Error for ChromePermissionAuthorityError {} | ||
|
|
||
| const REVIEWED_CHROME_COMPATIBILITY_PERMISSIONS: &[&str] = &[ | ||
| "bookmarks", | ||
| "commands", | ||
| "declarativeNetRequest", | ||
| "declarativeNetRequestWithHostAccess", | ||
| "downloads", | ||
| "history", | ||
| "nativeMessaging", | ||
| "scripting", | ||
| "sidePanel", | ||
| "storage", | ||
| "tabs", | ||
| "windows", | ||
| ]; | ||
|
|
||
| /// Refuse to treat a Chrome extension permission as OriginWeave Agent authority. | ||
| /// | ||
| /// A successful Chrome compatibility proof never becomes an OriginWeave Agent | ||
| /// capability. Adapters must keep browser compatibility evidence and explicit | ||
| /// OriginWeave grants separate and call this boundary before exposing a typed | ||
| /// action to policy. The action is accepted only to make that separation | ||
| /// explicit at the adapter boundary; no action kind can make this function | ||
| /// return success. | ||
| pub fn chrome_permission_authorizes_agent_action( | ||
| permission: &str, | ||
| _action: ActionKind, | ||
| ) -> Result<(), ChromePermissionAuthorityError> { | ||
| if !is_exact_chrome_permission_token(permission) { | ||
| return Err(ChromePermissionAuthorityError::UnrecognizedPermission); | ||
| } | ||
| if REVIEWED_CHROME_COMPATIBILITY_PERMISSIONS.contains(&permission) { | ||
| return Err(ChromePermissionAuthorityError::CompatibilitySurfaceOnly); | ||
| } | ||
| Err(ChromePermissionAuthorityError::UnrecognizedPermission) | ||
| } | ||
|
|
||
| fn is_exact_chrome_permission_token(permission: &str) -> bool { | ||
| let mut characters = permission.chars(); | ||
| let Some(first) = characters.next() else { | ||
| return false; | ||
| }; | ||
| first.is_ascii_lowercase() && characters.all(|character| character.is_ascii_alphabetic()) | ||
| } | ||
|
seonghobae marked this conversation as resolved.
seonghobae marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //! OriginWeave core contracts plus narrowly scoped adapter authority boundaries. | ||
| //! | ||
| //! The existing deterministic core remains implemented in `lib.rs`; this crate | ||
| //! root re-exports that protected-main API and adds the independently reviewed | ||
| //! Chrome-permission separation boundary without weakening existing authority. | ||
|
|
||
| #![forbid(unsafe_code)] | ||
| #![deny(missing_docs)] | ||
|
|
||
| #[path = "lib.rs"] | ||
| mod base; | ||
| pub use base::*; | ||
|
seonghobae marked this conversation as resolved.
|
||
|
|
||
| mod chrome_permission_authority; | ||
| pub use chrome_permission_authority::{ | ||
| ChromePermissionAuthorityError, chrome_permission_authorizes_agent_action, | ||
| }; | ||
|
|
||
| /// Stateless MCP routing validation that maps only explicit tools to typed actions. | ||
| pub mod mcp; | ||
| /// Deterministic fail-closed release benchmark acceptance aggregation. | ||
| pub mod release_acceptance; | ||
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
crates/originweave-core/tests/chrome_permission_authority.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| use originweave_core::{ | ||
| ActionKind, ChromePermissionAuthorityError, chrome_permission_authorizes_agent_action, | ||
| }; | ||
|
|
||
| #[test] | ||
| fn chrome_compatibility_permissions_never_mint_agent_authority() { | ||
| for permission in [ | ||
| "downloads", | ||
| "bookmarks", | ||
| "history", | ||
| "storage", | ||
| "tabs", | ||
| "windows", | ||
| "scripting", | ||
| "commands", | ||
| "sidePanel", | ||
| "declarativeNetRequest", | ||
| "declarativeNetRequestWithHostAccess", | ||
| "nativeMessaging", | ||
| ] { | ||
| assert_eq!( | ||
| chrome_permission_authorizes_agent_action(permission, ActionKind::Download), | ||
| Err(ChromePermissionAuthorityError::CompatibilitySurfaceOnly) | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn malformed_or_unreviewed_chrome_permissions_remain_unrecognized() { | ||
| for permission in [ | ||
| "", | ||
| "DOWNLOADS", | ||
| "downloads\nhttps://example.invalid", | ||
| "cookies", | ||
| "downloads ", | ||
| ] { | ||
| assert_eq!( | ||
| chrome_permission_authorizes_agent_action(permission, ActionKind::Download), | ||
| Err(ChromePermissionAuthorityError::UnrecognizedPermission) | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn chrome_permission_authority_errors_are_standard_credential_safe_errors() { | ||
| let cases = [ | ||
| ( | ||
| ChromePermissionAuthorityError::CompatibilitySurfaceOnly, | ||
| "Chrome compatibility permission cannot authorize an OriginWeave Agent action", | ||
| ), | ||
| ( | ||
| ChromePermissionAuthorityError::UnrecognizedPermission, | ||
| "Chrome permission is not a reviewed compatibility surface and cannot authorize an OriginWeave Agent action", | ||
| ), | ||
| ]; | ||
|
|
||
| for (error, expected_message) in cases { | ||
| assert_eq!(error.to_string(), expected_message); | ||
| assert!(std::error::Error::source(&error).is_none()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.