configsentry 0.0.21 → 0.0.23
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.md +7 -5
- package/dist/cli.js +26 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npx configsentry ./docker-compose.yml
|
|
|
15
15
|
### GitHub Action (minimal)
|
|
16
16
|
|
|
17
17
|
```yml
|
|
18
|
-
- uses: alfredMorgenstern/configsentry@v0.0.
|
|
18
|
+
- uses: alfredMorgenstern/configsentry@v0.0.21
|
|
19
19
|
with:
|
|
20
20
|
target: .
|
|
21
21
|
```
|
|
@@ -27,7 +27,7 @@ permissions:
|
|
|
27
27
|
contents: read
|
|
28
28
|
security-events: write
|
|
29
29
|
|
|
30
|
-
- uses: alfredMorgenstern/configsentry@v0.0.
|
|
30
|
+
- uses: alfredMorgenstern/configsentry@v0.0.21
|
|
31
31
|
with:
|
|
32
32
|
target: .
|
|
33
33
|
sarif: true
|
|
@@ -69,13 +69,13 @@ node dist/cli.js --target ./docker-compose.yml
|
|
|
69
69
|
### JSON output (CI / tooling)
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
node dist/cli.js --target ./docker-compose.yml --json
|
|
72
|
+
node dist/cli.js --target ./docker-compose.yml --format json
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### SARIF output (GitHub Code Scanning)
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
node dist/cli.js --target ./docker-compose.yml --sarif > configsentry.sarif.json
|
|
78
|
+
node dist/cli.js --target ./docker-compose.yml --format sarif > configsentry.sarif.json
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
## Baselines (incremental adoption)
|
|
@@ -92,6 +92,8 @@ Then suppress baseline findings in CI:
|
|
|
92
92
|
node dist/cli.js --target ./docker-compose.yml --baseline .configsentry-baseline.json
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
Tip: for machine output use `--format json` / `--format sarif`.
|
|
96
|
+
|
|
95
97
|
## Docs
|
|
96
98
|
|
|
97
99
|
- GitHub Action usage examples: [`docs/action-usage.md`](docs/action-usage.md)
|
|
@@ -144,7 +146,7 @@ jobs:
|
|
|
144
146
|
runs-on: ubuntu-latest
|
|
145
147
|
steps:
|
|
146
148
|
- uses: actions/checkout@v4
|
|
147
|
-
- uses: alfredMorgenstern/configsentry@v0.0.
|
|
149
|
+
- uses: alfredMorgenstern/configsentry@v0.0.21
|
|
148
150
|
with:
|
|
149
151
|
target: .
|
|
150
152
|
# optional: baseline: .configsentry-baseline.json
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,17 @@ function parseArgs(argv) {
|
|
|
14
14
|
const version = args.includes('-v') || args.includes('--version');
|
|
15
15
|
const json = args.includes('--json');
|
|
16
16
|
const sarif = args.includes('--sarif');
|
|
17
|
-
const
|
|
17
|
+
const formatIdx = args.indexOf('--format');
|
|
18
|
+
const format = formatIdx >= 0 ? args[formatIdx + 1] : undefined;
|
|
19
|
+
let output = json ? 'json' : sarif ? 'sarif' : 'pretty';
|
|
20
|
+
if (format) {
|
|
21
|
+
if (format === 'pretty' || format === 'json' || format === 'sarif') {
|
|
22
|
+
output = format;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Keep output as-is; main() will print a clear error.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
const baselineIdx = args.indexOf('--baseline');
|
|
19
29
|
const baselinePath = baselineIdx >= 0 ? args[baselineIdx + 1] : undefined;
|
|
20
30
|
const writeBaselineIdx = args.indexOf('--write-baseline');
|
|
@@ -25,18 +35,19 @@ function parseArgs(argv) {
|
|
|
25
35
|
// Back-compat: first positional arg
|
|
26
36
|
const targetFromPositional = args.find((a) => !a.startsWith('-'));
|
|
27
37
|
const target = targetFromFlag ?? targetFromPositional;
|
|
28
|
-
return { args, help, version, output, baselinePath, writeBaselinePath, target };
|
|
38
|
+
return { args, help, version, output, format, baselinePath, writeBaselinePath, target };
|
|
29
39
|
}
|
|
30
40
|
function usage() {
|
|
31
41
|
console.log(`ConfigSentry (MVP)
|
|
32
42
|
|
|
33
43
|
Usage:
|
|
34
|
-
configsentry <file-or-dir> [--json|--sarif] [--baseline <file>] [--write-baseline <file>]
|
|
35
|
-
configsentry --target <file-or-dir> [--json|--sarif] [--baseline <file>] [--write-baseline <file>]
|
|
44
|
+
configsentry <file-or-dir> [--json|--sarif|--format <pretty|json|sarif>] [--baseline <file>] [--write-baseline <file>]
|
|
45
|
+
configsentry --target <file-or-dir> [--json|--sarif|--format <pretty|json|sarif>] [--baseline <file>] [--write-baseline <file>]
|
|
36
46
|
|
|
37
47
|
Output:
|
|
38
|
-
--json
|
|
39
|
-
--sarif
|
|
48
|
+
--json machine-readable findings (deprecated; use --format json)
|
|
49
|
+
--sarif SARIF 2.1.0 (for GitHub code scanning) (deprecated; use --format sarif)
|
|
50
|
+
--format <pretty|json|sarif>
|
|
40
51
|
|
|
41
52
|
Baselines:
|
|
42
53
|
--baseline <file> suppress findings present in a baseline file
|
|
@@ -49,7 +60,7 @@ Exit codes:
|
|
|
49
60
|
`);
|
|
50
61
|
}
|
|
51
62
|
async function main() {
|
|
52
|
-
const { args, help, version, output, baselinePath, writeBaselinePath, target } = parseArgs(process.argv);
|
|
63
|
+
const { args, help, version, output, format, baselinePath, writeBaselinePath, target } = parseArgs(process.argv);
|
|
53
64
|
if (version) {
|
|
54
65
|
try {
|
|
55
66
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -67,13 +78,16 @@ async function main() {
|
|
|
67
78
|
usage();
|
|
68
79
|
process.exit(0);
|
|
69
80
|
}
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
if (format && format !== 'pretty' && format !== 'json' && format !== 'sarif') {
|
|
82
|
+
console.error(`Error: invalid --format '${format}'. Expected: pretty | json | sarif`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
if (args.includes('--json') && args.includes('--sarif')) {
|
|
86
|
+
console.error('Error: choose only one output mode: --json, --sarif, or --format');
|
|
73
87
|
process.exit(1);
|
|
74
88
|
}
|
|
75
|
-
if (
|
|
76
|
-
console.error('Error: choose only one output mode: --json or --
|
|
89
|
+
if (format && (args.includes('--json') || args.includes('--sarif'))) {
|
|
90
|
+
console.error('Error: choose only one output mode: --json, --sarif, or --format');
|
|
77
91
|
process.exit(1);
|
|
78
92
|
}
|
|
79
93
|
if (!target) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "configsentry",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Developer-first guardrails for docker-compose.yml (security + ops footguns).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"node": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "node
|
|
29
|
+
"test": "node scripts/run-tests.mjs",
|
|
30
30
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
31
31
|
"prepack": "npm run build",
|
|
32
32
|
"start": "node dist/cli.js",
|