mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
- 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>
15 lines
678 B
JavaScript
15 lines
678 B
JavaScript
const { expect } = require("chai");
|
|
require("ts-node/register/transpile-only");
|
|
const { adminUserFilter } = require("../src/server/routes/admin");
|
|
|
|
describe("admin user lookup", () => {
|
|
it("looks a user up by _id only when asked with id:", () => {
|
|
const hex = "0123456789abcdef01234567";
|
|
// A 24-hex GitHub login is a username, never another account's _id.
|
|
expect(adminUserFilter(hex)).to.deep.equal({ username: hex });
|
|
expect(adminUserFilter("id:" + hex)).to.deep.equal({ _id: hex });
|
|
expect(adminUserFilter("id:not-an-id")).to.deep.equal({ username: "id:not-an-id" });
|
|
expect(adminUserFilter("alice")).to.deep.equal({ username: "alice" });
|
|
});
|
|
});
|