Skip to content

fix(sso): login with custom startUrl not allowed#6368

Merged
nkomonen-amazon merged 4 commits into
aws:masterfrom
nkomonen-amazon:startUrlFix
Jan 15, 2025
Merged

fix(sso): login with custom startUrl not allowed#6368
nkomonen-amazon merged 4 commits into
aws:masterfrom
nkomonen-amazon:startUrlFix

Conversation

@nkomonen-amazon

@nkomonen-amazon nkomonen-amazon commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Problem:

A user reported that a non-standard start url is technically
valid. This is because it can redirect to the underlying valid
start url that matches the pattern: https://xxxxxxxx.awsapps.com/start

#6341

Solution:

Allow any URL, but warn users if they are using a non-standard one.
We will show a yellow warning message in this case.
The red error message is still shown when the input does not match a
URL in general.

Examples

Invalid URL

Screenshot 2025-01-14 at 4 33 58 PM

Possibly valid since it may redirect to a valid URL

Screenshot 2025-01-14 at 4 34 13 PM

Missing the trailing /start

Screenshot 2025-01-14 at 4 34 29 PM

URL that also matches expected pattern

Screenshot 2025-01-14 at 4 34 35 PM
  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem:

A user reported that a non-standard start url is technically
valid. This is because it can redirect to the underlying valid
start url that matches the pattern: https://xxxxxxxx.awsapps.com/start

Solution:

Allow any URL, but warn users if they are using a non-standard one.
We will show a yellow warning message in this case.
The red error message is still shown when the input does not match a
URL in general.

Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
@nkomonen-amazon nkomonen-amazon requested a review from a team as a code owner January 14, 2025 21:36
@nkomonen-amazon nkomonen-amazon changed the title Start url fix fix(sso): login with custom startUrl not allowed Jan 14, 2025
Comment thread packages/core/src/auth/sso/constants.ts Outdated
return vscode.Uri.file(path)
}

export function isValidUrl(string: string): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is vscode.Uri.parse useful here? docstring may want to mention why not

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That would add additional LOC since we'd have to check every part manually. Also there may be nuances with a valid URL that we could miss

Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
@nkomonen-amazon nkomonen-amazon merged commit d862a21 into aws:master Jan 15, 2025
@nkomonen-amazon nkomonen-amazon deleted the startUrlFix branch January 15, 2025 18:57
karanA-aws pushed a commit to karanA-aws/aws-toolkit-vscode that referenced this pull request Jan 17, 2025
## Problem:

A user reported that a non-standard start url is technically
valid. This is because it can redirect to the underlying valid
start url that matches the pattern: https://xxxxxxxx.awsapps.com/start

## Solution:

Allow any URL, but warn users if they are using a non-standard one.
We will show a yellow warning message in this case.
The red error message is still shown when the input does not match a
URL in general.

## Examples 

### Invalid URL
<img width="315" alt="Screenshot 2025-01-14 at 4 33 58 PM"
src="https://github.com/user-attachments/assets/a5b2cb8a-c4fc-4678-a711-2f3f00bbe084"
/>

### Possibly valid since it may redirect to a valid URL
<img width="302" alt="Screenshot 2025-01-14 at 4 34 13 PM"
src="https://github.com/user-attachments/assets/0690f818-f4ba-4eae-b037-f856f5a2b2a0"
/>

### Missing the trailing `/start`
<img width="295" alt="Screenshot 2025-01-14 at 4 34 29 PM"
src="https://github.com/user-attachments/assets/8bcf3a4b-eba3-4bd8-8c68-24b709ee854d"
/>

### URL that also matches expected pattern
<img width="286" alt="Screenshot 2025-01-14 at 4 34 35 PM"
src="https://github.com/user-attachments/assets/eea2f2cb-6500-469c-9836-96ffc9cb5794"
/>

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
kevluu-aws pushed a commit to kevluu-aws/aws-toolkit-vscode that referenced this pull request Jan 23, 2025
## Problem:

A user reported that a non-standard start url is technically
valid. This is because it can redirect to the underlying valid
start url that matches the pattern: https://xxxxxxxx.awsapps.com/start

## Solution:

Allow any URL, but warn users if they are using a non-standard one.
We will show a yellow warning message in this case.
The red error message is still shown when the input does not match a
URL in general.

## Examples 

### Invalid URL
<img width="315" alt="Screenshot 2025-01-14 at 4 33 58 PM"
src="https://github.com/user-attachments/assets/a5b2cb8a-c4fc-4678-a711-2f3f00bbe084"
/>

### Possibly valid since it may redirect to a valid URL
<img width="302" alt="Screenshot 2025-01-14 at 4 34 13 PM"
src="https://github.com/user-attachments/assets/0690f818-f4ba-4eae-b037-f856f5a2b2a0"
/>

### Missing the trailing `/start`
<img width="295" alt="Screenshot 2025-01-14 at 4 34 29 PM"
src="https://github.com/user-attachments/assets/8bcf3a4b-eba3-4bd8-8c68-24b709ee854d"
/>

### URL that also matches expected pattern
<img width="286" alt="Screenshot 2025-01-14 at 4 34 35 PM"
src="https://github.com/user-attachments/assets/eea2f2cb-6500-469c-9836-96ffc9cb5794"
/>

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
s7ab059789 pushed a commit to s7ab059789/aws-toolkit-vscode that referenced this pull request Feb 19, 2025
## Problem:

A user reported that a non-standard start url is technically
valid. This is because it can redirect to the underlying valid
start url that matches the pattern: https://xxxxxxxx.awsapps.com/start

## Solution:

Allow any URL, but warn users if they are using a non-standard one.
We will show a yellow warning message in this case.
The red error message is still shown when the input does not match a
URL in general.

## Examples 

### Invalid URL
<img width="315" alt="Screenshot 2025-01-14 at 4 33 58 PM"
src="https://github.com/user-attachments/assets/a5b2cb8a-c4fc-4678-a711-2f3f00bbe084"
/>

### Possibly valid since it may redirect to a valid URL
<img width="302" alt="Screenshot 2025-01-14 at 4 34 13 PM"
src="https://github.com/user-attachments/assets/0690f818-f4ba-4eae-b037-f856f5a2b2a0"
/>

### Missing the trailing `/start`
<img width="295" alt="Screenshot 2025-01-14 at 4 34 29 PM"
src="https://github.com/user-attachments/assets/8bcf3a4b-eba3-4bd8-8c68-24b709ee854d"
/>

### URL that also matches expected pattern
<img width="286" alt="Screenshot 2025-01-14 at 4 34 35 PM"
src="https://github.com/user-attachments/assets/eea2f2cb-6500-469c-9836-96ffc9cb5794"
/>

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Signed-off-by: nkomonen-amazon <nkomonen@amazon.com>
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.

3 participants