clckernel 1.2.6 → 1.2.8
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/README.es.md +51 -118
- package/README.md +48 -116
- package/package.json +14 -2
- package/src/adapters/agent-os.js +183 -0
- package/src/catalog.js +16 -0
- package/src/detector.js +2 -0
- package/src/index.js +11 -0
- package/src/ui.js +79 -35
- package/tools/audit.js +0 -0
- package/tools/audit.py +0 -0
- package/tools/check_custom.js +0 -0
- package/tools/check_custom.py +0 -0
- package/tools/check_db_efficiency.py +0 -0
- package/tools/check_domain_data.js +100 -0
- package/tools/check_hitl.js +93 -0
- package/tools/check_responsive.js +0 -0
- package/tools/check_seo.js +1 -1
- package/tools/check_symlinks.js +76 -0
- package/tools/scan_secrets.js +12 -1
- package/tools/scan_secrets.py +0 -0
- package/AGENTS.md +0 -124
- package/docs/Journal/001-adr-clckernel-governance.md +0 -18
- package/test/adapters/astro.test.js +0 -102
- package/test/adapters/base.test.js +0 -86
- package/test/adapters/django.test.js +0 -95
- package/test/adapters/fastapi.test.js +0 -88
- package/test/adapters/go.test.js +0 -81
- package/test/adapters/laravel.test.js +0 -106
- package/test/adapters/nextjs.test.js +0 -113
- package/test/adapters/rails.test.js +0 -108
- package/test/adapters/rust.test.js +0 -83
- package/test/catalog.test.js +0 -170
- package/test/config.test.js +0 -512
- package/test/detector.test.js +0 -345
- package/test/doctor.test.js +0 -302
- package/test/generator.test.js +0 -419
- package/test/guards_new.test.js +0 -95
- package/test/helpers.js +0 -36
- package/test/integration/cli-flow.test.js +0 -270
- package/test/technologies/celery_guard.test.js +0 -185
- package/test/technologies/detector.test.js +0 -342
- package/test/technologies/docker_guard.test.js +0 -187
- package/test/technologies/integration.test.js +0 -123
- package/test/technologies/postgres_guard.test.js +0 -87
- package/test/technologies/redis_guard.test.js +0 -128
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLC Forge — PostgreSQL guard integration tests.
|
|
3
|
-
* Tests postgres_guard.py via subprocess against fixture projects.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { describe, it } = require('node:test');
|
|
7
|
-
const assert = require('node:assert');
|
|
8
|
-
const { spawn, spawnSync } = require('child_process');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const { createTmpProject, teardown } = require('../helpers');
|
|
12
|
-
|
|
13
|
-
function runPostgresGuard(targetDir) {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const script = path.join(__dirname, '../../tools/postgres_guard.py');
|
|
16
|
-
const proc = spawn('python3', [script, targetDir], { cwd: targetDir });
|
|
17
|
-
let stdout = '';
|
|
18
|
-
proc.stdout.on('data', (d) => (stdout += d));
|
|
19
|
-
proc.on('close', () => {
|
|
20
|
-
try {
|
|
21
|
-
resolve(JSON.parse(stdout));
|
|
22
|
-
} catch {
|
|
23
|
-
reject(new Error(`Failed to parse: ${stdout}`));
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
proc.on('error', reject);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function initGitRepo(dir) {
|
|
31
|
-
fs.writeFileSync(path.join(dir, '.gitkeep'), '');
|
|
32
|
-
spawnSync('git', ['init'], { cwd: dir });
|
|
33
|
-
spawnSync('git', ['config', 'user.email', 'test@test.com'], { cwd: dir });
|
|
34
|
-
spawnSync('git', ['config', 'user.name', 'Test'], { cwd: dir });
|
|
35
|
-
spawnSync('git', ['add', '.'], { cwd: dir });
|
|
36
|
-
spawnSync('git', ['commit', '-m', 'initial'], { cwd: dir });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
describe('postgres_guard', () => {
|
|
40
|
-
it('skips when no git repo', async () => {
|
|
41
|
-
const dir = createTmpProject({});
|
|
42
|
-
try {
|
|
43
|
-
const result = await runPostgresGuard(dir);
|
|
44
|
-
assert.strictEqual(result.skipped, true);
|
|
45
|
-
} finally {
|
|
46
|
-
teardown(dir);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('no violations: no SQL queries in project', async () => {
|
|
51
|
-
const dir = createTmpProject({});
|
|
52
|
-
initGitRepo(dir);
|
|
53
|
-
|
|
54
|
-
fs.writeFileSync(
|
|
55
|
-
path.join(dir, 'main.py'),
|
|
56
|
-
`def hello():\n return "world"\n`
|
|
57
|
-
);
|
|
58
|
-
spawnSync('git', ['add', 'main.py'], { cwd: dir });
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const result = await runPostgresGuard(dir);
|
|
62
|
-
assert.strictEqual(result.exit_code, 0);
|
|
63
|
-
assert.strictEqual(result.data.findings.length, 0, 'should have no findings');
|
|
64
|
-
} finally {
|
|
65
|
-
teardown(dir);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('no violations: no postgres in project', async () => {
|
|
70
|
-
const dir = createTmpProject({});
|
|
71
|
-
initGitRepo(dir);
|
|
72
|
-
|
|
73
|
-
fs.writeFileSync(
|
|
74
|
-
path.join(dir, 'main.py'),
|
|
75
|
-
`def hello():\n return "world"\n`
|
|
76
|
-
);
|
|
77
|
-
spawnSync('git', ['add', 'main.py'], { cwd: dir });
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
const result = await runPostgresGuard(dir);
|
|
81
|
-
assert.strictEqual(result.exit_code, 0);
|
|
82
|
-
assert.strictEqual(result.data.findings.length, 0, 'should have no findings');
|
|
83
|
-
} finally {
|
|
84
|
-
teardown(dir);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLC Forge — Redis guard integration tests.
|
|
3
|
-
* Tests redis_guard.py via subprocess against fixture projects.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { describe, it } = require('node:test');
|
|
7
|
-
const assert = require('node:assert');
|
|
8
|
-
const { spawn, spawnSync } = require('child_process');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const { createTmpProject, teardown } = require('../helpers');
|
|
12
|
-
|
|
13
|
-
function runRedisGuard(targetDir) {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const script = path.join(__dirname, '../../tools/redis_guard.py');
|
|
16
|
-
const proc = spawn('python3', [script, targetDir], { cwd: targetDir });
|
|
17
|
-
let stdout = '';
|
|
18
|
-
proc.stdout.on('data', (d) => (stdout += d));
|
|
19
|
-
proc.on('close', () => {
|
|
20
|
-
try {
|
|
21
|
-
resolve(JSON.parse(stdout));
|
|
22
|
-
} catch {
|
|
23
|
-
reject(new Error(`Failed to parse: ${stdout}`));
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
proc.on('error', reject);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function initGitRepo(dir) {
|
|
31
|
-
fs.writeFileSync(path.join(dir, '.gitkeep'), '');
|
|
32
|
-
spawnSync('git', ['init'], { cwd: dir });
|
|
33
|
-
spawnSync('git', ['config', 'user.email', 'test@test.com'], { cwd: dir });
|
|
34
|
-
spawnSync('git', ['config', 'user.name', 'Test'], { cwd: dir });
|
|
35
|
-
spawnSync('git', ['add', '.'], { cwd: dir });
|
|
36
|
-
spawnSync('git', ['commit', '-m', 'initial'], { cwd: dir });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
describe('redis_guard', () => {
|
|
40
|
-
it('skips when no git repo', async () => {
|
|
41
|
-
const dir = createTmpProject({});
|
|
42
|
-
try {
|
|
43
|
-
const result = await runRedisGuard(dir);
|
|
44
|
-
assert.strictEqual(result.skipped, true);
|
|
45
|
-
} finally {
|
|
46
|
-
teardown(dir);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('finds violations: decode_responses=True without password', async () => {
|
|
51
|
-
const dir = createTmpProject({});
|
|
52
|
-
initGitRepo(dir);
|
|
53
|
-
|
|
54
|
-
fs.writeFileSync(
|
|
55
|
-
path.join(dir, 'cache.py'),
|
|
56
|
-
`from redis import Redis\nr = Redis(host="localhost", port=6379, decode_responses=True)\n`
|
|
57
|
-
);
|
|
58
|
-
spawnSync('git', ['add', 'cache.py'], { cwd: dir });
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const result = await runRedisGuard(dir);
|
|
62
|
-
assert.strictEqual(result.exit_code, 1);
|
|
63
|
-
const issues = result.data.findings.map((f) => f.issue);
|
|
64
|
-
assert.ok(issues.includes('decode_responses_without_password'), 'should detect decode_responses without password');
|
|
65
|
-
} finally {
|
|
66
|
-
teardown(dir);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('finds violations: missing socket_connect_timeout', async () => {
|
|
71
|
-
const dir = createTmpProject({});
|
|
72
|
-
initGitRepo(dir);
|
|
73
|
-
|
|
74
|
-
fs.writeFileSync(
|
|
75
|
-
path.join(dir, 'cache.py'),
|
|
76
|
-
`from redis import Redis\nr = Redis(host="localhost", port=6379, decode_responses=False, password="secret")\n`
|
|
77
|
-
);
|
|
78
|
-
spawnSync('git', ['add', 'cache.py'], { cwd: dir });
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
const result = await runRedisGuard(dir);
|
|
82
|
-
assert.strictEqual(result.exit_code, 1);
|
|
83
|
-
const issues = result.data.findings.map((f) => f.issue);
|
|
84
|
-
assert.ok(issues.includes('missing_socket_connect_timeout'), 'should detect missing timeout');
|
|
85
|
-
} finally {
|
|
86
|
-
teardown(dir);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('finds violations: hardcoded Redis host without timeout', async () => {
|
|
91
|
-
const dir = createTmpProject({});
|
|
92
|
-
initGitRepo(dir);
|
|
93
|
-
|
|
94
|
-
fs.writeFileSync(
|
|
95
|
-
path.join(dir, 'cache.py'),
|
|
96
|
-
`from redis import Redis\nr = Redis(host="localhost", port=6379)\n`
|
|
97
|
-
);
|
|
98
|
-
spawnSync('git', ['add', 'cache.py'], { cwd: dir });
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
const result = await runRedisGuard(dir);
|
|
102
|
-
assert.strictEqual(result.exit_code, 1);
|
|
103
|
-
const issues = result.data.findings.map((f) => f.issue);
|
|
104
|
-
assert.ok(issues.includes('missing_socket_connect_timeout'), 'should detect missing timeout');
|
|
105
|
-
} finally {
|
|
106
|
-
teardown(dir);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('no violations: no Redis in project', async () => {
|
|
111
|
-
const dir = createTmpProject({});
|
|
112
|
-
initGitRepo(dir);
|
|
113
|
-
|
|
114
|
-
fs.writeFileSync(
|
|
115
|
-
path.join(dir, 'main.py'),
|
|
116
|
-
`def hello():\n return "world"\n`
|
|
117
|
-
);
|
|
118
|
-
spawnSync('git', ['add', 'main.py'], { cwd: dir });
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
const result = await runRedisGuard(dir);
|
|
122
|
-
assert.strictEqual(result.exit_code, 0);
|
|
123
|
-
assert.strictEqual(result.data.findings.length, 0, 'should have no findings');
|
|
124
|
-
} finally {
|
|
125
|
-
teardown(dir);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|