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

Validate client redirects in SSO client logins #41833

Merged
merged 1 commit into from
May 21, 2024

Conversation

espadolini
Copy link
Contributor

This PR makes it so that client redirect URLs for SSO login sessions that are not web sessions (i.e., they're from tsh login) are now required to be http://127.0.0.1:*/callback (with ipv6 and "localhost" variants) with no query parameters other than the secret_key required for the response, or https://<hostname>/callback with the same single query parameter, and a hostname that matches one of the hostnames configured in the auth connector.

Configuration UX:

version: vX
kind: (saml|oidc|github)
metadata:
  name: ...
spec:
  ...
  client_redirect_settings:
    allowed_https_hostnames:
      - '*.app.github.dev'
      - '^\d+-[a-zA-Z0-9]+\.foo.internal$'

Related enterprise PR: gravitational/teleport.e#3727.

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from tigrato May 21, 2024 17:12
@espadolini espadolini added this pull request to the merge queue May 21, 2024
Merged via the queue into master with commit e4ec728 May 21, 2024
42 of 43 checks passed
@espadolini espadolini deleted the espadolini/enforce-sso-client-redirect branch May 21, 2024 19:02
@fghamsary
Copy link

These type of breaking changes should always have a backup configuration, which can be override if needed by the final client!

@zmb3
Copy link
Collaborator

zmb3 commented May 27, 2024

Hi @fghamsary,

There is a backup configuration. It is called allowed_https_hostnames and it is illustrated in the description in this PR.

@espadolini
Copy link
Contributor Author

To elaborate further: we considered adding an allowlist for non-https redirect URLs as well, but deliberately decided against it (requiring a valid webpki certificate at least adds some protection against DNS poisoning). This change is the remediation for a security vulnerability classified as HIGH (see https://github.com/gravitational/teleport/releases/tag/v15.3.6 ).

@fghamsary
Copy link

I understand that you did it for a reason, but I'm telling you that as an end user we may need the http and without DNS as it might be local IP.
In my case I use teleport-ent inside WSL2 on windows and the IP address is dynamic and I need to open the connection for tsh with --bind-addr to point to correct IP address. But this doesn't work anymore due to this change that you did.
Please consider adding http list as well, even though in many cases this is a vulnerability and security risk but in some cases that the Admin decides this should be possible for any reason, just as I mentioned on my case.

@fghamsary
Copy link

fghamsary commented May 27, 2024

Please refer to this as well.
#41516 (comment)
I saw that https is possible, but I need http with IP address!

@fghamsary
Copy link

In my opinion at least all local (private) IPs should be valid without any other configuration just like 127.0.0.1.
You know better than me the ranges of the IP addresses such as 172.0.0.0/8, 192.0.0.0/24 and 10.0.0.0/24

@yylbfyl
Copy link

yylbfyl commented Jun 3, 2024

I'm facing the same issue , I using Virtual Box to login teleport with a shell , I need redirect the port to a virtual IP to open SSO link from host machine, but it doesn't work now. Parameter --bind-addr is not work, it will return an error :
Failed to login due to a disallowed callback URL. Please check Teleport's log for more details.

So how to correctly to use parameter "--bind-addr" now?

@webvictim
Copy link
Contributor

Documentation is missing for this: #43373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
helm no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants