amazon-ec2-metadata-mock icon indicating copy to clipboard operation
amazon-ec2-metadata-mock copied to clipboard

Passing null value in AEMM config parameter

Open richardgalestok opened this issue 1 year ago • 4 comments

Hi i would like to ask whether is there any way how to pass null value in some of property by env variable such as AEMM_METADATA_VALUES_IAM_SECURITY_CREDENTIALS_TOKEN: null or maybe like AEMM_METADATA_VALUES_IAM_SECURITY_CREDENTIALS: '{"Code":"Success"","LastUpdated":"2020-04-02T18:50:40Z","Type":"AWS-HMAC","AccessKeyId":"MY_ACCESS_KEY","SecretAccessKey":"MY_SECRET_KEY","Token":null,"Expiration":"2040-04-02T00:49:51Z"}"'. In my case it's still overriden by default values from the code, or in case of passing the whole json content i cannot obtain the specified values, they're empty. Thank you a lot for any hint/workaround.

richardgalestok avatar Jul 29 '22 10:07 richardgalestok

I think we would need a change to the formatting logic to customize the output of null. I was able to override the value via env; however, the null is in quotes which does not match reality.

Repro Steps

  • export AEMM_METADATA_VALUES_IAM_SECURITY_CREDENTIALS_TOKEN=null
  • ./ec2-metadata-mock
  • curl localhost:1338/latest/meta-data/iam/security-credentials/baskinc-role :
curl localhost:1338/latest/meta-data/iam/security-credentials/baskinc-role
{
	"Code": "Success",
	"LastUpdated": "2020-04-02T18:50:40Z",
	"Type": "AWS-HMAC",
	"AccessKeyId": "12345678901",
	"SecretAccessKey": "v/12345678901",
	"Token": "null", --> real IMDS shows no quotes
	"Expiration": "2020-04-02T00:49:51Z"
}%

brycahta avatar Aug 11 '22 20:08 brycahta

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want this issue to never become stale, please ask a maintainer to apply the "stalebot-ignore" label.

github-actions[bot] avatar Sep 11 '22 17:09 github-actions[bot]

Hi, any chance to figure this issue out or possible workaround?

richardgalestok avatar Sep 12 '22 14:09 richardgalestok

@richardgalestok per my explanation, this would require a code change. I'll remove stale because we should align null output with IMDS; however, I'm not sure if we'll be able to get to it this year.

brycahta avatar Sep 12 '22 15:09 brycahta

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want this issue to never become stale, please ask a maintainer to apply the "stalebot-ignore" label.

github-actions[bot] avatar Oct 12 '22 17:10 github-actions[bot]

This issue was closed because it has become stale with no activity.

github-actions[bot] avatar Oct 17 '22 17:10 github-actions[bot]