Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Hunch: it's the change in AccessAwareRouter.

gabesullice’s picture

Assigned: Unassigned » gabesullice
Status: Active » Needs review
StatusFileSize
new3.72 KB

Okay, this first fix is sort of indirect. We were throwing an AccessDenied where we shouldn't have been because of a misreading of the spec. We had this:

if (isset($document['data']['id']) && !Uuid::isValid($document['data']['id'])) {
  // This should be a 422 response, but the JSON:API specification dictates
  // a 403 Forbidden response. We follow the specification.
  throw new EntityAccessDeniedHttpException(NULL, AccessResult::forbidden(), '/data/id', 'IDs should be properly generated and formatted UUIDs as described in RFC 4122.');
}

But the spec actually says:

A server MUST return 403 Forbidden in response to an unsupported request to create a resource with a client-generated ID.

The operative phrase that was misread was "in response to an unsupported request". We do support client-generated UUIDs. Later in the spec it says:

A server MAY respond with other HTTP status codes. ... A server MUST prepare responses, and a client MUST interpret responses, in accordance with HTTP semantics.

What this means is that because we do support client-generated UUIDs and since the UUID was malformed, 422 Unprocessable Entity is the semantically correct response.

This avoids inappropriately throwing an AccessDeniedException which led to one of the test failures.

More to come.

wim leers’s picture

Okay, this first fix is sort of indirect. […]

I did not expect that!

Status: Needs review » Needs work

The last submitted patch, 3: 3021277-3.patch, failed testing. View results

gabesullice’s picture

Status: Needs work » Needs review
StatusFileSize
new4.97 KB
new1.26 KB

Next, it looks like access denied $reason is now being appropriately bubbled up. We just need to update test expectations for those.

Status: Needs review » Needs work

The last submitted patch, 6: 3021277-6.patch, failed testing. View results

wim leers’s picture

Yay!

gabesullice’s picture

Status: Needs work » Needs review
StatusFileSize
new3.68 KB
new8.43 KB

More expectations updates. These will need Drupal::VERSION conditions added, but for now I just want to get 8.7 passing.

wim leers’s picture

Moar yay 😁

gabesullice’s picture

StatusFileSize
new1.4 KB
new9.83 KB

This should get 8.7 green.

The last submitted patch, 9: 3021277-9.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 11: 3021277-11.patch, failed testing. View results

gabesullice’s picture

Status: Needs work » Needs review
StatusFileSize
new3.5 KB
new10.07 KB

It did! So, here are the version conditions. This interdiff will need to reverted in #3015325: [ignore] support issue for the core patch.

gabesullice’s picture

Green on 8.5, 8.6 & 8.7. Committing.

I'll open a backport for the 1.x branch next.

  • gabesullice committed ecbe2a5 on 8.x-2.x
    Issue #3021277 by gabesullice, Wim Leers: Test failures on 8.7 since #...
gabesullice’s picture

Assigned: gabesullice » Unassigned
Status: Needs review » Fixed
wim leers’s picture

🥳

  • gabesullice committed bc19dfd on 8.x-1.x
    Issue #3021311 by gabesullice: Backport #3021277: Test failures on 8.7...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.