This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 4c040066eff [enhance](Backup) Obscure the secret key for show backup's
repository stmt #34226 (#34332)
4c040066eff is described below
commit 4c040066efff66f2dc3557b0540e5536dcf720e2
Author: AlexYue <[email protected]>
AuthorDate: Tue Apr 30 16:10:46 2024 +0800
[enhance](Backup) Obscure the secret key for show backup's repository stmt
#34226 (#34332)
---
.../src/main/java/org/apache/doris/backup/Repository.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
b/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
index 161b9e703b0..f58ffa63a51 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
@@ -29,6 +29,7 @@ import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.common.util.PrintableMap;
import org.apache.doris.common.util.TimeUtils;
+import org.apache.doris.datasource.property.constants.S3Properties;
import org.apache.doris.fs.PersistentFileSystem;
import org.apache.doris.fs.remote.BrokerFileSystem;
import org.apache.doris.fs.remote.RemoteFile;
@@ -58,7 +59,9 @@ import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
/*
@@ -691,8 +694,12 @@ public class Repository implements Writable {
stmtBuilder.append("\"");
stmtBuilder.append("\nPROPERTIES\n(");
- stmtBuilder.append(new
PrintableMap<>(this.getRemoteFileSystem().getProperties(), " = ",
- true, true));
+ Map<String, String> properties = new HashMap();
+ properties.putAll(this.getRemoteFileSystem().getProperties());
+ // WE should not return the acturl secret key to user for safety
consideration
+ properties.replace(S3Properties.SECRET_KEY, "xxxxxx");
+ properties.replace(S3Properties.Env.SECRET_KEY, "xxxxxx");
+ stmtBuilder.append(new PrintableMap<>(properties, " = ", true, true,
true));
stmtBuilder.append("\n)");
return stmtBuilder.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]