Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Oct 7, 2015 · 1 comment
Assignees
Labels
status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good catch! Addressed in a slight different fashion, since the super.validateRequest should actually go first there anyway (catching a missing transport value), plus a few other refinements across that class. I'll backport all of those to 4.1.8 as well.

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.2.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants