Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Registry returns 403 (Missing Authentication Token) when URL is incomplete #153

Open
rumenvasilev opened this issue Oct 25, 2023 · 3 comments

Comments

@rumenvasilev
Copy link
Contributor

rumenvasilev commented Oct 25, 2023

Drop any part of the URI path (in the example here, the last bit which is arch) and you get HTTP 403 (forbidden) instead of 400 (bad request). Response body is also misleading. There's no authentication with the registry.

// EDIT, the issue is observed with the module path as well, example here with removed type field -> https://registry.opentofu.org/v1/providers/hashicorp/versions

$ curl -v https://registry.opentofu.org/v1/providers/hashicorp/aws/5.20.1/download/darwin/

*   Trying 18.66.147.95:443...
* Connected to registry.opentofu.org (18.66.147.95) port 443 (#0)
...
> GET /v1/providers/hashicorp/aws/5.20.1/download/darwin/ HTTP/2
> Host: registry.opentofu.org
> User-Agent: curl/8.1.2
> Accept: */*
> 
< HTTP/2 403 
< content-type: application/json
< content-length: 42
< date: Wed, 25 Oct 2023 09:52:23 GMT
< x-amzn-requestid: c1330785-121a-4eaf-b145-4e12088e1a79
< x-amzn-errortype: MissingAuthenticationTokenException
< x-amz-apigw-id: NWjFvEtrjoEEGRQ=
< x-amzn-trace-id: Root=1-6538e557-23ce7bec17f730f66f245a86
< x-cache: Error from cloudfront
< via: 1.1 24fc4e03b1de2a14f79be2422e46a318.cloudfront.net (CloudFront)
< x-amz-cf-pop: FRA60-P4
< x-amz-cf-id: usKvOCbE_rYj-tAVzxlns9n7q6bHnOeavlSFtn-3PFExMm9J6B3vnA==
< 
* Connection #0 to host registry.opentofu.org left intact
{"message":"Missing Authentication Token"}
@rumenvasilev rumenvasilev changed the title Registry returns 403 (Missing Authentication Token) when provider URL is incomplete Registry returns 403 (Missing Authentication Token) when URL is incomplete Oct 25, 2023
@Yantrio
Copy link
Member

Yantrio commented Oct 25, 2023

I actually think these should throw a 404 not found, and not a 400.

These errors are thrown directly by AWS API gateway and we should probably configure this correctly to throw a 404.

@rumenvasilev
Copy link
Contributor Author

rumenvasilev commented Oct 25, 2023

404 would be not found. Which is not what happens here. The request itself is wrong hence my suggestion to switch to 400.

@dylanmtaylor
Copy link

https://registry.opentofu.org should probably have some sort of informational landing page

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants