extensions icon indicating copy to clipboard operation
extensions copied to clipboard

[Amazon AWS] Extension doesn't support credentials_process

Open albertquiroga opened this issue 1 year ago • 16 comments

Extension

https://raycast.com/Falcon/aws

Raycast Version

1.91.0

macOS Version

15.3

Description

It looks like the extension fails to retrieve credentials for any AWS profile configured to use the credentials_process feature ((docs)[https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-sourcing-external.html]) instead of statically setting the credentials in the .aws/credentials file. Here's an example of two profiles I have in my .aws/credentials file:

[profile one]
credentials_process = <my_command>

[profile two]
aws_access_key_id=<my_key>
aws_secret_access_key=<my_secret_key>
aws_session_token=<my_token>

Profile two works as intended, but profile one fails to list anything with this error:

CredentialsProviderError: Could not load credentials from any providers
    at /Users/myuser/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:52:1378
    at /Users/myuser/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:17:4091
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async coalesceProvider (/Users/bertolb/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:17:4272)
    at async /Users/myuser/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:17:4441
    at async /Users/myuser/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:1:11356
    at async /Users/myuser/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:1:7578
    at async BQe (/Users/myuser/.config/raycast/extensions/cdcb4b69-7df7-4f7e-977b-1406967eb3e7/ec2.js:82:18890)

The credentials_process feature is something supported by the AWS CLI and widely used across large companies to securely generate AWS credentials without exposing them in plain text config files. Not sure how the Raycast extension is currently retrieving credentials (the default credentials provider should support this without any work) but it doesn't seem to work properly. Any chance this can be looked at? Thanks in advance.

Steps To Reproduce

  1. Create a new AWS profile in .aws/config
  2. Create the respective section for that profile in .aws/credentials and set it to use the credentials_process option instead of plain text keys. The command in the option can be something silly like an echo command to print something in this format:
{"Version":1,"AccessKeyId":"<my_key>","SecretAccessKey":"<my_secret_key>","SessionToken":"<my_token>","Expiration":"2025-02-06T18:02:29Z"}
  1. Try to run any aws commands on raycast and it should fail with the aforementioned error

Current Behaviour

Fails with error

Expected Behaviour

Works as intended

albertquiroga avatar Feb 06 '25 17:02 albertquiroga

Thank you for opening this issue!

🔔 @victor-falcon @Hodglim @gebeto @momme-rtf @duboiss @hexpl0it @crisboarna @sidhant92 @DorukAkinci @frese @nagauta @vineus @jfkisafk @srikirank @b0lle you might want to have a look.

💡 Author and Contributors commands

The author and contributors of Falcon/aws can trigger bot actions by commenting:

  • @raycastbot close this issue Closes the issue.
  • @raycastbot close as not planned Closes the issue as not planned.
  • @raycastbot rename this issue to "Awesome new title" Renames the issue.
  • @raycastbot reopen this issue Reopens the issue.
  • @raycastbot assign me Assigns yourself to the issue.
  • @raycastbot good first issue Adds the "Good first issue" label to the issue.
  • @raycastbot keep this issue open Make sure the issue won't go stale and will be kept open by the bot.

raycastbot avatar Feb 06 '25 17:02 raycastbot

I second this, but I would like to use 1Password to retrieve the access key.

tobyward avatar Feb 24 '25 11:02 tobyward

aws-vault is supported, does it fit your needs?

b0lle avatar Mar 03 '25 13:03 b0lle

@b0lle it does not. AWS-Vault still assumes your account is accessed through static credentials which is not the case for many enterprise environments. As explained above many companies use dynamic credential generation through the credentials_process handler to generate credentials dynamically and prevent users from storing and keeping them locally which is considered insecure. Yes I know aws-vault encrypts them and keeps them securely, but the point is again to eliminate having static credentials altogether.

albertquiroga avatar Mar 03 '25 19:03 albertquiroga

Did a bit of research - it looks like this can be easily supported by changing how AWS clients are instantiated. For instance here the EC2Client is instantiated like this:

  const { NextToken, Reservations } = await new EC2Client({}).send(new DescribeInstancesCommand({ NextToken: token }));

Using the fromIni option on the credentials parameter lets the client take credentials from the default config files, including supporting the credentials_process option:

import { fromIni } from "@aws-sdk/credential-providers";

  const { NextToken, Reservations } = await new EC2Client({credentials: fromIni({})}).send(new DescribeInstancesCommand({ NextToken: token }));

So it looks like it can be an easy fix, although I'm not sure of how this would impact your current aws-vault integration

albertquiroga avatar Mar 31 '25 22:03 albertquiroga

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot avatar May 20 '25 23:05 raycastbot

This is not stale as the issue still exists

albertquiroga avatar May 22 '25 20:05 albertquiroga

Same here. Any news?

mschakulat avatar Jun 16 '25 07:06 mschakulat

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot avatar Aug 05 '25 07:08 raycastbot

This is still not stale as the issue still exists

mschakulat avatar Aug 05 '25 07:08 mschakulat

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot avatar Sep 24 '25 08:09 raycastbot

This is still not stale as the issue still exists

albertquiroga avatar Sep 24 '25 22:09 albertquiroga

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot avatar Nov 14 '25 03:11 raycastbot

This is still not stale as the issue still exists

albertquiroga avatar Nov 14 '25 04:11 albertquiroga

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot avatar Jan 03 '26 06:01 raycastbot

This is still not stale as the issue still exists

albertquiroga avatar Jan 04 '26 04:01 albertquiroga