aws / aws/aws-lambda-rust-runtime

Add Lambda-Runtime-Invocation-Id header support for cross-wiring protection

Đang mở
#1,155 0 bình luận 1 reaction 1 người được giao Được @darklight3it nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
3.6k
Fork
396
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Summary

Lambda now sends a `Lambda-Runtime-Invocation-Id` header on `/runtime/invocation/next` responses. Runtimes should echo this header back on `/runtime/invocation/{requestId}/response` and `/runtime/invocation/{requestId}/error` to enable RAPID to detect and reject stale responses from timed-out invocations.

## Problem

When an invoke times out, the runtime process continues running. If a new invoke arrives with the same `requestId` (customer-provided or retried by upstream), RAPID accepts it. The still-running old invocation eventually posts its response, and RAPID delivers the wrong response to the new invoke (cross-wiring).

This affects both On-Demand and Lambda Managed Instances (LMI), and Rust is a supported LMI runtime.

## What needs to change

1. **Parse** `Lambda-Runtime-Invocation-Id` from the `/next` response headers (optional — may be absent with older RAPID)
2. **Store** it alongside the invocation context
3. **Echo** it as a request header on `/response` and `/error`
4. If the header is absent from `/next`, don't send it back (backward compat)

## Backward Compatibility

- Old RAPID (doesn't send the header) + New RIC (no header to echo) → no change ✅
- New RAPID (sends the header) + Old RIC (doesn't echo) → RAPID skips validation ✅
- New RAPID + New RIC → header echoed, RAPID validates match ✅

## Reference Implementations

- Python RIC: https://github.com/aws/aws-lambda-python-runtime-interface-client/pull/214

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.