private boolean isURLTrusted(URI url, String[] trustedSources) throws URISyntaxException {
		final String domain = String.format("%s://%s", url.getScheme(), url.getAuthority());

		for (String trustedSource : trustedSources) {
			if ("*".equals(trustedSource)) {
				return true;
			}

			if (domain.equals(trustedSource)) {
				return true;
			}

			URI parsedTrustedSource;
			if (trustedSource.startsWith("https://") || trustedSource.startsWith("http://")) {
				parsedTrustedSource = new URI(trustedSource);
				if (!url.getScheme().equals(parsedTrustedSource.getScheme())) {
					continue;
				}
			} else {
				parsedTrustedSource = new URI("https://" + trustedSource);
			}

			if (url.getAuthority().equals(parsedTrustedSource.getAuthority())) {
				if (pathMatches(url.getPath(), parsedTrustedSource.getPath())) {
					return true;
				} else {
					continue;
				}
			}

			if (trustedSource.contains("*")) {

				String[] reversedAuthoritySegments = reverse(url.getAuthority().split("\\."));

				String[] reversedTrustedSourceAuthoritySegments = reverse(
						parsedTrustedSource.getAuthority().split("\\."));

				boolean ruleIsSmaller = reversedTrustedSourceAuthoritySegments.length < reversedAuthoritySegments.length;
				boolean ruleHasStarAtEnd = reversedTrustedSourceAuthoritySegments[reversedTrustedSourceAuthoritySegments.length
						- 1]
					.equals("*");
				if (ruleIsSmaller && ruleHasStarAtEnd) {
					reversedAuthoritySegments = Arrays.copyOfRange(reversedAuthoritySegments, 0,
							reversedTrustedSourceAuthoritySegments.length);
				}

				boolean authorityMatches = true;
				for (int i = 0; i < reversedAuthoritySegments.length; i++) {
					String val = reversedAuthoritySegments[i];
					String elementRule = reversedTrustedSourceAuthoritySegments[i];
					if (elementRule.equals("*")
							|| val.equals(elementRule)) {
						// they match
					} else {
						authorityMatches = false;
						break;
					}
				}

				if (authorityMatches && pathMatches(url.getPath(), parsedTrustedSource.getPath())) {
					return true;
				}
			}

		}

		// default trusted for usability and trust
		return url.toString().startsWith("https://github.com/jbangdev/");
	}
Check whether a URL like https://www.microsoft.com matches the list of
trusted sources.

- Schemes must match - There's no subdomain matching. For example
https://jbang.dev doesn't match https://www.jbang.dev - Star matches all
subdomains. For example https://*.jbang.dev matches https://www.jbang.dev and
https://foo.bar.jbangdev.com
src/main/java/dev/jbang/net/TrustedSources.java