Java Security Checklist Before Release for Web Services
A Java security checklist to run before release: dependencies, secrets, authentication, input handling, transport, logging and containers.

This is a pre-release checklist for a Java web service, ordered by where problems tend to hide. It does not replace a threat model, but it catches the mistakes that cause most incidents, and every line names a way to check, since a checklist item that cannot be verified is an opinion. The background is in Java security basics and the OWASP Top Ten for Java developers.
Dependencies
Most vulnerabilities in a typical service arrive through a library you did not write. Treat the dependency scan as a gate and not as a report.
| Check | How to verify |
|---|---|
| A dependency scan runs in CI and critical findings fail the build | The pipeline file contains the step, and a deliberately old library makes it fail |
| Direct dependencies are current and maintained | A report of outdated dependencies, reviewed for abandoned projects |
| The base image is recent and scanned | trivy image your-service:release shows no critical findings |
| An SBOM is generated for the artifact | The CycloneDX plugin output is stored with the build |
mvn org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=9The threshold is a policy choice. Failing at 9 blocks only the worst findings and keeps the gate usable on day one, and you can lower it as the backlog clears.
Secrets
| Check | How to verify |
|---|---|
| No credentials, keys or tokens in the repository or its history | gitleaks detect --source . finds nothing |
| Secrets come from the environment or a secret manager | The deployment manifest references a secret, never a literal |
The image holds no .env file or private key | docker run --rm your-service ls -la /app shows a clean tree |
| Any secret that was ever committed has been rotated | Removing it from history is not enough, because clones and caches keep it |
The last row is the one teams skip. A secret in git history is compromised from the moment it was pushed, and the only fix is a new secret.
Authentication and authorization
Authentication asks who the caller is, and authorization asks what they may do. Most serious bugs in business applications are the second kind: a logged-in user reading another user's record by changing an id in the URL.
| Check | How to verify |
|---|---|
| Every endpoint requires authentication unless deliberately public | List the routes and mark each public one with a reason |
| Authorization is checked on the server, per resource | An integration test where user A requests user B's record and expects 403 or 404 |
| Passwords use a slow hash such as Argon2 or bcrypt | Read the encoder bean, see hashing passwords |
| Sessions and tokens expire, and logout invalidates them | Test that a token is rejected after logout and after its expiry |
| Login and expensive endpoints are rate limited | Send 100 failed logins and expect throttling |
Input and output
Every place that builds a query, a page, a file path or a request out of user input needs its own defence. The relevant guides are SQL injection, preventing XSS, path traversal, XXE, insecure deserialization and SSRF.
| Check | How to verify |
|---|---|
| Input is validated at the boundary with Bean Validation | Controllers use @Valid, and a test posts a bad payload |
| All SQL uses parameters | Search for string concatenation near createQuery and Statement |
| Output is encoded for its context | Templates use the escaping syntax, and no raw HTML from users is written |
| Uploads check type, size and the stored path | Upload a file named with ../ and expect it to be refused |
| XML parsers disable external entities | The factory sets the secure processing feature |
| Outbound requests to user-supplied URLs are restricted | A request for an internal address is refused |
Transport and headers
curl -sI https://staging.example.test/ | grep -iE 'strict-transport|content-security|x-content-type|set-cookie'That one command shows most of this section. Look for HSTS, a content security policy and nosniff. Cookies should carry Secure, HttpOnly and SameSite. CSRF protection is required for state-changing requests authenticated by cookie, and not for pure token APIs. CORS should list specific origins; a wildcard combined with credentials is a bug.
Configuration and operations
Production should have no debug endpoints, no H2 console and no Actuator details exposed without authentication. Error responses must not carry stack traces. No JDWP debug port should be open, which a port scan from outside the network confirms. Logs must exclude passwords, tokens and personal data, and security events such as login failures and access denials should be logged and watched.
Container
| Check | How to verify |
|---|---|
| The process runs as a non-root user | docker run --rm your-service id does not print uid=0 |
| The image has no tools it does not need | Review the final stage of the Dockerfile |
| The filesystem is read-only where possible, with resource limits | The manifest sets readOnlyRootFilesystem and limits |
Making the checklist a habit
A checklist on a wiki page decays. Put it where the release happens: a pull request template with the manual items as checkboxes, and the automated ones as required status checks so the merge button stays grey until they pass. Assign the review to a person by name each release, rotating, so more than one engineer learns what the gates are for. After an incident, ask which line would have caught it, and if none, add one. After a release where nothing on the list failed for months, ask whether a check has become automatic enough to remove from the manual part. Short lists get used, and a list of eighty items is ticked without being read.
The most valuable single item for most teams is the authorization test, the one where user A asks for user B's record. It takes an hour to write the first time, fails often in real codebases, and finds the bug class that scanners cannot, since a scanner does not know which records belong to whom.
Using the list
Turn every item you can automate into a pipeline check and keep the rest as a template on the release pull request. Add a line whenever an incident teaches you one. A list that only grows is fine; a list that nobody ticks is not, so put an owner against the review. Regulated systems have their own control lists that take precedence over this one. The standard to grow it toward is the OWASP Application Security Verification Standard, and the Spring Security reference covers the framework settings.


