Skip to content

Commit 3d6ce2e

Browse files
committed
Fixing cross origin bug for rest calls that allow a malicious user to issue requests from a site other than the zeppelin server.
Adding unit tests and a dependency to mockito to the server project (please comment if that is ok or if there is another preferred mocking framework). Also upgrading the servelet version from 2.5 to 3.0 as this also fixes a security vulnerability with respect to httonly cookies.
1 parent 1f851c0 commit 3d6ce2e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

zeppelin-server/src/test/java/org/apache/zeppelin/security/SecurityUtilsTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929
* Created by joelz on 8/19/15.
3030
*/
3131
public class SecurityUtilsTests {
32+
@Test
33+
public void isInvalid() throws URISyntaxException, UnknownHostException {
34+
Assert.assertFalse(SecurityUtils.isValidOrigin("http://127.0.1.1", ZeppelinConfiguration.create()));
35+
}
36+
37+
@Test
38+
public void isInvalidFromConfig() throws URISyntaxException, UnknownHostException, ConfigurationException {
39+
Assert.assertFalse(
40+
SecurityUtils.isValidOrigin("http://otherinvalidhost.com",
41+
new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
42+
}
43+
3244
@Test
3345
public void isLocalhost() throws URISyntaxException, UnknownHostException {
3446
Assert.assertTrue(SecurityUtils.isValidOrigin("http://localhost", ZeppelinConfiguration.create()));

zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public static enum ConfVars {
427427
ZEPPELIN_CONF_DIR("zeppelin.conf.dir", "conf"),
428428
// Allows a way to specify a ',' separated list of allowed origins for rest and websockets
429429
// i.e. http://localhost:8080
430-
ZEPPELIN_ALLOWED_ORIGINS("zeppelin.server.allowed.origins", "");
430+
ZEPPELIN_ALLOWED_ORIGINS("zeppelin.server.allowed.origins", "*");
431431

432432
private String varName;
433433
@SuppressWarnings("rawtypes")

0 commit comments

Comments
 (0)