insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

[Feature Request] Read AWS IAM v4 credentials externally

Open mgravlin opened this issue 8 years ago • 7 comments

  • Insomnia Version: 6.0.2
  • Operating System: Mac 10.13.6

Details

I often use AWS IAM v4 authentication within Insomnia. It's a pain to copy/paste these credentials into Insomnia manually especially when you have different AWS profiles and using aws_session_tokens which often rotate.

It would save lot of time if Insomnia can read the current AWS IAM credentials externally - from ~/.aws/credentials based on profile names.

mgravlin avatar Oct 10 '18 02:10 mgravlin

👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. If you're requesting a feature 🎁, please provide real use cases that would benefit. 👪

To help make this a smooth process, please be sure you have first read the contributing guidelines.

welcome[bot] avatar Oct 10 '18 02:10 welcome[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 09 '18 03:12 stale[bot]

This sounds like a good use-case for a custom plugin. You could create a Template Tag that reads the file and parses out the necessary contents.

gschier avatar Dec 14 '18 21:12 gschier

Is anyone aware of a plugin implementing this ?

adrian-baker avatar Jun 07 '19 05:06 adrian-baker

I just created one! insomnia-plugin-aws-iam

The magic is done by the excellent awscred library.

It works out of the box (at least for me) but more documentation, testing etc will come soon.

dankelleher avatar Dec 30 '19 13:12 dankelleher

Awesome, thanks for sharing @dankelleher! 🤗🎁

Also added a link to it in the README

gschier avatar Dec 30 '19 19:12 gschier

@gschier why don't we just instead fallback with getting the aws credentials from the aws sdk?

So from https://github.com/Kong/insomnia/blob/cb715f95659f917dbc8464e987cedc10cc1296f1/packages/insomnia-app/app/network/network.js#L581-L585

We could just do something like

import AWS from 'aws-sdk';
...
const {credentials: awsCreds} = AWS.config;
const credentials = { 
   accessKeyId: authentication.accessKeyId || awsCreds?.accessKeyId || '', 
   secretAccessKey: authentication.secretAccessKey || awsCreds?.secretAccessKey || '', 
   sessionToken: authentication.sessionToken || awsCreds?.sessionToken || ''
}; 

This would load whatever default credentials that the user has defined. It would also pick up a more complex setup like if they are using profiles or not.

kirbyjs avatar Apr 16 '20 17:04 kirbyjs