Repository navigation
Restore baseline GraphQL and REST behaviour on Boot 3 (application/graphql, empty error locations, trailing slashes) - #1266
Conversation
…aphql bodies, empty error locations, trailing-slash URLs Co-Authored-By: joel.oshea <joel.oshea@cognition.ai>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: joel.oshea <joel.oshea@cognition.ai>
Co-Authored-By: joel.oshea <joel.oshea@cognition.ai>
There was a problem hiding this comment.
Devin Review found 2 findings. Devin fixed 1 finding; 1 finding is left for you to triage below.
Custom reviewers
- 👁️ TD Information Security: 1 finding · View
Fixed by Devin (1)
- Raw GraphQL fails with trailing slashes — Confirmed: authenticated raw POST /graphql/ returned 415 (baseline 200). The filter is now also mapped to /graphql/, and a test covers it.
| UrlHandlerFilter.trailingSlashHandler("/**").wrapRequest().build()); | ||
| registration.setOrder(SecurityProperties.DEFAULT_FILTER_ORDER + 1); |
There was a problem hiding this comment.
👁️ TD Information Security: P2 — Trailing slash bypasses feed authentication
Anonymous GET /articles/feed/ now reaches getFeed, bypassing §5 authentication. securityFilterChain protects only /articles/feed and permits /articles/** before normalization. findUserFeed dereferences the null user, producing an internal error rather than exposing feed data.
Devin left this for you to triage: Not a regression: the Boot 2.6 baseline app returns the same 500 for anonymous GET /articles/feed/ (security matches /articles/** before the slash is stripped, then the null user fails), and no feed data leaks. Turning it into a 401 changes the API contract, so it needs Joel's approval; recommend a follow-up that also protects /articles/feed/ in WebSecurityConfig.
View in Devin Review · Custom reviewer
Was this helpful? React with 👍 or 👎 to provide feedback.
|
CI results for head
|
48f44f3
into
devin/unt-5-spring-boot-2.7
Summary
Fixes the Boot 3 behaviour regressions left after #1265, so the smoke check matches the Boot 2.6.3 baseline again. Stacked on #1252 (base
devin/unt-5-spring-boot-2.7). Ticket: Fix Boot 3 test and behaviour regressions (plan steps3.2).1.
POST /graphqlwithContent-Type: application/graphql(was 415). Spring for GraphQL, which DGS 10 runs on, only routes JSON bodies. NewGraphQLRawQueryFilteris registered for/graphqland/graphql/only, and only for POST requests whose content type isapplication/graphql(any charset). It rewrites the request as JSON:An empty body returns 400 with the same body text and content type as the baseline. JSON requests don't pass through the filter.
2. GraphQL
errors[].locationsis[]again. InGraphQLCustomizeExceptionHandler:UNAUTHENTICATEDandBAD_REQUESTerrors set.locations(emptyList()). The DGS 10 builder leaves locationsnull, and graphql-java 22+ then leaves the key out.INTERNAL) are rebuilt asTypedGraphQLErrors with empty locations. DGS 10 adds the field's{line, column}; DGS 5 did not. Message, errorType, path, extensions and logging are unchanged.3. Trailing-slash URLs (
GET /articles/,/user/,/profiles/{u}/,/articles/feed/) work again (were 404). Spring MVC 6 dropped trailing-slash matching.TrailingSlashConfigregisters Spring 6.2'sUrlHandlerFilter.trailingSlashHandler("/**").wrapRequest()atSecurityProperties.DEFAULT_FILTER_ORDER + 1, which is after the Security filter chain. Security still checks the path as sent, the same as on the baseline:GET /tags/stays 401 andPOST /users/login/stays 401.Other ticket hypotheses I checked against the baseline app (Boot 2.6.3 on JDK 11, commit
b36adb47), comparing full values, not just shapes, side by side: validation messages inerrors(Hibernate Validator 8),UNWRAP_ROOT_VALUEhandling, Joda date formats in REST and GraphQL, the 404 and 403 error bodies, and the GraphQLcreateUservalidation payload. All of them were already identical, so they need no change. The ERROR-dispatch permit was already done in #1264/#1265.Smoke check
graphql.tags.application-graphql,graphql.me.application-graphql(with token),rest.articles.list.trailing-slash,rest.current-user.trailing-slash,rest.profile.trailing-slash,rest.tags.trailing-slash(401).smoke.shagainst the baseline app: its first 75 lines are byte-identical to the committedbaseline.jsonl, and only those 6 new lines were appended.Smoke check passed: 81 calls/Responses match baseline. No accepted differences.Tests
./gradlew clean spotlessCheck buildon JDK 17: 77 tests in 22 classes, 0 failures. The baseline is 68 tests in 20 classes. New tests:GraphQLApiTest(7, the first GraphQL-layer tests): rawapplication/graphql, with a charset, on/graphql/with a token, and with an empty body, plain JSON, andlocations: []forINTERNALandUNAUTHENTICATEDerrors.TrailingSlashTest(2).Differences outside the smoke contract (for review, not fixed)
I found these while probing. Smoke doesn't cover them, and they only affect malformed requests:
GET /graphqlreturns 405 (baseline 400), andPOST /graphqlwithtext/plainreturns 415 (baseline 400).POST /graphqlwith an empty JSON body returns aproblem+json400 (baseline: a 400 with the textInvalid GraphQL request - no request body was provided).GET /articles/feed/returns 500 (Security matches/articles/**before the slash is stripped). Making it 401 would change the contract, so it is left for review.extensions.errorType: BAD_REQUESTto them.Snyk
This PR adds no dependencies and changes no versions. CVE-2026-47890 (spring-webmvc 6.2.19) is expected to stay red, as on #1265. I added no ignores and made no policy changes.
👀 Devin fixed 1 finding · 1 finding for you to triage · Follow Devin's work