rust-agent-desktop-v1
13 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo not. - Confidence
- P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
- False-positive risk
- low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
- Edge
- The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
- Taxonomy chips
- References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.
keryn.rustagent.model-output-to-process-command-rs
Section titled “keryn.rustagent.model-output-to-process-command-rs”error rust data-flow rule rust, tokio, openai, anthropic
Text produced by the model (a completion’s content, a tool call’s arguments) becomes a program name or argument of a child process. A prompt-injected or hallucinated answer then runs commands on the host with the agent’s privileges. Map the model’s intent onto a fixed allowlist of commands and pass model text only as a single argv element that the chosen command treats as data.
Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-78 CWE-88 LLM05 LLM06 ASI05 ASI02
Fix: Never pass model text to Command::new or to .arg(“-c”); choose the executable from a fixed table keyed by the model’s tool name and pass model values as separate argv elements that are validated against the tool’s schema.
References: https://doc.rust-lang.org/std/process/struct.Command.html · https://docs.rs/tokio/latest/tokio/process/struct.Command.html
keryn.rustagent.model-output-to-sql-rs
Section titled “keryn.rustagent.model-output-to-sql-rs”error rust data-flow rule rust, rusqlite, sqlx
Text produced by the model is formatted into a SQL statement string (rusqlite / sqlx execute, prepare, query). The model, or whoever injected into its context, then writes the SQL the agent runs against its store: memories, transcripts, credentials. Keep statements constant and bind model text as a parameter.
Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Use a constant statement with ?1 / $1 placeholders and pass the model’s text in the params slice (rusqlite params![] or sqlx .bind()); never build the statement with format!.
References: https://docs.rs/rusqlite/latest/rusqlite/struct.Connection.html#method.execute · https://docs.rs/sqlx/latest/sqlx/fn.query.html
keryn.rustagent.model-output-to-fs-path-rs
Section titled “keryn.rustagent.model-output-to-fs-path-rs”error rust data-flow rule rust, tokio
A file path produced by the model is used to read, write, create or delete on the host filesystem. A prompt-injected path then reaches the agent’s own configuration, keys, shell profiles or the user’s documents. Resolve model paths inside a dedicated workspace directory, canonicalise, and refuse anything that escapes it.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-22 CWE-73 LLM05 LLM06 ASI02 ASI05
Fix: Join the model’s relative path onto a fixed workspace root, call canonicalize(), check starts_with(root) and only then open; never accept absolute paths or “..” from the model.
References: https://doc.rust-lang.org/std/fs/index.html · https://docs.rs/tokio/latest/tokio/fs/index.html
keryn.rustagent.model-output-to-url-fetch-rs
Section titled “keryn.rustagent.model-output-to-url-fetch-rs”warning rust data-flow rule rust, reqwest
A URL produced by the model is fetched by the agent’s HTTP client. A prompt-injected URL then turns the agent into a request forger against internal services, cloud metadata endpoints or the user’s own network, and the response flows back into the model’s context. Parse the URL, allow only http(s) to an allowlisted host, and block private address ranges.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Parse with url::Url, require scheme http/https, compare host against an allowlist (or the task’s origin), resolve and reject loopback, link-local and RFC 1918 addresses, and disable redirects or re-check each hop.
References: https://docs.rs/reqwest/latest/reqwest/struct.Client.html · https://docs.rs/reqwest/latest/reqwest/fn.get.html
keryn.rustagent.model-output-to-desktop-open-rs
Section titled “keryn.rustagent.model-output-to-desktop-open-rs”warning rust data-flow rule rust, tauri, opener
A URL or path produced by the model is handed to the desktop’s “open” handler (open::that, opener, the Tauri shell/opener plugin). The model can then launch the user’s browser on a phishing page, open a file:// or custom-scheme URL that triggers another application, or start a downloaded file. Allow only http(s) URLs to known hosts and show the target before opening.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-601 CWE-73 LLM05 LLM06 ASI02 ASI09
Fix: Parse the target, accept only http/https to an allowlisted host (never file:, custom schemes or local paths from the model), and ask the user to confirm the shown URL before calling the opener.
References: https://docs.rs/open/latest/open/fn.that.html · https://docs.rs/opener/latest/opener/fn.open.html · https://v2.tauri.app/plugin/opener/ · https://v2.tauri.app/plugin/shell/
keryn.rustagent.model-output-to-webview-eval-rs
Section titled “keryn.rustagent.model-output-to-webview-eval-rs”error rust data-flow rule rust, tauri
JavaScript produced by the model is executed in the application’s webview (Window / WebviewWindow eval). The model then runs with the webview’s full reach: every Tauri command the window may invoke, local storage, and the rendered UI the user trusts. Render model text as data in the UI and keep executed scripts constant.
Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Send model output to the frontend as an event payload (emit) and render it with textContent or a framework binding; if a script must run, keep it a constant string and pass model data only as a JSON-serialised argument.
References: https://docs.rs/tauri/latest/tauri/webview/struct.WebviewWindow.html#method.eval · https://v2.tauri.app/security/
keryn.rustagent.llm-http-client-tls-verification-disabled-rs
Section titled “keryn.rustagent.llm-http-client-tls-verification-disabled-rs”warning rust rust, reqwest
The reqwest client is built with certificate or hostname verification disabled. An agent whose model API calls and tool fetches run through this client can be intercepted by anyone on the network path: prompts, keys and tool results are readable and the model’s answers replaceable. Keep verification on and add the specific CA you need to the client instead.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: trusts one party believes another without evidence.
CWE-295 LLM02 LLM06 ASI03 ASI07
Fix: Remove danger_accept_invalid_certs / danger_accept_invalid_hostnames; load the private CA with ClientBuilder::add_root_certificate for the one internal endpoint that needs it.
References: https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html#method.danger_accept_invalid_certs · https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html#method.add_root_certificate
keryn.rustagent.llm-http-client-without-timeout-rs
Section titled “keryn.rustagent.llm-http-client-without-timeout-rs”warning rust rust, reqwest
A reqwest client is built without a request or connect timeout. A model endpoint or tool server that stalls then holds the agent’s task (and anything awaiting it) open indefinitely, and a slow-loris response is enough to exhaust it. Set timeout() and connect_timeout() on the builder.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: grants authority is given or left unchecked.
Fix: Add .timeout(Duration::from_secs(n)) and .connect_timeout(…) to the builder chain (reqwest has no default request timeout); for streaming completions use read_timeout or a per-chunk deadline.
References: https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html#method.timeout · https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html#method.connect_timeout
keryn.rustagent.tauri-config-csp-disabled
Section titled “keryn.rustagent.tauri-config-csp-disabled”warning json tauri
The Tauri app’s Content Security Policy is disabled (security.csp null). The webview that renders model output and tool results then runs any inline or remote script that reaches it, and a prompt-injected answer rendered as HTML becomes code with access to the app’s commands. Set a CSP that allows only your own scripts and the hosts you talk to.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: grants authority is given or left unchecked.
Fix: Set app.security.csp to a policy such as “default-src ‘self’; connect-src ‘self’ https://api.example.com; script-src ‘self’” and let Tauri add the hashes for its injected scripts.
References: https://v2.tauri.app/security/csp/ · https://v2.tauri.app/reference/config/#securityconfig
keryn.rustagent.tauri-config-remote-domain-ipc
Section titled “keryn.rustagent.tauri-config-remote-domain-ipc”error json tauri
dangerousRemoteDomainIpcAccess grants remote web content the ability to call this app’s Tauri commands. If that content includes anything the model fetched or wrote (a rendered page, a tool result, a hosted UI), prompt injection reaches the commands directly: file access, shell, secrets. Remove the grant; pass remote content through your own frontend and expose only narrowly scoped commands to it.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Delete dangerousRemoteDomainIpcAccess; if a remote origin truly needs commands, list them explicitly under a capability with a tight “remote.urls” pattern and keep every such command free of filesystem, shell and secret access.
References: https://v2.tauri.app/reference/config/#dangerousremotedomainipcaccess · https://v2.tauri.app/security/capabilities/#remote-api-access
keryn.rustagent.tauri-config-with-global-tauri
Section titled “keryn.rustagent.tauri-config-with-global-tauri”warning json tauri
withGlobalTauri exposes window.__TAURI__ to every script in the webview. Any script that gets in, including one carried by model-generated HTML or a third-party widget, can then invoke commands without importing the API. Keep the API behind the bundler import so only your own code holds it.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Set app.withGlobalTauri to false and import @tauri-apps/api in the frontend bundle instead.
References: https://v2.tauri.app/reference/config/#withglobaltauri
keryn.rustagent.tauri-capability-agent-reach
Section titled “keryn.rustagent.tauri-capability-agent-reach”warning json tauri
A Tauri capability grants the webview broad reach: spawning processes, opening arbitrary URLs or paths, whole-filesystem or unrestricted HTTP access. In an app whose UI shows model output, that is the reach a prompt-injected answer gets if it ever executes. Grant scoped permissions (specific commands, paths and URL patterns) instead of the plugin defaults.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: Replace shell:allow-spawn / shell:allow-open / shell:default with a scoped shell permission naming the exact program and argument validators; replace fs:default / fs:write-all / fs:read-all with allow-* permissions scoped to $APPDATA paths; replace http:default and opener:allow-open-url with a scope listing the URLs the app may reach.
References: https://v2.tauri.app/security/capabilities/ · https://v2.tauri.app/plugin/shell/#permissions · https://v2.tauri.app/plugin/file-system/#permissions · https://v2.tauri.app/plugin/http-client/#permissions
keryn.rustagent.tauri-capability-granted-to-remote-urls
Section titled “keryn.rustagent.tauri-capability-granted-to-remote-urls”error json tauri
A Tauri capability is granted to remote URLs (“remote.urls”). Pages loaded from those origins can invoke the listed commands and plugins, so anything injected into them (or any model-fetched content shown there) gains that access. Keep capabilities on local windows; if remote content is unavoidable, grant it only commands that touch nothing sensitive.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Remove “remote” from the capability, or narrow its urls to an exact origin you control and list only read-only, non-sensitive commands in that capability.
References: https://v2.tauri.app/security/capabilities/#remote-api-access