-
Notifications
You must be signed in to change notification settings - Fork 51.7k
feat: Add AWS CLI profile authentication support #22900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Add AWS CLI profile authentication support #22900
Conversation
- Add authentication type selector to AWS credentials (Access Keys vs Profile) - Support AWS CLI profile names (default and custom profiles) - Use native AWS SDK fromNodeProviderChain for credential resolution - Maintain full backwards compatibility with existing access key auth - Available for Bedrock and all AWS nodes in N8N
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 6 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/nodes-base/credentials/Aws.credentials.ts">
<violation number="1" location="packages/nodes-base/credentials/Aws.credentials.ts:168">
P1: Avoid switching AWS profiles by mutating process.env for each request; this creates cross-request race conditions and can resolve another user’s credentials. Pass the profile/region directly to fromNodeProviderChain instead of rewriting global env vars.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| }; | ||
|
|
||
| try { | ||
| process.env.AWS_PROFILE = profileName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Avoid switching AWS profiles by mutating process.env for each request; this creates cross-request race conditions and can resolve another user’s credentials. Pass the profile/region directly to fromNodeProviderChain instead of rewriting global env vars.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/nodes-base/credentials/Aws.credentials.ts, line 168:
<comment>Avoid switching AWS profiles by mutating process.env for each request; this creates cross-request race conditions and can resolve another user’s credentials. Pass the profile/region directly to fromNodeProviderChain instead of rewriting global env vars.</comment>
<file context>
@@ -87,14 +147,64 @@ export class Aws implements ICredentialType {
+ };
+
+ try {
+ process.env.AWS_PROFILE = profileName;
+ process.env.AWS_REGION = region;
+
</file context>
|
Hey @sofianhamiti, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: Regarding new nodes: If your node integrates with an AI service that you own or represent, please email [email protected] and we will be happy to discuss the best approach. About review timelines: Thank you again for contributing to n8n. |
Summary
This PR adds support for authenticating with AWS using AWS CLI profiles (from
~/.aws/credentialsand~/.aws/config), in addition to the existing access key authentication.Why This Change?
Changes Made
Aws.credentials.ts): Added "Authentication Type" selector with Access Keys (default) and AWS Profile optionstypes.ts): ExtendedAwsIamCredentialsTypewithauthenticationTypeandawsProfilefieldsLmChatAwsBedrock.node.ts): Updated to handle profile-based authentication@aws-sdk/credential-providersto bothnodes-baseandnodes-langchainpackagesHow to Use
Backwards Compatibility
✅ 100% backwards compatible - existing credentials continue to work unchanged (default type: "Access Keys")
Related Linear tickets, Github issues, and Community forum posts
Related to #21568 - This PR adds AWS CLI profile authentication support, addressing part of the request for better AWS credential chain support.
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)