Skip to content

feat(security): add kafka secure-mode smoke test and acceptance checklist#42

Merged
careb36 merged 1 commit into
developfrom
feature/security-hardening-phase7
Apr 2, 2026
Merged

feat(security): add kafka secure-mode smoke test and acceptance checklist#42
careb36 merged 1 commit into
developfrom
feature/security-hardening-phase7

Conversation

@careb36

@careb36 careb36 commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Security Hardening - Phase 7 (secure-mode validation closure)

What was added

  • Automated secure smoke test script:
    • scripts/kafka-secure-smoke.sh
  • Operational acceptance checklist:
    • docs/operations/kafka-sasl-ssl-acceptance-checklist.md

Docs updates

  • Quickstart now includes automated smoke validation command
  • Operations index now includes acceptance checklist

Security impact

Copilot AI review requested due to automatic review settings April 2, 2026 18:21
@careb36
careb36 merged commit ead31f2 into develop Apr 2, 2026
7 of 8 checks passed
@careb36
careb36 deleted the feature/security-hardening-phase7 branch April 2, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an operational “secure-mode validation” gate for Kafka SASL/SSL by introducing an automated smoke-test script and an accompanying acceptance checklist, and wiring both into the existing operations docs.

Changes:

  • Added scripts/kafka-secure-smoke.sh to validate container status, secure env vars, and scan recent logs for TLS/SASL failures.
  • Added docs/operations/kafka-sasl-ssl-acceptance-checklist.md to standardize secure-mode rollout acceptance steps/evidence.
  • Updated ops docs to reference the new checklist and smoke-test command.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
scripts/kafka-secure-smoke.sh New smoke-test script for secure Kafka rollout validation.
docs/operations/README.md Links the new acceptance checklist in the operations index (EN/ES sections).
docs/operations/kafka-sasl-ssl-quickstart.md Adds the smoke-test command to the quickstart verification step.
docs/operations/kafka-sasl-ssl-acceptance-checklist.md New release/ops checklist for closing secure-mode rollout.

Comment on lines +18 to +25
status="$(docker compose ps --format json "$svc" | tr -d '\n' | sed 's/}\s*{/}\n{/g' | grep -m1 '"Service":"'"$svc"'"' || true)"
if [[ -z "$status" ]]; then
echo " [FAIL] unable to read status: $svc"
failed=1
continue
fi

if echo "$status" | grep -q '"State":"running"'; then

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container-state detection is parsing docker compose ps --format json output with sed 's/}\s*{/}... where \s is not portable in POSIX/GNU sed (it won’t match whitespace). More importantly, grepping JSON is brittle and can misreport when a service has multiple containers (any "State":"running" match passes). Prefer using the supported Go-template output (e.g., --format '{{.State}}') and explicitly fail if any returned state is not running.

Suggested change
status="$(docker compose ps --format json "$svc" | tr -d '\n' | sed 's/}\s*{/}\n{/g' | grep -m1 '"Service":"'"$svc"'"' || true)"
if [[ -z "$status" ]]; then
echo " [FAIL] unable to read status: $svc"
failed=1
continue
fi
if echo "$status" | grep -q '"State":"running"'; then
states="$(docker compose ps --format '{{.State}}' "$svc" || true)"
if [[ -z "$states" ]]; then
echo " [FAIL] unable to read status: $svc"
failed=1
continue
fi
all_running=1
while IFS= read -r state; do
if [[ "$state" != "running" ]]; then
all_running=0
fi
done <<< "$states"
if [[ "$all_running" -eq 1 ]]; then

Copilot uses AI. Check for mistakes.
if echo "$combined_logs" | grep -Eiq 'SSLHandshakeException|SaslAuthenticationException|PKIX path building failed|No route to host|Connection refused'; then
echo " [WARN] suspicious errors detected in recent logs"
echo " inspect with: docker compose logs --tail=200 kafka kafka-connect backend"
failed=1

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block prints [WARN] but still sets failed=1, which makes the script exit non-zero. Either treat these matches as [FAIL] (and keep failing), or keep [WARN] but don’t flip failed so operators can distinguish a warning-only run from a hard failure.

Suggested change
failed=1

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +8
- [ ] `.env` contains secure Kafka credentials
- [ ] TLS artifacts exist under `docker/kafka/secrets/`
- [ ] Preflight passes: `./scripts/kafka-secure-preflight.sh`

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checklist says ".env contains secure Kafka credentials", but the referenced preflight script (./scripts/kafka-secure-preflight.sh) only checks the current process environment and does not source .env. This can confuse operators who rely on .env alone. Consider updating the checklist to explicitly say the vars must be exported in the shell (or that .env must be sourced before running preflight/smoke scripts).

Suggested change
- [ ] `.env` contains secure Kafka credentials
- [ ] TLS artifacts exist under `docker/kafka/secrets/`
- [ ] Preflight passes: `./scripts/kafka-secure-preflight.sh`
- [ ] Secure Kafka credentials are available as environment variables (exported in the shell or by running `source .env`)
- [ ] TLS artifacts exist under `docker/kafka/secrets/`
- [ ] Preflight passes after env is prepared: `./scripts/kafka-secure-preflight.sh`

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants