Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ksql.service.id should not be usable as a query parameter #7192

Conversation

tolgadur
Copy link
Contributor

Issue: #6869
ksql.service.id was settable as a query-level parameter but it should only be settable as a server-level parameter.

Description

The query-parameters that aren't allowed to be set are defined in the denylist that is imported from the ksql-server.properties. I hardcoded the 'ksql.servier.id' in the denylist as I wasn't sure if I should edit the config files. Hence, alternative to my approach we could edit the config files from where the denylist is imported.

Testing done

Just made sure that all tests run as there were already tests checking whether the properties set in the denylist actually are actually denied from query-level parameter setting.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@tolgadur tolgadur requested a review from rodesai March 10, 2021 16:18
@tolgadur tolgadur requested a review from a team as a code owner March 10, 2021 16:18
@ghost
Copy link

ghost commented Mar 10, 2021

@confluentinc It looks like @tolgadur just signed our Contributor License Agreement. 👍

Always at your service,

clabot

@@ -618,6 +618,7 @@ public static KsqlRestApplication buildApplication(final KsqlRestConfig restConf
final String ksqlServerId = ksqlConfig.getString(KsqlConfig.KSQL_SERVICE_ID_CONFIG);
updatedRestProps.putAll(
MetricCollectors.addConfluentMetricsContextConfigs(ksqlServerId, kafkaClusterId));
updatedRestProps.put(KsqlConfig.KSQL_PROPERTIES_OVERRIDES_DENYLIST, "ksql.service.id");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this was already specified, wouldn't this overwrite the previous value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right 😅. I changed it.

@tolgadur tolgadur force-pushed the fix-ksql.service.id-should-not-be-usable-as-a-query-parameter branch 2 times, most recently from 2c612e3 to 40023c2 Compare March 10, 2021 17:46
@tolgadur tolgadur requested a review from agavra March 10, 2021 17:49
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :) thanks for patching a long-standing bug!

this.immutableProps = ImmutableSet.copyOf(
Objects.requireNonNull(immutableProps, "immutableProps"));
this.immutableProps = ImmutableSet.<String>builder().addAll(
Objects.requireNonNull(immutableProps, "immutableProps")).add("ksql.service.id").build();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able to specify KsqlConfig.KSQL_SERVICE_ID_CONFIG here instead of hardcoding the property

Copy link
Member

@stevenpyzhang stevenpyzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, could you also add a unit test in DenyListPropertyValidatorTest.java?

@tolgadur tolgadur force-pushed the fix-ksql.service.id-should-not-be-usable-as-a-query-parameter branch from 40023c2 to 60a5cc3 Compare March 11, 2021 10:21
@tolgadur tolgadur force-pushed the fix-ksql.service.id-should-not-be-usable-as-a-query-parameter branch from 60a5cc3 to 7dc5b9d Compare March 11, 2021 10:27
@tolgadur tolgadur merged commit cc5cd81 into confluentinc:master Mar 11, 2021
@tolgadur tolgadur deleted the fix-ksql.service.id-should-not-be-usable-as-a-query-parameter branch March 11, 2021 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants