fix: harden runtime against panics/races, close path-traversal and fail-open gaps
- Runtime.Run rejects concurrent invocations instead of racing on shared state; panics in tools, hooks, and permission checkers are recovered and surfaced as errors/denials instead of crashing the loop - AgentSpec.Loop now actually overrides RuntimeDeps.AgentLoop per-agent, as documented - session.Store validates agent ID / session key as single path components, preventing traversal outside the session directory - ValidatePathInWorkDir resolves symlinks on the target itself, not just its parent, closing a workspace-escape gap - bash tool now fails closed on an unrecognized ExecPolicy.Level instead of allowing everything - browser tool rejects unknown actions instead of silently no-op'ing Bump README to v0.3.4 and document the AgentSpec.Loop override semantics.
This commit is contained in:
1 parent
445614757b
commit
eb4fa67976
15 files changed
+421
-37
No files matched your search
@@ -50,3 +50,16 @@ func TestStore_RewriteDegradedWarns(t *testing.T) {
|
||||
require.Equal(t, 1, strings.Count(buf.String(), "session persistence degraded"),
|
||||
"Rewrite failure must emit the degraded warning")
|
||||
}
|
||||
|
||||
func TestStoreRejectsPathTraversalIdentifiers(t *testing.T) {
|
||||
s := NewStore(t.TempDir())
|
||||
|
||||
_, err := s.Load("../outside", "key")
|
||||
require.ErrorContains(t, err, "invalid agent ID")
|
||||
require.ErrorContains(t, s.Create("agent", "../outside"), "invalid session key")
|
||||
require.ErrorContains(t, s.Rename("agent", "../old", "new"), "invalid session key")
|
||||
require.ErrorContains(t, s.Delete("agent", "../outside"), "invalid session key")
|
||||
require.False(t, s.Exists("agent", "../outside"))
|
||||
_, err = s.List("../outside")
|
||||
require.ErrorContains(t, err, "invalid agent ID")
|
||||
}
|
||||
Reference in new issue
Block a user