ego icon indicating copy to clipboard operation
ego copied to clipboard

BUG - Internal Server Error when Admin user self issues API Key

Open andricDu opened this issue 4 years ago • 1 comments

This happened following the swagger docs in virusseq-dataportal for issuing an API Key:

Basic auth worked, but this failed when @lepsalex as an admin user tried to issue himself an API Key with a Bearer token.

2021-04-07 01:07:45,544 [http-nio-8081-exec-7] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: A different object with the same identifier value was already associated with the session : [bio.overture.ego.model.entity.ApiKeyScope#VIRUS-SEQ.READ]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [bio.overture.ego.model.entity.ApiKeyScope#VIRUS-SEQ.READ]] with root cause
javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [bio.overture.ego.model.entity.ApiKeyScope#VIRUS-SEQ.READ]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:123)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)

andricDu avatar Apr 07 '21 13:04 andricDu

The exact step were (all using the EGO Swagger UI):

  1. Authorize with token (but forgot to add Bearer as I thought it was implicit given the verbiage on the swagger-ui)
  2. Send request for apiKey /api/o/api_key
  3. Request invalid due to bad auth?
  4. Add Bearer to auth and try again
  5. 500 error (logs as above)

lepsalex avatar Apr 07 '21 14:04 lepsalex