feat(embedding,vision): candle embeddings with offline fallback, on-demand clipboard vision capture, and concurrency audit
This commit is contained in:
1 parent
5bd8b1587a
commit
e4a0fe72df
47 files changed
+6292
-3503
No files matched your search
@@ -14,6 +14,19 @@ pub fn now_secs() -> u64 {
|
||||
.as_secs()
|
||||
}
|
||||
|
||||
pub fn validate_safe_path(path_str: &str) -> crate::error::Result<std::path::PathBuf> {
|
||||
let path = std::path::Path::new(path_str);
|
||||
for component in path.components() {
|
||||
if component == std::path::Component::ParentDir {
|
||||
return Err(crate::error::AppError::BadRequest(format!(
|
||||
"Path traversal forbidden: '{}' contains relative parent directory components ('..')",
|
||||
path_str
|
||||
)));
|
||||
}
|
||||
}
|
||||
Ok(path.to_path_buf())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user