Commit Graph
50 Commits
Author SHA1 Message Date
Chinmay D. Pai 430bffb2e2 chore: send useIMDSv2 bool from fetchIMDSToken method
Instead of using the errors to figure out whether IMDSv2 needs to be used,
we return a boolean value for useIMDSv2 from the function itself, and
propagate the error to upstream function calls in the library.

IMDSv2 tokens can be used in all cases, even when IMDSv2 is set to `Optional`
in the EC2 Instance configuration. As such, calls with token will not fail and
we should be able to send IMDSv2 requests with token even when using IMDSv1.

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2024-07-03 13:29:48 +05:30
Chinmay D. Pai 547dfa8756 feat: add support for IMDSv2
Currently, IMDSv2 is not supported by simple-s3's `NewUsingIAM` method, causing it
to fail on EC2 instances with IMDSv2 enabled in the EC2 metadata configuration.

This patch adds a failsafe method that executes PUT request on the IMDSv2 token endpoint,
and based on the response decides whether IMDSv2 support needs to be enabled. Doing so
will not break or require any code-level changes to existing deployments, and allows the
same binaries to run on both IMDSv2 enabled and optional instances.

ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-v2-how-it-works.html

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2024-06-29 00:52:18 +05:30
Rohan Verma 046c5f5514 Merge pull request #25 from rhnvrm/fix-security-token
fix: set token header if available
2022-07-11 11:04:56 +05:30
Rohan b051044f8c fix: set token header if available
Closes #24
2022-07-11 11:03:42 +05:30
Rohan Verma 1c0e12c925 Merge pull request #21 from rhnvrm/feat-do-support
feat: add support for DigitalOcean
2022-02-22 11:26:07 +05:30
Rohan de82585958 feat: add support for DigitalOcean
This commit adds a x-amz-date header which is an undocumented
requirement of DO API requests.
2022-02-21 10:14:17 +05:30
Rohan Verma fa36dbb143 Merge pull request #20 from rhnvrm/feat-iam-isolate
feat: add support for timeout and customization in IAM setup.
2022-01-08 15:33:44 +05:30
Rohan 66870855b7 feat: add support for timeout and customization in IAM setup.
This commit adds a defaultHTTPClient to have a timeout of 10s
instead of the one provided by Go. It introduces a few new methods such
as
- FetchAndSetIAMData which is a helper method to be able to use the
custom http client set by the user.

Closes #19
2022-01-07 10:53:21 +05:30
Rohan Verma ad0419ef77 Merge pull request #18 from rhnvrm/feat-file-put
feat: add support for FilePut
2021-12-29 15:02:42 +05:30
Rohan a9d0bbf9a8 feat: add support for FilePut 2021-12-29 13:59:45 +05:30
Rohan Verma b23aec1a12 Merge pull request #15 from rhnvrm/develop
Support for Custom Metadata in FileUpload and fetching FileDetails
2021-07-19 13:43:27 +05:30
Rohan Verma eac235b2b6 feat: add support for FileDetails/HEAD API call (#14) 2021-07-19 13:41:36 +05:30
Joice 2a57ff9944 feat: Adds support for custom metadata (#13)
* feat: Adds support for custom metadata

assigning metadata for files will be beneficial to
find files.
ref: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html

* fix: review suggestions by @rhnvrm

- metadata moved to UploadInput as optional field.
- changed x-amz-meta as constant
- changed sprintf to simple string concat

* FIX: changed amazon meta prefix

changed variable name for amazon meta prefix to the top,
prefix variable is exported.
removed redundant comment for metadata
2021-07-19 12:46:49 +05:30
Rohan Verma 35d7b10832 fix: minor doc changes 2021-07-19 12:33:48 +05:30
Rohan Verma 7977285b10 chore: remove debug flag in aws command 2021-02-09 19:19:49 +05:30
Rohan Verma c7b8d45858 chore: add github actions (#12) 2021-02-09 19:18:31 +05:30
Rohan Verma c344c52b27 Merge pull request #11 from jacksgt/url-encoding
Fix URL encoding issue for filenames with special characters
2021-02-03 21:27:58 +05:30
Jack Henschel bf02e3bacf fix: Ensure trailing slash in CustomEndpoint is handled gracefully 2021-02-03 17:48:04 +02:00
Jack Henschel b42d2b1f1e docs: Make bucket references in README example consistent 2021-02-03 17:47:51 +02:00
Jack Henschel ce1c250422 fix: Modify getURL method to correctly support special characters
fixes https://github.com/rhnvrm/simples3/issues/7
2021-02-03 17:47:51 +02:00
Jack Henschel c97ddac6df test: Check filenames with special characters work correctly 2021-02-03 17:47:51 +02:00
Rohan Verma 0a01d1c189 Merge remote-tracking branch 'origin/develop' 2021-02-02 13:53:27 +05:30
Rohan Verma 90794035ee fix: acl key for uploading 2021-01-29 15:52:30 +05:30
Rohan Verma cacb5dc7e1 Merge pull request #10 from rhnvrm/develop
fix: missing optional fields in policy
2021-01-29 14:34:31 +05:30
Rohan Verma 01c1568859 fix: missing optional fields in policy 2021-01-29 14:25:43 +05:30
Rohan Verma fbf23c1eaf fix: sample for IAM 2021-01-28 09:56:47 +05:30
Rohan Verma 7be0d9e563 feat: Content Disposition and ACL support
This commit adds two extra fields to the upload input
to add support for setting Content-Disposition and the
x-amz-acl params.
2021-01-27 09:20:07 +05:30
Rohan Verma f8d50ad6a3 fix: license in README 2021-01-14 18:51:34 +05:30
Rohan Verma bb29b03f9d chore: add ztech badge to readme 2020-09-30 14:02:32 +05:30
Rohan Verma 59b9f0b2d2 Merge pull request #5 from jacksgt/http-protocol
Allow user to specify protocol for custom endpoint
2020-09-15 13:26:09 +05:30
Jack Henschel 2c7094bdb6 Allow user to specify protocol for custom endpoint
In local setups, such as a Minio [1] instance in a Docker container,
the protocol may not always be HTTPS (like for public production
endpoints), but instead just plain HTTP.
To support this use-case, the user can specify a protocol at the
beginning of the custom endpoint URI (either http:// or https://).

To maintain backwards compatibility, the protocol defaults to HTTPS.

The patch also includes a test case to assert this behavior.

[1] https://hub.docker.com/r/minio/minio
2020-09-15 09:04:34 +02:00
jibin jose 2a542b05fe Fix: Add X-Amz-Security-Token to presigned url (#4)
Include the x-amz-security-token if signed with temporary credentials.

Ref:https://stackoverflow.com/questions/49306621/how-secret-is-the-session-token-in-aws-temporary-security-credentials/49344291#49344291
2020-04-13 16:44:33 +05:30
Rohan Verma 089155520f feat: adds download file 2020-01-03 16:32:19 +05:30
Rohan Verma 6f4b748717 refactor: move avatar to testdata folder 2019-12-11 15:32:55 +05:30
Rohan Verma aba89e779a refactor: minor doc changes 2019-12-11 13:54:46 +05:30
Liut 9a5e82a977 Add Endpoint for some compatible instance and fix time format (#3)
* Add Endpoint for some compatible instance.

* Fix: InvalidExpiration
* Fix: RequestTimeTooSkewed

Compatible s3: https://developer.qiniu.com/kodo/manual/4088/s3-access-domainname

* - clean code

* Fix: InvalidExpiration
2019-12-11 07:53:05 +00:00
Rohan Verma 3d5b071ef7 fix: change multipart.File -> io.ReadSeeker 2019-10-18 13:15:03 +05:30
Peter Tinti 4f0bc0042e Fix readme examples: Missing closing parenthesis. (#2) 2019-01-25 11:20:47 +05:30
Rohan Verma 20bc00a8c8 refactor: Presigned URL generator to use byte strings 2019-01-16 02:03:28 +05:30
Rohan Verma f3fc241849 fix: decouple http client from library 2019-01-15 16:27:02 +05:30
Rohan Verma 8b0be7fb53 fix: Set protocol 2018-12-29 21:05:17 +05:30
Rohan Verma f50dc493f8 test: NewUsingIAM mock 2018-12-28 14:59:45 +05:30
Rohan Verma b9b43d4bff Add coverage badge 2018-12-26 16:04:47 +05:30
Rohan Verma c3e6335634 fix: Delete credentials unsupported authorization type 2018-12-26 15:44:16 +05:30
Rohan Verma 8079b244c7 feat: read response from 201 on file upload 2018-12-26 13:36:35 +05:30
Rohan Verma e4c7d93da1 Update readme and docstrings, minor refactors. 2018-12-24 17:31:36 +05:30
Rohan Verma d218b23f05 feat: Presigned URLs 2018-12-24 13:36:29 +05:30
Joe Paul 41b1c70183 ref: DRY hmac method (#1) 2018-12-07 11:57:08 +05:30
Rohan Verma 157aa88554 docs: Add missing docstrings 2018-12-06 16:48:37 +05:30
Rohan Verma f30c5f9052 init 2018-12-06 15:54:47 +05:30