Skip to content

fix: encode the redirect URL passed to the login page - #591

Open
dungdong-aws wants to merge 1 commit into
Amazon-Q-Developer:mainfrom
dungdong-aws:fix/login-redirect-url-encoding
Open

dungdong-aws wants to merge 1 commit into
Amazon-Q-Developer:mainfrom
dungdong-aws:fix/login-redirect-url-encoding

Conversation

@dungdong-aws

Copy link
Copy Markdown
Contributor

Problem

The login view passes the sign-in redirect URL to its page by concatenating the URL into a script string. A URL that contains a quote or a backslash is not passed to the page as the URL text.

Change

  • UpdateRedirectUrlCommand.toScript() builds the script and writes the URL as an escaped string literal.
  • ToolkitLoginWebview.onEvent runs that script.

Behavior after this change

  • The login page receives every redirect URL as text and shows exactly that URL.
  • Sign-in URLs (IAM Identity Center, Builder ID) are passed and shown as before.

Testing

  • New UpdateRedirectUrlCommandTest: plain URL, quotes and backslashes, line terminators, control characters, and a round trip of the script argument back to the original URL.
  • New ToolkitLoginWebviewTest: the view runs the script for a live browser and does nothing for a disposed one.
  • mvn -B clean package: build passes, 536 tests, 0 Checkstyle violations.

The login view handed the redirect URL to the page by concatenating it
into a script string. Write it as an escaped string literal instead, so
the page receives every URL as text.

Sign-in URLs are passed to the page and shown as before.
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.

1 participant