Project

General

Profile

Actions

Bug #18801

closed

Requesting ApiClientAuthorization object with select=["uuid"] returns 422

Added by Lucas Di Pentima 4 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Target version:
Start date:
02/25/2022
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
-
Release relationship:
Auto

Description

We've received a report about arvados-ws getting errors from the API server.

This is what happens:

$ curl -k -G --data-urlencode 'select=["uuid"]' -H "Authorization: OAuth2 ---token---" https://example-host/arvados/v1/api_client_authorizations/some-valid-uuid
{"errors":["//railsapi.internal/arvados/v1/api_client_authorizations/some-valid-uuid?select=%5B%22uuid%22%5D: 422 Unprocessable Entity: #\u003cActiveModel::MissingAttributeError: missing attribute: api_token\u003e (req-c2h9urh6s0p0xvowm555)"]}

The arvados-ws services does a request like this and it has been doing it since 2017 (line 80):

https://dev.arvados.org/projects/arvados/repository/diff/services/ws/permission.go?utf8=✓&rev=ba418300c50e1375ca9938562579b7bd6bf9490d&rev_to=0f644e242ef37c911ad3dc25aca8135c339de349

RailsAPI attempts to access the api_token field in an after_initialize hook:

https://dev.arvados.org/projects/arvados/repository/revisions/608e8f79c3fb5cb7077fce4a0b497c5c93d6d6d0/entry/services/api/app/models/api_client_authorization.rb#L38

...but because the request does a select=["uuid"], that field isn't available.

Manual testing with arvbox determined that this is a regression introduced in the 2.3.0 release.


Subtasks 1 (0 open1 closed)

Task #18802: Review 18801-aca-req-select-uuidResolvedTom Clegg02/25/2022

Actions
Actions #1

Updated by Lucas Di Pentima 4 months ago

  • Description updated (diff)
Actions #2

Updated by Lucas Di Pentima 4 months ago

It seems that this could be the cause of the regression: https://dev.arvados.org/issues/18122

Actions #3

Updated by Lucas Di Pentima 4 months ago

Updates at 36c6d8e6b - branch 18801-aca-req-select-uuid
Test run: developer-run-tests: #2931

  • Ignores the ActiveModel::MissingAttributeError when the api_token field isn't present, because of using select=[...].
  • Adds test.
Actions #4

Updated by Tom Clegg 4 months ago

LGTM, thanks!

Actions #5

Updated by Lucas Di Pentima 4 months ago

  • Release set to 49
Actions #6

Updated by Lucas Di Pentima 4 months ago

  • Status changed from In Progress to Resolved

Applied in changeset arvados-private:commit:arvados|0dcb211b2c2511b86d9bd55c1e059bf44342ca91.

Actions #7

Updated by Lucas Di Pentima 4 months ago

Cherry-picked into branch 2.3-release at 0336418

Actions

Also available in: Atom PDF