abhishekrb19 commented on code in PR #13989:
URL: https://github.com/apache/druid/pull/13989#discussion_r1152418051
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteInsertDmlTest.java:
##########
@@ -307,6 +308,39 @@ public void testInsertFromExternal()
.verify();
}
+ @Test
+ public void testInsertFromExternalWithInputSourceSecurityEnabled()
+ {
+ testIngestionQuery()
+ .sql("INSERT INTO dst SELECT * FROM %s PARTITIONED BY ALL TIME",
externSql(externalDataSource))
+ .authentication(CalciteTests.SUPER_USER_AUTH_RESULT)
+
.authConfig(AuthConfig.newBuilder().setEnableInputSourceSecurity(true).build())
+ .expectTarget("dst", externalDataSource.getSignature())
+ .expectResources(dataSourceWrite("dst"), externalRead("inline"))
+ .expectQuery(
+ newScanQueryBuilder()
+ .dataSource(externalDataSource)
+ .intervals(querySegmentSpec(Filtration.eternity()))
+ .columns("x", "y", "z")
+ .context(PARTITIONED_BY_ALL_TIME_QUERY_CONTEXT)
+ .build()
+ )
+ .expectLogicalPlanFrom("insertFromExternal")
+ .verify();
+ }
+
+ @Test
+ public void
testUnauthorizedInsertFromExternalWithInputSourceSecurityEnabled()
+ {
+ testIngestionQuery()
+ .sql("INSERT INTO dst SELECT * FROM %s PARTITIONED BY ALL TIME",
externSql(externalDataSource))
+ .authentication(CalciteTests.REGULAR_USER_AUTH_RESULT)
+
.authConfig(AuthConfig.newBuilder().setEnableInputSourceSecurity(true).build())
Review Comment:
All the tests either implicitly disable the input source security (via a
default) or explicitly enable it. It'll be nice also to have a test where we
explicitly disable it.
Perhaps a unit test similar to this, where `setEnableInputSourceSecurity` us
set to `false`, and we shouldn't get a `ForbiddenException`.
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteInsertDmlTest.java:
##########
@@ -307,6 +308,39 @@ public void testInsertFromExternal()
.verify();
}
+ @Test
+ public void testInsertFromExternalWithInputSourceSecurityEnabled()
+ {
+ testIngestionQuery()
+ .sql("INSERT INTO dst SELECT * FROM %s PARTITIONED BY ALL TIME",
externSql(externalDataSource))
+ .authentication(CalciteTests.SUPER_USER_AUTH_RESULT)
+
.authConfig(AuthConfig.newBuilder().setEnableInputSourceSecurity(true).build())
+ .expectTarget("dst", externalDataSource.getSignature())
+ .expectResources(dataSourceWrite("dst"), externalRead("inline"))
+ .expectQuery(
+ newScanQueryBuilder()
+ .dataSource(externalDataSource)
+ .intervals(querySegmentSpec(Filtration.eternity()))
+ .columns("x", "y", "z")
+ .context(PARTITIONED_BY_ALL_TIME_QUERY_CONTEXT)
+ .build()
+ )
+ .expectLogicalPlanFrom("insertFromExternal")
+ .verify();
+ }
+
+ @Test
+ public void
testUnauthorizedInsertFromExternalWithInputSourceSecurityEnabled()
+ {
+ testIngestionQuery()
+ .sql("INSERT INTO dst SELECT * FROM %s PARTITIONED BY ALL TIME",
externSql(externalDataSource))
+ .authentication(CalciteTests.REGULAR_USER_AUTH_RESULT)
+
.authConfig(AuthConfig.newBuilder().setEnableInputSourceSecurity(true).build())
Review Comment:
All the tests either implicitly disable the input source security (via a
default) or explicitly enable it. It'll be nice also to have a test where we
explicitly disable it.
Perhaps a unit test similar to this, where `setEnableInputSourceSecurity` is
set to `false`, and we shouldn't get a `ForbiddenException`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]