feat: Add Lambda-Runtime-Invocation-Id support for cross-wiring protection#214
Open
vip-amzn wants to merge 1 commit into
Open
feat: Add Lambda-Runtime-Invocation-Id support for cross-wiring protection#214vip-amzn wants to merge 1 commit into
vip-amzn wants to merge 1 commit into
Conversation
c39ec23 to
61ca64f
Compare
…ction 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 — header only sent when received.
61ca64f to
39f026b
Compare
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 nonce via
Lambda-Runtime-Invocation-Idheader on/next. The runtime echoes it back on/responseand/error. RAPID validates the match before accepting the response.Changes
runtime_client.cpp: ParseLambda-Runtime-Invocation-Idfrom/nextresponse, pass topost_success/post_failureviazformat (acceptsNone→nullptr)lambda_runtime_client.py: Threadinvocation_idthrough to native clientbootstrap.py: Passinvocation_idfrom event request to response/error postingdeps/: Patchaws-lambda-cppto supportinvocation_idinget_next/do_postBackward Compatibility
Fully backward compatible in both directions:
Testing