feat: enhance safety filters for shell commands by normalizing ANSI-C quoting

This commit is contained in:
asepharyana
2026-07-13 04:10:08 +07:00
parent a080957c26
commit d09e440e7e
14 changed files with 383 additions and 85 deletions
+6 -2
View File
@@ -63,8 +63,12 @@ impl EditLog {
/// any filesystem operation fails.
pub fn append(&mut self, entry: EditLogEntry) -> std::io::Result<()> {
let line = serde_json::to_string(&entry)? + "\n";
let parent = self.path.parent().unwrap();
std::fs::create_dir_all(parent)?;
// Ensure parent directory exists; fall back to the current
// directory if path has no parent (should not happen in practice
// since EditLog::new always joins to a session dir).
if let Some(parent) = self.path.parent() {
std::fs::create_dir_all(parent)?;
}
let mut file = std::fs::OpenOptions::new()
.create(true)
.append(true)