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

feat: add strict_domain_check config attribute to be used in GET /login #4

Open
wants to merge 1 commit into
base: cermati/v0.39.0
Choose a base branch
from

Conversation

faiz-alhadiid
Copy link

@faiz-alhadiid faiz-alhadiid commented Nov 8, 2024

Background:

In current setup if we want to register a subdomain to vouch we need to configure it on openresty and vouch-proxy config. Sometime we forgot to configure the vouch proxy part (or developers just add it without telling infra team). When that happen they will be redirected to any subdomain (usually the first) that share a domain suffix. For example from grafana.cermati.com to jenkins.cermati.com. It is because the request hostname are checked for matching suffix domain. The problem is we must include the top level domain (e.g cermati.com) because it will be used for email checking.
The logic to get redirect URL is as follow:

  • Request URL will be compared against Config.Domains to check for matching domain.
  • The returned domain will be used to search for callback_urls using strings.Contains, which if the returned domain is TLD we will guaranteed to get a redirect URL.

Changes:

Add strict_domain_check attribute in config to indicates that we need to use strict comparison on subdomain matching. If the subdomain is not match it will send 400 response (instead of redirecting to random URL)

Copy link

@mikeadityas mikeadityas left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants