parse-community / parse-community/parse-server

Scoped Session Tokens

Open
#9,265 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Feature / Enhancement Checklist
Current Limitation

Currently session tokens are not scoped. This is limiting for my team as we want to distribute Parse session tokens to our API partners, but restrict their access scope beyond that the corresponding user is capable of. This is a widely used practice for identity providers but unfortunately, to the best of our knowledge, is not supported by Parse.

Feature / Enhancement Description

We propose a relation field on the _Role collection be added to the _Session collection. For backwards compatibility, if this field does not exist in the session object, the corresponding session token has the same set of roles as the user itself. If it does exist, it describes the set of Parse roles the corresponding session token can have direct access to, a subset of the Parse roles the corresponding user has direct access to. Note that indirect roles are not affected.

ACL and CLP checks need to respect the scopes. Cloud functions/triggers could be given access to this restricted set of roles as well.

We are not planning to create scoped session tokens with Parse. Such session tokens will be created by an external OAuth adapter, but we want Parse to respect them.

Example Use Case

Providing an API partner with only read access, or access only to a specific collection/subset of objects.

Alternatives / Workarounds
  • Always handing out regular session tokens (problematic from a security perspective, as then the API partner has more privileges than they actually need)
  • Creating "phantom users" associated with the main user but limited in terms of the Parse roles they have access to, and handing out access token for these (difficult to audit the corresponding logs, business logic (eg. triggers) needs to be phantom-user-aware for certain uses cases).
3rd Party References

GitHub supports access scopes: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes

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 session-token handling and the ACL and CLP checks, then review how _Session and _Role data are used. Determine how a session’s scoped roles should interact with direct versus indirect roles, including cloud functions and triggers. Done means externally created scoped session tokens are respected while sessions without the relation retain existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, authorization, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.