Skip to content

Commit eeacf1a

Browse files
committed
feat(portal): use wl-clipboard-rs crate instead of wl-paste binary
1 parent f184d1a commit eeacf1a

File tree

11 files changed

+190
-70
lines changed

11 files changed

+190
-70
lines changed

Cargo.lock

Lines changed: 157 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/explanation/rationale/security-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This section explains the security posture of using Portal and Agent-box togethe
1212

1313
- **Container**: untrusted or semi-trusted agent execution context.
1414
- **Portal host**: trusted broker enforcing method policy.
15-
- **Host binaries** (`gh`, `wl-paste`): executed only by host broker.
15+
- **Host integrations**: `gh` is executed by the host broker, while clipboard reads are handled directly by the host process via the Wayland clipboard crate.
1616

1717
## Control mechanisms
1818

docs/src/how-to/portal/debug-wrapper-failures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Find and fix common failures for `wl-paste`/`gh` wrappers and other Portal clien
3434
- **prompt_failed**
3535
- `prompt_command` missing or exits non-zero in ask-mode
3636
- **clipboard_failed**
37-
- no allowed image MIME currently in clipboard or host `wl-paste` issue
37+
- no allowed image MIME currently in clipboard or a host Wayland clipboard access issue
3838
- **gh_exec_failed**
3939
- host `gh` unavailable or command failure
4040

docs/src/reference/agent-box/requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Portal-related requirements
1111

12-
- `wl-paste` available on host when using portal clipboard methods
12+
- Wayland clipboard access available on host when using portal clipboard methods
1313
- `agent-portal-host` running for wrapper/API operations
1414

1515
## Optional tooling

docs/src/reference/common/env-vars.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
- Used by portal clients/wrappers to select socket path.
77
- Resolution priority is env var first, then config/default.
88

9-
- `AGENT_PORTAL_HOST_WL_PASTE`
10-
- Used by `agent-portal-host` to override host `wl-paste` binary path.
11-
129
- `AGENT_PORTAL_HOST_GH`
1310
- Used by `agent-portal-host` to override host `gh` binary path.
1411

docs/src/reference/portal/wrapper-contract.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ This page describes behavior expected from compatibility wrappers in `wrappers/`
3232
## Host-side execution model
3333

3434
- Policy decisions and prompts are enforced by `agent-portal-host`.
35-
- Host service resolves host-native binaries (`gh`, `wl-paste`) to avoid wrapper recursion.
35+
- Host service resolves the host-native `gh` binary to avoid wrapper recursion.
36+
- Clipboard reads are handled directly in-process via the Wayland clipboard crate.
3637

3738
## Versioning
3839

docs/src/tutorials/portal/first-run-standalone.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You run `agent-portal-host` and send successful requests with `agent-portal-cli`
88

99
- `agent-portal-host` and `agent-portal-cli` installed
1010
- `~/.agent-box.toml` with `[portal]` enabled
11-
- `wl-paste` available on host if testing clipboard method
11+
- Wayland clipboard access available on host if testing clipboard method
1212

1313
## Minimal config
1414

nix/home-manager/agent-portal.nix

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ in
3838
default = null;
3939
description = "Optional socket path override passed as `--socket` to agent-portal-host.";
4040
};
41-
42-
wlPasteBinary = lib.mkOption {
43-
type = lib.types.str;
44-
default = "${pkgs.wl-clipboard}/bin/wl-paste";
45-
defaultText = lib.literalExpression ''"${pkgs.wl-clipboard}/bin/wl-paste"'';
46-
description = "Host wl-paste binary used by portal host to avoid wrapper recursion.";
47-
};
4841
};
4942

5043
config = lib.mkIf cfg.enable {
@@ -59,9 +52,7 @@ in
5952

6053
Service = {
6154
Type = "simple";
62-
Environment = [
63-
"AGENT_PORTAL_HOST_WL_PASTE=${cfg.wlPasteBinary}"
64-
] ++ lib.optionals cfg.debug [
55+
Environment = lib.optionals cfg.debug [
6556
"RUST_LOG=debug"
6657
];
6758
ExecStart =

portal/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ serde.workspace = true
2121
serde_json.workspace = true
2222
tracing.workspace = true
2323
tracing-subscriber.workspace = true
24+
wl-clipboard-rs = "0.9.3"

portal/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Portal crate containing host service and official CLI for container-to-host medi
1414
- `clipboard.read_image`
1515
- `gh.exec`
1616

17+
`clipboard.read_image` is implemented directly against the Wayland clipboard via
18+
[`wl-clipboard-rs`](https://github.com/YaLTeR/wl-clipboard-rs), rather than shelling out to
19+
`wl-paste`.
20+
1721
`gh.exec` classification uses an embedded-at-compile-time command policy generated at repo root
1822
via `portal/scripts/gh-policy-gen.py`:
1923
`portal/gh-leaf-command-read-write-report.json`.

0 commit comments

Comments
 (0)