flecto 1.0.1 → 1.0.2
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/index.js +7 -2
- package/package.json +3 -2
- package/src/policy.js +4 -2
package/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { program } from 'commander';
|
|
4
4
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
5
|
-
import { resolve, relative } from 'path';
|
|
5
|
+
import { resolve, relative, dirname, join } from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
6
7
|
import { createHash } from 'crypto';
|
|
7
8
|
import { execFileSync } from 'child_process';
|
|
8
9
|
import chalk from 'chalk';
|
|
@@ -16,6 +17,10 @@ import { createEnvelope } from './src/envelope.js';
|
|
|
16
17
|
import { evaluatePolicies, highestSeverity } from './src/policy.js';
|
|
17
18
|
import { loadRcConfig, resolveEffectiveOptions, resolveFiles, initRcFile } from './src/config.js';
|
|
18
19
|
|
|
20
|
+
const PKG = JSON.parse(
|
|
21
|
+
readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf8'),
|
|
22
|
+
);
|
|
23
|
+
|
|
19
24
|
const SNAPSHOT_DIR = '.flecto-snapshots';
|
|
20
25
|
|
|
21
26
|
function snapshotIdForPath(absPath) {
|
|
@@ -151,7 +156,7 @@ function printCiOutput(results, format) {
|
|
|
151
156
|
program
|
|
152
157
|
.name('flecto')
|
|
153
158
|
.description('Flecto — semantic config watcher for meaningful structured file changes')
|
|
154
|
-
.version(
|
|
159
|
+
.version(PKG.version);
|
|
155
160
|
|
|
156
161
|
program
|
|
157
162
|
.command('watch [files...]')
|
package/package.json
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.2",
|
|
8
8
|
"description": "Flecto — semantic config watcher that reports meaningful changes in plain English",
|
|
9
|
+
"license": "MIT",
|
|
9
10
|
"keywords": [
|
|
10
11
|
"flecto",
|
|
11
12
|
"cli",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"index.js",
|
|
36
37
|
"src/**/*",
|
|
37
38
|
"README.md",
|
|
38
|
-
"
|
|
39
|
+
"LICENSE"
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|
|
41
42
|
"test": "node --test test/*.test.js",
|
package/src/policy.js
CHANGED
|
@@ -19,12 +19,14 @@ export function evaluatePolicies(changes) {
|
|
|
19
19
|
const path = change.path ?? '';
|
|
20
20
|
const pathLower = path.toLowerCase();
|
|
21
21
|
|
|
22
|
-
if (SECRET_KEY_RE.test(pathLower) && change.type === 'changed') {
|
|
22
|
+
if (SECRET_KEY_RE.test(pathLower) && (change.type === 'changed' || change.type === 'added')) {
|
|
23
23
|
findings.push({
|
|
24
24
|
id: 'secret-key-changed',
|
|
25
25
|
severity: 'error',
|
|
26
26
|
path,
|
|
27
|
-
message:
|
|
27
|
+
message: change.type === 'added'
|
|
28
|
+
? 'Sensitive-looking key added. Confirm secret storage and access controls.'
|
|
29
|
+
: 'Sensitive-looking key changed. Confirm secret rotation and access controls.',
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
|