Class ArgumentSanitizer
java.lang.Object
org.springframework.cloud.dataflow.rest.util.ArgumentSanitizer
Sanitizes potentially sensitive keys for a specific command line arg.
- Author:
- Glenn Renfro, Gunnar Hillert, Ilayaperumal Gopinathan, Corneil du Plessis
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReplaces a potential secure value with "******".Replaces a potential secure value with "******".sanitizeArguments
(List<String> arguments) For all sensitive arguments (e.g.sanitizeHeaders
(HttpHeaders headers) org.springframework.batch.core.JobParameters
sanitizeJobParameters
(org.springframework.batch.core.JobParameters jobParameters) Replaces the sensitive String values in the JobParameter value.sanitizeJsonOrYamlString
(String input) Will determine the type of data and treat as JSON or YAML to sanitize sensitive values.sanitizeJsonString
(String input) Will replace the sensitive string fields with '*****'sanitizeMap
(Map<String, Object> input) Will replace sensitive string value in the Map with '*****'sanitizeProperties
(Map<String, String> properties) For all sensitive properties (e.g.sanitizeTaskDsl
(TaskDefinition taskDefinition) Redacts sensitive property values in a task.sanitizeYamlString
(String input) Will replace the sensitive string fields with '*****'
-
Constructor Details
-
ArgumentSanitizer
public ArgumentSanitizer()
-
-
Method Details
-
sanitize
Replaces a potential secure value with "******".- Parameters:
argument
- the argument to cleanse.- Returns:
- the argument with a potentially sanitized value
-
sanitize
Replaces a potential secure value with "******".- Parameters:
key
- to check for sensitive words.value
- the argument to cleanse.- Returns:
- the argument with a potentially sanitized value
-
sanitizeJobParameters
public org.springframework.batch.core.JobParameters sanitizeJobParameters(org.springframework.batch.core.JobParameters jobParameters) Replaces the sensitive String values in the JobParameter value.- Parameters:
jobParameters
- the original job parameters- Returns:
- the sanitized job parameters
-
sanitizeTaskDsl
Redacts sensitive property values in a task.- Parameters:
taskDefinition
- the task definition to sanitize- Returns:
- Task definition text that has sensitive data redacted.
-
sanitizeProperties
For all sensitive properties (e.g. key names containing words like password, secret, key, token) replace the value with '*****' string- Parameters:
properties
- to be sanitized- Returns:
- sanitized properties
-
sanitizeArguments
For all sensitive arguments (e.g. key names containing words like password, secret, key, token) replace the value with '*****' string- Parameters:
arguments
- to be sanitized- Returns:
- sanitized arguments
-
sanitizeHeaders
-
sanitizeMap
Will replace sensitive string value in the Map with '*****'- Parameters:
input
- to be sanitized- Returns:
- the sanitized map.
-
sanitizeJsonString
public String sanitizeJsonString(String input) throws com.fasterxml.jackson.core.JsonProcessingException Will replace the sensitive string fields with '*****'- Parameters:
input
- to be sanitized- Returns:
- The sanitized JSON string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- from mapper.
-
sanitizeYamlString
public String sanitizeYamlString(String input) throws com.fasterxml.jackson.core.JsonProcessingException Will replace the sensitive string fields with '*****'- Parameters:
input
- to be sanitized- Returns:
- The sanitized YAML string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- from mapper
-
sanitizeJsonOrYamlString
Will determine the type of data and treat as JSON or YAML to sanitize sensitive values.- Parameters:
input
- to be sanitized- Returns:
- the sanitized string
-