Spring Boot 4 Actuator in production: endpoints, security, custom health indicators
Companion repository for the ankurm.com article. Every transcript in docs/output/ was produced by running this project; scripts/run-all.sh regenerates all of them. Verified against Spring Boot 4.1.1 / Framework 7.0.9 / Security 7.1.1 / Micrometer 1.17.1 / kafka-clients 4.2.1 on Temurin JDK 25.0.4.1+1.
This commit is contained in:
23
scripts/demo-heapdump-leak.sh
Executable file
23
scripts/demo-heapdump-leak.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# The endpoint that really does hand over your secrets - once you turn it on.
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
OUT=docs/output/04-heapdump-leak.txt
|
||||
B=http://localhost:8080/actuator
|
||||
{
|
||||
echo "### profiles: exposeall,open PLUS --management.endpoint.heapdump.access=unrestricted"
|
||||
echo
|
||||
echo "\$ curl -s -o /tmp/heap.hprof -w 'status=%{http_code} bytes=%{size_download} type=%{content_type}' $B/heapdump"
|
||||
curl -s -o /tmp/heap.hprof -w 'status=%{http_code} bytes=%{size_download} type=%{content_type}\n' "$B/heapdump"
|
||||
echo
|
||||
echo "\$ strings /tmp/heap.hprof | grep -c 'S3CRET-partner-credential'"
|
||||
strings /tmp/heap.hprof 2>/dev/null | grep -c 'S3CRET-partner-credential'
|
||||
echo "\$ strings /tmp/heap.hprof | grep -o 'not-a-real-password[^\"]*' | head -1"
|
||||
strings /tmp/heap.hprof 2>/dev/null | grep -o 'not-a-real-password[^\"]*' | head -1
|
||||
echo
|
||||
echo " /actuator/env masked both of these to ******."
|
||||
echo " /actuator/heapdump handed over the process memory that contains them in plaintext."
|
||||
echo " Sanitisation is a property-rendering feature. It is not a security boundary."
|
||||
rm -f /tmp/heap.hprof
|
||||
} > "$OUT" 2>&1
|
||||
echo "wrote $OUT"
|
||||
Reference in New Issue
Block a user