Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions policy/memory-action.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ const (
// MemoryListSecretsAction - list the secrets in a cortex.
MemoryListSecretsAction MemoryAction = "memory:ListSecrets"

// MemoryPutAgentAction - write an agent record in a cortex.
// MemoryPutBioTablesAction - create an agent's telemetry namespace and
// tables in a cortex's warehouse. Separate from MemoryPutAgentAction because
// it writes the Tables catalog, so a principal that may write agent state
// must not gain it.
MemoryPutBioTablesAction MemoryAction = "memory:PutBioTables"

// MemoryDeleteBioTablesAction - delete an agent's telemetry namespace and
// tables from a cortex's warehouse. Carries the same privilege as creating
// them, over history the agent has already written.
MemoryDeleteBioTablesAction MemoryAction = "memory:DeleteBioTables"

// MemoryPutAgentAction - write an agent record, or a memory beneath one, in
// a cortex.
MemoryPutAgentAction MemoryAction = "memory:PutAgent"

// MemoryGetAgentAction - read an agent record from a cortex.
Expand All @@ -75,21 +87,23 @@ const (

// SupportedMemoryActions - list of all supported AIStor Memory API actions.
var SupportedMemoryActions = map[MemoryAction]struct{}{
MemoryCreateCortexAction: {},
MemoryDeleteCortexAction: {},
MemoryGetCortexAction: {},
MemoryListCortexesAction: {},
MemoryPutSecretAction: {},
MemoryGetSecretAction: {},
MemoryDeleteSecretAction: {},
MemoryListSecretsAction: {},
MemoryPutAgentAction: {},
MemoryGetAgentAction: {},
MemoryDeleteAgentAction: {},
MemoryListAgentsAction: {},
MemorySearchAction: {},
MemoryGetObjectBioAction: {},
AllMemoryActions: {},
MemoryCreateCortexAction: {},
MemoryDeleteCortexAction: {},
MemoryGetCortexAction: {},
MemoryListCortexesAction: {},
MemoryPutSecretAction: {},
MemoryGetSecretAction: {},
MemoryDeleteSecretAction: {},
MemoryListSecretsAction: {},
MemoryPutBioTablesAction: {},
MemoryDeleteBioTablesAction: {},
MemoryPutAgentAction: {},
MemoryGetAgentAction: {},
MemoryDeleteAgentAction: {},
MemoryListAgentsAction: {},
MemorySearchAction: {},
MemoryGetObjectBioAction: {},
AllMemoryActions: {},
}

// IsValid - checks if action is valid or not.
Expand Down
2 changes: 2 additions & 0 deletions policy/memory-action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func TestMemoryActionIsValid(t *testing.T) {
{MemoryGetSecretAction, true},
{MemoryDeleteSecretAction, true},
{MemoryListSecretsAction, true},
{MemoryPutBioTablesAction, true},
{MemoryDeleteBioTablesAction, true},
{MemoryPutAgentAction, true},
{MemoryGetAgentAction, true},
{MemoryDeleteAgentAction, true},
Expand Down
5 changes: 4 additions & 1 deletion policy/memory-resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,10 @@ func TestStarPrefixedResourceParses(t *testing.T) {
// both actions against one resource would leak names without any cue.
func TestMemoryEnumerationConditionKeys(t *testing.T) {
listActions := []string{"memory:ListAgents", "memory:ListSecrets", "memory:ListCortexes"}
pointActions := []string{"memory:GetAgent", "memory:PutAgent", "memory:DeleteAgent", "memory:GetSecret"}
pointActions := []string{
"memory:GetAgent", "memory:PutAgent", "memory:DeleteAgent", "memory:GetSecret",
"memory:PutBioTables", "memory:DeleteBioTables",
}
Comment thread
dilverse marked this conversation as resolved.

for _, action := range listActions {
keys, ok := MemoryActionConditionKeyMap[Action(action)]
Expand Down
Loading