@astrale-os/sdk 0.6.0-beta.53 → 0.6.0-beta.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,7 +36,7 @@ export function tokenExchange(issuer, subject, signing, policy, verification, ma
|
|
|
36
36
|
const inner = await verifyCredentialAgainst(carried.credential, outer.verified.iss, outer.basis);
|
|
37
37
|
requireProfile(inner.verified, 'inner');
|
|
38
38
|
requireCoherence(outer.verified, inner.verified);
|
|
39
|
-
|
|
39
|
+
requireDirect(inner.verified);
|
|
40
40
|
context.signal.throwIfAborted();
|
|
41
41
|
const now = Math.floor(Date.now() / 1_000);
|
|
42
42
|
const expiresAt = Math.min(outer.verified.exp, inner.verified.exp, now + maximumTtlSeconds);
|
|
@@ -104,6 +104,16 @@ function requireCoherence(outer, inner) {
|
|
|
104
104
|
if (inner.iss !== outer.iss || inner.sub !== outer.sub || inner.aud !== outer.iss)
|
|
105
105
|
invalid();
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Exchange only a direct delegation, whose subject delegated its own authority: the proof's resolved
|
|
109
|
+
* caller is its subject, which coherence already bound to the carrier's. A session acting for
|
|
110
|
+
* another caller presents that authority to this Domain's code instead, never through the exchange
|
|
111
|
+
* (ISSUER-TOKEN-EXCHANGE-DIRECT, AUTH-FUNCTION-DOMAIN-EXCHANGE).
|
|
112
|
+
*/
|
|
113
|
+
function requireDirect(inner) {
|
|
114
|
+
if (acceptResolvedDelegation(inner.claims.delegation) !== inner.sub)
|
|
115
|
+
invalid();
|
|
116
|
+
}
|
|
107
117
|
function invalid() {
|
|
108
118
|
throw protocolError('AUTH_INVALID', 'Token is invalid.');
|
|
109
119
|
}
|
|
@@ -17,7 +17,9 @@ it. Errors remain errors; a network failure is not a permission denial. Admissio
|
|
|
17
17
|
installed Domain with token exchange, and runs the same delegate and token exchange chain as the
|
|
18
18
|
Session `exchange` option and `session.exchange(issuer)`. Delegation uses explicit per-call
|
|
19
19
|
attenuation, the Session's attenuation, or `self`, and can therefore narrow a composed Grant. A later
|
|
20
|
-
invocation is independently authorized.
|
|
20
|
+
invocation is independently authorized. A Domain exchanges only a direct delegation, whose source
|
|
21
|
+
principal is its own caller (a user or Function credential): a Session acting for another caller,
|
|
22
|
+
such as a Domain-exchanged credential, cannot admit or exchange through another Domain.
|
|
21
23
|
|
|
22
24
|
## Constructor migration
|
|
23
25
|
|