Rust Support
Skylos analyzes Rust source with tree-sitter parsing for dead code and selected security checks.
File Coverage
| Area | Support |
|---|---|
| Extensions | .rs |
| Dead code | Modules, structs, enums, traits, type aliases, functions, methods, fields, and imports |
| Security | Partial, with checks for selected web, database, filesystem and cryptographic APIs |
| Quality | Unreachable statements and duplicate branch bodies |
Dead Code Detection
Rust analysis understands module paths, use imports, public items, impl
blocks, trait methods, derived behavior, test functions, and common implicit
methods such as clone, default, drop, fmt, from, into, poll, and
call.
Skylos treats main, test functions, and methods implied by common traits more
conservatively than ordinary private helpers.
Security Scope
From the crate or workspace root, run a report at the default confidence setting:
skylos . --danger
The following checks are on the development branch. An older installed release may cover fewer APIs.
- Request text used as SQL in an executed rusqlite, SQLx, MySQL or MySQL async query. Fixed query text with separately bound request values stays quiet.
- Input reaching commands, filesystem paths, HTML output and the destination of a dispatched
reqwestrequest. - Certificate and hostname verification disabled by supported TLS APIs, plus sensitive session cookies issued without the Secure flag.
- HTTP authentication sent to a cleartext destination and exposed secrets put in request URLs, including HTTPS URLs.
- Exposed
secrecy::SecretStringvalues in logs and password writes, weak ciphers and hashes in supported crypto APIs, and fixed symmetric keys. - Decoded request text in plain log messages, unescaped request fragments used in regexes, and selected unbounded allocation or JSON input paths.
Reading a Rust finding
For a SQL injection finding (SKY-D211), start at the reported database call. Check whether a request value can change the SQL text that actually runs. With SQLx, creating a query and dropping its future leaves it unexecuted. For a PostgreSQL lookup, keep the SQL fixed and bind the request value:
let rows = sqlx::query("SELECT id FROM users WHERE name = $1")
.bind(name)
.fetch_all(pool)
.await?;
For reqwest, check both the destination and where the secret goes. Sending credentials over plain HTTP can trigger SKY-D356. An exposed SecretString in the URL path or query can trigger SKY-D391 even over HTTPS, because URLs can end up in logs. For bearer authentication, send the token in the authorization header over HTTPS.
For cookies (SKY-D252), check where the application issues its session cookie. Use .secure(true) on the builder. Skylos recognizes selected session names and outgoing APIs. A custom session name still needs review.
What the benchmarks cover
The development scanner detected examples in 18 of 20 security categories in GitHub's published Rust query index. The other two concern unsafe pointers. On 23 pinned repositories, all 40 pre-labeled safe operations stayed quiet. Those repository labels measure noise. The report lists the positive cases, individual misses, and the file the parser only partially checked. Rust security benchmark
Limitations
Findings depend on the crate, the resolved API and the data path. DNS resolution, arbitrary macros and general cross-crate data flow remain gaps.
Skylos does not run rustc, Cargo resolution, borrow checking, or Rust type
checking. Pair Skylos with cargo check, cargo clippy, and tests for full
Rust validation.