JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Security issue: Can remove to-one relationship even if not in updatable_fields
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
See:
Removing a to-one relationship is handled as a special case, which does not call verify_params. Therefore, a relationship which the user would otherwise expect to not be updatable (because updatable_fields does not include it) can be altered.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/jsonapi/request.rb around line 119 and trace how removing a to-one relationship bypasses verify_params. Confirm that updatable_fields currently does not protect this path, then verify that relationship removal is rejected when the relationship is not permitted to be updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100