mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
fix(logging): keep reviewers unlinkable, look admin users up by explicit id
- Requests carry userId on warn and error records only. The app calls /api/user on every page load, so a userId on routine info records sat next to the repoId a signed-in reviewer opened, and timestamps linked them. Jobs keep it at every level. Logger, collector and the admin projection apply the same rule. - Admin user routes take an _id only as id:<_id>; a 24-hex GitHub login can no longer match another account's _id for ban or promote. - The download-job expectation includes the owner id the PR adds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c281841f91
commit
d8a777cd35
8 files changed
+58
-20
No files matched your search
@@ -82,7 +82,8 @@ if includes(["/", "other", "/dashboard", "/anonymize", "/healthcheck", "/api/hea
|
||||
}
|
||||
# Public anonymized project IDs, the viewer role and the internal user _id.
|
||||
# Same double-blind rule as src/core/log-context.ts logIdentity: on
|
||||
# anonymized-content routes userId is kept only for owner/coauthor/admin.
|
||||
# anonymized-content routes userId is kept only for owner/coauthor/admin, and
|
||||
# requests keep it on warn and error records only (jobs at every level).
|
||||
if includes(["api", "streamer"], service) {
|
||||
log_route = string(out.route) ?? ""
|
||||
# Upstream lookups (/api/repo/:owner/:repo) carry an owner name, never a repoId,
|
||||
@@ -98,7 +99,9 @@ if includes(["api", "streamer"], service) {
|
||||
privileged = includes(["owner", "coauthor", "admin"], record.viewer)
|
||||
anonymized_route = service == "streamer" || match(log_route, r'^/(?:api/repo/:(?:repoId|id)(?:/|$)|r/|w/|viewer/|api/pr/|api/gist/)')
|
||||
account_route = includes(["/dashboard", "/anonymize", "/profile", "/api/repo", "/api/anonymize-preview", "/api/conferences/plans", "/conference/:id", "/github/:action"], log_route) || match(log_route, r'^/api/(?:user|billing|admin)(?:/|$)') || match(log_route, r'^/api/repo/:owner/:repo(?:/|$)')
|
||||
keep_user = if has_viewer || anonymized_route { privileged } else { account_route || (log_route == "" && out.service == "worker") }
|
||||
is_job = log_route == "" && out.service == "worker"
|
||||
keep_user = if has_viewer || anonymized_route { privileged } else { account_route || is_job }
|
||||
keep_user = keep_user && (is_job || includes(["warn", "error"], record.severity))
|
||||
if keep_user { out.userId = record.userId }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user