Download this file
| 1 | package agentaccess |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "encoding/json" |
| 6 | ) |
| 7 | |
| 8 | // ScheduleResponseGuard performs only current reads and credential checks. |
| 9 | // Other operations keep their own app-owned emission authorization. |
| 10 | func (r *Registry) ScheduleResponseGuard(ctx context.Context, p Principal, name string, raw json.RawMessage, result any) error { |
| 11 | if name != "calls_schedule" { |
| 12 | return nil |
| 13 | } |
| 14 | team, err := operationTeam(raw) |
| 15 | if err != nil { |
| 16 | return Fail("unavailable", "Workflow provenance is unavailable.") |
| 17 | } |
| 18 | if r.schedule == nil { |
| 19 | return Fail("unavailable", "Scheduling is unavailable.") |
| 20 | } |
| 21 | var in scheduleInput |
| 22 | var out scheduleResult |
| 23 | body, err := json.Marshal(result) |
| 24 | if err != nil || len(body) > 65535 || json.Unmarshal(raw, &in) != nil || json.Unmarshal(body, &out) != nil || in.Team != team || out.Team != team || out.ClientID != in.ClientID { |
| 25 | return Fail("unavailable", "Workflow provenance is unavailable.") |
| 26 | } |
| 27 | return r.schedule.revalidate(ctx, p, in, out) |
| 28 | } |
| 29 | |