OpenConext / OpenConext/Mujina

/api/entityid doesn't properly process JSON strings

Open
#67 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Java
Stars
386
Forks
172
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Input data to /api/entityid (and similar endpoints that accept a single string), don't quite make sense me. The endpoint accepts JSON, so I am expected to send a valid JSON data.

However, the schema for that data is just string. So the only valid JSON data I can send is a JSON string (e.g. "abc"). However, if I do so, the entire value I sent is treated as the entity ID (including the quotation marks). I'm, therefore forced to send the string without the quotation marks, which makes my input not valid JSON data, and disagrees with the content type of the request data.

Using text/plain content type causes the server to reject the request.

P.S. I'm not entirely sure this is Mujina's issue, looking at the code, it's all Spring annotations. However, I don't know much about Spring, so may be there is a way to configure this (i.e. it's not a Spring bug).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Spring annotations and request handling for /api/entityid, then compare the similar endpoints that accept a single string. Reproduce the behavior with a valid JSON string and with text/plain. Done means JSON string input is interpreted as its string value rather than including quotation marks, with the behavior covered for the affected endpoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.