@pablozrrrr/jevguard 0.2.2 → 0.2.3
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 +75 -16
- package/cli/main.js +951 -70
- package/index.js +877 -73
- package/package.json +1 -1
- package/skills/jev-init/SKILL.md +8 -2
- package/skills/jev-init/validate-init.js +528 -65
- package/skills/jevguard-rules/SKILL.md +44 -2
- package/skills/jevguard-rules/validate-rules.js +528 -65
|
@@ -54,8 +54,23 @@ Do not re-ask what an existing valid block already states. The complete rule nee
|
|
|
54
54
|
2. **Concrete violation** — the specific change that breaches that boundary.
|
|
55
55
|
3. **Allowed exception** — what is explicitly permitted, or `none`.
|
|
56
56
|
4. **Severity** — `error` or `warning`.
|
|
57
|
-
5. **Scope** —
|
|
58
|
-
|
|
57
|
+
5. **Scope** — optional repo-relative POSIX globs, one per `scope:` line, where a
|
|
58
|
+
leading `!` marks an exclusion; or no scope.
|
|
59
|
+
6. **Evidence class** — `code` (default), `docs`, or `any`; ask only when the rule
|
|
60
|
+
is about prose documentation.
|
|
61
|
+
7. **Rule ID** — matching `[A-Za-z0-9][A-Za-z0-9._-]*`, unique in the document.
|
|
62
|
+
|
|
63
|
+
Before drafting a security-shaped rule, enumerate the concrete channels a violation
|
|
64
|
+
can travel through and name the channels that apply in the rule text. Consider each
|
|
65
|
+
of these explicitly: process environment variables; subprocess environment (`env=` /
|
|
66
|
+
`subprocess`); command-line arguments; logs; error messages and stack traces;
|
|
67
|
+
LLM/agent context; generated reports and artifacts; and the reviewed diff itself.
|
|
68
|
+
Jev judges the rule text literally, so a channel the rule does not name is a channel
|
|
69
|
+
it cannot catch. A security rule that names only the diff will miss a secret written
|
|
70
|
+
to the process environment or echoed into a log.
|
|
71
|
+
|
|
72
|
+
For a contract or API rule, require an explicit `scope:` choice — or an explicit
|
|
73
|
+
statement, in the rule text, that the rule is repository-wide — before writing it.
|
|
59
74
|
|
|
60
75
|
### 3. Complete the candidate
|
|
61
76
|
|
|
@@ -67,6 +82,8 @@ blocks follow the document grammar:
|
|
|
67
82
|
|
|
68
83
|
severity: error
|
|
69
84
|
scope: src/**
|
|
85
|
+
scope: !src/generated/**
|
|
86
|
+
evidence: code
|
|
70
87
|
|
|
71
88
|
### Rule
|
|
72
89
|
|
|
@@ -81,6 +98,31 @@ scope: src/**
|
|
|
81
98
|
<non-empty exception, or omit the section>
|
|
82
99
|
```
|
|
83
100
|
|
|
101
|
+
`scope:` may repeat. Each line adds an inclusion glob, and a leading `!` marks an
|
|
102
|
+
exclusion glob: a path is in scope when it matches at least one inclusion and no
|
|
103
|
+
exclusion. A `scope:` block whose lines are all exclusions is invalid, and an empty
|
|
104
|
+
`scope:` value is invalid. A single `scope: src/**` behaves exactly as before. Both
|
|
105
|
+
`/` and `\` separators are normalized, and `*`, `**`, and `?` are supported.
|
|
106
|
+
|
|
107
|
+
`evidence:` selects which extension class the rule is evaluated against: `code`
|
|
108
|
+
(default), `docs`, or `any`. `evidence: code` sends source, config, and data formats
|
|
109
|
+
and ignores prose docs, so a `.md` file never pulls a code rule into review by
|
|
110
|
+
itself. `evidence: docs` sends prose docs only (`.md`, `.mdx`, `.txt`), and
|
|
111
|
+
`evidence: any` sends both. Use `evidence: docs` or `evidence: any` for a rule that
|
|
112
|
+
must inspect documentation, for example a "no secrets in documentation" rule:
|
|
113
|
+
|
|
114
|
+
```md
|
|
115
|
+
## DOCS-001
|
|
116
|
+
|
|
117
|
+
severity: error
|
|
118
|
+
scope: docs/**
|
|
119
|
+
evidence: docs
|
|
120
|
+
|
|
121
|
+
### Rule
|
|
122
|
+
|
|
123
|
+
Documentation must not contain secret values.
|
|
124
|
+
```
|
|
125
|
+
|
|
84
126
|
If `.jev/rules.md` already begins with a `jev-init` provenance manifest — one fenced
|
|
85
127
|
`yaml` block before the first `##` rule heading that maps rule IDs to
|
|
86
128
|
`{ source, evidence }` — keep it as the first thing in the document and update it to
|