Metaculus / Metaculus/metaculus

User loses permission AFTER subscribing

Open
#4,616 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
TypeScript
Stars
113
Forks
34
Avg merge
16h 34m
Merged PRs (30d)
30

Description

hey, i was going through projects/services/subscriptions.py and noticed something that might lead to inconsistent subscription state over time
found that in follow_all_project_questions and related flows, we create PostSubscription entries based on the posts a user currently has access to

posts = (
    Post.objects.filter_projects(project)
    .filter_permission(user=user)
    .filter_questions()
)

but if a user later loses access to the project, their existing PostSubscription records are not cleaned up and still remain in the db

i see that in some places (like notifications) we re-check permissions

subscriptions.filter(
    user__in=post.default_project.get_users_for_permission(
        ObjectPermission.VIEWER
    )
)

so it looks like the system relies on checking permissions at read/notification time rather than ensuring that the underlying data (subscriptions) stays consistent with access control

am curious to know whether this was intentional or was it more of a system design oversight where subscriptions should be cleaned up when access changes?

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 projects/services/subscriptions.py with follow_all_project_questions and related flows, then compare how PostSubscription records are filtered against current permissions in notification code. Determine whether permission loss should remove stored subscriptions or whether read-time checks are the intended behavior; done requires a documented decision and corresponding validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authorization, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.