-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(config): Configuration Endpoint - ConfigurationProvider #14237
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2791b8a
chore(config): Configuration Endpoint - ConfigurationProvider
6d170de
using regexes
91af81a
placeholders for mae and mce components. pretty print responses
026d1a6
unit tests fixes
c9b7422
suppressed aikido warnings, more docs
b43722c
another attempt to suppress aikido errors, added more smoke tests
fce7747
added unit tests
b419dd7
added a unit test to check that all configuration properties are clas…
9da55d0
more documentation, minor fixes for the test
ba373d7
feedback
6112461
updated the property classification test to ignore environment variables
f847596
system-info requires MANAGE_SYSTEM_OPERATIONS_PRIVILEGE
5e77fb6
added test to make sure 403 is returned when the user doesn't have MA…
8cf03f6
Merge branch 'master' into sa-config-PFP-1193-david
alexsku 48d5ca1
more unit test fixes
27218ba
Merge branch 'sa-config-PFP-1193-david' of github.com:datahub-project…
440f5f6
removed the fetch method - it is not used any only worsens the code c…
e0e5778
fixed the broken stuff
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Metadata IO Module | ||
|
||
This module contains the core metadata I/O services for DataHub, including system information collection and property management. | ||
|
||
## Security: Configuration Property Classification | ||
|
||
**Critical Test**: `PropertiesCollectorConfigurationTest` enforces that all configuration properties are explicitly classified as either sensitive (redacted) or non-sensitive (visible in system info). | ||
|
||
**Why**: Prevents accidental exposure of secrets through DataHub's system information endpoints. | ||
|
||
**When adding new properties**: The test will fail with instructions on which classification list to add your property to. The test file contains comprehensive documentation on: | ||
|
||
- The four classification lists (sensitive/non-sensitive, exact/template) | ||
- Template syntax for dynamic properties (`[*]` for indices, `*` for segments) | ||
- Security guidelines and examples | ||
|
||
**Test Command**: | ||
|
||
```bash | ||
./gradlew :metadata-io:test --tests "*.PropertiesCollectorConfigurationTest" | ||
``` | ||
|
||
**Security Rule**: When in doubt, classify as sensitive. This test is a mandatory security guardrail - never disable it. |
17 changes: 17 additions & 0 deletions
17
metadata-io/src/main/java/com/linkedin/metadata/system_info/ComponentInfo.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import java.util.Map; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ComponentInfo { | ||
private String name; | ||
private ComponentStatus status; | ||
private String version; | ||
private Map<String, Object> properties; | ||
private String errorMessage; | ||
} |
7 changes: 7 additions & 0 deletions
7
metadata-io/src/main/java/com/linkedin/metadata/system_info/ComponentStatus.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
public enum ComponentStatus { | ||
AVAILABLE, | ||
UNAVAILABLE, | ||
ERROR | ||
} |
16 changes: 16 additions & 0 deletions
16
metadata-io/src/main/java/com/linkedin/metadata/system_info/PropertyInfo.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class PropertyInfo { | ||
private String key; | ||
private Object value; | ||
private String source; | ||
private String sourceType; | ||
private String resolvedValue; | ||
} |
14 changes: 14 additions & 0 deletions
14
metadata-io/src/main/java/com/linkedin/metadata/system_info/PropertySourceInfo.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class PropertySourceInfo { | ||
private String name; | ||
private String type; | ||
private int propertyCount; | ||
} |
14 changes: 14 additions & 0 deletions
14
metadata-io/src/main/java/com/linkedin/metadata/system_info/SpringComponentsInfo.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class SpringComponentsInfo { | ||
private ComponentInfo gms; | ||
private ComponentInfo maeConsumer; | ||
private ComponentInfo mceConsumer; | ||
} |
19 changes: 19 additions & 0 deletions
19
metadata-io/src/main/java/com/linkedin/metadata/system_info/SystemInfoConstants.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
/** Constants for system information components */ | ||
public class SystemInfoConstants { | ||
|
||
// Component names | ||
public static final String GMS_COMPONENT_NAME = "GMS"; | ||
public static final String MAE_COMPONENT_NAME = "MAE Consumer"; | ||
public static final String MCE_COMPONENT_NAME = "MCE Consumer"; | ||
|
||
// Component keys for remote fetching | ||
public static final String GMS_COMPONENT_KEY = "gms"; | ||
public static final String MAE_COMPONENT_KEY = "maeConsumer"; | ||
public static final String MCE_COMPONENT_KEY = "mceConsumer"; | ||
|
||
private SystemInfoConstants() { | ||
// Utility class - no instantiation | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
metadata-io/src/main/java/com/linkedin/metadata/system_info/SystemInfoException.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
/** Exception thrown when system information collection fails */ | ||
public class SystemInfoException extends RuntimeException { | ||
|
||
public SystemInfoException(String message) { | ||
super(message); | ||
} | ||
|
||
public SystemInfoException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
metadata-io/src/main/java/com/linkedin/metadata/system_info/SystemInfoResponse.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class SystemInfoResponse { | ||
private SpringComponentsInfo springComponents; | ||
} |
136 changes: 136 additions & 0 deletions
136
metadata-io/src/main/java/com/linkedin/metadata/system_info/SystemInfoService.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.linkedin.metadata.system_info.collectors.PropertiesCollector; | ||
import com.linkedin.metadata.system_info.collectors.SpringComponentsCollector; | ||
import java.util.Map; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.TimeUnit; | ||
import javax.annotation.PreDestroy; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Service for collecting and providing system information. | ||
* | ||
* <p>This service orchestrates the collection of system information from various sources including: | ||
* | ||
* <ul> | ||
* <li>Spring component status (GMS, MAE Consumer, MCE Consumer) | ||
* <li>Spring application configuration properties (available via separate methods) | ||
* <li>System properties and environment variables (available via separate methods) | ||
* </ul> | ||
* | ||
* <p><strong>API Design:</strong> | ||
* | ||
* <ul> | ||
* <li>The main getSystemInfo() method returns only Spring component information | ||
* <li>Detailed system properties are available via separate getSystemPropertiesInfo() method | ||
* <li>This separation avoids duplication and improves response clarity | ||
* </ul> | ||
* | ||
* <p><strong>Security Considerations:</strong> | ||
* | ||
* <ul> | ||
* <li>This service exposes sensitive system configuration data | ||
* <li>Access should be restricted to administrators with MANAGE_SYSTEM_OPERATIONS_PRIVILEGE | ||
* <li>Sensitive properties (passwords, secrets, keys) are automatically redacted | ||
* <li>Property filtering is applied to prevent accidental exposure of credentials | ||
* </ul> | ||
* | ||
* <p><strong>Performance:</strong> | ||
* | ||
* <ul> | ||
* <li>Uses parallel execution for improved performance | ||
* <li>Includes timeouts for remote component fetching | ||
* <li>Graceful degradation when components are unavailable | ||
* </ul> | ||
* | ||
* @see SystemInfoController for REST API endpoints | ||
* @see PropertiesCollector for configuration property collection | ||
* @see SpringComponentsCollector for component status collection | ||
*/ | ||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class SystemInfoService { | ||
|
||
// Thread pool for parallel execution | ||
private final ExecutorService executorService = Executors.newFixedThreadPool(10); | ||
|
||
// Collectors | ||
private final SpringComponentsCollector springComponentsCollector; | ||
private final PropertiesCollector propertiesCollector; | ||
|
||
/** | ||
* Get Spring components information in parallel. | ||
* | ||
* @return SpringComponentsInfo containing status of GMS, MAE Consumer, and MCE Consumer | ||
*/ | ||
public SpringComponentsInfo getSpringComponentsInfo() { | ||
return springComponentsCollector.collect(executorService); | ||
} | ||
|
||
/** | ||
* Get all system properties with detailed metadata. | ||
* | ||
* <p>Returns comprehensive property information including: | ||
* | ||
* <ul> | ||
* <li>Individual property details with sources and resolution | ||
* <li>Property source metadata | ||
* <li>Filtering and redaction statistics | ||
* </ul> | ||
* | ||
* @return SystemPropertiesInfo with detailed property metadata | ||
*/ | ||
public SystemPropertiesInfo getSystemPropertiesInfo() { | ||
return propertiesCollector.collect(); | ||
} | ||
|
||
/** | ||
* Get only configuration properties as a simple map (for backward compatibility). | ||
* | ||
* <p>This method provides a simplified view of system properties without metadata, suitable for | ||
* legacy integrations or simple configuration debugging. | ||
* | ||
* @return Map of property keys to resolved values | ||
*/ | ||
public Map<String, Object> getPropertiesAsMap() { | ||
return propertiesCollector.getPropertiesAsMap(); | ||
} | ||
|
||
/** | ||
* Get system information - spring components only. | ||
* | ||
* <p>This method retrieves Spring component information including GMS, MAE Consumer, and MCE | ||
* Consumer status. For detailed system properties information, use the separate | ||
* getSystemPropertiesInfo() method or call the /properties endpoint directly. | ||
* | ||
* @return SystemInfoResponse containing component information | ||
* @throws SystemInfoException if collection fails or times out | ||
*/ | ||
public SystemInfoResponse getSystemInfo() { | ||
try { | ||
SpringComponentsInfo springComponents = getSpringComponentsInfo(); | ||
return SystemInfoResponse.builder().springComponents(springComponents).build(); | ||
} catch (Exception e) { | ||
log.error("Error collecting system info", e); | ||
throw new SystemInfoException("Failed to collect system information", e); | ||
} | ||
} | ||
|
||
@PreDestroy | ||
public void shutdown() { | ||
executorService.shutdown(); | ||
try { | ||
if (!executorService.awaitTermination(5, TimeUnit.SECONDS)) { | ||
executorService.shutdownNow(); | ||
} | ||
} catch (InterruptedException e) { | ||
executorService.shutdownNow(); | ||
Thread.currentThread().interrupt(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
metadata-io/src/main/java/com/linkedin/metadata/system_info/SystemPropertiesInfo.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.linkedin.metadata.system_info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class SystemPropertiesInfo { | ||
private Map<String, PropertyInfo> properties; | ||
private List<PropertySourceInfo> propertySources; | ||
private int totalProperties; | ||
private int redactedProperties; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.