Protect legitimate profiles and administrators #1

Merged
lambadalambda merged 1 commit from fix/registration-policy-safety into main 2026-08-29 07:47:23 +00:00

Summary

  • stop treating an ordinary profile homepage alone as high-confidence abuse while retaining sanitize/restrict scoring
  • preserve high-confidence handling for stronger suspicious keyword/domain combinations
  • exclude administrators from candidate selection, scoring, and planning
  • recheck administrator status at execution time for every affected user, including repository, issue, and comment owners
  • count only rows actually affected by executed actions

Testing

  • .venv/bin/pytest -q (44 passed)
  • git diff --check

This is intended to be deployed alongside the Forgejo registration guard, while remaining independently safe to roll out.

## Summary - stop treating an ordinary profile homepage alone as high-confidence abuse while retaining sanitize/restrict scoring - preserve high-confidence handling for stronger suspicious keyword/domain combinations - exclude administrators from candidate selection, scoring, and planning - recheck administrator status at execution time for every affected user, including repository, issue, and comment owners - count only rows actually affected by executed actions ## Testing - `.venv/bin/pytest -q` (44 passed) - `git diff --check` This is intended to be deployed alongside the Forgejo registration guard, while remaining independently safe to roll out.
fix(policy): protect legitimate profiles and admins
All checks were successful
opencode/review OpenCode execution completed
3ac44fdd91
Author
Owner

/oc review

/oc review
Owner

OpenCode Review

Execution completed for pleroma/forgejo-janitor at 3ac44fdd9184 (job #64).

Rating: 5/5

The PR reliably shields administrators and low-signal legitimate profiles. Admins are excluded in the candidate SQL for both signup and activity scans, short-circuited in scoring and planning, and every execute path re-checks admin status at UPDATE time (defense in depth against plan/execute TOCTOU, including owner/poster guards for quarantine_repo, redact_issue, and redact_comment). execute_actions now returns psycopg rowcounts so skipped admin targets are not reported as executed. The high-confidence rule now requires a corroborating keyword or suspicious domain for profile_backlink_spam, so a generic homepage with no forge activity is no longer login-prohibited while keyword/domain backlink spammers still are; verified generic(130, no prohibit), seo-helper(165, prohibit), admin(0, no actions), issue spammer(redact+prohibit). All 44 tests pass, compile checks are clean, SQL guards are valid correlated predicates, and parameters remain bound. No concrete defects found.

No findings were reported.

Merge-ready: layered admin protection (fetch, score, plan, execute) is implemented and tested; the scoring relaxation only removes the harshest action for backlink-only profiles and is explicitly asserted by tests; execution counting via rowcount is more accurate than before. No correctness, security, data-integrity, performance, or maintainability regressions identified.


Last reviewed commit: 3ac44fdd9184

<!-- opencode-review:v1:05606e376348a3d0806aa0dd6107e257 --> <!-- opencode-reviewed-head:3ac44fdd9184178267803b4306709546308cb935 --> ## OpenCode Review _Execution completed for `pleroma/forgejo-janitor` at `3ac44fdd9184` (job #64)._ Rating: **5/5** The PR reliably shields administrators and low-signal legitimate profiles. Admins are excluded in the candidate SQL for both signup and activity scans, short-circuited in scoring and planning, and every execute path re-checks admin status at UPDATE time (defense in depth against plan/execute TOCTOU, including owner/poster guards for quarantine_repo, redact_issue, and redact_comment). execute_actions now returns psycopg rowcounts so skipped admin targets are not reported as executed. The high-confidence rule now requires a corroborating keyword or suspicious domain for profile_backlink_spam, so a generic homepage with no forge activity is no longer login-prohibited while keyword/domain backlink spammers still are; verified generic(130, no prohibit), seo-helper(165, prohibit), admin(0, no actions), issue spammer(redact+prohibit). All 44 tests pass, compile checks are clean, SQL guards are valid correlated predicates, and parameters remain bound. No concrete defects found. No findings were reported. Merge-ready: layered admin protection (fetch, score, plan, execute) is implemented and tested; the scoring relaxation only removes the harshest action for backlink-only profiles and is explicitly asserted by tests; execution counting via rowcount is more accurate than before. No correctness, security, data-integrity, performance, or maintainability regressions identified. --- _Last reviewed commit: `3ac44fdd9184`_
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/forgejo-janitor!1
No description provided.