JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Security issue: Can remove to-one relationship even if not in updatable_fields

Open
#645 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

See:

https://github.com/cerebris/jsonapi-resources/blob/49a738759f1ff03cf5f18bf77eab627576ba63ed/lib/jsonapi/request.rb#L119

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

  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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.