This is an automated email from the ASF dual-hosted git repository.
wuchunfu pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 63c52de30f [config][doc]add sensitive columns and enhance the doc
(#8523)
63c52de30f is described below
commit 63c52de30ff69875ce2bcd146feb1ebb46f6b5ec
Author: litiliu <[email protected]>
AuthorDate: Wed Jan 15 16:57:47 2025 +0800
[config][doc]add sensitive columns and enhance the doc (#8523)
Co-authored-by: litiliu <[email protected]>
---
docs/en/connector-v2/Config-Encryption-Decryption.md | 9 +++++++--
docs/zh/connector-v2/Config-Encryption-Decryption.md | 6 +++++-
.../apache/seatunnel/core/starter/utils/ConfigShadeUtils.java | 2 +-
.../apache/seatunnel/core/starter/utils/ConfigShadeTest.java | 11 +++++++++++
.../src/test/resources/config.shade.conf | 4 ++++
5 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/docs/en/connector-v2/Config-Encryption-Decryption.md
b/docs/en/connector-v2/Config-Encryption-Decryption.md
index 341fbf11a1..edb8061b46 100644
--- a/docs/en/connector-v2/Config-Encryption-Decryption.md
+++ b/docs/en/connector-v2/Config-Encryption-Decryption.md
@@ -12,6 +12,9 @@ Base64 encryption support encrypt the following parameters:
- username
- password
- auth
+- token
+- access_key
+- secret_key
Next, I'll show how to quickly use SeaTunnel's own `base64` encryption:
@@ -130,13 +133,14 @@ If you want to customize the encryption method and the
configuration of the encr
1. Create a java maven project
-2. Add `seatunnel-api` module in dependencies like the following shown:
+2. Add `seatunnel-api` module with the provided scope in dependencies like the
following shown:
```xml
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>seatunnel-api</artifactId>
<version>${seatunnel.version}</version>
+ <scope>provided</scope>
</dependency>
```
3. Create a new class and implement interface `ConfigShade`, this interface
has the following methods:
@@ -174,7 +178,8 @@ If you want to customize the encryption method and the
configuration of the encr
}
}
```
-4. Add `org.apache.seatunnel.api.configuration.ConfigShade` in
`resources/META-INF/services`
+4. Create a file named `org.apache.seatunnel.api.configuration.ConfigShade` in
`resources/META-INF/services`, the file content should be the fully qualified
class name of the class that you defined in step 3.
+
5. Package it to jar and add jar to `${SEATUNNEL_HOME}/lib`
6. Change the option `shade.identifier` to the value that you defined in
`ConfigShade#getIdentifier`of you config file, please enjoy it \^_\^
diff --git a/docs/zh/connector-v2/Config-Encryption-Decryption.md
b/docs/zh/connector-v2/Config-Encryption-Decryption.md
index c2b7ced0ab..9293d0e71e 100644
--- a/docs/zh/connector-v2/Config-Encryption-Decryption.md
+++ b/docs/zh/connector-v2/Config-Encryption-Decryption.md
@@ -12,6 +12,9 @@ Base64编码支持加密以下参数:
- username
- password
- auth
+- token
+- access_key
+- secret_key
接下来,将展示如何快速使用 SeaTunnel 自带的 `base64` 加密功能:
@@ -138,6 +141,7 @@ Base64编码支持加密以下参数:
<groupId>org.apache.seatunnel</groupId>
<artifactId>seatunnel-api</artifactId>
<version>${seatunnel.version}</version>
+ <scope>provided</scope>
</dependency>
```
3. 创建一个 java 类并实现 `ConfigShade` 接口,该接口包含以下方法:
@@ -175,7 +179,7 @@ Base64编码支持加密以下参数:
}
}
```
-4. 在 `resources/META-INF/services` 目录下添加
`org.apache.seatunnel.api.configuration.ConfigShade`
+4. 在 `resources/META-INF/services` 目录下创建名为
`org.apache.seatunnel.api.configuration.ConfigShade`的文件, 文件内容是您在步骤 3
中定义的类的完全限定类名。
5. 将其打成 jar 包, 并添加到 `${SEATUNNEL_HOME}/lib` 目录下。
6. 将选项 `shade.identifier` 的值更改为上面定义在配置文件中的 `ConfigShade#getIdentifier` 的值。
diff --git
a/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java
b/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java
index 3269ab8cd8..2772454efb 100644
---
a/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java
+++
b/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java
@@ -48,7 +48,7 @@ public final class ConfigShadeUtils {
private static final String SHADE_IDENTIFIER_OPTION = "shade.identifier";
public static final String[] DEFAULT_SENSITIVE_KEYWORDS =
- new String[] {"password", "username", "auth", "token"};
+ new String[] {"password", "username", "auth", "token",
"access_key", "secret_key"};
private static final Map<String, ConfigShade> CONFIG_SHADES = new
HashMap<>();
diff --git
a/seatunnel-core/seatunnel-core-starter/src/test/java/org/apache/seatunnel/core/starter/utils/ConfigShadeTest.java
b/seatunnel-core/seatunnel-core-starter/src/test/java/org/apache/seatunnel/core/starter/utils/ConfigShadeTest.java
index 2256b7447e..b62df81608 100644
---
a/seatunnel-core/seatunnel-core-starter/src/test/java/org/apache/seatunnel/core/starter/utils/ConfigShadeTest.java
+++
b/seatunnel-core/seatunnel-core-starter/src/test/java/org/apache/seatunnel/core/starter/utils/ConfigShadeTest.java
@@ -51,6 +51,9 @@ public class ConfigShadeTest {
private static final String PASSWORD = "seatunnel_password";
+ private static final String ACCESS_KEY = "access_key";
+ private static final String SECRET_KEY = "secret_key";
+
@Test
public void testParseConfig() throws URISyntaxException {
URL resource = ConfigShadeTest.class.getResource("/config.shade.conf");
@@ -71,6 +74,10 @@ public class ConfigShadeTest {
config.getConfigList("source").get(0).getString("username"),
USERNAME);
Assertions.assertEquals(
config.getConfigList("source").get(0).getString("password"),
PASSWORD);
+ Assertions.assertEquals(
+ config.getConfigList("source").get(0).getString("access_key"),
ACCESS_KEY);
+ Assertions.assertEquals(
+ config.getConfigList("source").get(0).getString("secret_key"),
SECRET_KEY);
}
@Test
@@ -89,6 +96,10 @@ public class ConfigShadeTest {
config.getConfigList("source").get(0).getString("username"),
"******");
Assertions.assertEquals(
config.getConfigList("source").get(0).getString("password"),
"******");
+ Assertions.assertEquals(
+ config.getConfigList("source").get(0).getString("access_key"),
"******");
+ Assertions.assertEquals(
+ config.getConfigList("source").get(0).getString("secret_key"),
"******");
String conf = ConfigBuilder.mapToString(config.root().unwrapped());
Assertions.assertTrue(conf.contains("\"password\" : \"******\""));
}
diff --git
a/seatunnel-core/seatunnel-core-starter/src/test/resources/config.shade.conf
b/seatunnel-core/seatunnel-core-starter/src/test/resources/config.shade.conf
index 7c72073d03..bd06880161 100644
--- a/seatunnel-core/seatunnel-core-starter/src/test/resources/config.shade.conf
+++ b/seatunnel-core/seatunnel-core-starter/src/test/resources/config.shade.conf
@@ -39,6 +39,10 @@ source {
database-name = "inventory_vwyw0n"
table-name = "products"
base-url = "jdbc:mysql://localhost:56725"
+
+ # test properties
+ access_key = "YWNjZXNzX2tleQ=="
+ secret_key = "c2VjcmV0X2tleQ=="
}
}