mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: check param customSessionId (alphanumeric string)
parent
189c6264c2
commit
c2da80429e
|
@ -140,6 +140,11 @@ public class SessionRestController {
|
||||||
builder = builder.mediaMode(MediaMode.ROUTED);
|
builder = builder.mediaMode(MediaMode.ROUTED);
|
||||||
}
|
}
|
||||||
if (customSessionId != null && !customSessionId.isEmpty()) {
|
if (customSessionId != null && !customSessionId.isEmpty()) {
|
||||||
|
if (!sessionManager.formatChecker.isValidCustomSessionId(customSessionId)) {
|
||||||
|
return this.generateErrorResponse(
|
||||||
|
"Parameter \"customSessionId\" is wrong. Must be an alphanumeric string",
|
||||||
|
"/api/sessions", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
builder = builder.customSessionId(customSessionId);
|
builder = builder.customSessionId(customSessionId);
|
||||||
}
|
}
|
||||||
builder = builder.defaultCustomLayout((defaultCustomLayout != null) ? defaultCustomLayout : "");
|
builder = builder.defaultCustomLayout((defaultCustomLayout != null) ? defaultCustomLayout : "");
|
||||||
|
|
|
@ -29,4 +29,9 @@ public class FormatChecker {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValidCustomSessionId(String customSessionId) {
|
||||||
|
// Alphanumeric string
|
||||||
|
return customSessionId.matches("[a-zA-Z0-9]+");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue