Spaces:
Running
Running
Download sample.js from Helinity/rust-security: direct link, hf CLI and curl.
- Browser
- Download file 5.54 kB
-
https://huggingface.co/spaces/Helinity/rust-security/resolve/main/sample.js
- Command line
-
hf download hf://spaces/Helinity/rust-security/sample.js
-
curl -L -o sample.js https://huggingface.co/spaces/Helinity/rust-security/resolve/main/sample.js
5.54 kB
| const sample = { | |
| "findings": [ | |
| { | |
| "id": "HEL-RUST-001", | |
| "path": "review_markers.rs", | |
| "line": 4, | |
| "column": 13, | |
| "evidence": "SQL API receives a formatted statement with a nonliteral value", | |
| "remediation": "Use a constant statement with bound parameters for values. Map permitted SQL identifiers to a fixed set.", | |
| "severity": "medium", | |
| "title": "Formatted SQL query", | |
| "category": "source", | |
| "lines": [ | |
| { | |
| "number": 2, | |
| "code": "#[cfg(any())]" | |
| }, | |
| { | |
| "number": 3, | |
| "code": "fn inspect(root: &std::path::Path, label: &str) -> Result<(), Box<dyn std::error::Error>> {" | |
| }, | |
| { | |
| "number": 4, | |
| "code": " let _ = sqlx::query(&format!(\"SELECT caption FROM labels WHERE caption = {}\", label));" | |
| }, | |
| { | |
| "number": 5, | |
| "code": " let _ = std::process::Command::new(std::env::var(\"FIXTURE_PROGRAM\")?);" | |
| }, | |
| { | |
| "number": 6, | |
| "code": " let _ = std::fs::read(root.join(std::env::var(\"FIXTURE_NAME\")?));" | |
| } | |
| ] | |
| }, | |
| { | |
| "id": "HEL-RUST-002", | |
| "path": "review_markers.rs", | |
| "line": 5, | |
| "column": 13, | |
| "evidence": "std::process::Command::new receives an environment-derived program", | |
| "remediation": "Select the executable from trusted configuration or a fixed allowlist and pass each argument separately.", | |
| "severity": "medium", | |
| "title": "Program name from environment", | |
| "category": "source", | |
| "lines": [ | |
| { | |
| "number": 3, | |
| "code": "fn inspect(root: &std::path::Path, label: &str) -> Result<(), Box<dyn std::error::Error>> {" | |
| }, | |
| { | |
| "number": 4, | |
| "code": " let _ = sqlx::query(&format!(\"SELECT caption FROM labels WHERE caption = {}\", label));" | |
| }, | |
| { | |
| "number": 5, | |
| "code": " let _ = std::process::Command::new(std::env::var(\"FIXTURE_PROGRAM\")?);" | |
| }, | |
| { | |
| "number": 6, | |
| "code": " let _ = std::fs::read(root.join(std::env::var(\"FIXTURE_NAME\")?));" | |
| }, | |
| { | |
| "number": 7, | |
| "code": " let _ = std::env::var(\"FIXTURE_TEXT\")?.as_bytes()[0];" | |
| } | |
| ] | |
| }, | |
| { | |
| "id": "HEL-RUST-003", | |
| "path": "review_markers.rs", | |
| "line": 6, | |
| "column": 13, | |
| "evidence": "Filesystem read receives a path joined with an environment value", | |
| "remediation": "Restrict the input to permitted path components and enforce the directory boundary when opening the file.", | |
| "severity": "medium", | |
| "title": "File path from environment", | |
| "category": "source", | |
| "lines": [ | |
| { | |
| "number": 4, | |
| "code": " let _ = sqlx::query(&format!(\"SELECT caption FROM labels WHERE caption = {}\", label));" | |
| }, | |
| { | |
| "number": 5, | |
| "code": " let _ = std::process::Command::new(std::env::var(\"FIXTURE_PROGRAM\")?);" | |
| }, | |
| { | |
| "number": 6, | |
| "code": " let _ = std::fs::read(root.join(std::env::var(\"FIXTURE_NAME\")?));" | |
| }, | |
| { | |
| "number": 7, | |
| "code": " let _ = std::env::var(\"FIXTURE_TEXT\")?.as_bytes()[0];" | |
| }, | |
| { | |
| "number": 8, | |
| "code": " Ok(())" | |
| } | |
| ] | |
| }, | |
| { | |
| "id": "HEL-RUST-004", | |
| "path": "review_markers.rs", | |
| "line": 7, | |
| "column": 13, | |
| "evidence": "Direct byte indexing on an environment-derived string without a recognized length guard", | |
| "remediation": "Use a checked lookup and return a validation error when the required byte is absent.", | |
| "severity": "low", | |
| "title": "Unchecked byte index", | |
| "category": "source", | |
| "lines": [ | |
| { | |
| "number": 5, | |
| "code": " let _ = std::process::Command::new(std::env::var(\"FIXTURE_PROGRAM\")?);" | |
| }, | |
| { | |
| "number": 6, | |
| "code": " let _ = std::fs::read(root.join(std::env::var(\"FIXTURE_NAME\")?));" | |
| }, | |
| { | |
| "number": 7, | |
| "code": " let _ = std::env::var(\"FIXTURE_TEXT\")?.as_bytes()[0];" | |
| }, | |
| { | |
| "number": 8, | |
| "code": " Ok(())" | |
| }, | |
| { | |
| "number": 9, | |
| "code": "}" | |
| } | |
| ] | |
| }, | |
| { | |
| "id": "RUSTSEC-2022-0082", | |
| "path": "Cargo.lock", | |
| "line": 5, | |
| "column": 11, | |
| "evidence": "warp 0.3.2 (https://rustsec.org/advisories/RUSTSEC-2022-0082.html)", | |
| "remediation": "Check the advisory for fixed releases or mitigation and update the dependency using Cargo.", | |
| "severity": "medium", | |
| "title": "Affected warp dependency", | |
| "category": "dependency", | |
| "lines": [ | |
| { | |
| "number": 3, | |
| "code": "[[package]]" | |
| }, | |
| { | |
| "number": 4, | |
| "code": "name = \"warp\"" | |
| }, | |
| { | |
| "number": 5, | |
| "code": "version = \"0.3.2\"" | |
| }, | |
| { | |
| "number": 6, | |
| "code": "source = \"registry+https://github.com/rust-lang/crates.io-index\"" | |
| } | |
| ] | |
| } | |
| ], | |
| "prompt": "Install Rust Security from https://github.com/Helincharm/rust-security. Follow INSTALL.md, connect it to my MCP client for the Rust project I choose, and verify the connection by scanning the included fixture and opening one finding at its source line. Tell me which client and project folder you configured." | |
| }; | |