get-query | Get get request parameter '' from browser | REST library
kandi X-RAY | get-query Summary
kandi X-RAY | get-query Summary
Get "get request parameter" from browser
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of get-query
get-query Key Features
get-query Examples and Code Snippets
Community Discussions
Trending Discussions on get-query
QUESTION
I'm trying to generate a presigned link to API Gateway (that uses IAM authentication), so client may access one of my Lambda functions behind this API Gateway without authenticating request. This is mostly for client convenience, so it may use some links from response transparently, whether they points to the same authenticated API Gateway, some S3 bucket or any arbitrary URL in the Internet.
To do so, I crafting API signature v4 using query parameters (see docs and example)
So, if I try to sign following link scoped for us-west-2
region and execute-api
service:
ANSWER
Answered 2021-Apr-06 at 12:00This is a very interesting question!
At first, I thought it is clearly documented in the S3 docs that X-Amz-Expires
is supported by all services (including API Gateway). [1][2]
After some more research, it turned out that it is not so clear at all if services other than S3 support the X-Amz-Expires
parameter.
There are various sources claiming that only S3 is respecting the parameter. The following is a statement by an AWS employee working on the aws-sdk for go:
The expires time is only relevant for the S3 service. Other services have their own fixed expiration time. Generally this is 15 minutes, but it looks like IoT data service uses a 5 minute expiration time. [3]
They followed up with:
The SDK doesn't have any metadata data available providing which services do or do not use the expiry value. [4]
Then adding a note into the corresponding source code on GitHub:
All other AWS services will use a fixed expiration time of 15 minutes. [5]
There are a ton of examples that show that AWS is using the parameter for the S3 service, e.g. [1][6]. However, there are also examples from AWS docs that show the use of the parameter for the IAM service, e.g. [7][8]. That is very confusing.
There is a comment by an SDE at AWS which is dated back to 2018 in which he makes the same confusing observation [9]:
If S3 is the only service that supports this header I agree that the SDK's documentation should be updated to reflect that - including a note in the description for this header in S3's SigV4 documentation stating that this header is exclusive to presigned URLs for this service would also be helpful.
FWIW I spoke to some folks from AWS Auth and the only service they know of using the header is S3 (interesting that you found a code sample using IAM). They suggested that the 15 minute expiration for STS presigned URLs would not be changing.
Another former AWS employee further noticed:
I was able to reproduce this behavior both on the AWS SDKs for Go and PHP with presigned URLs for EC2, IAM, STS, and Route 53. The only service I observed that invalidated a presigned URL after the time specified in the "x-amz-expires" header (instead of the default 15 minutes) was S3.
Thus, I guess it is not possible to increase pre-signed link validity duration for API Gateway access. I think that AWS did not design the signature signing algorithm to support your use case. I think that the S3 presigned URL action is one of the rare exceptions for which AWS allows an extended expiry period.
When looking at their motivation behind creating the signing algorithm the way it is, I noticed that they try to minimize the attack surface for replay attacks:
Protect against potential replay attacks
In most cases, a request must reach AWS within five minutes of the time stamp in the request. Otherwise, AWS denies the request. [10]
There are some more resources [11][12] that lead to the conclusion that letting customers choose lengthy expiry values would undermine the original security purpose of that parameter.
I think there is no generic way to create a presigned URL towards an AWS service's REST API and execute it far in the future.
If I were in your place, I would implement a custom authentication strategy using JWTs and API Gateway Lambda authorizers. [13] That way you can control the signing algorithm and particulary its expiration time on your own. I want to add that JWTs are URL-safe in the same way AWS signature query string parameters are. [14]
[1] https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
[2] https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html
[3] https://github.com/aws/aws-sdk-go/issues/2304#issuecomment-441755864
[4] https://github.com/aws/aws-sdk-go/issues/2304#issuecomment-441758599
[5] https://github.com/aws/aws-sdk-go/blob/6212dfa8032336d438c526c086918c8d2ceb6432/aws/request/request.go#L310
[6] https://github.com/mhart/aws4/blob/master/aws4.js#L130
[7] https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[8] https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html
[9] https://github.com/aws/aws-sdk-go/issues/2167#issuecomment-428764319
[10] https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html
[11] https://aws.amazon.com/de/articles/making-secure-requests-to-amazon-web-services/?nc1=h_ls (section "Replay Attacks")
[12] https://stackoverflow.com/a/12267408/10473469
[13] https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html
[14] https://stackoverflow.com/a/56273952/10473469
QUESTION
My function works perfectly if I provide one instance of ComputerName value. My question is how to modify SQL query so it could accept an array? I don't believe creating a loop to query a database several times is a proper way. For example, I think this SQL query with IN clause is a proper way:
...ANSWER
Answered 2021-Mar-26 at 19:18You need to do a little bit of string manipulation, also when working with SQL queries is a lot easier to use Here Strings.
If you are going to pass multiple computers to your functions, the parameter $PCname
has to be able to accept an array of strings, hence changing [string]
to [string[]]
.
Check out this code and see if it works for you:
QUESTION
Hoping someone can help :) I have a Wordpress site, which we are sending refer links to, like this... http://website.com/?ref=hotelname&loc=townname. We need to take these queries in the URL and place them into the cookies of the site using javascript. The cookies are then used to populate booking buttons, which then link to an external custom booking engine, and we need to pass the queries using js because php not working properly with our caching. I was recommended this post, but it doesn't seem to work unfortunately How can I get query string values in JavaScript?.
...ANSWER
Answered 2021-Mar-26 at 18:12You can do this by javascripts. first you have to get query string from URL and then have to save in cookie using this document.cookie = name + "=" + (value || "") + expires + "; path=/";
QUESTION
In an AWS Athena instance we have several user-created views.
Would like to back-up the views.
Have been experimenting using AWS CLI
aws athena start-query-execution --query-string “show views...
and for each view
aws athena start-query-execution --query-string “show create views...
and then
aws athena get-query-execution --query-execution-id...
to get the s3 location for the create view code.
Looking for ways to get the view definitions backed up.
If AWS CLI is the best suggestion, then I will create a Lambda to do the backup.
ANSWER
Answered 2021-Mar-14 at 01:37I think SHOW VIEWS is the best option.
Then you can get the Data Definition Language (DDL) with SHOW CREATE VIEW.
There are a couple of ways to back the views up. You could use GIT (AWS offers CodeCommit). You could definitely leverage CodeCommit in a Lambda Function using Boto3.
In fact, just by checking the DDL, you are in fact backing them up to [S3].
Consider the following DDL:
QUESTION
I want to make search page which after I click its button will be redirected to another page. And this page will be like this
...ANSWER
Answered 2021-Feb-18 at 03:18QUESTION
I'm trying to create [1] AWS V4 signed URLs to download files stored in a ScaleWay Object Storage bucket. I used the python example from AWS's [2] site and modified it but I can't make it work. When I try to access the generated link, I get a 403 response [3] which you can see below.
I copy my python script [4] here that produces the 403 links.
Could you please take a look at it and let me know what I did wrong? Why can't I generate the proper signature?
[1]: A URL that was generated by the [4] python script: https://laboschqpa.s3.pl-waw.scw.cloud/1SorNemSorCpp.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=%2F20210120%2Fpl-waw%2Fs3%2Faws4_request&X-Amz-Date=20210120T011857Z&X-Amz-Expires=3000&X-Amz-SignedHeaders=host&X-Amz-Signature=8ff4a56eef6dbd555a9b92ce2ac291488fabc6cb97b26711b6eeebfb0052ce15
[2]: The python example on AWS's site: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html#sig-v4-examples-get-query-string
[3]: The 403 response I get from the scaleway API when accessing my generated link: SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.txb1179690b7a94d92a899a-0060035729
[4]: The python script that I try to generate links with:
...ANSWER
Answered 2021-Jan-21 at 00:36If you use a GET request, you shouldn't use the hash of an empty string (like it is told in the official example) for the canonical request but the raw "UNSIGNED-PAYLOAD" string.
As an example:
Your canonical request will look like this:
QUESTION
I need to download a full table content that I have on my AWS/Glue/Catalog using AWS/Athena. At the moment what I do it is running a select * from my_table
from the Dashboard and saving the result locally as CSV always from Dashboard. Is there a way to get the same result using AWS/CLI?
From the documentation I can see https://docs.aws.amazon.com/cli/latest/reference/athena/get-query-results.html but it is not quite what I need.
...ANSWER
Answered 2020-Oct-02 at 10:15You cannot save results from the AWS CLI, but you can Specify a Query Result Location and Amazon Athena will automatically save a copy of the query results in an Amazon S3 location that you specify.
You could then use the AWS CLI to download that results file.
QUESTION
ANSWER
Answered 2020-Jun-25 at 13:55Try
QUESTION
I've noticed that when I query my Postgres database, DataGrip allows me to examine the explain plain (operations tree, Flame chart, visual graph) with operation, row, and cost information.
When I run (any) query on Snowflake, DataGrip returns an explain plan with the basic operations but no information on cost. I'm thinking that it is not returning information ex post query execution.
Is this expected behavior? This post makes me think that Snowflake doesn't support this outside of their GUI.
...ANSWER
Answered 2020-Apr-06 at 11:26Yes, in Snowflake 'cost' is partition bytes in optimizer and we don't show them. But if you think it would be useful - feel free to fill up feature request on our tracker.
QUESTION
Mostly new at frontend, definitely new at Vue. I'm trying to read query parameters from the URL. Following How can I get query parameters from a URL in Vue.js? and https://router.vuejs.org/guide/#javascript
I now have this code:
...ANSWER
Answered 2020-Mar-28 at 11:00The rendering speed of the vue-router
might be the issue. You can try assigning the value in any of the Vue life cycle hooks
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install get-query
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page