Class SecurityUtils
java.lang.Object
org.apache.camel.util.SecurityUtils
Utility for detecting insecure configuration options.
The security options map is generated by camel build tools from @Metadata(security=...) and
@UriParam(security=...) annotations.
- Since:
- 4.19.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordInformation about a security-sensitive configuration option. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic List<SecurityViolation> detectViolations(Map<String, Object> properties, BiPredicate<String, Object> secretDetector, UnaryOperator<String> policyResolver, Set<String> allowedKeys) Detect security policy violations in a set of configuration properties.static SecurityUtils.SecurityOptiongetSecurityOption(String text) Get security information for a configuration property.static Map<String, SecurityUtils.SecurityOption> All the security options (unmodifiable)static booleanisInsecureValue(String text, Object value) Whether the given configuration property value is the insecure value for the property.static booleanisPlainTextSecret(Object value) Whether the given property value appears to be a plain-text secret (not using vault, env var, or system property placeholders).
-
Field Details
-
INSECURE_SSL
- See Also:
-
INSECURE_SERIALIZATION
- See Also:
-
INSECURE_DEV
- See Also:
-
-
Method Details
-
getSecurityOptions
All the security options (unmodifiable) -
getSecurityOption
Get security information for a configuration property.- Parameters:
text- the configuration property key (e.g., "camel.component.http.trustAllCertificates")- Returns:
- the security option info, or null if the property has no security category
-
isInsecureValue
Whether the given configuration property value is the insecure value for the property.- Parameters:
text- the configuration property keyvalue- the property value- Returns:
- true if the value is the insecure value for this property, false otherwise
-
isPlainTextSecret
Whether the given property value appears to be a plain-text secret (not using vault, env var, or system property placeholders).- Parameters:
value- the property value to check- Returns:
- true if the value is plain text (not secured via a placeholder mechanism)
-
detectViolations
public static List<SecurityViolation> detectViolations(Map<String, Object> properties, BiPredicate<String, Object> secretDetector, UnaryOperator<String> policyResolver, Set<String> allowedKeys) Detect security policy violations in a set of configuration properties.This method checks for both plain-text secrets and insecure configuration options based on the security options map and the provided policy resolver.
- Parameters:
properties- map of property key → value pairs to checksecretDetector- predicate that returns true if a property key+value pair represents a sensitive secretpolicyResolver- function that resolves the effective policy ("allow", "warn", "fail") for a given security categoryallowedKeys- set of property keys to skip (allowed explicitly by the user)- Returns:
- list of violations found (may be empty)
-