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

fix(*): fix AWS_CONTAINER_CREDENTIALS_FULL_URI parsing #65

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

windmgc
Copy link
Member

@windmgc windmgc commented Jul 27, 2023

The RemoteCredential does not support a full URI with port number now, the error log shows as follow:

2023/07/27 15:48:41 [debug] 46876#0: [lua] RemoteCredentials.lua:70: Failed to construct RemoteCredentials url: Unsupported hostname: AWS.RemoteCredentials only supports localhost,127.0.0.1 for http; http://localhost requested.

It seems that the code is using wrong reference for host, it should be host instead of hostname.

The document of socket.url.parse:

url.parse(url, default)

Parses an URL given as a string into a Lua table with its components.

Url is the URL to be parsed. If the default table is present, it is used to store the parsed fields. Only fields present in the URL are overwritten. Therefore, this table can be used to pass default values for each field.

The function returns a table with all the URL components:

parsed_url = {
  url = string,
  scheme = string,
  authority = string,
  path = string,
  params = string,
  query = string,
  fragment = string,
  userinfo = string,
  host = string,
  port = string,
  user = string,
  password = string
}

@windmgc
Copy link
Member Author

windmgc commented Jul 27, 2023

ps I found that https://github.com/Kong/kong/blob/985119016f67872b9d9d2d7140be969a994a6cc7/kong/plugins/aws-lambda/iam-ecs-credentials.lua#L58 is having the same problem, but definitely the RELATIVE_URI has been hiding this problem for a long time...

Tieske
Tieske previously approved these changes Jul 27, 2023
Copy link
Member

@Tieske Tieske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a chaneglog entry?

@windmgc
Copy link
Member Author

windmgc commented Jul 28, 2023

changelog added

@windmgc windmgc merged commit e918c4a into Kong:main Jul 31, 2023
@windmgc windmgc deleted the fix-remote-credential-uri-parse branch August 15, 2023 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants