NationalSecurityAgency/ghidra · error · IllegalArgumentException

Invalid userinfo specified

Error message

Invalid userinfo specified

What it means

Thrown by cleanupUserInfo() when the userinfo string's first character is a colon (pwdSep == 0), meaning the username portion is empty (e.g. ':password'). A userinfo credential must have a non-empty username. Throws IllegalArgumentException.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java:238

		String urlUserInfo;
		if (pwSep >= 0) {
			urlUserInfo = urlDecode(userinfo.substring(0, pwSep)) + ":" +
				urlDecode(userinfo.substring(pwSep + 1));
		}
		else {
			urlUserInfo = urlDecode(userinfo);
		}
		return cleanupUserInfo(urlUserInfo);
	}

	private static String cleanupUserInfo(String userinfo) {
		if (StringUtils.isBlank(userinfo)) {
			return null;
		}
		userinfo = userinfo.trim();
		int pwdSep = userinfo.indexOf(':');
		if (pwdSep == 0) {
			throw new IllegalArgumentException("Invalid userinfo specified");
		}
		else if (pwdSep > 0 && (userinfo.length() - pwdSep) == 0) {
			throw new IllegalArgumentException("Invalid userinfo specified");
		}
		return userinfo;
	}

	private static String cleanupFilename(String name) {
		// transform dbName into acceptable H2 DB file path

		Matcher m = BAD_H2_CHARS_PATTERN.matcher(name);
		if (m.matches()) {
			throw new IllegalArgumentException("Bad character in H2 database path. " +
				"Disallowed characters: " + BAD_H2_CHARS);
		}
		String dbName = name.trim();
		dbName = dbName.replace("\\", "/");
		if ((!dbName.startsWith("/") && !isWindowsFilePath(dbName)) || dbName.endsWith("/")) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ensure the userinfo begins with a non-empty username, e.g. 'user:password'.
  2. If no password is needed, omit it entirely: 'user@host'.
  3. Validate that the username is non-empty before forming the userinfo.

Example fix

// before
new BSimServerInfo(new URL("postgresql://:" + pwd + "@host:5432/db"));
// after (include username)
new BSimServerInfo(new URL("postgresql://" + user + ":" + pwd + "@host:5432/db"));
Defensive patterns

Strategy: validation

Validate before calling

String ui = userinfo == null ? null : userinfo.trim();
if (ui != null && ui.startsWith(":")) {
    throw new IllegalArgumentException("userinfo must start with a non-empty username");
}

Prevention

When it happens

Trigger: Constructing a BSimServerInfo from a URL or value whose userinfo is ':password' (colon at index 0, empty user), e.g. 'postgresql://:secret@host:5432/db'.

Common situations: Building a userinfo string by concatenation with a null/empty username; stripping the username during sanitization; mis-parsed credentials.

Related errors


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