Skip to content

Conversation

@remones
Copy link
Contributor

@remones remones commented Feb 16, 2025

Purpose of this pull request

support custom config keys for encrypt/decrypt
related issue: #8511

Does this PR introduce any user-facing change?

Yes. config encryption/decryption now supports shade.options, allowing users to add custom parameters that intend to be encrypted/decrypted.

How was this patch tested?

Exist tests

Check list

@Hisoka-X
Copy link
Member

Please follow the guide to open github action on your fork repository. https://github.com/apache/seatunnel/pull/8739/checks?check_run_id=37293359572

@remones remones force-pushed the feature/custom-encrypt-options branch 5 times, most recently from 94129d4 to 48f123d Compare February 17, 2025 09:59
return ConfigFactory.parseMap(configMap);
}

public static List<String> getSensitiveOptions(Config config) {
Copy link
Member

Choose a reason for hiding this comment

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

Use set as return type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I'll revise it, and do you have any other suggestions or comments?

Copy link
Member

Choose a reason for hiding this comment

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

overall LGTM.

@remones remones force-pushed the feature/custom-encrypt-options branch from 48f123d to f352f20 Compare February 18, 2025 07:48
env {
parallelism = 1
shade.identifier = "base64"
shade.options = ["username", "password", "f1", "config1.f1", "config2.list"]
Copy link
Contributor

Choose a reason for hiding this comment

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

is it better to rename to shade.keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@litiliu I don't think so, shade.options may be clearer in config context, especially with default values.

: ConfigFactory.empty(),
SHADE_OPTIONS_OPTION,
new ArrayList<>()));
sensitiveOptions.addAll(new ArrayList<>(Arrays.asList(DEFAULT_SENSITIVE_KEYWORDS)));
Copy link
Contributor

Choose a reason for hiding this comment

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

we can directly use sensitiveOptions.addAll(Arrays.asList(DEFAULT_SENSITIVE_KEYWORDS));

if (Arrays.asList(DEFAULT_SENSITIVE_KEYWORDS)
.contains(key.toLowerCase())) {
m.put(key, "******");
if (sensitiveKeywords.contains(key.toLowerCase())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the toLowerCase needed here? As in the doc, we didn't specify whether we can match with the ignore case.

Copy link
Member

Choose a reason for hiding this comment

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

We don't care keywords case. The old behavior already convert to lowercase https://github.com/apache/seatunnel/pull/8739/files#diff-f4fa1a9b065718cc135d232712063b7b3a9135933396dd2674253da754d95c86L131. So I think we should keep it. cc @remones

@remones remones force-pushed the feature/custom-encrypt-options branch from f352f20 to fe8d1e3 Compare February 19, 2025 02:19
@Hisoka-X Hisoka-X linked an issue Feb 19, 2025 that may be closed by this pull request
3 tasks
@remones remones force-pushed the feature/custom-encrypt-options branch from fe8d1e3 to a30c818 Compare February 19, 2025 03:14
Hisoka-X
Hisoka-X previously approved these changes Feb 19, 2025
Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

LGTM. cc @hailin0

@remones
Copy link
Contributor Author

remones commented Feb 19, 2025

I noticed that every time I push a new commit, the GitHub Actions test workflow runs for over an hour, and some e2e test cases are not stable so it may fail sometimes. do you have any suggestions for this? cc @Hisoka-X @hailin0

@hailin0
Copy link
Member

hailin0 commented Feb 19, 2025

I noticed that every time I push a new commit, the GitHub Actions test workflow runs for over an hour, and some e2e test cases are not stable so it may fail sometimes. do you have any suggestions for this? cc @Hisoka-X @hailin0

If you are interested, you can fix the unstable test case

@Hisoka-X Hisoka-X merged commit b16aac2 into apache:dev Feb 20, 2025
7 checks passed
@remones remones deleted the feature/custom-encrypt-options branch February 20, 2025 02:05
zax1314157 pushed a commit to zax1314157/seatunnel that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Config] Support custom config keys for encrypt/decrypt

4 participants