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:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-29 13:08:19 +00:00
1 parent c281841f91
commit d8a777cd35
8 files changed
+58 -20

No files matched your search

+6 -3
View File
@@ -1207,9 +1207,12 @@ router.get("/users", async (req, res) => {
res.json({ query: filter, page, total, sort, results, statusCounts });
});
// Log records carry the internal user _id, never the username; accept either.
function adminUserFilter(param: string) {
return /^[a-f0-9]{24}$/.test(param) ? { $or: [{ username: param }, { _id: param }] } : { username: param };
// Log records carry the internal user _id, never the username. An _id is
// asked for explicitly as "id:<_id>": a GitHub login can also be 24 hex
// characters, and ban or promote must never hit a different account.
export function adminUserFilter(param: string) {
const id = /^id:([a-f0-9]{24})$/.exec(param);
return id ? { _id: id[1] } : { username: param };
}
router.get(