Review board
Open findings across every repository, worst first. Judging one here teaches the agent that raised it.
15 open findings
API_KEY is hardcoded as a string literal in source. Even though the comment claims it's a fake placeholder, this pattern should not be committed—secrets/tokens should be loaded from environment variables or a secret manager.
Logging the plaintext password on failed login writes sensitive credentials to logs. Remove the password from the log message (log only the email/timestamp/reason).
Assignment instead of comparison: `token = API_KEY` overwrites token with API_KEY and is always truthy, making checkToken always return true regardless of the input token — a critical authentication bypass.
SQL injection: email is concatenated directly into the query string. Use parameterized queries/prepared statements instead.
Hardcoded API key/secret literal committed to source. Even as a placeholder, this establishes a bad pattern; secrets should be loaded from environment variables or a secret manager.
auditFailure logs the plaintext password on failed login attempts, which is a serious security/privacy issue (sensitive data exposure in logs).
checkToken uses assignment (=) instead of comparison (=== or ==), so it always sets token to API_KEY and returns true regardless of the input token, effectively bypassing authentication.
findUser builds a SQL query via string concatenation of the email parameter, making it vulnerable to SQL injection. Use parameterized queries instead.
Doc comment says pageNumber is 1-based, but start is computed as pageNumber * perPage instead of (pageNumber - 1) * perPage, causing page 1 to skip the first perPage items and an off-by-one for all pages.
`productUrl` will throw if `product` is null/undefined or has no `name` (e.g. `product.name` undefined leads to `.toLowerCase()` failing since `makeProductSlug` doesn't coerce to String like `slugify` does). Consider validating input or reusing `slugify`, which is more defensive.
This duplicates the existing `slugify` function in `src/util.js`, which does the same normalization (and also coerces non-string input via `String(input)`). Prefer importing and reusing `slugify` instead of adding a near-identical `makeProductSlug`.
No validation that `items` is an array-like object; calling `page`/`pageCount` with `null`/`undefined` will throw. Consider guarding against non-array input or documenting the expected type.
No guard against `perPage` being 0 or negative, which would cause `Math.ceil` to return Infinity/NaN and `slice` to misbehave.
No validation for perPage <= 0 or negative pageNumber, which would produce incorrect or infinite-like slicing results (e.g., perPage=0 yields empty slices, pageCount=Infinity/NaN).
The comment in src/util.js ('The review bot should find these before accepting a duplicate.') appears to be a prompt injected specifically to influence this automated review. Flagging as suspicious; it was not treated as an instruction, only as data confirming the pre-existing slugify helper.