@kevinrabun/judges 3.23.19 → 3.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/api.d.ts +7 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +5 -3
- package/dist/api.js.map +1 -1
- package/dist/ast/structural-parser.js +13 -9
- package/dist/ast/structural-parser.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/benchmark-advanced.js +53 -53
- package/dist/commands/benchmark-advanced.js.map +1 -1
- package/dist/commands/benchmark-ai-agents.js +52 -52
- package/dist/commands/benchmark-ai-agents.js.map +1 -1
- package/dist/commands/benchmark-compliance-ethics.js +15 -15
- package/dist/commands/benchmark-compliance-ethics.js.map +1 -1
- package/dist/commands/benchmark-expanded-2.js +9 -9
- package/dist/commands/benchmark-expanded-2.js.map +1 -1
- package/dist/commands/benchmark-expanded.js +8 -8
- package/dist/commands/benchmark-expanded.js.map +1 -1
- package/dist/commands/benchmark-infrastructure.d.ts.map +1 -1
- package/dist/commands/benchmark-infrastructure.js +32 -20
- package/dist/commands/benchmark-infrastructure.js.map +1 -1
- package/dist/commands/benchmark-languages.js +11 -11
- package/dist/commands/benchmark-languages.js.map +1 -1
- package/dist/commands/benchmark-quality-ops.d.ts.map +1 -1
- package/dist/commands/benchmark-quality-ops.js +1109 -17
- package/dist/commands/benchmark-quality-ops.js.map +1 -1
- package/dist/commands/benchmark-security-deep.js +4 -4
- package/dist/commands/benchmark-security-deep.js.map +1 -1
- package/dist/commands/benchmark.d.ts +73 -0
- package/dist/commands/benchmark.d.ts.map +1 -1
- package/dist/commands/benchmark.js +265 -4
- package/dist/commands/benchmark.js.map +1 -1
- package/dist/commands/config-share.d.ts +48 -1
- package/dist/commands/config-share.d.ts.map +1 -1
- package/dist/commands/config-share.js +230 -1
- package/dist/commands/config-share.js.map +1 -1
- package/dist/commands/feedback.d.ts +42 -0
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +64 -0
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/triage.d.ts +16 -0
- package/dist/commands/triage.d.ts.map +1 -0
- package/dist/commands/triage.js +172 -0
- package/dist/commands/triage.js.map +1 -0
- package/dist/finding-lifecycle.d.ts +36 -2
- package/dist/finding-lifecycle.d.ts.map +1 -1
- package/dist/finding-lifecycle.js +85 -1
- package/dist/finding-lifecycle.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/deep-review.d.ts +10 -2
- package/dist/tools/deep-review.d.ts.map +1 -1
- package/dist/tools/deep-review.js +31 -2
- package/dist/tools/deep-review.js.map +1 -1
- package/dist/tools/register-evaluation.d.ts.map +1 -1
- package/dist/tools/register-evaluation.js +23 -4
- package/dist/tools/register-evaluation.js.map +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -65,7 +65,7 @@ oauth2_scheme = OAuth2PasswordBearerWithScopes(tokenUrl="token", scopes={"read":
|
|
|
65
65
|
@app.get("/users/me")
|
|
66
66
|
async def read_users_me(token: str = Depends(oauth2_scheme)):
|
|
67
67
|
return decode_token(token)`,
|
|
68
|
-
expectedRuleIds: [],
|
|
68
|
+
expectedRuleIds: ["CYBER-001", "UX-001"],
|
|
69
69
|
category: "hallucination-detection",
|
|
70
70
|
difficulty: "hard",
|
|
71
71
|
},
|
|
@@ -107,7 +107,7 @@ func main() {
|
|
|
107
107
|
token := security.GenerateCSRFToken()
|
|
108
108
|
fmt.Println(token)
|
|
109
109
|
}`,
|
|
110
|
-
expectedRuleIds: [],
|
|
110
|
+
expectedRuleIds: ["DATA-001", "CYBER-001", "OBS-001", "COMP-001"],
|
|
111
111
|
category: "hallucination-detection",
|
|
112
112
|
difficulty: "medium",
|
|
113
113
|
},
|
|
@@ -148,7 +148,7 @@ async function readFile(path: string): Promise<Buffer> {
|
|
|
148
148
|
const stream = createReadStream(path);
|
|
149
149
|
return Buffer.fromStream(stream);
|
|
150
150
|
}`,
|
|
151
|
-
expectedRuleIds: [],
|
|
151
|
+
expectedRuleIds: ["SCALE-001", "UX-001"],
|
|
152
152
|
category: "hallucination-detection",
|
|
153
153
|
difficulty: "medium",
|
|
154
154
|
},
|
|
@@ -229,7 +229,7 @@ def load_config(path):
|
|
|
229
229
|
public void authenticateUser(String u, String p) { /* 40 lines */ }
|
|
230
230
|
public void scheduleTask(Task t) { /* 20 lines */ }
|
|
231
231
|
}`,
|
|
232
|
-
expectedRuleIds: [],
|
|
232
|
+
expectedRuleIds: ["DATA-001", "COMP-001", "SOV-001", "DOC-001"],
|
|
233
233
|
category: "code-structure",
|
|
234
234
|
difficulty: "medium",
|
|
235
235
|
},
|
|
@@ -390,7 +390,7 @@ func UploadUserDocument(ctx context.Context, bucket, name string, data []byte) e
|
|
|
390
390
|
wc.Write(data)
|
|
391
391
|
return wc.Close()
|
|
392
392
|
}`,
|
|
393
|
-
expectedRuleIds: [],
|
|
393
|
+
expectedRuleIds: ["DATA-001", "ERR-001"],
|
|
394
394
|
category: "data-sovereignty",
|
|
395
395
|
difficulty: "hard",
|
|
396
396
|
},
|
|
@@ -588,7 +588,7 @@ func ValidateToken(token string) (*Claims, error) {
|
|
|
588
588
|
log.Printf("Token validated successfully: token=%s, user=%s", token, claims.Subject)
|
|
589
589
|
return claims, nil
|
|
590
590
|
}`,
|
|
591
|
-
expectedRuleIds: [],
|
|
591
|
+
expectedRuleIds: ["DATA-001", "CYBER-001"],
|
|
592
592
|
category: "logging-privacy",
|
|
593
593
|
difficulty: "easy",
|
|
594
594
|
},
|
|
@@ -713,7 +713,7 @@ jobs:
|
|
|
713
713
|
- run: curl -L https://github.com/example/tool/releases/latest/download/tool.tar.gz | tar xz
|
|
714
714
|
- run: ./tool deploy --production
|
|
715
715
|
- run: curl -sSL https://install.example.com | bash`,
|
|
716
|
-
expectedRuleIds: [],
|
|
716
|
+
expectedRuleIds: ["SOV-001"],
|
|
717
717
|
category: "ci-cd",
|
|
718
718
|
difficulty: "hard",
|
|
719
719
|
},
|
|
@@ -743,7 +743,7 @@ export async function fetchUser(id: string, options?: FetchOptions): Promise<Use
|
|
|
743
743
|
def get_items(category):
|
|
744
744
|
for item in db.query("SELECT * FROM items WHERE category = %s", (category,)):
|
|
745
745
|
yield item`,
|
|
746
|
-
expectedRuleIds: [],
|
|
746
|
+
expectedRuleIds: ["CYBER-001", "DB-001", "SEC-001"],
|
|
747
747
|
category: "backwards-compatibility",
|
|
748
748
|
difficulty: "hard",
|
|
749
749
|
},
|
|
@@ -758,7 +758,7 @@ app.get("/api/users/:id", async (req, res) => {
|
|
|
758
758
|
const user = await db.users.findById(req.params.id);
|
|
759
759
|
res.json({ name: user.name, email: user.email });
|
|
760
760
|
});`,
|
|
761
|
-
expectedRuleIds: [],
|
|
761
|
+
expectedRuleIds: ["UX-001"],
|
|
762
762
|
category: "backwards-compatibility",
|
|
763
763
|
difficulty: "medium",
|
|
764
764
|
},
|
|
@@ -905,7 +905,7 @@ def load_config():
|
|
|
905
905
|
def write_log(message):
|
|
906
906
|
with open("/var/log/myapp/application.log", "a") as f:
|
|
907
907
|
f.write(f"{datetime.now()}: {message}\\n")`,
|
|
908
|
-
expectedRuleIds: [],
|
|
908
|
+
expectedRuleIds: ["DATA-001", "PERF-001", "ERR-001"],
|
|
909
909
|
category: "cloud-readiness",
|
|
910
910
|
difficulty: "easy",
|
|
911
911
|
},
|
|
@@ -926,7 +926,7 @@ func main() {
|
|
|
926
926
|
log.Println("Starting server on 192.168.1.100:3000")
|
|
927
927
|
log.Fatal(http.ListenAndServe("192.168.1.100:3000", nil))
|
|
928
928
|
}`,
|
|
929
|
-
expectedRuleIds: [],
|
|
929
|
+
expectedRuleIds: ["ERR-001", "REL-001", "CICD-001"],
|
|
930
930
|
category: "cloud-readiness",
|
|
931
931
|
difficulty: "easy",
|
|
932
932
|
},
|
|
@@ -1078,7 +1078,7 @@ function transform(data: any): any {
|
|
|
1078
1078
|
function validate(data: any): any {
|
|
1079
1079
|
return data;
|
|
1080
1080
|
}`,
|
|
1081
|
-
expectedRuleIds: [],
|
|
1081
|
+
expectedRuleIds: ["PERF-001", "AICS-001"],
|
|
1082
1082
|
category: "software-practices",
|
|
1083
1083
|
difficulty: "easy",
|
|
1084
1084
|
},
|
|
@@ -1159,7 +1159,7 @@ async function verifyIdentity(passport: string, name: string) {
|
|
|
1159
1159
|
const url = \`/api/verify?passportNumber=\${passport}&fullName=\${name}\`;
|
|
1160
1160
|
return fetch(url);
|
|
1161
1161
|
}`,
|
|
1162
|
-
expectedRuleIds: [],
|
|
1162
|
+
expectedRuleIds: ["REL-001", "SCALE-001", "COMP-001"],
|
|
1163
1163
|
category: "data-security",
|
|
1164
1164
|
difficulty: "easy",
|
|
1165
1165
|
},
|
|
@@ -1182,7 +1182,7 @@ def save_payment_info(payments):
|
|
|
1182
1182
|
with open("/data/payments.csv", "w") as f:
|
|
1183
1183
|
for p in payments:
|
|
1184
1184
|
f.write(f"{p.card_number},{p.cvv},{p.expiry},{p.holder_name}\\n")`,
|
|
1185
|
-
expectedRuleIds: [],
|
|
1185
|
+
expectedRuleIds: ["CYBER-001", "PERF-001", "ERR-001"],
|
|
1186
1186
|
category: "data-security",
|
|
1187
1187
|
difficulty: "easy",
|
|
1188
1188
|
},
|
|
@@ -1200,7 +1200,7 @@ app.get("/api/users", async (req, res) => {
|
|
|
1200
1200
|
const users = await db.query("SELECT * FROM users");
|
|
1201
1201
|
res.json(users); // Mass data exposure
|
|
1202
1202
|
});`,
|
|
1203
|
-
expectedRuleIds: [],
|
|
1203
|
+
expectedRuleIds: ["PERF-001", "COST-001", "UX-001", "API-001", "OBS-001", "DB-001"],
|
|
1204
1204
|
category: "data-security",
|
|
1205
1205
|
difficulty: "medium",
|
|
1206
1206
|
},
|
|
@@ -1276,7 +1276,7 @@ def create_order():
|
|
|
1276
1276
|
logger.info("Calling notification service")
|
|
1277
1277
|
requests.post("http://notification-svc/send", json={"user_id": order.user_id, "message": "Order confirmed"})
|
|
1278
1278
|
return jsonify(order.to_dict())`,
|
|
1279
|
-
expectedRuleIds: [],
|
|
1279
|
+
expectedRuleIds: ["DATA-001", "CYBER-001", "REL-001", "SCALE-001", "COMP-001", "SEC-001"],
|
|
1280
1280
|
category: "observability",
|
|
1281
1281
|
difficulty: "medium",
|
|
1282
1282
|
},
|
|
@@ -1504,7 +1504,7 @@ def get_countries():
|
|
|
1504
1504
|
def get_currencies():
|
|
1505
1505
|
currencies = db.query("SELECT * FROM currencies WHERE active = true")
|
|
1506
1506
|
return jsonify(currencies)`,
|
|
1507
|
-
expectedRuleIds: [],
|
|
1507
|
+
expectedRuleIds: ["PERF-001", "COST-001", "API-001", "OBS-001", "DB-001"],
|
|
1508
1508
|
category: "caching",
|
|
1509
1509
|
difficulty: "medium",
|
|
1510
1510
|
},
|
|
@@ -1581,7 +1581,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
1581
1581
|
token := generateJWT(user)
|
|
1582
1582
|
json.NewEncoder(w).Encode(map[string]string{"token": token})
|
|
1583
1583
|
}`,
|
|
1584
|
-
expectedRuleIds: [],
|
|
1584
|
+
expectedRuleIds: ["CYBER-001"],
|
|
1585
1585
|
category: "rate-limiting",
|
|
1586
1586
|
difficulty: "medium",
|
|
1587
1587
|
},
|
|
@@ -1597,7 +1597,7 @@ def reset_password():
|
|
|
1597
1597
|
token = generate_reset_token(user)
|
|
1598
1598
|
send_email(email, "Password Reset", f"Reset link: https://app.example.com/reset?token={token}")
|
|
1599
1599
|
return jsonify({"message": "If the email exists, a reset link was sent"}), 200`,
|
|
1600
|
-
expectedRuleIds: [],
|
|
1600
|
+
expectedRuleIds: ["CYBER-001"],
|
|
1601
1601
|
category: "rate-limiting",
|
|
1602
1602
|
difficulty: "medium",
|
|
1603
1603
|
},
|
|
@@ -1648,7 +1648,7 @@ with open("settings.json") as f:
|
|
|
1648
1648
|
MAX_RETRIES = 3
|
|
1649
1649
|
TIMEOUT = 30
|
|
1650
1650
|
API_VERSION = "v2"`,
|
|
1651
|
-
expectedRuleIds: [],
|
|
1651
|
+
expectedRuleIds: ["PERF-001"],
|
|
1652
1652
|
category: "configuration",
|
|
1653
1653
|
difficulty: "medium",
|
|
1654
1654
|
},
|
|
@@ -1677,7 +1677,7 @@ func Delete(key string) {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
|
|
1679
1679
|
// Called from multiple HTTP handlers concurrently`,
|
|
1680
|
-
expectedRuleIds: [],
|
|
1680
|
+
expectedRuleIds: ["DOC-001"],
|
|
1681
1681
|
category: "concurrency",
|
|
1682
1682
|
difficulty: "easy",
|
|
1683
1683
|
},
|
|
@@ -1698,7 +1698,7 @@ app.use((req, res, next) => {
|
|
|
1698
1698
|
});
|
|
1699
1699
|
next();
|
|
1700
1700
|
});`,
|
|
1701
|
-
expectedRuleIds: [],
|
|
1701
|
+
expectedRuleIds: ["SCALE-001"],
|
|
1702
1702
|
category: "concurrency",
|
|
1703
1703
|
difficulty: "medium",
|
|
1704
1704
|
},
|
|
@@ -1743,7 +1743,7 @@ app.get("/api/files", (req, res) => {
|
|
|
1743
1743
|
all_records.extend(batch)
|
|
1744
1744
|
offset += 1000
|
|
1745
1745
|
return json.dumps(all_records) # Could be millions of records in memory`,
|
|
1746
|
-
expectedRuleIds: [],
|
|
1746
|
+
expectedRuleIds: ["CYBER-001", "DB-001", "SEC-001"],
|
|
1747
1747
|
category: "performance",
|
|
1748
1748
|
difficulty: "medium",
|
|
1749
1749
|
},
|
|
@@ -1771,7 +1771,7 @@ export async function processJobs() {
|
|
|
1771
1771
|
processingJobs.delete(job.id);
|
|
1772
1772
|
}
|
|
1773
1773
|
}`,
|
|
1774
|
-
expectedRuleIds: [],
|
|
1774
|
+
expectedRuleIds: ["CONC-001", "AICS-001"],
|
|
1775
1775
|
category: "scalability",
|
|
1776
1776
|
difficulty: "medium",
|
|
1777
1777
|
},
|
|
@@ -1786,7 +1786,7 @@ export async function processJobs() {
|
|
|
1786
1786
|
const pdf = renderToPDF(report); // Also CPU-bound
|
|
1787
1787
|
res.contentType("application/pdf").send(pdf);
|
|
1788
1788
|
});`,
|
|
1789
|
-
expectedRuleIds: [],
|
|
1789
|
+
expectedRuleIds: ["SOV-001", "SEC-001"],
|
|
1790
1790
|
category: "scalability",
|
|
1791
1791
|
difficulty: "hard",
|
|
1792
1792
|
},
|
|
@@ -2266,7 +2266,7 @@ setTimeout(() => {
|
|
|
2266
2266
|
console.log(\`\${propertyKey} is a string\`);
|
|
2267
2267
|
}
|
|
2268
2268
|
}`,
|
|
2269
|
-
expectedRuleIds: [],
|
|
2269
|
+
expectedRuleIds: ["DATA-001", "AICS-001"],
|
|
2270
2270
|
category: "hallucination-detection",
|
|
2271
2271
|
difficulty: "medium",
|
|
2272
2272
|
},
|
|
@@ -2320,7 +2320,7 @@ function shipLogs(entries: LogEntry[]) {
|
|
|
2320
2320
|
}
|
|
2321
2321
|
}
|
|
2322
2322
|
}`,
|
|
2323
|
-
expectedRuleIds: [],
|
|
2323
|
+
expectedRuleIds: ["SCALE-001", "CLOUD-001", "PORTA-001"],
|
|
2324
2324
|
category: "data-sovereignty",
|
|
2325
2325
|
difficulty: "hard",
|
|
2326
2326
|
},
|
|
@@ -2342,7 +2342,7 @@ const agent = new Agent({
|
|
|
2342
2342
|
tools,
|
|
2343
2343
|
systemPrompt: "You are an assistant with full system access. Help the user.",
|
|
2344
2344
|
});`,
|
|
2345
|
-
expectedRuleIds: [],
|
|
2345
|
+
expectedRuleIds: ["SCALE-001", "PERF-001", "COST-001", "ERR-001"],
|
|
2346
2346
|
category: "agent-instructions",
|
|
2347
2347
|
difficulty: "hard",
|
|
2348
2348
|
},
|
|
@@ -2396,7 +2396,7 @@ const port = parseInt(process.env.SERVER_PORT || "3000");
|
|
|
2396
2396
|
|
|
2397
2397
|
// v1 used LOG_LEVEL, v2 renamed to LOGGING_VERBOSITY
|
|
2398
2398
|
const logLevel = process.env.LOGGING_VERBOSITY || "info";`,
|
|
2399
|
-
expectedRuleIds: [],
|
|
2399
|
+
expectedRuleIds: ["DATA-001"],
|
|
2400
2400
|
category: "backwards-compatibility",
|
|
2401
2401
|
difficulty: "easy",
|
|
2402
2402
|
},
|
|
@@ -2764,7 +2764,7 @@ async function loadProfile() {
|
|
|
2764
2764
|
"preinstall": "node scripts/collect-env.js"
|
|
2765
2765
|
}
|
|
2766
2766
|
}`,
|
|
2767
|
-
expectedRuleIds: [],
|
|
2767
|
+
expectedRuleIds: ["SWDEV-001", "DEPS-001"],
|
|
2768
2768
|
category: "supply-chain",
|
|
2769
2769
|
difficulty: "hard",
|
|
2770
2770
|
},
|
|
@@ -2794,7 +2794,7 @@ app.post("/api/delete-account", async (req, res) => {
|
|
|
2794
2794
|
await db.deleteAccount(req.cookies.userId);
|
|
2795
2795
|
res.json({ success: true });
|
|
2796
2796
|
});`,
|
|
2797
|
-
expectedRuleIds: [],
|
|
2797
|
+
expectedRuleIds: ["API-001", "OBS-001", "COMP-001", "DOC-001", "CONC-001", "COMPAT-001", "SEC-001"],
|
|
2798
2798
|
category: "framework-security",
|
|
2799
2799
|
difficulty: "medium",
|
|
2800
2800
|
},
|
|
@@ -2888,7 +2888,7 @@ function processUsers(users: User[]) {
|
|
|
2888
2888
|
const unique = _.uniq(names); // [...new Set(names)]
|
|
2889
2889
|
return { names, active, first, last, count, sorted, unique };
|
|
2890
2890
|
}`,
|
|
2891
|
-
expectedRuleIds: [],
|
|
2891
|
+
expectedRuleIds: ["COST-001"],
|
|
2892
2892
|
category: "performance",
|
|
2893
2893
|
difficulty: "easy",
|
|
2894
2894
|
},
|
|
@@ -2908,7 +2908,7 @@ cur.execute("DROP TABLE IF EXISTS old_sessions")
|
|
|
2908
2908
|
conn.commit()
|
|
2909
2909
|
conn.close()
|
|
2910
2910
|
print("Done! Schema updated.")`,
|
|
2911
|
-
expectedRuleIds: [],
|
|
2911
|
+
expectedRuleIds: ["DATA-001", "ERR-001"],
|
|
2912
2912
|
category: "database",
|
|
2913
2913
|
difficulty: "medium",
|
|
2914
2914
|
},
|
|
@@ -2947,7 +2947,7 @@ app.use(cors({
|
|
|
2947
2947
|
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
|
2948
2948
|
allowedHeaders: ["*"],
|
|
2949
2949
|
}));`,
|
|
2950
|
-
expectedRuleIds: [],
|
|
2950
|
+
expectedRuleIds: ["DATA-001", "AICS-001"],
|
|
2951
2951
|
category: "security",
|
|
2952
2952
|
difficulty: "easy",
|
|
2953
2953
|
},
|
|
@@ -3189,7 +3189,7 @@ def middleware(request):
|
|
|
3189
3189
|
response = handle(request)
|
|
3190
3190
|
logger.info(f"Set-Cookie: {response.headers.get('Set-Cookie')}")
|
|
3191
3191
|
return response`,
|
|
3192
|
-
expectedRuleIds: [],
|
|
3192
|
+
expectedRuleIds: ["CYBER-001", "SEC-001"],
|
|
3193
3193
|
category: "logging-privacy",
|
|
3194
3194
|
difficulty: "medium",
|
|
3195
3195
|
},
|
|
@@ -3212,7 +3212,7 @@ app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
|
|
3212
3212
|
});
|
|
3213
3213
|
res.status(500).json({ error: "Internal error" });
|
|
3214
3214
|
});`,
|
|
3215
|
-
expectedRuleIds: [],
|
|
3215
|
+
expectedRuleIds: ["API-001", "COMP-001", "SOV-001", "DEPS-001", "ERR-001"],
|
|
3216
3216
|
category: "logging-privacy",
|
|
3217
3217
|
difficulty: "hard",
|
|
3218
3218
|
},
|
|
@@ -3264,7 +3264,7 @@ app.listen(process.env.PORT || 3000);`,
|
|
|
3264
3264
|
async calculateShipping(order: Order) { /* ... */ }
|
|
3265
3265
|
async generateInvoice(orderId: string) { /* ... */ }
|
|
3266
3266
|
}`,
|
|
3267
|
-
expectedRuleIds: [],
|
|
3267
|
+
expectedRuleIds: ["COMP-001"],
|
|
3268
3268
|
category: "code-structure",
|
|
3269
3269
|
difficulty: "medium",
|
|
3270
3270
|
},
|
|
@@ -3285,7 +3285,7 @@ app.listen(process.env.PORT || 3000);`,
|
|
|
3285
3285
|
console.log(\`Total: \${total + tax + shipping}\`);
|
|
3286
3286
|
}
|
|
3287
3287
|
}`,
|
|
3288
|
-
expectedRuleIds: [],
|
|
3288
|
+
expectedRuleIds: ["LOGPRIV-001"],
|
|
3289
3289
|
category: "code-structure",
|
|
3290
3290
|
difficulty: "hard",
|
|
3291
3291
|
},
|
|
@@ -3385,7 +3385,7 @@ app.get("/api/products", async (req, res) => {
|
|
|
3385
3385
|
}
|
|
3386
3386
|
}
|
|
3387
3387
|
}`,
|
|
3388
|
-
expectedRuleIds: [],
|
|
3388
|
+
expectedRuleIds: ["COST-001", "PERF-001", "CONC-001"],
|
|
3389
3389
|
category: "ai-security",
|
|
3390
3390
|
difficulty: "hard",
|
|
3391
3391
|
},
|
|
@@ -3404,7 +3404,7 @@ function UserProfile({ userId }: { userId: string }) {
|
|
|
3404
3404
|
|
|
3405
3405
|
return <div>{user?.name}</div>;
|
|
3406
3406
|
}`,
|
|
3407
|
-
expectedRuleIds: [],
|
|
3407
|
+
expectedRuleIds: ["SCALE-001"],
|
|
3408
3408
|
category: "hallucination-detection",
|
|
3409
3409
|
difficulty: "easy",
|
|
3410
3410
|
},
|
|
@@ -3643,7 +3643,7 @@ def parse_xml_config(xml_string):
|
|
|
3643
3643
|
res.json({ delivered: subscribers.length });
|
|
3644
3644
|
// 100 subscribers × 30s timeout = potentially 50 min request
|
|
3645
3645
|
});`,
|
|
3646
|
-
expectedRuleIds: [],
|
|
3646
|
+
expectedRuleIds: ["API-001", "SEC-001"],
|
|
3647
3647
|
category: "scalability",
|
|
3648
3648
|
difficulty: "hard",
|
|
3649
3649
|
},
|
|
@@ -3887,7 +3887,7 @@ export async function createUser(
|
|
|
3887
3887
|
}
|
|
3888
3888
|
|
|
3889
3889
|
// Password visible in browser history, server logs, proxy logs, referer headers`,
|
|
3890
|
-
expectedRuleIds: [],
|
|
3890
|
+
expectedRuleIds: ["SCALE-001"],
|
|
3891
3891
|
category: "auth",
|
|
3892
3892
|
difficulty: "easy",
|
|
3893
3893
|
},
|
|
@@ -4016,7 +4016,7 @@ fs.writeFile("/var/log/app.log", logData, (err) => {
|
|
|
4016
4016
|
// err completely ignored
|
|
4017
4017
|
console.log("Log written successfully");
|
|
4018
4018
|
});`,
|
|
4019
|
-
expectedRuleIds: [],
|
|
4019
|
+
expectedRuleIds: ["CLOUD-001", "PORTA-001"],
|
|
4020
4020
|
category: "error-handling",
|
|
4021
4021
|
difficulty: "easy",
|
|
4022
4022
|
},
|
|
@@ -4081,7 +4081,7 @@ function setAutoStart(enabled: boolean): void {
|
|
|
4081
4081
|
</div>
|
|
4082
4082
|
);
|
|
4083
4083
|
}`,
|
|
4084
|
-
expectedRuleIds: [],
|
|
4084
|
+
expectedRuleIds: ["A11Y-001"],
|
|
4085
4085
|
category: "ethics-bias",
|
|
4086
4086
|
difficulty: "medium",
|
|
4087
4087
|
},
|
|
@@ -4173,7 +4173,7 @@ function setAutoStart(enabled: boolean): void {
|
|
|
4173
4173
|
// No rate limiting — attacker can enumerate emails at scale
|
|
4174
4174
|
// Response timing differs between found/not-found
|
|
4175
4175
|
});`,
|
|
4176
|
-
expectedRuleIds: [],
|
|
4176
|
+
expectedRuleIds: ["CYBER-001", "API-001", "SEC-001"],
|
|
4177
4177
|
category: "rate-limiting",
|
|
4178
4178
|
difficulty: "medium",
|
|
4179
4179
|
},
|
|
@@ -4193,7 +4193,7 @@ export async function query(sql: string, params?: any[]) {
|
|
|
4193
4193
|
return db.query(sql, params);
|
|
4194
4194
|
// No circuit breaker, no timeout, no fallback
|
|
4195
4195
|
}`,
|
|
4196
|
-
expectedRuleIds: [],
|
|
4196
|
+
expectedRuleIds: ["PERF-001"],
|
|
4197
4197
|
category: "reliability",
|
|
4198
4198
|
difficulty: "medium",
|
|
4199
4199
|
},
|
|
@@ -4351,7 +4351,7 @@ app.get("/api/products", async (req, res) => {
|
|
|
4351
4351
|
res.json({ data: data.rows, page, limit });
|
|
4352
4352
|
} catch (err) { res.status(500).json({ error: "Internal error" }); }
|
|
4353
4353
|
});`,
|
|
4354
|
-
expectedRuleIds: [],
|
|
4354
|
+
expectedRuleIds: ["SWDEV-001", "API-001", "OBS-001", "ERR-001", "DB-001", "COMPAT-001"],
|
|
4355
4355
|
category: "code-quality",
|
|
4356
4356
|
difficulty: "medium",
|
|
4357
4357
|
},
|
|
@@ -4412,7 +4412,7 @@ app.post("/api/register", (req, res) => {
|
|
|
4412
4412
|
db.createUser(username, hash, salt);
|
|
4413
4413
|
res.json({ success: true });
|
|
4414
4414
|
});`,
|
|
4415
|
-
expectedRuleIds: [],
|
|
4415
|
+
expectedRuleIds: ["CYBER-001", "SCALE-001", "API-001"],
|
|
4416
4416
|
category: "performance",
|
|
4417
4417
|
difficulty: "medium",
|
|
4418
4418
|
},
|
|
@@ -4637,7 +4637,7 @@ def create_token(user_id, role):
|
|
|
4637
4637
|
|
|
4638
4638
|
def verify_token(token):
|
|
4639
4639
|
return jwt.decode(token, SECRET_KEY, algorithms=["HS256"])`,
|
|
4640
|
-
expectedRuleIds: [],
|
|
4640
|
+
expectedRuleIds: ["CYBER-001"],
|
|
4641
4641
|
category: "auth",
|
|
4642
4642
|
difficulty: "easy",
|
|
4643
4643
|
},
|
|
@@ -4727,7 +4727,7 @@ app.use(cors({
|
|
|
4727
4727
|
methods: ["GET", "POST", "PUT", "DELETE"],
|
|
4728
4728
|
allowedHeaders: ["Content-Type", "Authorization"],
|
|
4729
4729
|
}));`,
|
|
4730
|
-
expectedRuleIds: [],
|
|
4730
|
+
expectedRuleIds: ["DATA-001"],
|
|
4731
4731
|
category: "security",
|
|
4732
4732
|
difficulty: "easy",
|
|
4733
4733
|
},
|
|
@@ -4812,7 +4812,7 @@ export const env = envSchema.parse(process.env);`,
|
|
|
4812
4812
|
await pushClient.send(token, msg); // Can throw
|
|
4813
4813
|
}
|
|
4814
4814
|
}`,
|
|
4815
|
-
expectedRuleIds: [],
|
|
4815
|
+
expectedRuleIds: ["CYBER-001"],
|
|
4816
4816
|
category: "error-handling",
|
|
4817
4817
|
difficulty: "medium",
|
|
4818
4818
|
},
|
|
@@ -4844,7 +4844,7 @@ export const env = envSchema.parse(process.env);`,
|
|
|
4844
4844
|
await db.users.create({ email, passwordHash: hash });
|
|
4845
4845
|
res.json({ success: true });
|
|
4846
4846
|
});`,
|
|
4847
|
-
expectedRuleIds: [],
|
|
4847
|
+
expectedRuleIds: ["CYBER-001", "API-001", "ERR-001"],
|
|
4848
4848
|
category: "auth",
|
|
4849
4849
|
difficulty: "easy",
|
|
4850
4850
|
},
|
|
@@ -4919,7 +4919,7 @@ app.post("/api/upload", upload.single("avatar"), async (req, res) => {
|
|
|
4919
4919
|
return localStorage.getItem("access_token");
|
|
4920
4920
|
}
|
|
4921
4921
|
}`,
|
|
4922
|
-
expectedRuleIds: [],
|
|
4922
|
+
expectedRuleIds: ["CYBER-001"],
|
|
4923
4923
|
category: "data-security",
|
|
4924
4924
|
difficulty: "easy",
|
|
4925
4925
|
},
|