If icon
AwsCLI icon
OutputValues icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon
Schedule icon

SSM Parameter Secret Hygiene Gate

Audit AWS SSM Parameter Store for plaintext secrets on a schedule and alert Slack with the exact parameter names affected.

Categories
CloudInfrastructure

Parameter Store has two kinds of parameter, String and SecureString, and nothing stops a put-parameter call from storing an API key or a database password as the plain, unencrypted kind by mistake, the API accepts either with no warning. A plaintext secret in Parameter Store is readable by anyone with ssm:GetParameter, a far wider set of people than were ever meant to see it, and it sits there silently until someone happens to look at every parameter's Type by hand. This blueprint reads describe-parameters' own output, flags every parameter whose name looks like it holds a secret but is not SecureString, and alerts Slack with the exact names.

How it works

  1. route_connection_mode (io.kestra.plugin.core.flow.If) picks the AWS CLI endpoint based on use_localstack. Both branches run the identical aws ssm describe-parameters command via io.kestra.plugin.aws.cli.AwsCLI, scoped by --parameter-filters Key=Name,Option=BeginsWith,Values=... when scan_scope is prefix, and shaped with the AWS CLI's own --query JMESPath to {parameters: Parameters[*].{Name: Name, Type: Type}} before being captured as a named output through the plugin's own documented ::{"outputs":{}}:: echo convention. Only the connection differs: the LocalStack branch sets endpointOverride and uses the fixed test/test credentials LocalStack accepts, the live branch omits endpointOverride entirely and uses real AWS credentials.
  2. audit_parameter_hygiene (io.kestra.plugin.core.output.OutputValues) reads whichever branch's vars.parameters list exists (guarded with is defined/is not defined, since exactly one branch ran) and flags every entry whose Name matches secret_name_pattern (case-insensitive) and whose Type is not SecureString.
  3. classify_hygiene_status (io.kestra.plugin.core.debug.Return) returns PROBE_FAILED when neither branch produced a parameters list at all, CRITICAL when the flagged count meets violation_count_critical_threshold, COMPLIANT otherwise.
  4. route_by_hygiene_status (io.kestra.plugin.core.flow.Switch) branches on that status: COMPLIANT logs it, CRITICAL and PROBE_FAILED each alert Slack, and the CRITICAL alert names the exact plaintext parameters found, never an invented count.
  5. log_audit_summary always runs last and logs the final classification.
  6. The errors block posts to Slack if the flow itself fails outside the gate logic above.

What you get

  • A real list of which parameters look like secrets by name but are stored unencrypted, not a hope that every put-parameter call used the right type.
  • A Slack alert naming the exact parameters, never an invented count.
  • A fully local test path: the default inputs point at a LocalStack container with no real AWS account needed, DescribeParameters is one of the SSM operations LocalStack's community edition actually implements.

Who it's for

  • Security and platform teams enforcing that anything secret-shaped in Parameter Store is encrypted, and who need proof across every parameter, not a sample.
  • Teams migrating secrets into Parameter Store who want a safety net against a script or a developer defaulting to String instead of SecureString.
  • Teams evaluating the AWS CLI plugin who want a working example of the ::{"outputs":{}}:: output-capture convention applied to an array result, by wrapping it in a single-key object with --query before the marker is echoed.

Why orchestrate this with Kestra

describe-parameters is a single point-in-time read, Parameter Store itself has no concept of a schedule, a naming policy, or an alert built from what it finds. Kestra adds the recurring scan, the secret-name-pattern check, and a Slack alert built only from the parameters' own reported names and types, all as one declarative YAML file you can version and review like code, runnable against LocalStack before it ever touches a real account.

Prerequisites

  • For local testing, a LocalStack container, no AWS account needed:

    docker run --rm -d --name localstack -p 4566:4566 localstack/localstack
    

    Port 4566 does not collide with Kestra's own default UI port. DescribeInstancePatchStates and several other SSM operations are not implemented in LocalStack's community edition, but DescribeParameters, the one this blueprint depends on, is.

  • For real AWS, an IAM credential with ssm:DescribeParameters permission (this blueprint only reads, it never calls PutParameter or changes a parameter's type).

  • A Slack incoming webhook for alerts.

  • If Kestra itself runs in a container and use_localstack is true, point localstack_endpoint at http://host.docker.internal:4566 or connect Kestra's container to LocalStack's Docker network and use its container name instead, check the exact network name first with docker network ls.

Secrets

  • AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: used by probe_parameters_live only, not needed when use_localstack is true, LocalStack accepts the fixed test/test credentials this blueprint hard-codes on that branch.

  • SLACK_WEBHOOK: Slack incoming webhook URL used by the alert tasks and the errors block.

    In Kestra OSS, set these as base64-encoded environment variables, for example SECRET_AWS_ACCESS_KEY_ID, SECRET_SLACK_WEBHOOK.

Inputs

Input Type Default Allowed values
parameter_path_prefix STRING /app/ any SSM parameter path prefix
scan_scope SELECT prefix prefix, all
secret_name_pattern STRING secret|password|token|apikey|credential any extended regex without an unescaped "
violation_count_critical_threshold INT 1 any non-negative integer
aws_region STRING us-east-1 any AWS region
use_localstack BOOL true true, false
localstack_endpoint STRING http://localhost:4566 any LocalStack endpoint URL

Quick start

  1. Start LocalStack and create a test parameter the wrong way: aws --endpoint-url=http://localhost:4566 ssm put-parameter --name /app/db_password --value hunter2 --type String.
  2. Add the SLACK_WEBHOOK secret.
  3. Run this flow manually with the defaults, it should report CRITICAL and name /app/db_password.
  4. Fix it: put-parameter --type SecureString --overwrite, then run again and confirm COMPLIANT.
  5. Set use_localstack: false and add the AWS secrets to point this at a real account.
  6. Enable the daily trigger.

How to extend

  • Add a second check for KeyId, parameters that are SecureString but encrypted with the AWS-managed default key instead of a customer-managed KMS key, if your policy requires the latter.
  • Page through results instead of relying on one describe-parameters call, for an account with more parameters than a single page returns.
  • Chain a downstream task after CRITICAL that re-encrypts a flagged parameter as SecureString with put-parameter --overwrite, behind a manual approval task, since changing a parameter's type is destructive enough to want a human in the loop.

Pitfalls

  • secret_name_pattern is interpolated directly into the jq filter string, a pattern containing an unescaped " breaks the filter. Stick to a plain alternation of bare words, as the default does.
  • describe-parameters with no --max-results returns AWS's own default page size, a large account's full parameter set may not fit in one page, see How to extend.
  • This blueprint never calls put-parameter, there is no remediation step, flipping a parameter's type is a change worth a human decision, not an automatic one.
  • The LocalStack branch hard-codes the test/test credentials LocalStack's own documentation specifies for local development, these are not real AWS credentials and do not work against a real account, that is expected, not a leaked secret.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.