Skip to content

Commit 56cf2f3

Browse files
committed
Describe the header context as HPKE info
Tink's HybridEncrypt passes contextInfo to HPKE as the info parameter, which is mixed into key derivation, and seals with empty associated data. The docs called the context authenticated associated data, which is inaccurate. Describe it as HPKE info and state that it is never transmitted, only rebuilt by the receiver.
1 parent 577368e commit 56cf2f3

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎core/src/main/java/io/temporal/samples/nexussecurecredentialpropagation/README.MD‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ Nexus header "x-temporal-end-user-credential":
9595
plaintext = frame("credential-envelope", v1, compactJwt, intent)
9696
```
9797

98-
`frame` is a length-prefixed encoding. The context is visible to anyone who can read history; only the plaintext is
98+
`frame` is a length-prefixed encoding. The context is passed to Tink as HPKE `info`, which is mixed into the key
99+
derivation (Tink's HPKE uses empty AEAD associated data). It is never transmitted: the receiver rebuilds it from the
100+
dispatched route, its Workflow info, and the argument ciphertexts it received, and a different context derives a
101+
different key, so decryption fails. Its components are visible to anyone who can read history; only the plaintext is
99102
secret.
100103

101104
The Java SDK builds the continue-as-new header before encoding the new run's arguments, so continue-as-new headers
@@ -226,8 +229,8 @@ Nexus header contain only ciphertext.
226229

227230
### Verify the binding
228231

229-
The args digest is not a field in the header; it is authenticated associated data that the receiver recomputes. To
230-
check the binding in a real history, run the verifier against the caller namespace:
232+
The args digest is not a field in the header; it is part of the HPKE `info` that the receiver recomputes. To check
233+
the binding in a real history, run the verifier against the caller namespace:
231234

232235
```
233236
./gradlew -q :core:execute -PmainClass=io.temporal.samples.nexussecurecredentialpropagation.tools.VerifyCredentialBinding \

‎core/src/main/java/io/temporal/samples/nexussecurecredentialpropagation/common/Frame.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import java.security.GeneralSecurityException;
77

88
/**
9-
* Unambiguous length-prefixed encoding used for associated data, digests, and envelopes.
9+
* Unambiguous length-prefixed encoding used for associated data, HPKE context info, digests, and
10+
* envelopes.
1011
*
1112
* <p>Every field is written as a 4-byte big-endian length followed by its bytes, so no two
1213
* different field sequences produce the same encoding.

‎core/src/main/java/io/temporal/samples/nexussecurecredentialpropagation/common/SecureCredentialHeaders.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Base64;
1111

1212
/**
13-
* Wire formats and associated data for the credential headers.
13+
* Wire formats and HPKE context info for the credential headers.
1414
*
1515
* <p>Every header carries an HPKE ciphertext of a {@link CredentialEnvelope} encrypted to the
1616
* receiving hop. The HPKE context info binds it to the hop's context and, where available, to the

‎core/src/main/java/io/temporal/samples/nexussecurecredentialpropagation/tools/VerifyCredentialBinding.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* digest from the event's input ciphertexts, or using {@code firstExecutionRunId} for
3030
* continue-as-new headers), opens the header with it, and confirms that the same context with one
3131
* bit changed is rejected. It also confirms the digest never appears in the header bytes: the
32-
* digest is authenticated associated data, not a transmitted field.
32+
* digest is part of the HPKE {@code info} mixed into key derivation, not a transmitted field.
3333
*
3434
* <p>Opening a header requires the receivers' private keys, so this is an operator debugging tool.
3535
* It prints only the subject and issuer of each credential, never the token.

0 commit comments

Comments
 (0)