fix: issues discovered by invocation validation tests

This commit is contained in:
Steve Moyer
2024-11-13 12:40:25 -05:00
parent 64b989452f
commit fc4c8f2de1
4 changed files with 7 additions and 5 deletions

View File

@@ -94,7 +94,7 @@ func TestToken_ExecutionAllowed(t *testing.T) {
args := invocationtest.EmptyArguments
prf := invocationtest.Proof(t, dlg1TknCIDStr, expiredDlg0TknCIDStr, rootTknCIDStr)
testFails(t, invocation.ErrDelegationExpired, []string{"seg0"}, args, prf)
testFails(t, invocation.ErrTokenInvalidNow, []string{"seg0"}, args, prf)
})
t.Run("fails - referenced delegation inactive", func(t *testing.T) {
@@ -102,7 +102,7 @@ func TestToken_ExecutionAllowed(t *testing.T) {
args := invocationtest.EmptyArguments
prf := invocationtest.Proof(t, dlg1TknCIDStr, inactiveDlg0TknCIDStr, rootTknCIDStr)
testFails(t, invocation.ErrDelegationInactive, []string{"seg0"}, args, prf)
testFails(t, invocation.ErrTokenInvalidNow, []string{"seg0"}, args, prf)
})
t.Run("fails - last (or only) delegation not root", func(t *testing.T) {
@@ -126,7 +126,7 @@ func TestToken_ExecutionAllowed(t *testing.T) {
args := invocationtest.EmptyArguments
prf := invocationtest.Proof(t, dlg0TknCIDStr, rootTknCIDStr)
testFails(t, invocation.ErrNotIssuedToInvoker, []string{"seg0"}, args, prf)
testFails(t, invocation.ErrBrokenChain, []string{"seg0"}, args, prf)
})
}

View File

@@ -26,6 +26,8 @@ func (t *Token) verifyProofs(delegations []*delegation.Token) error {
aud = t.subject
}
fmt.Println("Subject:", t.subject, ", Audience:", aud)
var last *delegation.Token
// control from the invocation to the root