Pulsar Topic Activity Sentinel
Non-destructively sample a Pulsar topic on a schedule with a non-durable reader and page Slack when it goes silent, floods, or the broker is unreachable.
Audit AWS SSM Parameter Store for plaintext secrets on a schedule and alert Slack with the exact parameter names affected.
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.
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.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.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.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.log_audit_summary always runs last and logs the final classification.errors block posts to Slack if the flow itself fails outside the gate logic above.put-parameter call used the right type.DescribeParameters is one of the SSM operations LocalStack's
community edition actually implements.String instead of SecureString.::{"outputs":{}}:: output-capture convention applied to an array result, by wrapping
it in a single-key object with --query before the marker is echoed.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.
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.
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.
| 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 |
aws --endpoint-url=http://localhost:4566 ssm put-parameter --name /app/db_password --value hunter2 --type String.SLACK_WEBHOOK secret.CRITICAL and name
/app/db_password.put-parameter --type SecureString --overwrite, then run again and confirm
COMPLIANT.use_localstack: false and add the AWS secrets to point this at a real account.daily trigger.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.describe-parameters call, for an
account with more parameters than a single page returns.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.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.put-parameter, there is no remediation step, flipping a
parameter's type is a change worth a human decision, not an automatic one.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.