본문으로 건너뛰기
cccskills

ponytail-audit 검증 로그

과제별로 요청문과 채점 항목, 항목별 점수, 실행마다의 시간・토큰, Claude Code의 전체 로그, 만든 파일을 싣습니다. 배점을 바꿔도 다시 계산할 수 있도록 원본 데이터도 둡니다.

2026년 11월 6일 실행(실행: claude-sonnet-5-5 / 채점: claude-opus-5-5). 수치는 중앙값입니다. 과제는 AI가 SKILL.md를 바탕으로 만든 것이라 스킬에 유리한 상황으로 치우칠 수 있습니다.

이 검증의 생성물은 저장되지 않았습니다.

과제 1: 인수받은 Python 주문 도구 품질 감사

요청문

I'm taking over this small order/invoice tool from a colleague who left. Before I touch anything, I want an honest review of the whole repo: real bugs, security problems, things that will break with how it's actually deployed (see the README), risky logic with no tests, slow spots, and code we could just delete. Put the most important problems first, and for each one tell me where it is, what goes wrong in a concrete case, and the smallest fix. Number them so I can tell you which ones to fix later. Please don't change any code yet, I only want the report.

채점 기준

  1. Flags the SQL injection in app/db.py find_orders_by_customer (f-string with user-supplied customer name) as a top-priority problem and proposes parameterized queries.
  2. Identifies the password-reset weaknesses: the token is returned in the /reset/start HTTP response (anyone can reset any account) and/or is made with the non-cryptographic random module; also notes hardcoded secrets and MD5 password hashing.
  3. Finds the stock race/oversell in place_order (read stock, then write stock - qty, across 4 concurrent server copies, with two separate commits) and suggests an atomic update/transaction such as UPDATE ... SET stock = stock - ? WHERE stock >= ?; also notes zero/negative qty is not rejected.
  4. Finds the invoice bugs: invoice_lines skips the last item (range(len(items) - 1)) and the bulk discount rule differs between orders.py (qty > 10, rounded) and invoice.py (qty >= 10, unrounded), so a 10-item order is priced differently.
  5. Report is ordered by severity, findings are numbered with file locations, a concrete failing case and a small fix each, and it mentions missing tests for risky logic and deletable code (duplicate money formatters, unused legacy_csv_export, one-product factory).
  6. No source files were modified; the result is a report only.

채점 항목별 점수 (1 = 충족・0.5 = 일부・0 = 미충족)

#1번째
스킬 없음 / 스킬 있음
2번째
스킬 없음 / 스킬 있음
3번째
스킬 없음 / 스킬 있음
11 / 11 / 11 / 1
21 / 0.50.5 / 11 / 1
31 / 11 / 11 / 1
41 / 10.5 / 10 / 0
50.5 / 0.50.5 / 0.50.5 / 0.5
61 / 11 / 11 / 1
초기 파일(10)

README.md

# shop-orders

Internal order and invoice tool for our shop staff (about 40 people use it during the day).

Run: `python -m app.server`

Production: 4 copies of the server run at the same time behind a load balancer, all using the same `shop.db` file on a shared disk.

Tests: `python -m unittest discover tests`

app/__init__.py

app/db.py

import sqlite3

DB_PATH = "shop.db"


def connect():
    return sqlite3.connect(DB_PATH)


def init():
    con = connect()
    con.executescript("""
    CREATE TABLE IF NOT EXISTS products(id INTEGER PRIMARY KEY, name TEXT, price REAL, stock INTEGER);
    CREATE TABLE IF NOT EXISTS orders(id INTEGER PRIMARY KEY, customer TEXT, product_id INTEGER, qty INTEGER, total REAL);
    CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, email TEXT, password TEXT, reset_token TEXT);
    """)
    con.commit()
    con.close()


def find_orders_by_customer(name):
    con = connect()
    rows = con.execute(
        f"SELECT id, product_id, qty, total FROM orders WHERE customer = '{name}'"
    ).fetchall()
    con.close()
    return rows

app/orders.py

from app.db import connect


def unit_price_after_discount(price, qty):
    # 10% off for bulk orders
    if qty > 10:
        return round(price * 0.9, 2)
    return price


def place_order(customer, product_id, qty):
    con = connect()
    row = con.execute(
        "SELECT price, stock FROM products WHERE id = ?", (product_id,)
    ).fetchone()
    if row is None:
        con.close()
        return None
    price, stock = row
    if stock < qty:
        con.close()
        return None
    total = unit_price_after_discount(price, qty) * qty
    con.execute(
        "INSERT INTO orders(customer, product_id, qty, total) VALUES (?, ?, ?, ?)",
        (customer, product_id, qty, total),
    )
    con.commit()
    con.execute(
        "UPDATE products SET stock = ? WHERE id = ?", (stock - qty, product_id)
    )
    con.commit()
    con.close()
    return total

app/invoice.py

from app.utils import money_str


def bulk_price(price, qty):
    # bulk discount, same as in orders
    if qty >= 10:
        return price * 0.9
    return price


def invoice_lines(items):
    """items: list of dicts with name, price, qty"""
    lines = []
    for i in range(len(items) - 1):
        item = items[i]
        unit = bulk_price(item["price"], item["qty"])
        lines.append(f"{item['name']} x{item['qty']}: {money_str(unit * item['qty'])}")
    return lines


def invoice_total(items):
    total = 0
    for item in items:
        total += bulk_price(item["price"], item["qty"]) * item["qty"]
    return money_str(total)

app/auth.py

import random
import hashlib

from app.db import connect

SECRET_KEY = "s3cr3t-prod-key-2023"
ADMIN_PASSWORD = "admin123"


def hash_password(pw):
    return hashlib.md5((SECRET_KEY + pw).encode()).hexdigest()


def make_reset_token():
    return str(random.randint(100000, 999999))


def start_reset(email):
    token = make_reset_token()
    con = connect()
    try:
        con.execute("UPDATE users SET reset_token = ? WHERE email = ?", (token, email))
        con.commit()
    except Exception:
        pass
    con.close()
    return token


def finish_reset(email, token, new_password):
    con = connect()
    row = con.execute("SELECT reset_token FROM users WHERE email = ?", (email,)).fetchone()
    if row and row[0] == token:
        con.execute(
            "UPDATE users SET password = ? WHERE email = ?",
            (hash_password(new_password), email),
        )
        con.commit()
        con.close()
        return True
    con.close()
    return False

app/utils.py

def format_money(value):
    return "%.2f EUR" % value


def money_str(value):
    return "{:.2f} EUR".format(value)


def legacy_csv_export(rows, path):
    # old export, kept just in case
    with open(path, "w") as f:
        for r in rows:
            f.write(",".join(str(x) for x in r) + "\n")


class OrderRepositoryFactory:
    def create(self):
        from app import db
        return db

app/server.py

import json
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs

from app import db, orders, auth


class Handler(BaseHTTPRequestHandler):
    def _send(self, code, body):
        data = json.dumps(body).encode()
        self.send_response(code)
        self.send_header("Content-Type", "application/json")
        self.end_headers()
        self.wfile.write(data)

    def do_GET(self):
        url = urlparse(self.path)
        if url.path == "/orders":
            name = parse_qs(url.query).get("customer", [""])[0]
            self._send(200, db.find_orders_by_customer(name))
        else:
            self._send(404, {"error": "not found"})

    def do_POST(self):
        length = int(self.headers.get("Content-Length", 0))
        body = json.loads(self.rfile.read(length) or b"{}")
        if self.path == "/order":
            total = orders.place_order(body["customer"], body["product_id"], int(body["qty"]))
            if total is None:
                self._send(400, {"error": "cannot order"})
            else:
                self._send(200, {"total": total})
        elif self.path == "/reset/start":
            token = auth.start_reset(body["email"])
            self._send(200, {"ok": True, "token": token})
        elif self.path == "/reset/finish":
            ok = auth.finish_reset(body["email"], body["token"], body["password"])
            self._send(200 if ok else 403, {"ok": ok})
        else:
            self._send(404, {"error": "not found"})


if __name__ == "__main__":
    db.init()
    HTTPServer(("0.0.0.0", 8000), Handler).serve_forever()

tests/__init__.py

tests/test_utils.py

import unittest

from app.utils import format_money


class TestMoney(unittest.TestCase):
    def test_format(self):
        self.assertEqual(format_money(3), "3.00 EUR")


if __name__ == "__main__":
    unittest.main()

1번째: 스킬 없음 (달성률 91.7% / 83.3%)

A는 하드코딩된 비밀값과 MD5 해싱도 지적했지만, B의 보이는 부분에는 이 내용이 없었다.

스킬 없음91.7%

이 검증의 생성물은 저장되지 않았습니다.

스킬 있음83.3%

이 검증의 생성물은 저장되지 않았습니다.

2번째: 스킬 있음 (달성률 75% / 91.7%)

보이는 부분에서 B는 MD5, 하드코딩된 비밀값, 할인 기준 차이(>10 대 >=10)를 명시했으나 A의 보이는 부분은 이를 다루지 않았다

스킬 없음75%

이 검증의 생성물은 저장되지 않았습니다.

스킬 있음91.7%

이 검증의 생성물은 저장되지 않았습니다.

3번째: 무승부 (달성률 75% / 75%)

둘 다 SQL 인젝션·재설정·재고 경쟁을 잘 짚었으나 잘려서 송장 버그와 삭제 가능 코드가 안 보여 동등하다.

스킬 없음75%

이 검증의 생성물은 저장되지 않았습니다.

스킬 있음75%

이 검증의 생성물은 저장되지 않았습니다.

과제 2: Node.js URL 단축 서버 전체 리뷰

요청문

We're about to open our little link shortener (plain Node, no framework) to the whole company, maybe a few thousand clicks an hour. Can you go through the repo and tell me what's wrong with it before we do that? I care most about anything that's broken or unsafe, then what won't hold up under that traffic, then missing tests, performance, and stuff we can remove. Give me a prioritized, numbered list with file and line references, a concrete example of how each problem shows up, and the simplest fix. Just the report for now, don't edit the code.

채점 기준

  1. Flags the path traversal in the /static/ handler (path.join with a decoded user path, e.g. /static/..%2F..%2Fetc%2Fpasswd or ../data/links.json is served) as must-fix and proposes checking the resolved path stays inside public/.
  2. Flags isValidUrl (u.includes('http')) accepting things like javascript:alert('http') and the unescaped url in the /stats HTML (stored XSS), with a concrete fix (parse with URL and allow only http/https, escape HTML).
  3. Identifies that makeCode has no collision check, so a new link can silently overwrite an existing one (4 chars ≈ 1.7M codes, collisions likely at scale), and suggests checking for an existing code and/or longer codes.
  4. Identifies load problems: every click rewrites the whole JSON file synchronously (writeFileSync on each redirect), the clicks array grows forever, and a crash during the write can corrupt or lose data; also notes JSON.parse on the POST body can crash the request or server on bad input.
  5. Finds the logic bugs: /stats pagination skips the first 20 links because page starts at 1 (slice(page*PAGE_SIZE)), and clicksToday compares a local-time day key to UTC day keys so counts are wrong near midnight.
  6. Gives a numbered, severity-ordered report with file references and smallest fixes, notes missing tests for the risky parts, lists removable code (unused uuid/lodash dependencies, makeLegacyCode, duplicate isUrl), and does not modify any files.

채점 항목별 점수 (1 = 충족・0.5 = 일부・0 = 미충족)

#1번째
스킬 없음 / 스킬 있음
2번째
스킬 없음 / 스킬 있음
3번째
스킬 없음 / 스킬 있음
10.5 / 11 / 11 / 1
21 / 11 / 11 / 1
31 / 11 / 11 / 1
40.5 / 11 / 11 / 1
50.5 / 01 / 0.51 / 0
60.5 / 0.50.5 / 0.50.5 / 0.5
초기 파일(9)

README.md

# shorty

Tiny link shortener. `node server.js` starts it on port 3000.

- POST /shorten {"url": "https://..."} -> {"code": "abc123"}
- GET /r/<code> redirects
- GET /stats?page=1 shows an HTML table of links, 20 per page (page numbers start at 1)
- GET /static/<file> serves files from ./public

Data lives in data/links.json. Single process.

package.json

{
  "name": "shorty",
  "version": "1.0.0",
  "main": "server.js",
  "scripts": { "start": "node server.js", "test": "node --test test/" },
  "dependencies": {
    "uuid": "^9.0.0",
    "lodash": "^4.17.21"
  }
}

server.js

const http = require('node:http');
const fs = require('node:fs');
const path = require('node:path');
const store = require('./lib/store');
const { makeCode } = require('./lib/codes');
const { isValidUrl } = require('./lib/validate');

const PUBLIC_DIR = path.join(__dirname, 'public');
const PAGE_SIZE = 20;

function readBody(req) {
  return new Promise((resolve) => {
    let data = '';
    req.on('data', (c) => (data += c));
    req.on('end', () => resolve(data));
  });
}

const server = http.createServer(async (req, res) => {
  const url = new URL(req.url, 'http://localhost');

  if (req.method === 'POST' && url.pathname === '/shorten') {
    const body = JSON.parse(await readBody(req));
    if (!isValidUrl(body.url)) {
      res.writeHead(400);
      return res.end('bad url');
    }
    const code = makeCode();
    store.put(code, body.url);
    res.writeHead(200, { 'Content-Type': 'application/json' });
    return res.end(JSON.stringify({ code }));
  }

  if (req.method === 'GET' && url.pathname.startsWith('/r/')) {
    const code = url.pathname.slice(3);
    const link = store.get(code);
    if (!link) {
      res.writeHead(404);
      return res.end('not found');
    }
    store.recordClick(code);
    res.writeHead(302, { Location: link.url });
    return res.end();
  }

  if (req.method === 'GET' && url.pathname === '/stats') {
    const page = parseInt(url.searchParams.get('page') || '1', 10);
    const all = store.all();
    const rows = all.slice(page * PAGE_SIZE, page * PAGE_SIZE + PAGE_SIZE);
    let html = '<table><tr><th>code</th><th>url</th><th>clicks today</th></tr>';
    for (const l of rows) {
      html += `<tr><td>${l.code}</td><td>${l.url}</td><td>${store.clicksToday(l.code)}</td></tr>`;
    }
    html += '</table>';
    res.writeHead(200, { 'Content-Type': 'text/html' });
    return res.end(html);
  }

  if (req.method === 'GET' && url.pathname.startsWith('/static/')) {
    const file = path.join(PUBLIC_DIR, decodeURIComponent(req.url.slice('/static/'.length)));
    fs.readFile(file, (err, data) => {
      if (err) {
        res.writeHead(404);
        return res.end('not found');
      }
      res.writeHead(200);
      res.end(data);
    });
    return;
  }

  res.writeHead(404);
  res.end('not found');
});

server.listen(3000, () => console.log('listening on 3000'));

lib/store.js

const fs = require('node:fs');
const path = require('node:path');

const FILE = path.join(__dirname, '..', 'data', 'links.json');

let links = {};
try {
  links = JSON.parse(fs.readFileSync(FILE, 'utf8'));
} catch (e) {
  links = {};
}

function save() {
  fs.writeFileSync(FILE, JSON.stringify(links, null, 2));
}

function put(code, url) {
  links[code] = { code, url, created: Date.now(), clicks: [] };
  save();
}

function get(code) {
  return links[code];
}

function recordClick(code) {
  links[code].clicks.push(Date.now());
  save();
}

function all() {
  return Object.values(links).sort((a, b) => a.created - b.created);
}

function dayKeyUTC(ts) {
  return new Date(ts).toISOString().slice(0, 10);
}

function dayKeyLocal(ts) {
  const d = new Date(ts);
  return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
}

function clicksToday(code) {
  const today = dayKeyLocal(Date.now());
  return links[code].clicks.filter((ts) => dayKeyUTC(ts) === today).length;
}

module.exports = { put, get, recordClick, all, clicksToday, save };

lib/codes.js

const ALPHABET = 'abcdefghijklmnopqrstuvwxyz0123456789';

function makeCode(len = 4) {
  let out = '';
  for (let i = 0; i < len; i++) {
    out += ALPHABET[Math.floor(Math.random() * ALPHABET.length)];
  }
  return out;
}

// old format, before we switched to short codes
function makeLegacyCode() {
  return 'L' + Date.now().toString(36);
}

module.exports = { makeCode, makeLegacyCode };

lib/validate.js

function isValidUrl(u) {
  return typeof u === 'string' && u.includes('http');
}

function isUrl(u) {
  try {
    new URL(u);
    return true;
  } catch {
    return false;
  }
}

module.exports = { isValidUrl, isUrl };

public/index.html

<!doctype html><html><body><h1>shorty</h1></body></html>

data/links.json

{}

test/codes.test.js

const test = require('node:test');
const assert = require('node:assert');
const { makeCode } = require('../lib/codes');

test('code has 4 chars', () => {
  assert.strictEqual(makeCode().length, 4);
});

1번째: 스킬 있음 (달성률 66.7% / 75%)

B는 경로 탐색을 최우선 필수로 두고 클릭마다 전체 쓰기와 증가를 지적했으나 A는 부족

스킬 없음66.7%

이 검증의 생성물은 저장되지 않았습니다.

스킬 있음75%

이 검증의 생성물은 저장되지 않았습니다.

2번째: 스킬 없음 (달성률 91.7% / 83.3%)

둘 다 중간에 끊겼지만 A는 페이지네이션 오류와 clicksToday 시간대 불일치를 모두 다뤘고 B는 페이지네이션에서 끊겼다

스킬 없음91.7%

이 검증의 생성물은 저장되지 않았습니다.

스킬 있음83.3%

이 검증의 생성물은 저장되지 않았습니다.

3번째: 스킬 없음 (달성률 91.7% / 75%)

A는 페이지 오프바이원과 날짜 시간대 불일치를 지적했지만 B의 출력에는 둘 다 없다.

스킬 없음91.7%

이 검증의 생성물은 저장되지 않았습니다.

스킬 있음75%

이 검증의 생성물은 저장되지 않았습니다.