This is an automated email from the ASF dual-hosted git repository.
jialiang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 9b5e1a7424 AMBARI-26555: Password leaked for configurations at stack
root (e.g. cluster-env.xml) (#4086)
9b5e1a7424 is described below
commit 9b5e1a74241085bc3483f67f172413e95d4d8336
Author: Yubi Lee <[email protected]>
AuthorDate: Thu Nov 13 15:16:09 2025 +0900
AMBARI-26555: Password leaked for configurations at stack root (e.g.
cluster-env.xml) (#4086)
---
.../org/apache/ambari/server/state/StackInfo.java | 41 +++++++++++++++-------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
index ec541e76e2..ca89f6c716 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
@@ -513,27 +513,44 @@ public class StackInfo implements Comparable<StackInfo>,
Validable {
}
public Map<PropertyInfo.PropertyType, Set<String>>
getConfigPropertiesTypes(String configType) {
- if(!propertiesTypesCache.containsKey(configType)) {
+ if (!propertiesTypesCache.containsKey(configType)) {
Map<PropertyInfo.PropertyType, Set<String>> propertiesTypes = new
HashMap<>();
+
+ collectPropertyTypes(propertiesTypes, getProperties(), configType);
+
Collection<ServiceInfo> services = getServices();
for (ServiceInfo serviceInfo : services) {
- for (PropertyInfo propertyInfo : serviceInfo.getProperties()) {
- if (propertyInfo.getFilename().contains(configType) &&
!propertyInfo.getPropertyTypes().isEmpty()) {
- Set<PropertyInfo.PropertyType> types =
propertyInfo.getPropertyTypes();
- for (PropertyInfo.PropertyType propertyType : types) {
- if (!propertiesTypes.containsKey(propertyType)) {
- propertiesTypes.put(propertyType, new HashSet<>());
- }
- propertiesTypes.get(propertyType).add(propertyInfo.getName());
- }
- }
- }
+ collectPropertyTypes(propertiesTypes, serviceInfo.getProperties(),
configType);
}
propertiesTypesCache.put(configType, propertiesTypes);
}
return propertiesTypesCache.get(configType);
}
+ private void collectPropertyTypes(Map<PropertyInfo.PropertyType,
Set<String>> target,
+ Collection<PropertyInfo> sources,
+ String configType) {
+ if (sources == null) {
+ return;
+ }
+
+ for (PropertyInfo propertyInfo : sources) {
+ String filename = propertyInfo.getFilename();
+ if (filename == null || !filename.contains(configType)) {
+ continue;
+ }
+
+ Set<PropertyInfo.PropertyType> types = propertyInfo.getPropertyTypes();
+ if (types == null || types.isEmpty()) {
+ continue;
+ }
+
+ for (PropertyInfo.PropertyType propertyType : types) {
+ target.computeIfAbsent(propertyType, key -> new
HashSet<>()).add(propertyInfo.getName());
+ }
+ }
+ }
+
/**
* Return default config attributes for specified config type.
* @param configType config type
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]