Repository navigation
fix(kafka-connect): ignore worker-managed and masked connector config values - #835
Merged
Merged
Conversation
… values
Applying an unchanged KafkaConnector manifest always reported an UPDATE
because two values returned by GET /connectors/{name}/config can never be
written in a manifest:
- `__internal.config.version` is added by the Connect worker and was
reported as deleted on every run. Keys prefixed with `__internal.` are
now dropped when reading a connector config.
- Some distributions (e.g. Confluent Platform) return sensitive values
masked as bullet characters. A masked value is now considered equal to
the desired value. The mask is matched with the new provider property
`maskedConfigValuePattern` (default `^•+$`; empty to disable).
Fixes #822
|
Contributor
Security Scan ResultsVulnerabilities detected: Scanned by Trivy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Applying an unchanged
KafkaConnectormanifest always reported anUPDATE, because two values returned byGET /connectors/{name}/configcan never appear in a manifest.__internal.config.version: the Connect worker adds this key, and with orphan deletion enabled it was reported asDELETEon every run. Keys prefixed with__internal.are now dropped when a connector config is read (KafkaConnectUtils.removeCommonConnectorConfig).••••••••. When the actual value matches the newmaskedConfigValuePatternprovider property and the key is still declared in the manifest, it is treated as equal to the desired value, so the change isNONE.^•+$(a non-empty sequence of bullet characters).ConfigException.DELETE.Trade-off: Jikkou cannot see the real value behind a mask, so if only that value changes, the change is not detected. This is documented on the Kafka Connect provider configuration page.
Fixes #822
Tests
KafkaConnectorChangeComputerTest: masked value givesNONE; no pattern givesUPDATE; masked key removed givesDELETE; other keys still diff normally; custom pattern.KafkaConnectUtilsTest:__internal.*keys are stripped.KafkaConnectExtensionProviderTest: default pattern, disabled by an empty value, invalid regex../mvnw test -pl providers/jikkou-provider-kafka-connect: 57 tests, all passing.