Skip to content

Commit

Permalink
fix: ksql.service.id should not be usable as a query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
tolgadur committed Mar 11, 2021
1 parent 643816f commit 7dc5b9d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 0 additions & 1 deletion ksqldb-cli/src/main/java/io/confluent/ksql/cli/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ private void setPropertyFromCtxt(

private void setProperty(final String property, final String value) {
final Object priorValue = restClient.setProperty(property, value);

terminal.writer().printf(
"Successfully changed local property '%s'%s to '%s'.%s%n",
property,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import io.confluent.ksql.util.KsqlConfig;
import io.confluent.ksql.util.KsqlException;

import java.util.Collection;
Expand All @@ -32,8 +33,8 @@ public class DenyListPropertyValidator {
private final Set<String> immutableProps;

public DenyListPropertyValidator(final Collection<String> immutableProps) {
this.immutableProps = ImmutableSet.copyOf(
Objects.requireNonNull(immutableProps, "immutableProps"));
this.immutableProps = ImmutableSet.<String>builder().addAll(
Objects.requireNonNull(immutableProps, "immutableProps")).add(KsqlConfig.KSQL_SERVICE_ID_CONFIG).build();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,21 @@ public void shouldNotThrowOnAllowedProp() {
"anything", "v2"
));
}

@Test
public void shouldThrowOnKsqlServiceIdProperty() {
// When:
final KsqlException e = assertThrows(
KsqlException.class,
() -> validator.validateAll(ImmutableMap.of(
"ksql.service.id", "v1"
))
);

// Then:
assertThat(e.getMessage(), containsString(
"One or more properties overrides set locally are prohibited by the KSQL server "
+ "(use UNSET to reset their default value): [ksql.service.id]"
));
}
}

0 comments on commit 7dc5b9d

Please sign in to comment.