Repository navigation
Conversation
Signed-off-by: anilb <epipav@gmail.com>
|
@greptileai review |
|
|
PR SummaryMedium Risk Overview
New Reviewed by Cursor Bugbot for commit fda04ba. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@epipav I'm starting review 1 of this pull request now (started 2026-11-23 15:28 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by Hi anilb, SummaryThis pull request lets the Temporal payload encryption key rotate: the codec keeps encrypting with the current key and can decrypt with older keys from a new optional environment variable. The logic is sound and tested; the main concern is a style comment and a question about the Insights codec. Decision✅ Approved with minor comments 🟡 1 minor · ❔ 1 question DetailsOverall impression: Small, focused change. Behavior is identical while 🟡 Minor: 1 issue: Comment above Other reviewers and CI checks: Greptile and Copilot flagged the same comment (agreed, linked in the inline comment). Cursor Bugbot's summary raised nothing further. The required Documentation reminder: changed Rule files: read Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues |
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryAdds support for decrypting Temporal payloads with older keys while keeping new payloads on the current key.
Reviews (3) · Last reviewed commit: "style: fix codec formatting" · Reviewed by Greptile |
There was a problem hiding this comment.
🟡 Changes recommended
A redundant key-loading comment in encryption-codec.ts still violates AGENTS.md’s prohibition on comments that merely describe the code.
1 open issue
What changed in this PR
Adds key-rotation support to CDP’s shared Temporal payload codec so stored payloads can remain readable after the current encryption key changes.
Changes:
- Loads optional previous keys from
CROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUS, while encrypting new payloads with the current key. - Selects decryption keys by payload key ID, preserving the current-key fallback for unknown IDs.
- Adds tests for rotation, key retirement, compatibility, and malformed configuration.
| File | Description |
|---|---|
services/libs/temporal/src/encryption/encryption-codec.ts |
Loads and validates previous keys and selects the decryption key. |
services/libs/temporal/src/encryption/encryption-codec.test.ts |
Adds five tests covering codec behavior and configuration errors. |
Review effort: Balanced
lfx-one
left a comment
There was a problem hiding this comment.
The key-rotation logic is correct and well tested. Behavior is unchanged while the new variable is unset. One minor comment-style finding and one question about the Insights contract ride along; neither blocks approval.
Documentation
This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:
CROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUS(new optional environment variable)
| this.keys.set(keyId, key) | ||
| } | ||
| // Unknown key ids fall back to the current key, which is how every id was decrypted before. | ||
| const key = this.keys.get(decode(keyIdBytes)) ?? this.keys.get(this.defaultKeyId) |
There was a problem hiding this comment.
[question] Does the Insights codec need to rotate in step with this one?
Issue: decode sends every key id that is not in the map to the current key. AGENTS.md (Downstream consumer: LFX Insights) says Insights keeps its own implementation of the payload encryption codec for the two workflows it starts on this repo's workers, and that the codec of those workflows is part of the external contract.
Proof: In the rotation steps in the PR description, step 2 makes a new key current. A payload from Insights carries Insights' own key id, which is not in this map, so it is decrypted with the new current key. Insights would have to switch to the new key at that moment, or its payloads fail to decrypt. The description doesn't mention Insights.
Why it matters: A rotation done without the Insights team could break upsertOSPSBaselineSecurityInsights and processProjectDocsReadiness runs in production.
Fix: Confirm how the Insights codec gets its key and what key id it writes, then add a step to the rotation procedure for coordinating with the Insights team (the contract doc linked in AGENTS.md is the place to check). If Insights needs to decrypt under its own key id, register that id in CROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUS.
There was a problem hiding this comment.
Insights sets NUXT_TEMPORAL_ENCRYPTION_KEY_ID and INSIGHTS_TEMPORAL_ENCRYPTION_KEY_ID to the same id and key as CROWD_TEMPORAL_ENCRYPTION_KEY_ID, so its payloads already decrypt through this map. linuxfoundation/insights#2550 adds the same previous-keys support there, and both sides get the new key in one config change.
Signed-off-by: anilb <epipav@gmail.com>
|
@epipav A recent review was posted within the last 5 minutes: #5430 (comment). I won't re-review yet. Push another update after 5 minutes if you want another pass. |
There was a problem hiding this comment.
🔵 Needs a closer look
Production rotation requires cross-repo confirmation of consumer readiness and historical key retention across CDP and Insights, whose independent Nuxt codec remains single-key.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Signed-off-by: anilb <epipav@gmail.com>
|
@epipav I'm starting review 2 of this pull request now (started 2026-11-23 15:53 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by Hi anilb, thanks for addressing the earlier feedback so quickly. SummaryThese new commits remove the narrating comments from Decision✅ Approved DetailsOverall impression: The follow-up is small and scoped to the earlier feedback. Behavior is identical to the version reviewed in review 1: encryption uses the current key, decryption picks the key by the payload's key id, and a malformed 👏 Nice work: you dropped both narrating comments, as the repo's no-comments rule asks, and kept the one that guards against leaking key material.
Other reviewers and CI checks: Greptile scored the PR 5/5 and Copilot reported no open issues; both agree with this review. The required Rule files: read Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues |
lfx-one
left a comment
There was a problem hiding this comment.
The new commits remove the narrating comments and fix formatting; the key-rotation logic is unchanged and still correct. The earlier comment-style finding is fixed, and the Insights question was answered in the thread.
There was a problem hiding this comment.
🔵 Needs a closer look
Human confirmation is needed for coordinated key provisioning, rollout, and retirement with Insights, whose separate single-key codec is not updated by this PR or validated by its local tests.
No open issues 🎉
Review effort: Balanced
gaspergrom
left a comment
There was a problem hiding this comment.
Looks good to me, LGTM.

Summary
Lets the Temporal payload encryption key rotate without breaking payloads that are already stored.
EncryptionCodeckeeps encrypting with the current key and can now also decrypt with older keys listed in a new, optionalCROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUS.Today the codec holds a single key, and every key id decrypts with it. Swapping the key would make running workflow histories, signals and schedule arguments undecodable.
Changes
services/libs/temporal/src/encryption/encryption-codec.tsEncryptionCodec.create(keyId)loads the current key (CROWD_TEMPORAL_ENCRYPTION_KEY, unchanged) plus every entry ofCROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUS, a JSON object of key id to key, for example{"old-id":"<32-byte key>"}.encodeis unchanged: new payloads carry the current key id.decodepicks the key by the payload'sencryption-key-id. Unknown ids fall back to the current key, which is how every id was decrypted before, so behaviour is identical while the new variable is unset.temporal_codec_serverand every worker get this throughEncryptionCodec.createandgetDataConverter, with no change on their side.Rotation with this in place
CROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUSeverywhere and restart, so every process can decrypt it before anything encrypts with it.CROWD_TEMPORAL_ENCRYPTION_KEYS_PREVIOUS, then restart.Testing
encryption-codec.test.ts(5 tests, real AES-GCM keys): round trip; payloads written with a previous key decrypt after rotation while new payloads carry the new id; a payload fails once its key is dropped; unknown ids decrypt with the current key; a malformed value is rejected without echoing it.tsc -bforservices/libs/temporalandservices/apps/temporal_codec_server,oxlintandoxfmtpass.