The AGENTS.md explicitly forbids the use of .unwrap(), .expect(), panic!(), todo!(), and unimplemented!() in production code. A search of the codebase revealed several instances of unwrap() being used in non-test contexts.
Vulnerable Locations:
botserver/src/drive/drive_handlers.rs:269- Contains a.unwrap()call duringResponse::builder()generation, which could panic in production.botserver/src/basic/compiler/mod.rs- Containsunwrap()usages outside test boundaries.botserver/src/llm/llm_models/deepseek_r3.rs- Containsunwrap()usages outside test boundaries.botserver/src/botmodels/opencv.rs- Test scopes useunwrap(), but please audit carefully for any leaks to production scope.
Action:
- Replace all
.unwrap()occurrences with safe alternatives (?,unwrap_or_default(), or pattern matching with early returns) and useErrorSanitizerto avoid panics.
Running cargo audit uncovered a reported vulnerability inside the dependency tree.
Vulnerable Component:
- Crate:
glib - Version:
0.18.5 - Advisory ID:
RUSTSEC-2024-0429 - Title: Unsoundness in
IteratorandDoubleEndedIteratorimpls forglib::VariantStrIter - Dependency Tree context: It's pulled through
botdeviceandbotappvia Tauri plugins and GTK dependencies.
Action:
- Review dependencies and upgrade the GTK/Glib ecosystem dependencies if patches are available, or evaluate the exact usage to assess the direct risk given the desktop GUI context.
- Ensure all new state-changing endpoints are correctly shielded by the custom CSRF store (
redis_csrf_store.rs). Verification is recommended as standardtower-csrfis absent fromCargo.toml. - Confirm security headers (
Content-Security-Policyviaheaders.rs) are indeed attached universally inbotserverand not selectively omitted in new modules.