mirror of
https://github.com/mudler/LocalAI.git
synced 2026-11-06 04:23:15 -05:00
test(studio): the allowlist does not pass the gate of an auto trigger that acts
The gate behind the auto start of a trigger with acts asks about a capability that is not sensitive, with the Sensitive mark. Pin that an allowlisted sender alone is refused and a paired one passes. Assisted-by: Claude:claude-sonnet-5-5
This commit is contained in:
1 file changed
+6
@@ -194,6 +194,12 @@ var _ = Describe("permissions in the turns of a connector chat", func() {
|
||||
Expect(req(studio.CapabilityRequest{Capability: contract.CapProposalsConfirm, Sender: "11", Sensitive: true})).To(BeFalse(), "neither does the allowlist")
|
||||
Expect(req(studio.CapabilityRequest{Capability: contract.CapProposalsConfirm, Sender: "12", Sensitive: true})).To(BeTrue(), "a pairing does")
|
||||
Expect(req(studio.CapabilityRequest{Capability: contract.CapProposalsConfirm, Sender: "12"})).To(BeTrue(), "paired")
|
||||
// The gate behind the auto start of a trigger that acts asks about a
|
||||
// capability that is not sensitive, with the Sensitive mark: the
|
||||
// allowlist must not pass it, only a pairing.
|
||||
Expect(req(studio.CapabilityRequest{Capability: contract.CapTriggersPropose, Sender: "11"})).To(BeTrue(), "the allowlist holds a capability that is not sensitive")
|
||||
Expect(req(studio.CapabilityRequest{Capability: contract.CapTriggersPropose, Sender: "11", Sensitive: true})).To(BeFalse(), "but not when the request is marked sensitive")
|
||||
Expect(req(studio.CapabilityRequest{Capability: contract.CapTriggersPropose, Sender: "12", Sensitive: true})).To(BeTrue(), "a pairing passes")
|
||||
Expect(gate.Allow(ctx, studio.CapabilityRequest{Capability: contract.CapProposalsConfirm, Binding: "nope", Sender: "12"})).To(BeFalse())
|
||||
Expect(gate.Allow(ctx, studio.CapabilityRequest{Capability: contract.CapProposalsConfirm, Binding: b.ID, Owner: "mallory", Sender: "12"})).To(BeFalse())
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user