Add security and context filter for REST api - #595
Open
Slartibartfass2 wants to merge 22 commits into
Open
Conversation
1 task
Code Coverage
|
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 24483668 | Triggered | Generic Password | d7e524a | src/test/kotlin/se/uulm/snowballr/backend/rest/AuthWorkflowIntegrationTest.kt | View secret |
| 36073591 | Triggered | Generic Password | d7e524a | src/test/kotlin/se/uulm/snowballr/backend/rest/AuthWorkflowIntegrationTest.kt | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Slartibartfass2
force-pushed
the
feat/583-feature-add-security-and-context-filter-for-rest-api
branch
2 times, most recently
from
August 13, 2026 21:11
964a4c2 to
ff0ab99
Compare
Slartibartfass2
force-pushed
the
feat/583-feature-add-security-and-context-filter-for-rest-api
branch
from
August 13, 2026 23:21
c7b47fc to
16a25a3
Compare
5 tasks
Slartibartfass2
force-pushed
the
feat/583-feature-add-security-and-context-filter-for-rest-api
branch
4 times, most recently
from
August 17, 2026 21:01
267f00c to
5864cf1
Compare
writeQueuedCookies ran before filterChain.doFilter, so cookies queued by handlers during the request (e.g. login, logout) were never written to the response - only pre-emptive refresh/clear cookies queued during authentication were flushed.
Drives register, verify-email, login, status, change-password, and logout through MockMvc and the actual security filter chain, rather than calling the service layer directly, so cookie handling on the wire is exercised the same way a real client would use it.
Both endpoints were caught by anyRequest().authenticated(), so /auth/status could never report UNAUTHENTICATED and /auth/logout could never clear cookies once both tokens had expired. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…requests SameSite=Strict blocks classic cross-site CSRF but still permits requests from a sibling subdomain, which is same-site. Requiring a custom header as defense-in-depth closes that gap, since forged cross-origin form/fetch requests cannot set one without triggering a CORS preflight. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Cookies queued by pre-emptive token refresh (or refresh-failure clearing) were only written in the finally block after the handler ran, so a handler streaming a large enough body to auto-flush the output buffer silently dropped them, since Set-Cookie is a no-op on an already-committed response. Flush them immediately instead, and re-flush only cookies the handler itself changed afterward. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Only /actuator/health is exposed today, but the wildcard sat above anyRequest().authenticated(), so exposing more endpoints later (e.g. /actuator/env, /actuator/heapdump) would have made them anonymously reachable without anyone touching the security config. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Matches the constructor-injection convention used by every other service/manager in the codebase and avoids exposing the injected service as public API on the controller bean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Matches the explicit binding annotations used by every other handler in this controller instead of relying on implicit simple-type param resolution. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…akage Switches the Docker healthcheck from grpc-health-probe to Spring Boot actuator on port 8090, replacing gRPC health with HTTP health now that Spring is the process entrypoint. This exposed a latent bug that made the REST server unreachable: shadowJar's default duplicatesStrategy (EXCLUDE) silently dropped nearly all Spring Boot autoconfiguration metadata, since several dependency jars ship META-INF/spring.factories and META-INF/spring/*.imports at the same path. Without TomcatServletWebServerAutoConfiguration surviving the merge, the app booted as a plain (non-web) ApplicationContext and never bound port 8090 at all. Fixed by setting duplicatesStrategy = INCLUDE and merging/appending the affected resource files instead of picking one arbitrarily. The healthcheck itself uses wget --spider rather than curl: curl was only ever needed for pycurl's build (libcurl/curl-dev) and isn't installed by default, while wget is already present via BusyBox in the eclipse-temurin alpine base, so no extra package is needed. It also drops a `grep "status":"UP"` step, since Spring Boot Actuator already maps health status to HTTP status codes by default (200 for UP, 503 otherwise) — wget's own exit code is sufficient. Verified with a full docker compose build/up against the real .env and database: actuator/health returns 200 and the container reaches Docker's healthy state using the wget-based check. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Slartibartfass2
force-pushed
the
feat/583-feature-add-security-and-context-filter-for-rest-api
branch
from
August 19, 2026 13:59
5864cf1 to
77298b6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #583
What I have made
This is the baseline for the REST API. Now clients can register, log in, and so on...
I added an integration test that verifies that the whole workflow works.
Checklist
Either tick or cross out the items that do not apply (using ~~example text~~) and give a reason why the item does not apply.
Author
[ ] I have updatedAGENTS.mdif the changes affect project structure, commands, tooling, or conventionsReviewer