Skip to content

Commit

Permalink
fix api_trusted_hosts_only_whitelist_path_regexp setting
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrenn committed Nov 21, 2024
1 parent 3cbde39 commit 84b999c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ContainerRequest filter(ContainerRequest request) {
if (Settings.getBoolean(SettingCodes.API_TRUSTED_HOSTS_ONLY, Bundle.SETTINGS, DefaultSettings.API_TRUSTED_HOSTS_ONLY) && !WebUtil.isTrustedHost(this.request)) {
Pattern whitelistRegExp = Settings.getRegexp(SettingCodes.API_TRUSTED_HOSTS_ONLY_WHITELIST_PATH_REGEXP, Bundle.SETTINGS,
DefaultSettings.API_TRUSTED_HOSTS_ONLY_WHITELIST_REGEXP);
if (whitelistRegExp != null || !whitelistRegExp.matcher(request.getRequestUri().getPath()).find()) {
if (whitelistRegExp == null || !whitelistRegExp.matcher(request.getRequestUri().getPath()).find()) {
AuthorisationException ex = new AuthorisationException(Messages.getMessage(MessageCodes.HOST_NOT_ALLOWED_OR_UNKNOWN_HOST, WebUtil.getRemoteHost(this.request)));
ex.setErrorCode(AuthorisationExceptionCodes.HOST_NOT_ALLOWED_OR_UNKNOWN_HOST);
throw new WebApplicationException(ex);
Expand Down

0 comments on commit 84b999c

Please sign in to comment.