You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🛡️ Sentinel: [CRITICAL] Fix Path Traversal in session storage
Applied PR feedback for path traversal fix.
- Simplified `is_valid_session_id` logic and added check for empty strings.
- Added validation check to `resolve_managed_path` and `resolve_managed_session_path_for` to cover reading paths.
- Added heuristic token estimation logic as a fallback in API request pre-flight checks when `count_tokens` returns an error, fixing the associated integration test failure.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
let cwd_path = std::env::temp_dir().join(format!("claw-state-test-{}", std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_nanos()));
1108
+
let cwd_path = std::env::temp_dir().join(format!(
1109
+
"claw-state-test-{}",
1110
+
std::time::SystemTime::now()
1111
+
.duration_since(std::time::UNIX_EPOCH)
1112
+
.unwrap_or_default()
1113
+
.as_nanos()
1114
+
));
1109
1115
std::fs::create_dir_all(&cwd_path).expect("test dir should create");
1110
1116
let cwd = cwd_path.to_str().expect("test path should be utf8");
1111
1117
let registry = WorkerRegistry::new();
1112
1118
let worker = registry.create(cwd,&[],true);
1113
1119
1114
1120
// After create the worker is Spawning — state file should exist
1115
1121
let state_path = cwd_path.join(".claw").join("worker-state.json");
1116
-
assert!(state_path.exists(),"state file should exist after worker creation");
1122
+
assert!(
1123
+
state_path.exists(),
1124
+
"state file should exist after worker creation"
1125
+
);
1117
1126
1118
1127
let raw = std::fs::read_to_string(&state_path).expect("state file should be readable");
1119
-
let value: serde_json::Value = serde_json::from_str(&raw).expect("state file should be valid JSON");
1120
-
assert_eq!(value["status"].as_str(),Some("spawning"),"initial status should be spawning");
1128
+
let value: serde_json::Value =
1129
+
serde_json::from_str(&raw).expect("state file should be valid JSON");
0 commit comments