ontola / ontola/atomic-server

Queries can leak hidden information through `count`

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

Nobody has claimed this yet.

security
Dominant language
TypeScript
Stars
1.6k
Forks
82
Avg merge
10h 34m
Merged PRs (30d)
205

Description

relates to #114

I think theres a hypothetical privacy flaw in my collections cache design:

  • Create a Query with some value from which you suspect that exists somewhere that you aren't allowed to see. Let's consider someone has a private resource containing a secretLover property. You do a search for this property.
  • When fetching the results, you will not see the hidden item, but you might see a count that shows that something is hidden. Ok, you now know that there is someone with a secretLover!
  • Try filtering by various Values, and you may see the count value increase by one. If you got it right, you know who the secret lover is. Whoops!

The reason this will happen, is because the indexed query system is quite fast in returning the amount of hits for some query, but checking if every one of these hits is authorized is... expensive.

So what can we do about this?

Add a new key to the index

Like... Some rights resource? But this can only be a string, such as the publicagent string. Not sure if that will ever be enough.

We could add the Agent to the QueryFilter. But this will lead to an immense growth of indexes, potentially one for every user + query combination. Doesn't scale.

Don't show count

Which also means no total pages... Seems pretty bad.

Redesign how pagination works

Instead of counting the pages, we can use start_value and end_value from Queries to construct pages.
This does mean we don't know at which page we are, and how many there are left.

Check all subjects

Slooowwwww

Contributor guide

Open the contributing guide

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 collections cache, indexed query system, QueryFilter, and the count and pagination values described in the issue. Determine how authorization affects returned hits and counts; done means hidden resources cannot be inferred through count or filtering, with the pagination behavior explicitly defined.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design, databases, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.