Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdcff126ef |
@@ -111,6 +111,12 @@ func TestBrainEditRollbackDoesNotWriteThroughASymlinkSwappedInForTheNote(t *test
|
||||
})()
|
||||
resp := authCall(t, srv, jwtAuthz, "brain_edit", map[string]any{"path": path, "old_str": "static body", "new_str": "injected"})
|
||||
require.NotNil(t, resp["error"])
|
||||
// The swap happened and the rollback refused it: the error says so,
|
||||
// and the note path is still the planted symlink.
|
||||
assert.Contains(t, resp["error"].(map[string]any)["message"], "could NOT be rolled back")
|
||||
fi, err := os.Lstat(note)
|
||||
require.NoError(t, err)
|
||||
assert.NotZero(t, fi.Mode()&os.ModeSymlink, "the note path is still the swapped-in symlink")
|
||||
got, _ := os.ReadFile(victim)
|
||||
assert.Equal(t, "untouched", string(got), "the rollback wrote through the swapped-in symlink")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user