-
Notifications
You must be signed in to change notification settings - Fork 30
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
Connector secrets #949
Merged
Merged
Connector secrets #949
Conversation
This file contains 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
( Note: there is not yet an entry in the CHANGELOG.md ) |
gz
approved these changes
Oct 27, 2023
411fbad
to
e0023c2
Compare
691e38a
to
2f38235
Compare
Rebased with main, added CHANGELOG note, and incorporated feedback (see feedback comments for more details). |
lalithsuresh
approved these changes
Oct 30, 2023
Signed-off-by: Simon Kassing <simon.kassing@feldera.com>
2f38235
to
9c6bcfe
Compare
( Rebased again with main ) |
gz
approved these changes
Oct 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
adapters
Issues related to the adapters crate
User-facing
For PRs that lead to Feldera-user visible changes
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.
Overview:
Secret reference: add enumeration type
SimpleStringOrSecretReference
with constructor that takes in a string. If the string follows the${secret:example}
pattern, it returns a secret reference toexample
. Else, it returns a simplestring with the direct content. Its pattern is similar to that of Kafka Connect / Debezium.
Secret resolver: converts a secret reference to the secret string it refers to.
Resolution options: currently, only secret references named "^[a-z0-9]+(-[a-z0-9]+)*$" are allowed, and are resolved by checking if a file "/etc/secret-volume/.example" exists (e.g., for the secret named
example
). This file needs to be made available by mounting the secret volume in advance.Resolution result is a
SimpleOrSecretString
instead of just aString
, such that if it is formatted for logs, it does not show the content for the secret variant. Of course, this only lasts until it must be passed as a plain String to the underlying connector library (e.g.,librdkafka
).Both conversion to potential secret reference (to
SimpleStringOrSecretReference
) and resolution (toSimpleOrSecretString
) are currently done at the latest possible point (latest resolution). They will be decoupled if secret references are directly integrated into the API (see future directions).Current implementation: secrets through pattern are enabled only for the additional config properties of the Kafka input and Kafka output connector.
Possible future directions:
Integration of secret references directly into the API (i.e., using a dedicated type to which is deserialized, like
SimpleStringOrSecretReference
(already added deserialization for it)). This would require changes at the core API, the Python API wrapper and the web console, as they would need to pass an object other than a basic string. It would remove the need for a secret pattern (although this could still be provided as a UI input method).Allow secrets to be specified in Docker demo via adding mounted volume at
/etc/secret-volume
of the pipeline manager.Additional resolution sources: external providers, maybe environment variables
Only at the pipeline the secret reference is resolved. There could already be earlier checks in place to warn if the secret reference does not exist (e.g., in the UI).
Pattern matching considerations:
A string must follow the
${secret:example}
pattern to be parsed as a secret reference. As such, it is impossible to have strings that follow the pattern.Because of this, there is one scenario in which the secret pattern matching would have an undesirable effect:
example
, intended for an input field for connector A${secret:example}
for an input field for connector B${secret:example}
being sent, instead the secret stringbehind the
example
secret is sent to connector BThis is highly unlikely as (1) it is exceedingly unlikely a user wants to enter a string following the pattern literally, and (2) the user must have already created a secret with the exact internal name and must match it exactly in the literal string. Because of (2), the user must already be aware of secrets and their pattern syntax (having created a secret), and as such the user wanting to enter a literal string like in (1) is improbable.
Motivation why it is not done with Yaml transformation:
Technically, we could also before deserializing the config
YamlValue
replace any Yaml/Json-specific construct (e.g.,!secret_ref: "example
) or any pattern-following Yaml-String with the Yaml-String containing the resolved secret. This would make the connector oblivious to whether it is a secret or not. However, this would make it format in any potential future logs.The Yaml replacement could also be a
SimpleStringOrSecretRef
, but if the replacement is scoped to the entire YamlValue it would require changing the type of all strings. Scoping it only to a subset of the YamlValue (e.g., only the ones under thekafka_options
key of the top mapping) would be possible, but would yield no difference in the current pattern-matching implementation and would need the Yaml conversion to become config-aware rather than just directly deserializing.It would also just be an inbetween solution, as an even better way is the integration of secret references directly into the API (see above), which would make them directly deserialize from Yaml without config-awareness.
Is this a user-visible change (yes/no): yes