feat(runtime-interface-client): Add Lambda-Runtime-Invocation-Id support for cross-wiring protection#624
Open
vip-amzn wants to merge 1 commit into
Open
feat(runtime-interface-client): Add Lambda-Runtime-Invocation-Id support for cross-wiring protection#624vip-amzn wants to merge 1 commit into
vip-amzn wants to merge 1 commit into
Conversation
…ort for cross-wiring protection Echo the invocation ID received from RAPID on /next back on /response and /error, enabling RAPID to detect and reject stale responses from timed-out invocations. Fully backward compatible.
vip-amzn
requested review from
darklight3it and
maxday
and removed request for
darklight3it
July 21, 2026 12:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
Lambda-Runtime-Invocation-Idheader support for cross-wiring protection.The RIC now echoes the invocation ID received from RAPID on
/nextback on/responseand/error, enabling RAPID to detect and reject stale responses from timed-out invocations.Problem
On Lambda Managed Instances (LMI) and On-Demand (OD), when an invoke times out, the runtime process continues running in the background. If a new invoke arrives with the same
requestId, RAPID accepts it. The still-running old invocation eventually posts its response, and RAPID matches it to the new invoke — delivering the wrong response (cross-wiring).Solution
RAPID sends a unique per-invoke identifier via
Lambda-Runtime-Invocation-Idheader on/next. The runtime echoes it back on/responseand/error. RAPID validates the match before accepting the response.Changes
aws-lambda-cpp-0.2.7/runtime.h: Addedinvocation_idfield toinvocation_request, added param topost_success/post_failure/do_postaws-lambda-cpp-0.2.7/runtime.cpp: Parse header inget_next(), add to curl request indo_post()when non-emptyNativeClient.cpp/.h: JNI readsinvocation_idfrom C++ response, passes to Java;postInvocationResponseaccepts nullable invocationIdInvocationRequest.java: NewinvocationIdfieldNativeClient.java: Updated native method signatureLambdaRuntimeApiClient.java/Impl:reportInvocationSuccess/reportInvocationErroraccept invocationIdAWSLambda.java: Thread invocationId through runtime loopBackward Compatibility
Fully backward compatible in both directions: