Draft: Hide issues created by banned users [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
Epic: &5741
Issue: #327355 (closed)
Follow up to !61292 (merged)
Malicious actors create many issues in public projects/groups for spam. We need a way to be able to hide their issues until they can be reviewed and deemed safe. This MR hides issues created by banned users from non-admins. Admin users can still see the hidden issues.
Database
With check for banned users:
explain SELECT "issues".* FROM "issues" INNER JOIN "users" ON "users"."id" = "issues"."author_id" WHERE (users.state != 'banned') AND ( issues.confidential IS NOT TRUE OR (issues.confidential = TRUE AND (issues.author_id = 5966677 OR EXISTS (SELECT TRUE FROM issue_assignees WHERE user_id = 5966677 AND issue_id = issues.id) OR EXISTS (SELECT 1 FROM "project_authorizations" WHERE "project_authorizations"."user_id" = 5966677 AND (project_authorizations.project_id = issues.project_id) AND (project_authorizations.access_level >= 20))))) AND "issues"."project_id" = 278964 AND ("issues"."state_id" IN (1)) AND "issues"."issue_type" IN (0, 1) ORDER BY "issues"."created_at" DESC, "issues"."id" DESC LIMIT 20 OFFSET 0
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/4434/commands/15492
Without check for banned users:
explain SELECT "issues".* FROM "issues" WHERE ( issues.confidential IS NOT TRUE OR (issues.confidential = TRUE AND (issues.author_id = 5966677 OR EXISTS (SELECT TRUE FROM issue_assignees WHERE user_id = 5966677 AND issue_id = issues.id) OR EXISTS (SELECT 1 FROM "project_authorizations" WHERE "project_authorizations"."user_id" = 5966677 AND (project_authorizations.project_id = issues.project_id) AND (project_authorizations.access_level >= 20))))) AND "issues"."project_id" = 278964 AND ("issues"."state_id" IN (1)) AND "issues"."issue_type" IN (0, 1) ORDER BY "issues"."created_at" DESC, "issues"."id" DESC LIMIT 20 OFFSET 0
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/4434/commands/15493
Screenshots (strongly suggested)
When current user is admin:
The issue count includes hidden issues, which are indicated with the spam icon which has a tooltip explaining why the issue is hidden.
Admin is able to view hidden issue normally.
When impersonating a group member:
The issue count includes confidential issues but NOT hidden issues.
Group member is not able to view hidden issue.
When impersonating a non group member:
The issue count does not include confidential issues or hidden issues, and the user cannot view confidential issues or hidden issues.
Does this MR meet the acceptance criteria?
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team