Skip to content
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

parameter containing uri string is interpreted as uri parameter #630

Closed
DominikTo opened this issue Feb 4, 2014 · 18 comments
Closed

parameter containing uri string is interpreted as uri parameter #630

DominikTo opened this issue Feb 4, 2014 · 18 comments
Labels
automation-exempt Issue will not be subject to stale-bot feature-request A feature should be added or improved.

Comments

@DominikTo
Copy link

When passing an uri as a string, awscli fetches the content of the uri instead of just using the string value.

Example:

aws ec2 run-instances \
[...] \
--user-data 'https://foo/bar' \
[...] \

Expected result:

Actual result:

  • User data contains the contents served at that uri (which should only happen if an uri is passed without quotes).
@jamesls
Copy link
Member

jamesls commented Feb 11, 2014

I agree with your general comment, which is that there should be some way to escape the URI param processing if you want to specify the literal URI string as the value for the parameter.

However, in some shells (such as bash), the shell strips the quotes for an argument before the process is able to access the arguments. For example:

$ python -c "import sys; print(sys.argv)" --test foo --test 'single_qoutes' --test "double quotes"
['-c', '--test', 'foo', '--test', 'single_qoutes', '--test', 'double quotes']

This means that it's not possible to tell which values were originally quoted. If we were to implement this, you'd have to escape the quotes in the shell, which doesn't look quite as nice:

$ python -c "import sys; print(sys.argv)" --test \'escapedquotes\'
['-c', '--test', "'escapedquotes'"]

Perhaps there's some other way a user can specify that an argument not the URI contents? Maybe we could prefix the value with some character? Otherwise we could implement the quotes check provided that users are fine with escaping the quotes in the shell.

@m17kea
Copy link

m17kea commented Jun 19, 2017

Has anything been done to remedy this? It still remains an issue I believe. If anyone has a workaround other than creating a txt file with the value I would appreciate it

@AlJohri
Copy link

AlJohri commented Jul 26, 2017

this is way way way too magical. please have an option to disable this.

@AlJohri
Copy link

AlJohri commented Jul 26, 2017

switching to https://www.npmjs.com/package/kms-cli for now

@jasonmcaffee
Copy link

fyi, for ssm put-parameter param, i found a workaround using the --cli-input-json, that i'm guessing will work for the ec2 command as well:

aws --profile myprofile ssm put-parameter --cli-input-json '{
  "Name": "/some/url/param",
  "Value": "http://google.com",
  "Type": "String",
  "Description": "url"
}'

@toby5box
Copy link

toby5box commented Dec 14, 2017

This just blind-sided me again, even though I supposedly knew about it, having commented on a related issue before. So here I am at nearly midnight and it's blocking a production push while I try to find a reasonable workaround. I bet this is implicated in more than a couple Sev 2's.

Please fix it, the current behaviour is just too surprising and potentially dangerous.

The quotes idea is misguided though. It should just never fetch the contents of the URL. If that behaviour is desired in some (hard to imagine) situation, then add a different option to do so. Yes I realise backward compatibility is impaired. That's just how bad an idea it was in the first place.

Even more astonishing is that it's not even documented. On the upside, this should really give carte blanche to breaking scripts.

@ASayre
Copy link
Contributor

ASayre commented Feb 6, 2018

Good Morning!

We're closing this issue here on GitHub, as part of our migration to UserVoice for feature requests involving the AWS CLI.

This will let us get the most important features to you, by making it easier to search for and show support for the features you care the most about, without diluting the conversation with bug reports.

As a quick UserVoice primer (if not already familiar): after an idea is posted, people can vote on the ideas, and the product team will be responding directly to the most popular suggestions.

We’ve imported existing feature requests from GitHub - Search for this issue there!

And don't worry, this issue will still exist on GitHub for posterity's sake. As it’s a text-only import of the original post into UserVoice, we’ll still be keeping in mind the comments and discussion that already exist here on the GitHub issue.

GitHub will remain the channel for reporting bugs.

Once again, this issue can now be found by searching for the title on: https://aws.uservoice.com/forums/598381-aws-command-line-interface

-The AWS SDKs & Tools Team

This entry can specifically be found on UserVoice at: https://aws.uservoice.com/forums/598381-aws-command-line-interface/suggestions/33168802-parameter-containing-uri-string-is-interpreted-as

@ASayre ASayre closed this as completed Feb 6, 2018
@AlJohri
Copy link

AlJohri commented Feb 6, 2018

@m17kea
Copy link

m17kea commented Feb 7, 2018

@ASayre could you please provide a direct link to this feature request in UserVoice so that people finding this issue in an internet search can easily navigate there and up-vote. Thanks

@AlJohri
Copy link

AlJohri commented Feb 7, 2018

@armitagemderivitec
screen shot 2018-02-07 at 10 29 04 am

@jamesls
Copy link
Member

jamesls commented Apr 6, 2018

Based on community feedback, we have decided to return feature requests to GitHub issues.

@jamesls jamesls reopened this Apr 6, 2018
@jonatcorus
Copy link

This is one of those "features" that's such a horrible idea, it's surprising it's not fixed. The feature should have had some kind of prefix like fetch-url:http://example.com. For now there should be a way of turning it off at least by some kind of environment variable. Ideally it would be off by default and could be turned on for those who actually use it.

@jmehnle
Copy link

jmehnle commented Nov 28, 2018

Per #1475 (comment) the workaround is to put your URL value in a file and pass it via fileb://$FILENAME. E.g., using Bash's process substitution:

aws ec2 run-instances [...] --user-data fileb://<(echo -n 'https://foo/bar')

@rosswilson
Copy link

This has now been fixed. A new configuration option called cli_follow_urlparam can be set to disable this auto-fetch URL behaviour across the entire AWS CLI.

In your ~/.aws/config file, add the following line:

cli_follow_urlparam = false

See the documentation for more details.

@DominikTo
Copy link
Author

Great to hear!
Would be even better with false as the default. Unexpected behaviour.

@kdaily kdaily added the automation-exempt Issue will not be subject to stale-bot label Sep 17, 2020
@joguSD
Copy link
Contributor

joguSD commented Oct 15, 2020

In addition to the configuration mentioned by @rosswilson, this functionality has been entirely removed in the AWS CLI v2.

@kdaily kdaily closed this as completed Apr 15, 2021
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this issue Feb 12, 2022
thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this issue Feb 12, 2022
* fix: Functional tests must run on localhost to work in Windows (aws#552)

* fix: spacing typo in Log statement in start-lambda (aws#559)

* docs: Fix syntax highlighting in README.md (aws#561)

* docs: Change jest to mocha in Nodejs init README (aws#564)

* docs: Fix @mhart link in README (aws#562)

* docs(README): removed cloudtrail, added SNS to generate-event (aws#569)

* docs: Update repo name references (aws#577)

* feat(debugging): Fixing issues around debugging Golang functions. (aws#565)

* fix(init): Improve current init samples around docs and fixes (aws#558)

* docs(README): Update launch config to SAM CLI from SAM Local (aws#587)

* docs(README): Update sample code for calling Local Lambda Invoke (aws#584)

* refactor(init): renamed handler for camel case, moved callback call up (aws#586)

* chore: aws-lambda-java-core 1.1.0 -> 1.2.0 for java sam init (aws#578)

* feat(validate): Add profile and region options (aws#582)

Currently, `sam validate` requires AWS Creds (due to the SAM Translator).
This commits adds the ability to pass in the credientials through a profile
that is configured through `aws configure`.

* docs(README): Update README prerequisites to include awscli (aws#596)

* fix(start-lambda): Remove Content-Type Header check (aws#594)

* docs: Disambiguation "Amazon Kinesis" (aws#599)

* docs: Adding instructions for how to add pyenv to your PATH for Windows (aws#600)

* docs: Update README with small grammar fix (aws#601)

* fix: Update link in NodeJS package.json (aws#603)

* docs: Creating instructions for Windows users to install sam (aws#605)

* docs: Adding a note directing Windows users to use pipenv (aws#606)

* fix: Fix stringifying λ environment variables when using Python2 (aws#579)

* feat(generate-event): Added support for 50+ events (aws#612)

* feat(invoke): Add region parameter to all invoke related commands (aws#608)

* docs: Breaking up README into separate files to make it easier to read (aws#607)

* chore: Update JVM size params to match docker-lambda (aws#615)

* feat(invoke): Invoke Function Without Parameters through --no-event (aws#604)

* docs: Update advanced_usage.rst with clarification on --env-vars usage (aws#610)

* docs: Remove an extra word in the sam packaging command (aws#618)

* UX: Improves event names to reflect Lambda Event Sources (aws#619)

* docs: Fix git clone typo in installation docs (aws#630)

* docs(README): Callout go1.x runtime support (aws#631)

* docs(installation): Update sam --version command (aws#634)

* chore(0.6.0): SAM CLI Version bump (aws#635)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation-exempt Issue will not be subject to stale-bot feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests