Skip to content

Null Pointer when receiving an invalid transport type during SockJS request [SPR-13545] #18121

Closed
@spring-projects-issues

Description

@spring-projects-issues

Ben Kiefer opened SPR-13545 and commented

Our endpoint fuzzer was able to produce a 500 error due to a nullpointer in the TransportHandlingSockJsService. The following lines were the problem

protected boolean validateRequest(String serverId, String sessionId, String transport) {
		if (!getAllowedOrigins().contains("*") && !TransportType.fromValue(transport).supportsOrigin()) {
			if (logger.isWarnEnabled()) {
				logger.warn("Origin check has been enabled, but transport " + transport + " does not support it");
			}
			return false;
		}
		return super.validateRequest(serverId, sessionId, transport);

The nullpointer occurs when the transport is an unknown value (ex: bob) as the fromValue returns null when the type is not found.


Affects: 4.1.7, 4.2.1

Reference URL: #882

Referenced from: commits 8429c4b, 966f95b

Backported to: 4.1.8

Metadata

Metadata

Assignees

Labels

status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions