Class ArgumentSanitizer

java.lang.Object
org.springframework.cloud.dataflow.rest.util.ArgumentSanitizer

public class ArgumentSanitizer extends Object
Sanitizes potentially sensitive keys for a specific command line arg.
Author:
Glenn Renfro, Gunnar Hillert, Ilayaperumal Gopinathan, Corneil du Plessis
  • Constructor Details

    • ArgumentSanitizer

      public ArgumentSanitizer()
  • Method Details

    • sanitize

      public String sanitize(String argument)
      Replaces a potential secure value with "******".
      Parameters:
      argument - the argument to cleanse.
      Returns:
      the argument with a potentially sanitized value
    • sanitize

      public String sanitize(String key, String value)
      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

      public String sanitizeTaskDsl(TaskDefinition taskDefinition)
      Redacts sensitive property values in a task.
      Parameters:
      taskDefinition - the task definition to sanitize
      Returns:
      Task definition text that has sensitive data redacted.
    • sanitizeProperties

      public Map<String,String> sanitizeProperties(Map<String,String> properties)
      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

      public List<String> sanitizeArguments(List<String> arguments)
      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

      public HttpHeaders sanitizeHeaders(HttpHeaders headers)
    • sanitizeMap

      public Map<String,Object> sanitizeMap(Map<String,Object> input)
      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

      public String sanitizeJsonOrYamlString(String input)
      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