AWS appsync: AppSync JS resolver sourceIp semantics and X-Forwarded-For warning
Summary
Rewrites the `ctx.request.sourceIp` description to describe it as an ordered list of addresses (X-Forwarded-For entries followed by the TCP connection address) and adds an Important callout warning that clients and proxies can set `x-forwarded-for` arbitrarily, AppSync does not verify it, and only the last element should be used for authorization decisions.
Security assessment
The new callout explicitly warns that `x-forwarded-for` is attacker-controllable and unverified, and instructs developers to base IP-based authorization only on the last (connection-derived) list element. This is security best-practice guidance that mitigates IP-spoofing-driven authorization bypass, but there is no reference to a specific vulnerability, incident, or CVE, so it is hardening documentation rather than a fix.
Evidence
+Clients and intermediate proxies can set the `x-forwarded-for` header to any value, and AWS AppSync doesn't verify it. Use only the last element of `sourceIp` for authorization decisions, and sanitize the other entries before you use them.
Diff
diff --git a/appsync/latest/devguide/resolver-context-reference-js.md b/appsync/latest/devguide/resolver-context-reference-js.md index e18f45e..2edc287 100644 --- a//appsync/latest/devguide/resolver-context-reference-js.md +++ b//appsync/latest/devguide/resolver-context-reference-js.md @@ -242 +242 @@ The token issuer. -The source IP address of the caller that AWS AppSync receives. If the request doesn't include the `x-forwarded-for` header, the source IP value contains only a single IP address from the TCP connection. If the request includes a `x-forwarded-for` header, the source IP is a list of IP addresses from the `x-forwarded-for` header, in addition to the IP address from the TCP connection. +A list of the source IP addresses for the request that AWS AppSync receives. If the request doesn't include an `x-forwarded-for` header, the list contains only the address of the connection to AWS AppSync. If the request includes an `x-forwarded-for` header, the list contains the addresses from that header in order, followed by the address of the connection to AWS AppSync. For example, if the header is ``ip-1`, `ip-2`` and the connection comes from ``ip-3``, `sourceIp` is `[`ip-1`, `ip-2`, `ip-3`]`. @@ -263,0 +264,4 @@ The user name of the authenticated user. In the case of `AMAZON_COGNITO_USER_POO +###### Important + +Clients and intermediate proxies can set the `x-forwarded-for` header to any value, and AWS AppSync doesn't verify it. Use only the last element of `sourceIp` for authorization decisions, and sanitize the other entries before you use them. +