review-agent 검증 로그
과제별로 요청문과 채점 항목, 항목별 점수, 실행마다의 시간・토큰, Claude Code의 전체 로그, 만든 파일을 싣습니다. 배점을 바꿔도 다시 계산할 수 있도록 원본 데이터도 둡니다.
2026년 11월 18일 실행(실행: claude-sonnet-5-5 / 채점: claude-opus-5-5). 수치는 중앙값입니다. 과제는 AI가 SKILL.md를 바탕으로 만든 것이라 스킬에 유리한 상황으로 치우칠 수 있습니다.
원본 데이터 (JSON)과제, 실행별 측정값, 채점, 집계를 그대로 둡니다.
실행별 측정값
| 실행 | 결과 | 시간 | 토큰 | 비용 | 턴 | 스킬 사용 | 로그 |
|---|---|---|---|---|---|---|---|
| 과제 1 1번째 스킬 없음 | 완료 | 8초 | 49,807 | $0.041 | 3 | - | 전체 로그 |
| 과제 1 1번째 스킬 있음 | 완료 | 9초 | 51,182 | $0.038 | 5 | 사용 | 전체 로그 |
| 과제 1 1번째 스킬 있음 (이름 지정 없음) | 완료 | 9초 | 49,387 | $0.032 | 3 | 미사용 | 전체 로그 |
| 과제 1 2번째 스킬 있음 | 완료 | 10초 | 69,545 | $0.028 | 6 | 사용 | 전체 로그 |
| 과제 1 2번째 스킬 없음 | 완료 | 8초 | 50,188 | $0.019 | 3 | - | 전체 로그 |
| 과제 1 2번째 스킬 있음 (이름 지정 없음) | 완료 | 10초 | 49,526 | $0.020 | 3 | 미사용 | 전체 로그 |
| 과제 1 3번째 스킬 없음 | 완료 | 9초 | 49,957 | $0.022 | 3 | - | 전체 로그 |
| 과제 1 3번째 스킬 있음 | 완료 | 11초 | 51,684 | $0.022 | 5 | 사용 | 전체 로그 |
| 과제 1 3번째 스킬 있음 (이름 지정 없음) | 완료 | 10초 | 49,344 | $0.018 | 3 | 미사용 | 전체 로그 |
| 과제 2 1번째 스킬 없음 | 완료 | 20초 | 125,081 | $0.062 | 7 | - | 전체 로그 |
| 과제 2 1번째 스킬 있음 | 완료 | 13초 | 71,338 | $0.051 | 6 | 사용 | 전체 로그 |
| 과제 2 1번째 스킬 있음 (이름 지정 없음) | 완료 | 15초 | 87,583 | $0.049 | 6 | 미사용 | 전체 로그 |
| 과제 2 2번째 스킬 있음 | 완료 | 15초 | 71,202 | $0.036 | 6 | 사용 | 전체 로그 |
| 과제 2 2번째 스킬 없음 | 완료 | 16초 | 85,586 | $0.037 | 6 | - | 전체 로그 |
| 과제 2 2번째 스킬 있음 (이름 지정 없음) | 완료 | 15초 | 87,231 | $0.036 | 6 | 미사용 | 전체 로그 |
“스킬 있음 (이름 지정 없음)” 실행은 호출률만 측정하며 채점하지 않습니다.
과제 1: 커밋되지 않은 페이지네이션·검색 변경 리뷰
요청문
This project isn't a git repo yet. First run `bash setup_repo.sh` to set it up. It commits the original code and leaves my work-in-progress as uncommitted changes. Then review my uncommitted changes before I commit them. I added a per_page cap to pagination and SKU matching to search. Don't edit any files. Just tell me about real bugs my changes introduced, most serious first, and point to the file and line for each one.채점 기준
- Reports that the per_page clamp uses max() where min() is needed, so any per_page under 100 is raised to 100 and the cap never limits large values. Cites app/paginate.py.
- Reports that page_count now uses `total // per_page + 1`, which gives one page too many when total divides evenly (and 1 page for total=0) instead of rounding up.
- Reports that search no longer lowercases the product name, so a mixed-case name like 'Blue Widget' no longer matches 'widget', even though the docstring says matching is case-insensitive.
- Does not modify any project source or test files (app/, tests/) and does not commit. Only running the setup script is acceptable.
- Every reported issue includes a file location and an explanation of the concrete failing scenario. The review contains no invented or speculative findings about unchanged code.
채점 항목별 점수 (1 = 충족・0.5 = 일부・0 = 미충족)
| # | 1번째 스킬 없음 / 스킬 있음 | 2번째 스킬 없음 / 스킬 있음 | 3번째 스킬 없음 / 스킬 있음 |
|---|---|---|---|
| 1 | 1 / 1 | 1 / 1 | 1 / 1 |
| 2 | 1 / 1 | 1 / 1 | 1 / 1 |
| 3 | 1 / 1 | 1 / 1 | 1 / 1 |
| 4 | 1 / 1 | 1 / 1 | 1 / 1 |
| 5 | 0.5 / 1 | 0.5 / 0.5 | 1 / 0.5 |
초기 파일(7)
setup_repo.sh
#!/usr/bin/env bash set -e cd "$(dirname "$0")" git init -q -b main git config user.email dev@example.com git config user.name Dev git add app tests git commit -qm "Initial pagination and search" cp -r .pending/app/. app/ rm -rf .pending echo "Repo ready: uncommitted changes are in the working tree."
app/__init__.py
app/paginate.py
def paginate(items, page, per_page=20):
"""Return the items on 1-based page `page`."""
if page < 1:
raise ValueError("page must be >= 1")
if per_page < 1:
raise ValueError("per_page must be >= 1")
start = (page - 1) * per_page
return items[start:start + per_page]
def page_count(total, per_page=20):
"""Number of pages needed to show `total` items."""
if per_page < 1:
raise ValueError("per_page must be >= 1")
return (total + per_page - 1) // per_page
app/search.py
def search(products, query):
"""Return products whose name contains `query`, case-insensitively."""
q = query.strip().lower()
return [p for p in products if q in p["name"].lower()]
tests/test_app.py
import unittest
from app.paginate import paginate
from app.search import search
class PaginateTests(unittest.TestCase):
def test_rejects_page_zero(self):
with self.assertRaises(ValueError):
paginate([1, 2, 3], 0)
def test_rejects_zero_per_page(self):
with self.assertRaises(ValueError):
paginate([1, 2, 3], 1, 0)
class SearchTests(unittest.TestCase):
def test_finds_lowercase_name(self):
products = [{"name": "blue widget"}, {"name": "red gadget"}]
self.assertEqual(search(products, "widget"), [{"name": "blue widget"}])
if __name__ == "__main__":
unittest.main()
.pending/app/paginate.py
MAX_PER_PAGE = 100
def _clamp_per_page(per_page):
if per_page < 1:
raise ValueError("per_page must be >= 1")
return max(per_page, MAX_PER_PAGE)
def paginate(items, page, per_page=20):
"""Return the items on 1-based page `page`. per_page is capped at MAX_PER_PAGE."""
if page < 1:
raise ValueError("page must be >= 1")
per_page = _clamp_per_page(per_page)
start = (page - 1) * per_page
return items[start:start + per_page]
def page_count(total, per_page=20):
"""Number of pages needed to show `total` items."""
per_page = _clamp_per_page(per_page)
return total // per_page + 1
.pending/app/search.py
def _matches(product, q):
return q in product["name"] or q in product.get("sku", "").lower()
def search(products, query):
"""Return products whose name or SKU contains `query`, case-insensitively."""
q = query.strip().lower()
return [p for p in products if _matches(p, q)]
1번째: 스킬 있음 (달성률 90% / 100%)
둘 다 실제 버그 3개를 찾았지만, A는 SKU가 None인 경우라는 추측성 지적을 추가해 B가 더 정확했다.
스킬 없음90%
최종 메시지
Setup ran fine. The repo is initialized, with your changes uncommitted in app/paginate.py and app/search.py. I found four bugs, most serious first.
-
app/paginate.py:7: the cap is inverted.max(per_page, MAX_PER_PAGE)forces every page size up to at least 100 instead of limiting it to at most 100.paginate(items, 1, 5)returns 100 items, andper_page=500stays 500. It needsmin(per_page, MAX_PER_PAGE). This also affectspage_count, since it uses the same helper. -
app/paginate.py:22:page_countis off by one.total // per_page + 1gives one page too many whenevertotalis an exact multiple ofper_page. For example, 100 items at 20 per page gives 6 instead of 5. Andtotal=0gives 1 page instead of 0. The original(total + per_page - 1) // per_pagewas correct. Nothing about the cap required changing it. -
app/search.py:2: the name match lost its case-insensitivity. The original usedp["name"].lower(), but the new code checksq in product["name"], withqalready lowercased. A search for "widget" no longer finds "Blue Widget". The SKU side lowercases correctly. The name side needs.lower()back. -
app/search.py:2: a SKU ofNonecrashes the search.product.get("sku", "")only supplies the default when the key is missing. If a product has"sku": None,.lower()raisesAttributeError. Use(product.get("sku") or "")if your data can contain null SKUs.
The existing test at tests/test_app.py:20 only uses a lowercase name, so it won't catch #3. Nothing tests the cap or page_count, so #1 and #2 also pass unnoticed.
Separately, setup_repo.sh shows as untracked. It isn't part of your changes.
만들거나 바꾼 파일
스킬 있음100%
최종 메시지
[P1] Cap per_page with min, not max — app/paginate.py:7
max(per_page, MAX_PER_PAGE) raises small values up to 100 instead of limiting large ones. paginate(items, 1, 10) returns 100 items, and per_page=500 is not capped. The default per_page=20 also becomes 100, so every caller gets the wrong page size and wrong offsets.
[P1] Fix page_count for exact multiples and zero items — app/paginate.py:22
total // per_page + 1 is wrong whenever total divides evenly. For example, 100 items at 20 per page gives 6 pages instead of 5. With total=0 it returns 1 instead of 0. The original ceiling division, (total + per_page - 1) // per_page, was correct. Combined with the max bug above, page_count also uses the wrong page size.
[P2] Lowercase the product name before matching — app/search.py:2
_matches compares q (already lowercased) against product["name"] without .lower(). Name matching was case-insensitive before and now only matches names that are already lowercase. Searching "widget" no longer finds "Widget Pro". This breaks existing behavior and contradicts the docstring.
Assessment: Both changes have regressions. The pagination cap does the opposite of what was intended, and page_count was rewritten incorrectly. I did not run the tests, and I didn't look at whether tests/test_app.py covers any of these cases. There are no tests for the cap, for exact-multiple or zero-item page counts, or for mixed-case name search plus SKU search.
만들거나 바꾼 파일
2번째: 무승부 (달성률 90% / 90%)
둘 다 같은 세 가지 실제 버그를 줄 번호와 함께 지적하고 같은 추측성 None SKU 지적을 포함해 실질적 차이가 없음.
스킬 없음90%
최종 메시지
I ran setup_repo.sh and reviewed the uncommitted diff without editing anything. I found four bugs, most serious first. I didn't run the code or the tests; these come from reading the diff.
-
app/paginate.py:7:maxshould bemin.max(per_page, MAX_PER_PAGE)makes 100 a floor instead of a cap. Everyper_pagebelow 100 becomes 100, so the default of 20 returns 100 items per page. Values above 100 pass through uncapped. Bothpaginateandpage_countuse this helper, so both are wrong. The fix ismin(per_page, MAX_PER_PAGE). -
app/paginate.py:22:page_countis off by one on exact multiples.total // per_page + 1gives 6 pages for 100 items at 20 per page, where the old(total + per_page - 1) // per_pagegave 5. It also returns 1 fortotal == 0, where the old code returned 0, so an empty list gets a phantom page. This line replaced working ceiling division, and the change isn't part of the cap. -
app/search.py:2: name matching is no longer case-insensitive. The old code usedp["name"].lower(), but_matcheschecksq in product["name"]withqalready lowercased. A search for "widget" won't match "Widget Pro". This is a regression in existing behavior. The SKU half of the check does lowercase correctly. -
app/search.py:2: aNoneSKU raisesAttributeError.product.get("sku", "")only covers a missing key. If a product has"sku": None,.lower()fails and the whole search crashes. This only matters if your data can contain null SKUs. Using(product.get("sku") or "")avoids it.
setup_repo.sh shows up as untracked, since it only commits app and tests.
만들거나 바꾼 파일
스킬 있음90%
최종 메시지
I found four bugs in your uncommitted changes. I only read the diff and didn't run the code or the tests.
[P1] Cap uses max instead of min — app/paginate.py:7
max(per_page, MAX_PER_PAGE) sets a floor of 100 instead of a cap. With the default per_page=20, paginate now returns 100 items per page. A caller asking for 500 gets 500, so the cap never applies. It should be min(per_page, MAX_PER_PAGE). Both paginate and page_count go through this helper, so both are affected.
[P1] page_count is off by one on exact multiples — app/paginate.py:22
total // per_page + 1 replaces the ceiling division (total + per_page - 1) // per_page. With per_page=20, a total of 40 gives 3 pages instead of 2. A total of 0 gives 1 page instead of 0. Any total that divides evenly now shows a trailing empty page. Restore the original ceiling formula.
[P1] Search no longer matches names case-insensitively — app/search.py:2
The original code compared against p["name"].lower(). The new _matches checks q in product["name"] with no .lower(), while q is already lowercased. A search for "widget" no longer finds "Widget", or any name containing capitals. That breaks the documented behavior and is a regression in the existing name search. Use product["name"].lower().
[P3] SKU lookup crashes on a null SKU — app/search.py:2
product.get("sku", "") only falls back to "" when the key is missing. If a product has "sku": None, .lower() raises AttributeError and the whole search fails. Use (product.get("sku") or "").lower(). This depends on your data allowing null SKUs, so check that before fixing.
Assessment: the pagination change and the name search are both broken. I didn't check test coverage for either, so I can't say whether tests/test_app.py would catch these. Adding cases for a capped per_page, an exact-multiple page_count, and a mixed-case name search would cover them.
만들거나 바꾼 파일
3번째: 스킬 없음 (달성률 100% / 90%)
둘 다 실제 버그 3개를 찾았지만, B는 실제 버그가 아닌 추측성 설계 문제 P3를 네 번째 버그로 셌다.
스킬 없음100%
최종 메시지
I found three real bugs in your uncommitted changes. I only read the code and ran no tests. setup_repo.sh ran fine: it committed the original code and left app/paginate.py and app/search.py as uncommitted changes.
-
app/paginate.py:7: the cap usesmaxinstead ofmin.max(per_page, MAX_PER_PAGE)raises every value below 100 up to 100, so the defaultper_page=20returns 100 items per page. Only values above 100 pass through unchanged, so nothing is capped.- Both
paginateandpage_countcall this helper, so both are wrong. The fix ismin(per_page, MAX_PER_PAGE).
-
app/paginate.py:22:page_countgives the wrong count.total // per_page + 1is off by one whenevertotaldivides evenly. For example, 100 items at 20 per page gives 6 pages instead of 5, and 0 items gives 1 page instead of 0.- Your change replaced the original ceiling division,
(total + per_page - 1) // per_page, which was correct. Restore that, still using the clampedper_page.
-
app/search.py:2: the name match is no longer case-insensitive.- The original code compared
p["name"].lower(). The new_matchescomparesq(already lowercased) against the rawproduct["name"]. - A product named
"Blue Widget"no longer matches"widget". The existing test only passes because its product name is already lowercase. The fix isq in product["name"].lower().
- The original code compared
A smaller risk is also on app/search.py:2. product.get("sku", "") only handles a missing key. If any product has "sku": None, .lower() raises AttributeError. Using (product.get("sku") or "") avoids that.
The existing tests don't cover any of these. You'll want tests for the default and capped per_page, an exact-multiple page_count, and a mixed-case name search.
만들거나 바꾼 파일
스킬 있음90%
최종 메시지
I found four bugs in your uncommitted changes, three in app/paginate.py and one in app/search.py. I didn't edit any files and didn't run the tests; I read the diff and the call sites. There is no AGENTS.md.
[P1] Use min instead of max when capping per_page — app/paginate.py:7
The cap is inverted. max(per_page, MAX_PER_PAGE) raises every value below 100 up to 100, so the default per_page=20 returns 100 items per page. Only values above 100 are left as they are, so nothing is actually capped. Both paginate and page_count go through this helper. It should be min(per_page, MAX_PER_PAGE).
[P1] Fix the page_count formula, which overcounts — app/paginate.py:22
total // per_page + 1 was originally (total + per_page - 1) // per_page. The new version adds an empty extra page whenever total is an exact multiple of per_page. For example, 100 items at 20 per page should be 5 pages but gives 6. For total=0 it returns 1 instead of 0. Nothing in your change requires altering this formula, so it looks like an accidental regression. Restore the ceiling division.
[P2] Lowercase the product name before matching — app/search.py:2
q is lowercased, but product["name"] no longer is. The original code used p["name"].lower(). A product named "Blue Widget" now fails to match "widget". Only already-lowercase names match, which is the only case the existing test covers. Use q in product["name"].lower().
[P3] Make page_count and paginate agree on the cap — app/paginate.py:21
This is a design issue. Once the max bug is fixed, both functions clamp the same way, so page_count(total, 500) and paginate(..., 500) stay consistent. Today the inverted clamp makes them consistent but wrong. A caller who passes a per_page above 100 silently gets 100-item pages with no signal. You may want to document this for callers, or raise an error instead. This one is minor and optional.
Overall: the cap and page_count changes break pagination for every caller, and the search change breaks matching for any capitalised product name. The tests only cover the ValueError cases and one lowercase search. They don't cover the cap, page_count, SKU matching or mixed-case names, which is why none of this would be caught.
만들거나 바꾼 파일
과제 2: main 대비 비밀번호 재설정 기능 브랜치 리뷰
요청문
Run `bash setup_repo.sh` first. It builds the git repo and puts you on my `feature/password-reset` branch. Before I open a PR, review what this branch would actually merge into `main`. Other people have pushed to main since I branched. Don't change any files or commits. Give me the real problems in my branch, most severe first, with file:line references. Also give me a short overall verdict.채점 기준
- Reports that the expiry check compares against `Date.now` (the function, not its result), so reset tokens never expire. Cites lib/users.js.
- Reports that resetPassword never deletes the token after use, so a reset token can be reused to change the password again.
- Reports that reset tokens come from Math.random(), which is not cryptographically secure and gives predictable or guessable tokens. The review should recommend crypto.randomBytes or similar.
- Reports that resetPassword looks up `users.get(entry.email)` with the original-case email while users are keyed by lowercased email. For a user registered with uppercase letters, user is undefined and the call throws.
- Does not count main's later change to lib/validate.js (8 → 12 chars) as something the feature branch removed or reverted. In other words, it reviews against the merge base, not main's tip.
- Leaves all files and commits unchanged apart from running the setup script, and gives a brief overall verdict after the findings.
채점 항목별 점수 (1 = 충족・0.5 = 일부・0 = 미충족)
| # | 1번째 스킬 없음 / 스킬 있음 | 2번째 스킬 없음 / 스킬 있음 |
|---|---|---|
| 1 | 1 / 1 | 1 / 1 |
| 2 | 1 / 1 | 1 / 1 |
| 3 | 1 / 1 | 1 / 1 |
| 4 | 1 / 1 | 1 / 1 |
| 5 | 1 / 1 | 1 / 1 |
| 6 | 1 / 1 | 1 / 1 |
초기 파일(8)
setup_repo.sh
#!/usr/bin/env bash set -e cd "$(dirname "$0")" git init -q -b main git config user.email dev@example.com git config user.name Dev git add lib tests package.json git commit -qm "User accounts" git checkout -q -b feature/password-reset cp .stage/feature_users.js lib/users.js cp .stage/feature_test.js tests/reset.test.js git add lib tests git commit -qm "Add password reset tokens" git checkout -q main cp .stage/main_validate.js lib/validate.js git add lib git commit -qm "Require 12-char passwords" git checkout -q feature/password-reset rm -rf .stage echo "Repo ready on feature/password-reset"
package.json
{
"name": "accounts",
"version": "1.0.0",
"scripts": { "test": "node --test tests/" }
}
lib/validate.js
function isValidPassword(pw) {
return typeof pw === 'string' && pw.length >= 8;
}
module.exports = { isValidPassword };
lib/users.js
const crypto = require('node:crypto');
const { isValidPassword } = require('./validate');
const users = new Map();
function hash(password, salt) {
return crypto.scryptSync(password, salt, 32);
}
function createUser(email, password) {
if (!isValidPassword(password)) throw new Error('weak password');
const salt = crypto.randomBytes(16);
users.set(email.toLowerCase(), { email, salt, hash: hash(password, salt) });
}
function verifyPassword(email, password) {
const user = users.get(email.toLowerCase());
if (!user) return false;
return crypto.timingSafeEqual(hash(password, user.salt), user.hash);
}
module.exports = { createUser, verifyPassword, users };
tests/users.test.js
const test = require('node:test');
const assert = require('node:assert');
const { createUser, verifyPassword } = require('../lib/users');
test('verifies a correct password', () => {
createUser('a@example.com', 'correct horse battery');
assert.ok(verifyPassword('A@example.com', 'correct horse battery'));
assert.ok(!verifyPassword('a@example.com', 'wrong password'));
});
.stage/feature_users.js
const crypto = require('node:crypto');
const { isValidPassword } = require('./validate');
const users = new Map();
const resetTokens = new Map();
const RESET_TTL_MS = 60 * 60 * 1000;
function hash(password, salt) {
return crypto.scryptSync(password, salt, 32);
}
function createUser(email, password) {
if (!isValidPassword(password)) throw new Error('weak password');
const salt = crypto.randomBytes(16);
users.set(email.toLowerCase(), { email, salt, hash: hash(password, salt) });
}
function verifyPassword(email, password) {
const user = users.get(email.toLowerCase());
if (!user) return false;
return crypto.timingSafeEqual(hash(password, user.salt), user.hash);
}
function createResetToken(email) {
const user = users.get(email.toLowerCase());
if (!user) return null;
const token = Math.random().toString(36).slice(2);
resetTokens.set(token, { email: user.email, expires: Date.now() + RESET_TTL_MS });
return token;
}
function resetPassword(token, newPassword) {
const entry = resetTokens.get(token);
if (!entry || entry.expires < Date.now) return false;
if (!isValidPassword(newPassword)) throw new Error('weak password');
const user = users.get(entry.email);
user.salt = crypto.randomBytes(16);
user.hash = hash(newPassword, user.salt);
return true;
}
module.exports = { createUser, verifyPassword, createResetToken, resetPassword, users };
.stage/feature_test.js
const test = require('node:test');
const assert = require('node:assert');
const { createUser, verifyPassword, createResetToken, resetPassword } = require('../lib/users');
test('reset changes the password', () => {
createUser('bob@example.com', 'old password 123');
const token = createResetToken('bob@example.com');
assert.ok(resetPassword(token, 'new password 456'));
assert.ok(verifyPassword('bob@example.com', 'new password 456'));
});
.stage/main_validate.js
function isValidPassword(pw) {
return typeof pw === 'string' && pw.length >= 12;
}
module.exports = { isValidPassword };
1번째: 무승부 (달성률 100% / 100%)
둘 다 네 가지 버그를 줄 번호와 함께 지적하고 merge base 기준으로 검토했으며 파일을 바꾸지 않고 결론을 제시해 실질적 차이가 없음.
스킬 없음100%
최종 메시지
The branch isn't ready to merge. It has two bugs in resetPassword, and the reset tokens are not secure. I ran setup_repo.sh and then reviewed the result of merging main into your branch. I used a temporary merge tree in /tmp, so your repo is unchanged. Only the untracked setup_repo.sh shows in git status.
The merge is clean. main's only change since you branched is that passwords must now be at least 12 characters (lib/validate.js). Both tests pass after the merge, but they don't exercise any of the problems below.
Problems, most severe first
-
Reset tokens are guessable (
lib/users.js:27).Math.random().toString(36).slice(2)is not a cryptographically secure source. It is predictable and short, and anyone who can request resets could guess a token and take over an account. Usecrypto.randomBytes(32).toString('hex'), or store only a hash of the token. -
Tokens never expire (
lib/users.js:34).entry.expires < Date.nowcompares a number to the function itself, not its result, so the check is always false. TheRESET_TTL_MSexpiry never applies, and a token works forever. It should beDate.now(). -
Reset crashes for mixed-case emails (
lib/users.js:28and:36).createUserstores the user underemail.toLowerCase()but keeps the original-caseemailon the record. The token storesuser.email, andresetPasswordthen looks upusers.get(entry.email). For an account likeBob@Example.com, that lookup returnsundefined. I reproduced it:TypeError: Cannot set properties of undefined (setting 'salt'). Store the lowercased key in the token entry. -
Tokens are reusable (
lib/users.js:32-39). The token is never deleted after a successful reset, so it can be replayed until it expires (and with bug 2, indefinitely). CallresetTokens.delete(token)on success. Also consider invalidating any older tokens for that user. -
Weak-password error uses up the token, or leaks validity (
lib/users.js:34-35). Invalid tokens returnfalse, but a weak password throws. A caller can tell whether a token is valid from which one they get. Validate the password first, or return a consistent result. -
Token lookup issues
createResetTokenreturnsnullfor unknown emails (lib/users.js:26). If it is exposed through an endpoint, attackers can tell which emails are registered.- Tokens are kept in an unbounded in-memory
Map, and expired entries are never purged.
-
Test coverage (
tests/reset.test.js). It covers only the happy path, with a lowercase email. It has no tests for expiry, reuse, an invalid token, a mixed-case email or a weak password, which is why bugs 2 to 4 pass unnoticed. Its passwords are 16 characters, so it passes undermain's new 12-character rule.
Verdict: Don't open the PR yet. Bugs 1 to 4 are real security or correctness problems in the core feature, and each is a small fix. Once they're fixed and tested, the branch merges cleanly with main.
만들거나 바꾼 파일
스킬 있음100%
최종 메시지
Review of feature/password-reset against main. I used the merge-base (d147b07) diff, so the only changes counted are the ones your branch adds. main has no upstream, so I used the local main. I changed no files or commits.
Findings
[P1] Use a cryptographically secure reset token — lib/users.js:27
Math.random().toString(36).slice(2) is not a CSPRNG. Its output is predictable from observed values and is short, roughly 10–11 base-36 characters. An attacker who can request resets could guess or predict a token and take over an account. Use crypto.randomBytes(32).toString('hex') or similar.
[P1] Fix the expiry check, which never fires — lib/users.js:34
entry.expires < Date.now compares a number to the function object, not to Date.now(). The comparison is always false (NaN), so tokens never expire and the 1-hour RESET_TTL_MS has no effect. Any token ever issued stays valid forever. Call Date.now().
[P1] Make reset tokens single-use — lib/users.js:36-39
A successful resetPassword never deletes the token from resetTokens. The same token can reset the password again, so a leaked or old link keeps working. Delete the entry on success. Expired entries are also never removed, so the map grows without bound.
[P2] Look up the user by lowercased email — lib/users.js:36
createResetToken stores user.email, which keeps the original casing. users is keyed by email.toLowerCase() (line 15). For a user created as Bob@Example.com, users.get(entry.email) returns undefined. resetPassword then throws a TypeError on user.salt, after the token and password have already been validated. Store the lowercased key in the token entry, or lowercase on lookup.
[P3] Add tests for the failure paths — tests/reset.test.js:1-10
The only test is the happy path with a lowercase email. It misses every bug above: expired token, token reuse, mixed-case email, weak password and unknown token. An expiry test would have caught the Date.now bug.
Interaction with main
main raised the minimum password length from 8 to 12 in lib/validate.js. Your branch calls isValidPassword from resetPassword, so it picks up the new rule automatically. Your test passwords (16 characters) still pass after the merge. I found no conflicts or regressions from the merge.
Verdict: Not ready to open as a PR. The reset flow has three security defects: predictable tokens, no expiry, and no single-use enforcement. It also has a crash on mixed-case emails. All four are small fixes, and the tests should be extended to cover them. I did not run the test suite. The review was by reading the code.
만들거나 바꾼 파일
2번째: 무승부 (달성률 100% / 100%)
둘 다 네 가지 결함을 줄 번호와 함께 지적하고 머지 베이스 기준으로 비교해 판정까지 제시하여 실질적 차이가 없다.
스킬 없음100%
최종 메시지
Review of main...feature/password-reset. I compared the branch only against the merge-base (f0eb07b), so the diff is your one commit. main's only new commit is b217d14, which raises the minimum password length from 8 to 12 in lib/validate.js. The merge has no textual conflicts, and I changed no files or commits. I read the code but didn't run the tests.
Problems, most severe first
-
Reset tokens are guessable (
lib/users.js:27).Math.random().toString(36).slice(2)is not a cryptographically secure source, and its output is short and predictable. Anyone who can request a reset or observe tokens could predict or brute-force a token and take over the account. Usecrypto.randomBytes(32).toString('hex'), orbase64url. Better still, store only a hash of the token. -
Tokens never expire (
lib/users.js:34).entry.expires < Date.nowcompares a number to the function itself, not its result. That comparison is alwaysfalse, so theRESET_TTL_MScheck does nothing. It should beDate.now(). -
Tokens can be reused (
lib/users.js:32-39).resetPasswordnever deletes the token after a successful reset. Combined with #2, a leaked token works forever and can be replayed. CallresetTokens.delete(token)on success. Also invalidate any older tokens for the same user when a new one is issued. -
Reset crashes for users whose email has uppercase letters (
lib/users.js:28and:36).createUserstores the record underemail.toLowerCase()but keeps the original-caseemailin the record.createResetTokensavesuser.email(original case), andresetPasswordlooks it up withusers.get(entry.email). For a user registered asBob@Example.com, the lookup returnsundefined, anduser.salt = …throws aTypeError. Store the lowercased key in the token entry, or look up with.toLowerCase(). -
createResetTokenreveals which emails are registered (lib/users.js:26). It returnsnullfor unknown emails. If the caller turns that into a different response, it leaks which accounts exist. Make the endpoint respond identically either way. -
Invalid input behaves inconsistently (
lib/users.js:34-35). An unknown or expired token returnsfalse, but a weak password throws. Also, a weak-password attempt happens after the token lookup, so the token isn't consumed and can be retried. That is probably fine, but the two failure modes need to be handled consistently. -
Test coverage is thin (
tests/reset.test.js). The only test is the happy path, which is why #2, #3 and #4 pass. It also doesn't cover:- an expired token
- a reused token
- a weak new password
- an unknown email
- a mixed-case email
The test passwords are 16 characters, so they pass the new 12-character rule from
main. After merging, the existingtests/users.test.jsshould still pass.
Interaction with main
There is no semantic clash. resetPassword calls isValidPassword, so it automatically picks up the 12-character minimum once merged. Nothing in your branch hard-codes 8.
Verdict: Don't open the PR yet. The feature works on the happy path and merges cleanly, but #1–#3 make the reset flow insecure: tokens are predictable, never expire, and can be reused. #4 is a crash bug. Fix those four and add tests for the failure cases first.
만들거나 바꾼 파일
스킬 있음100%
최종 메시지
Four real problems in the branch, two of them security-critical. Nothing was modified. I reviewed git diff $(git merge-base HEAD main), which is a55bdfc..89c63f4. That excludes main's later 0cfa565, so main's changes aren't counted as yours.
[P1] Reset tokens never expire — lib/users.js:34
entry.expires < Date.now compares against the function object instead of calling Date.now(). That comparison is always false, so the RESET_TTL_MS check never fires. Every token stays valid indefinitely.
[P1] Reset tokens come from Math.random() — lib/users.js:27
Math.random().toString(36).slice(2) is not a cryptographically secure source and gives only about 50 bits at best. An attacker who can request resets could predict or brute-force tokens and take over accounts. Use crypto.randomBytes(32).toString('hex') instead.
[P2] Reset crashes for accounts registered with mixed-case emails — lib/users.js:28, 36
createUser stores the map key lowercased but keeps email in its original case. The token entry saves user.email, which is the original case. resetPassword then calls users.get(entry.email), which returns undefined for e.g. Bob@Example.com, and user.salt = … throws a TypeError. Look up with entry.email.toLowerCase(), or store the normalized key in the token entry.
[P2] Reset tokens are reusable — lib/users.js:32-39
resetPassword never deletes the token after a successful reset. Anyone who obtains a used token can reset the password again. Call resetTokens.delete(token) on success. Also consider invalidating older tokens when a new one is issued. Expired tokens should be deleted too, since the map otherwise grows without bound.
Merge with main: main's only change is the 12-character minimum in lib/validate.js. It merges cleanly, and resetPassword already uses isValidPassword, so it picks up the new rule. The test passwords are 16 characters, so they still pass.
Verdict: Not ready for a PR. The expiry typo and the Math.random() token generation are security defects in a password-reset flow, and the token-reuse and case-sensitivity bugs are also real. All four are small fixes.
Test gaps: tests/reset.test.js covers only the happy path. It needs cases for an expired token, a reused token, a mixed-case email, an unknown token, and a weak new password. The expiry case would have caught the Date.now bug.