Skip to content

Commit

Permalink
fix: disallow requests to /inserts-stream if insert values disabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vcrfxia authored Jun 10, 2020
1 parent 174756d commit e277f25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private void throwIfDisabled(final KsqlConfig config) {

if (canBeDisabledByConfig && !isEnabled) {
throw new KsqlException("The server has disabled INSERT INTO ... VALUES functionality. "
+ "To enable it, restart your KSQL-server "
+ "To enable it, restart your ksqlDB server "
+ "with 'ksql.insert.into.values.enabled'=true");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package io.confluent.ksql.api.impl;

import static io.confluent.ksql.rest.Errors.ERROR_CODE_BAD_REQUEST;
import static io.confluent.ksql.rest.Errors.ERROR_CODE_BAD_STATEMENT;

import io.confluent.ksql.api.server.InsertResult;
Expand Down Expand Up @@ -53,6 +54,12 @@ public InsertsStreamSubscriber createInsertsSubscriber(final String target,
final WorkerExecutor workerExecutor,
final ServiceContext serviceContext) {
VertxUtils.checkIsWorker();
if (!ksqlConfig.getBoolean(KsqlConfig.KSQL_INSERT_INTO_VALUES_ENABLED)) {
throw new KsqlApiException("The server has disabled INSERT INTO ... VALUES functionality. "
+ "To enable it, restart your ksqlDB server "
+ "with 'ksql.insert.into.values.enabled'=true",
ERROR_CODE_BAD_REQUEST);
}
final DataSource dataSource = getDataSource(ksqlEngine.getMetaStore(),
SourceName.of(target));
if (dataSource.getDataSourceType() == DataSourceType.KTABLE) {
Expand Down

0 comments on commit e277f25

Please sign in to comment.