惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News and Events Feed by Topic
N
News | PayPal Newsroom
SecWiki News
SecWiki News
P
Privacy International News Feed
T
Troy Hunt's Blog
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Security Latest
Security Latest
AWS News Blog
AWS News Blog
S
Secure Thoughts
W
WeLiveSecurity
H
Heimdal Security Blog
T
Threat Research - Cisco Blogs
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security @ Cisco Blogs
G
GRAHAM CLULEY
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
Cisco Talos Blog
Cisco Talos Blog
雷峰网
雷峰网
Cloudbric
Cloudbric
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
Latest news
Latest news
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
D
Docker
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
H
Help Net Security
博客园 - 司徒正美
TaoSecurity Blog
TaoSecurity Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Check Point Blog
博客园 - 叶小钗

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Spring Security with Spring Boot Actuator: the authorization model that survived the incident
Juan Torchia · 2026-05-12 · via DEV Community

Spring Security with Spring Boot Actuator: the authorization model that survived the incident

68% of security misconfigs in Spring Boot come from configuration that looks secure because it doesn't throw an error. Yeah, read that again. No exception, no warning in the log, nothing. The endpoint just responds 200 and you don't find out until someone else does.

That's exactly what happened in the case I described in the previous post. Actuator running in production, /env and /metrics returning data without asking for credentials — all because Spring Boot 3's default configuration doesn't lock down what you don't know about. We closed the misconfigured endpoints. But closing them wasn't enough — the authorization model that remained was inherited, implicit, and fragile. It had to be rebuilt.

My thesis is this: an inherited-by-default authorization model is technically worse than an explicit one, even if both produce the same observable behavior today. Because the first one will break when you update a dependency or add a new endpoint. The second one will scream.


The problem with the SecurityFilterChain we had

Before the incident, the Spring Boot 3 + Java 21 backend had no SecurityFilterChain dedicated to Actuator. It depended on the default behavior of Spring Security 6 and properties in application.yml. The result was predictable in hindsight: any change in the Spring Boot version could break the security contract without the build catching it.

This is what you don't want to have:

# ❌ Ambiguous configuration — what you do NOT want
management:
  endpoints:
    web:
      exposure:
        include: "*"  # exposes EVERYTHING — terrible in production
  endpoint:
    health:
      show-details: always  # stack traces and details to anyone

Enter fullscreen mode Exit fullscreen mode

Spring Boot with include: "*" exposes /actuator/env, /actuator/heapdump, /actuator/threaddump, /actuator/loggers, and a long list. With show-details: always, the health endpoint returns datasource details, dependency status, and internal error messages to any IP.

The problem wasn't just "who can see what?". It was that the model wasn't explicit. Nobody could read the code and understand the security intent without knowing the default behavior of Spring Boot for that specific version.


The resulting SecurityFilterChain: before/after with real code

The rebuild started with a design decision: Actuator needs its own SecurityFilterChain, separate from the application's main chain. Spring Security 6 with Spring Boot 3.x supports this natively with @Order.

// SecurityConfig.java
// Dedicated chain for Actuator — explicit order before the main app chain
@Bean
@Order(1) // Processed before the app chain
public SecurityFilterChain actuatorSecurityFilterChain(HttpSecurity http) throws Exception {
    http
        // Only applies to Actuator routes
        .securityMatcher("/actuator/**")
        .authorizeHttpRequests(auth -> auth
            // Public health only for Railway/k8s probe — no internal details
            .requestMatchers("/actuator/health/liveness").permitAll()
            .requestMatchers("/actuator/health/readiness").permitAll()
            // General health without details — useful for load balancer
            .requestMatchers("/actuator/health").permitAll()
            // Info public — only what we explicitly configure in application.yml
            .requestMatchers("/actuator/info").permitAll()
            // Metrics, env, loggers — ACTUATOR_ADMIN only
            .requestMatchers("/actuator/metrics/**").hasRole("ACTUATOR_ADMIN")
            .requestMatchers("/actuator/env/**").hasRole("ACTUATOR_ADMIN")
            .requestMatchers("/actuator/loggers/**").hasRole("ACTUATOR_ADMIN")
            // Everything else in Actuator — also requires ACTUATOR_ADMIN
            .anyRequest().hasRole("ACTUATOR_ADMIN")
        )
        // Actuator doesn't need CSRF — it's an internal API
        .csrf(csrf -> csrf.disable())
        // HTTP Basic auth for private endpoints — over HTTPS only
        .httpBasic(Customizer.withDefaults())
        // No session state in Actuator
        .sessionManagement(session ->
            session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
        );

    return http.build();
}

// Main application chain — order 2, processes everything else
@Bean
@Order(2)
public SecurityFilterChain appSecurityFilterChain(HttpSecurity http) throws Exception {
    http
        .authorizeHttpRequests(auth -> auth
            .requestMatchers("/api/public/**").permitAll()
            .anyRequest().authenticated()
        )
        // ... rest of app configuration
        ;

    return http.build();
}

Enter fullscreen mode Exit fullscreen mode

The @Order(1) is critical. Without it, Spring Security can apply the wrong chain to Actuator routes depending on bean initialization order — another example of implicit behavior that bites you when you least expect it.


application.yml: what gets exposed and what doesn't

The SecurityFilterChain controls who can access. But if the endpoint isn't even enabled, even better: smaller attack surface.

# application.yml — explicit Actuator configuration
management:
  endpoints:
    web:
      # ✅ Explicit whitelist — only what we actually need
      exposure:
        include:
          - health
          - info
          - metrics
          - loggers
          - env
        # heapdump and threaddump — disabled in production
        # too risky, too much sensitive information in a dump
        exclude:
          - heapdump
          - threaddump
          - httptrace
  endpoint:
    health:
      # No details on general health — UP/DOWN only
      show-details: never
      # Kubernetes/Railway probes separated
      probes:
        enabled: true
      group:
        # Liveness group — only what's critical for the process to be alive
        liveness:
          include:
            - livenessState
          show-details: never
        # Readiness group — datasource + external dependencies
        readiness:
          include:
            - readinessState
            - db
          show-details: never
    # Info: only what we explicitly decide to expose
    info:
      enabled: true
  info:
    env:
      enabled: false  # Don't expose environment variables in /actuator/info
    git:
      mode: simple   # Only commit hash and branch — not the full history

Enter fullscreen mode Exit fullscreen mode

The heapdump point deserves a separate note: a heap dump from a digital identity backend contains tokens, hashed passwords, session data, and potentially cryptographic keys in memory. There is no production use case that justifies that endpoint being exposed — not even behind authentication. We disabled it completely.


Real validation: how to confirm the lockdown actually worked

This is what frustrates me most about generic security posts: they explain the configuration but don't show how to verify that the lockdown actually worked. Because "it works" in dev with spring.profiles.active=dev means nothing for production.

The validation procedure I used, reproducible with any backend:

# 1. Verify that public endpoints respond without credentials
curl -s -o /dev/null -w "%{http_code}" https://my-backend.railway.app/actuator/health
# Expected: 200

curl -s -o /dev/null -w "%{http_code}" https://my-backend.railway.app/actuator/health/liveness
# Expected: 200

curl -s -o /dev/null -w "%{http_code}" https://my-backend.railway.app/actuator/info
# Expected: 200

# 2. Verify that private endpoints reject without credentials
curl -s -o /dev/null -w "%{http_code}" https://my-backend.railway.app/actuator/metrics
# Expected: 401 (not 200, not 403 with details)

curl -s -o /dev/null -w "%{http_code}" https://my-backend.railway.app/actuator/env
# Expected: 401

# 3. Verify that disabled endpoints don't exist
curl -s -o /dev/null -w "%{http_code}" https://my-backend.railway.app/actuator/heapdump
# Expected: 404 (not 401 — the endpoint doesn't exist, it's not just protected)

# 4. Verify access with valid credentials for ACTUATOR_ADMIN
curl -s -u "actuator-admin:SECURE_PASSWORD" \
  https://my-backend.railway.app/actuator/metrics \
  | jq '.names[:5]'
# Expected: list of available metrics

# 5. Verify that incorrect credentials return 401, not useful information
curl -s -u "admin:wrong" https://my-backend.railway.app/actuator/metrics
# Expected: 401 with no body containing error details

Enter fullscreen mode Exit fullscreen mode

Point 3 is the most important and the most commonly skipped: there's a real difference between an endpoint that returns 401 and one that returns 404. If /actuator/heapdump returns 401, it exists but is protected. If it returns 404, the endpoint is disabled — attack surface effectively eliminated, not just covered.


Common mistakes when configuring this in Spring Boot 3

Mistake 1: Trusting management.server.port as security

Moving Actuator to an internal port (e.g., 8081) looks like a solution, but on Railway, Fly.io, or any platform where ports are mapped dynamically, that "internal port" can end up exposed anyway. It's not a replacement for authorization — it's a network layer you don't fully control.

Mistake 2: Using hasAuthority instead of hasRole

Spring Security 6 automatically prefixes roles with ROLE_ when you use hasRole("ACTUATOR_ADMIN"). If you mix hasAuthority("ACTUATOR_ADMIN") and hasRole("ACTUATOR_ADMIN") in the same chain, you'll get inconsistent behavior that's a nightmare to debug. Pick one and be consistent throughout the entire model.

Mistake 3: The Actuator chain without securityMatcher

If you create a SecurityFilterChain for Actuator without securityMatcher("/actuator/**"), Spring Security will apply it to all routes according to order. @Order(1) without the matcher is a ticking time bomb.

Mistake 4: show-details: when_authorized with the wrong model

when_authorized seems like the balanced option, but its behavior depends on who is "authorized" according to Spring Security at that moment. If authorization isn't properly configured, it can show details to authenticated app users who shouldn't be seeing datasource state. never for the public endpoint, always only on the protected endpoint — that's more predictable.

Mistake 5: Not checking what /actuator/env actually exposes

The /env endpoint on a typical backend exposes environment variables, Spring properties, and resolved values. That includes DATABASE_URL, JWT_SECRET, REDIS_PASSWORD — any variable you've defined in the environment. Even behind authentication, you need to think carefully about who holds the ACTUATOR_ADMIN role in production.


FAQ: Spring Boot Actuator Security and Spring Security in production

Why do I need a separate SecurityFilterChain for Actuator instead of just properties in application.yml?

The management.endpoints properties control which endpoints are enabled and exposed. The SecurityFilterChain controls who can access them and with what credentials. They're two orthogonal layers. You can disable an endpoint from application.yml and Spring Security never sees it — that's fine. But relying only on properties without an explicit chain means your security behavior is coupled to the defaults of whichever version of Spring Boot you're running, which change between minor versions.

What role should the ACTUATOR_ADMIN user have?

In Spring Security 6, hasRole("ACTUATOR_ADMIN") expects the user to have the authority ROLE_ACTUATOR_ADMIN. If you manage users in a database, that role needs to exist separately from your application roles. Ideally it's a dedicated technical user, with credentials rotated periodically, used only for internal observability — never the same user the app uses at runtime.

How do I handle Railway or Kubernetes health probes without exposing internal details?

With Spring Boot 3's health groups: management.endpoint.health.group.liveness and management.endpoint.health.group.readiness. Each group exposes /actuator/health/liveness and /actuator/health/readiness respectively. These can be public (permitAll() in the chain) with show-details: never — they only return {"status":"UP"} or {"status":"DOWN"} with zero internal detail. The general health at /actuator/health can also be public but equally detail-free.

Is it safe to have /actuator/info public?

Depends on what you expose in that endpoint. By default, Spring Boot can expose the Java version, the Spring Boot version, Git information, and environment variables prefixed with info.. That last one is the problem: if you have INFO_SOMETHING=sensitive_value in your environment, it can show up. With management.info.env.enabled: false and management.info.git.mode: simple you can have a public /actuator/info that only returns commit hash, branch, and artifact version — enough for operational debugging, nothing sensitive.

How do I integrate this with an API Gateway that already handles authentication?

If the backend sits behind a gateway (Kong, AWS API Gateway, your own Nginx), the temptation is to assume the gateway protects everything and relax the backend's authorization model. Don't. The defense in depth principle says every layer has to be secure independently. The gateway can go down, can be misconfigured, can have a bypass. The backend has to survive on its own.

How do I validate that Spring Security is actually processing Actuator routes and not the wrong chain?

With Spring Security's debug log. Enable logging.level.org.springframework.security: DEBUG in a staging environment, make a request to /actuator/metrics without credentials, and look in the log for which SecurityFilterChain was selected. You'll see something like Trying to match request against ... DefaultSecurityFilterChain. If the chain that shows up isn't the Actuator one, your @Order or securityMatcher is wrong. That's the only reliable diagnostic.


My take after rebuilding this

Locking down endpoints isn't enough. Spring Boot's inherited-by-default authorization model is fine for demos and small projects, but in any backend where the data matters, it's technical debt with an unknown expiration date.

What's still standing after rebuilding this is a model where every rule has an explicit intent that's readable in the code. Anyone who opens the SecurityFilterChain can understand what's protected, why, and with what credentials — without needing to know the defaults of the specific Spring Boot version being used.

If you're running Spring Boot Actuator in production and you've never written an explicit SecurityFilterChain for it, now is the time. Not because you're going to have an incident tomorrow — but because when the incident does come, you'll want the explicit model already in production, not be rebuilding it under pressure.

For the broader context of how I handle infrastructure security across different layers of the stack, you can also check out the encryption analysis with Themis vs Web Crypto API and the post on Jakarta EE vs Spring Boot in real production backends.


Original source:


This article was originally published on juanchi.dev