NationalSecurityAgency/ghidra · error · MalformedURLException

Protocol not permissable for BSim URL

Error message

Protocol not permissable for BSim URL

What it means

BSimClientFactory.checkBSimServerURL() validates the URL protocol against the allowed set: postgresql, https, elastic, and file. Any other protocol causes MalformedURLException. This is the first validation gate for BSim URLs — the protocol must be one of the supported database backends.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimClientFactory.java:54

	 * @throws URISyntaxException if the URL string cannot be parsed
	 */
	public static URL buildURL(String urlString) throws MalformedURLException, URISyntaxException {
		URL url = new URI(urlString).toURL();
		checkBSimServerURL(url);
		return url;
	}

	/**
	 * Validate BSim DB URL.
	 * Acceptable protocols are  postgresql://  https://,  (or possibly http://) file:/
	 * @param url BSim DB URL
	 * @throws MalformedURLException if the URL string is not a support BSim DB URL
	 */
	public static void checkBSimServerURL(URL url) throws MalformedURLException {
		String protocol = url.getProtocol();
		if (!protocol.equals("postgresql") && !protocol.equals("https") &&
			!protocol.equals("elastic") && !protocol.equals("file")) {
			throw new MalformedURLException("Protocol not permissable for BSim URL");
		}
		String path = url.getPath();
		if (path == null || path.length() == 0 || path.equals("/")) {
			throw new MalformedURLException("BSim URL missing DB name/path");
		}
		if (!"file".equals(protocol) && path.indexOf('/', 1) >= 0) {
			throw new MalformedURLException("BSim URL must specify exactly 1 path element");
		}
	}

	/**
	 * Construct the root URL to a specific BSim repository given a "related" URL.
	 * The root URL will have an explicit protocol, a hostname + other mods (the authority), and 1 level of path
	 *    this first level path indicates the particular repository being referenced on the host.
	 * The "related" URL -url- can be an explicitly provided URL pointing to the BSim repository,
	 *    possibly with additional path levels, which are simply stripped from the final root URL.
	 * Alternately -url- can reference a ghidra server, as indicated by the "ghidra" protocol.
	 *    In this case the true BSim URL is derived from ghidra URL in some way

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Change the URL protocol to one of: postgresql://, https://, elastic://, or file:/.
  2. If using http://, switch to https:// (plain http is not accepted despite the javadoc comment).
  3. If using a ghidra:// URL, pass it through deriveBSimURL() instead of checkBSimServerURL() directly — deriveBSimURL handles ghidra URLs and converts them.
  4. Double-check for protocol typos (e.g., postgreql instead of postgresql).

Example fix

// before
checkBSimServerURL(new URL("http://myhost/bsimdb")); // throws
//
// after — use https (or postgresql/elastic/file)
checkBSimServerURL(new URL("https://myhost/bsimdb"));
Defensive patterns

Strategy: validation

Validate before calling

String protocol = url.getProtocol();
if (!Set.of("postgresql", "https", "elastic", "file").contains(protocol)) {
    // Inform user of valid protocols; note that http is NOT supported
    throw new IllegalArgumentException(
        "Protocol '" + protocol + "' not supported. Use postgresql, https, elastic, or file.");
}

Try / catch

try {
    BSimClientFactory.checkBSimServerURL(url);
} catch (MalformedURLException e) {
    if (e.getMessage().startsWith("Protocol not permissable")) {
        // prompt user to use a valid protocol
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling checkBSimServerURL(url) (directly or via deriveBSimURL/buildClient) where url.getProtocol() returns a value not in {postgresql, https, elastic, file}. Note: the javadoc mentions http:// as 'possibly' supported, but the code does NOT accept plain 'http'.

Common situations: User provides an http:// URL thinking it's supported (the javadoc is misleading); typo in the protocol string; user provides a ghidra:// URL directly to checkBSimServerURL instead of going through deriveBSimURL; copy-paste of a URL from documentation that uses an unsupported scheme.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/97d975c025078745. Report an issue: GitHub.