Conversation
Merge in EADPGHS/light-aws-lambda from feature/stsWebToken to sync * commit '4538d52d3ad7c3b127b1afc6c6aa122db5864d0b': adding cache for IDToken support for AssumeRoleWithWebIdentity
There was a problem hiding this comment.
Pull request overview
This PR updates the lambda-invoker STS configuration from a boolean flag (stsEnabled) to a typed selector (stsType) and adds support for STS AssumeRole with Web Identity, along with related config/schema/test updates.
Changes:
- Replace
stsEnabledwithstsTypeacross config model, config files, and generated schema. - Add
StsWebIdentitysupport inLambdaFunctionHandler(Authorization token-based STS exchange) and add aStsFuncUsertest config. - Add
metrics-configdependency to the parent and lambda-invoker module POMs.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Adds metrics-config to dependency management so modules can consume it consistently. |
| lambda-invoker/pom.xml | Adds metrics-config dependency for the lambda-invoker module. |
| lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaInvokerConfig.java | Replaces stsEnabled with stsType and updates validation/error text accordingly. |
| lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java | Implements STS client/provider selection based on stsType and adds Web Identity token handling. |
| lambda-invoker/src/main/resources/config/lambda-invoker.yml | Updates config documentation and key name from stsEnabled to stsType. |
| lambda-invoker/src/main/resources/config/lambda-invoker.yaml | Same as above, for the .yaml variant. |
| lambda-invoker/src/main/resources/config/lambda-invoker-schema.json | Updates schema properties/required list to replace stsEnabled with stsType. |
| lambda-invoker/src/test/java/com/networknt/aws/lambda/LambdaInvokerConfigTest.java | Updates tests to reflect stsType and adds a new sts type scenario. |
| lambda-invoker/src/test/resources/config/lambda-invoker-sts-with-role.yml | Updates test config to use stsType: StsWebIdentity. |
| lambda-invoker/src/test/resources/config/lambda-invoker-sts-no-role.yml | Updates test config to use stsType: StsWebIdentity with missing roleArn. |
| lambda-invoker/src/test/resources/config/lambda-invoker-sts-func.yml | Adds new test config for stsType: StsFuncUser. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaInvokerConfig.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/resources/config/lambda-invoker-schema.json
Outdated
Show resolved
Hide resolved
…alidation Agent-Logs-Url: https://github.com/networknt/light-aws-lambda/sessions/7d681ae3-7571-4446-82f3-109707801103 Co-authored-by: stevehu <2042337+stevehu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…est coverage Agent-Logs-Url: https://github.com/networknt/light-aws-lambda/sessions/e1696a54-4c13-45ea-831c-e02b5160ef43 Co-authored-by: stevehu <2042337+stevehu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java:191
- When config is reloaded,
tokenCacheis not cleared. If the handler previously cached a token and then reloads/recreatesstsWebIdentityCredentialsProvider(which is initially built without awebIdentityToken), the first request after reload with the same token will hit the cache fast-path and skip rebuilding the provider with the token, leaving the provider with a token-less refresh request. ClearingtokenCacheduring the reload/close block would prevent this.
if(stsWebIdentityCredentialsProvider != null) {
try {
stsWebIdentityCredentialsProvider.close();
} catch (Exception e) {
logger.error("Failed to close the StsAssumeRoleWithWebIdentityCredentialsProvider", e);
}
stsWebIdentityCredentialsProvider = null;
}
if(stsClient != null) {
try {
stsClient.close();
} catch (Exception e) {
logger.error("Failed to close the StsClient", e);
}
stsClient = null;
}
client = initClient(config);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaInvokerConfig.java
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/test/java/com/networknt/aws/lambda/LambdaInvokerConfigTest.java
Outdated
Show resolved
Hide resolved
…nctionHandler.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…vokerConfigTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…date() Agent-Logs-Url: https://github.com/networknt/light-aws-lambda/sessions/2cd98e34-9726-4923-b74b-1cb85395a819 Co-authored-by: stevehu <2042337+stevehu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
|
For StsWebIdentity, the handler no longer mutates shared client or credentials-provider state on request threads. It now validates the bearer token, returns 401 immediately when the header is missing or invalid, and builds a request-scoped |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaInvokerConfig.java
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Show resolved
Hide resolved
lambda-invoker/src/test/java/com/networknt/aws/lambda/LambdaInvokerConfigTest.java
Show resolved
Hide resolved
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
|
I removed the request-scoped client recreation. StsWebIdentity now uses one shared LambdaAsyncClient again, backed by a stable mutable credentials provider that swaps its underlying StsAssumeRoleWithWebIdentityCredentialsProvider under |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lambda-invoker/src/main/java/com/networknt/aws/lambda/LambdaFunctionHandler.java
Outdated
Show resolved
Hide resolved
…nctionHandler.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@DiogoFKT @KalevGonvick , I have made some changes along with some Copilot updates. Please review and approve. Thanks. |
No description provided.