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

[Request] Allow subdomain wildcard matching for origin whitelisting #803

Open
blockjoe opened this issue Mar 31, 2022 · 1 comment
Open

Comments

@blockjoe
Copy link
Contributor

Currently origin whitelisting requires explicit string matching of the origin domain:

if (!checkWhitelist(application.gatewaySettings.whitelistOrigins, this.origin, 'explicit')) {

Being able to whitelist a collection of subdomains like *.domain.com is an intuitive process.

The checkWhitelist enforcement function takes a type argument that could allow for a "wildcard" type which could check for a pattern match i.e.:

for (cost test of tests) {
  switch (type) {
    case 'wildcard':
      if (check.toLowerCase().match(test.toLowerCase()) != null ) {
        return true;
      }
      break;
    case 'explicit':
      if (test.toLowerCase() === check.toLowerCase()) {
        return true;
      }
      break;
    default:
      if (check.toLowerCase().includes(test.toLowerCase())) {
        return true;
      }
  }
}
return false;
@crisog
Copy link
Contributor

crisog commented Mar 31, 2022

I don't have any objections against this. It is a low hanging fruit that can certainly be helpful for some.
cc: @rem1niscence @nymd

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

No branches or pull requests

2 participants