pywrit 0.2.12__tar.gz → 0.2.14__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.
- {pywrit-0.2.12/src/pywrit.egg-info → pywrit-0.2.14}/PKG-INFO +20 -3
- {pywrit-0.2.12 → pywrit-0.2.14}/README.md +18 -2
- {pywrit-0.2.12 → pywrit-0.2.14}/pyproject.toml +4 -3
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit/__init__.py +1 -1
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit/cli.py +558 -29
- {pywrit-0.2.12 → pywrit-0.2.14/src/pywrit.egg-info}/PKG-INFO +20 -3
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit.egg-info/SOURCES.txt +1 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit.egg-info/requires.txt +1 -0
- pywrit-0.2.14/tests/test_scan_go.py +344 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/tests/test_scan_tsjs.py +94 -9
- {pywrit-0.2.12 → pywrit-0.2.14}/LICENSE +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/setup.cfg +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit/client.py +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit/errors.py +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit.egg-info/dependency_links.txt +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit.egg-info/entry_points.txt +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/src/pywrit.egg-info/top_level.txt +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/tests/test_client.py +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/tests/test_scan_json.py +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/tests/test_scan_python.py +0 -0
- {pywrit-0.2.12 → pywrit-0.2.14}/tests/test_wrap.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pywrit
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Python client + CLI for Writ — the gate before the write
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/withwrit/pywrit
|
|
@@ -13,6 +13,7 @@ Provides-Extra: polyglot
|
|
|
13
13
|
Requires-Dist: tree-sitter>=0.23; extra == "polyglot"
|
|
14
14
|
Requires-Dist: tree-sitter-typescript>=0.23; extra == "polyglot"
|
|
15
15
|
Requires-Dist: tree-sitter-javascript>=0.23; extra == "polyglot"
|
|
16
|
+
Requires-Dist: tree-sitter-go>=0.23; extra == "polyglot"
|
|
16
17
|
Provides-Extra: keywords
|
|
17
18
|
Requires-Dist: ai-agents; extra == "keywords"
|
|
18
19
|
Requires-Dist: policy; extra == "keywords"
|
|
@@ -54,6 +55,14 @@ first run it installs `pywrit[polyglot]` from PyPI using your Python 3.9+
|
|
|
54
55
|
environment overrides (`WRIT_PYTHON`, `WRIT_SCAN_NO_INSTALL`), and the
|
|
55
56
|
install test.
|
|
56
57
|
|
|
58
|
+
## Language coverage
|
|
59
|
+
|
|
60
|
+
| Language | `writ scan` | `writ scan --apply` | Notes |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| Python | Yes | Yes, inserts `_writ_check` gates | Parsed with the stdlib `ast`, no extra needed |
|
|
63
|
+
| TypeScript / JavaScript | Yes, with `pywrit[polyglot]` | No, scan only | Needs the extra: `pip install 'pywrit[polyglot]'`. Without it, the report says so loudly: a warning block names the unscanned files instead of reporting zero findings |
|
|
64
|
+
| Go | Yes, with `pywrit[polyglot]` | No, scan only | First detection family only: database/sql Exec/ExecContext, GORM Create/Save/Update/Updates/Delete, HTTP client writes and http.NewRequest with a write method, generated-client <client>.<Resource>.<New\|Update\|Delete\|Create>; package-level generated clients not yet covered. Without the extra, the report names the unscanned Go files in the same warning block as TS/JS |
|
|
65
|
+
|
|
57
66
|
## 60-second quickstart: scan → wrap → gate
|
|
58
67
|
|
|
59
68
|
**1. Scan.** See which functions write, and how many of them are gated.
|
|
@@ -148,8 +157,8 @@ optional extra (tree-sitter based):
|
|
|
148
157
|
pip install 'pywrit[polyglot]'
|
|
149
158
|
writ scan .
|
|
150
159
|
|
|
151
|
-
Without the extra, the scanner prints a
|
|
152
|
-
Python scanning never needs it.
|
|
160
|
+
Without the extra, the scanner prints a prominent warning block naming the
|
|
161
|
+
unscanned TS/JS files and keeps going — Python scanning never needs it.
|
|
153
162
|
|
|
154
163
|
Findings from non-product paths (docs/, scripts/, sandbox/, examples/,
|
|
155
164
|
benchmark/, demo/, and build-tooling files such as gulpfile.js or
|
|
@@ -176,6 +185,14 @@ pipeline (twilio-style generated clients, e.g. `twilio-node`).
|
|
|
176
185
|
|
|
177
186
|

|
|
178
187
|
|
|
188
|
+
### Go (scan-only)
|
|
189
|
+
|
|
190
|
+
`writ scan` also finds write sites in Go. It needs the optional extra (tree-sitter based):
|
|
191
|
+
|
|
192
|
+
pip install 'pywrit[polyglot]'
|
|
193
|
+
|
|
194
|
+
Covered in this first family: `database/sql` `Exec` / `ExecContext`, GORM `Create` / `Save` / `Update` / `Updates` / `Delete`, HTTP client `Post` / `Put` / `Patch` / `Delete` and `http.NewRequest` / `NewRequestWithContext` with a write method, and generated-client calls shaped `<client>.<Resource>.<New|Update|Delete|Create>` with an uppercase resource segment (the stripe-go shape). GET/HEAD requests, `db.Query` / `QueryRow`, and bare constructors are not flagged. `_test.go` files and `vendor/` trees are skipped. Go is **scan-only**: `writ scan --apply` never rewrites `.go` files, gate those by hand. Not yet covered: package-level generated clients (`charge.New(...)`, the pre-v87 stripe-go shape), request-pipeline calls with a variable method, and raw-SQL helpers.
|
|
195
|
+
|
|
179
196
|
## GitHub Action
|
|
180
197
|
|
|
181
198
|
Scan every pull request for ungated write sites. Findings land as check
|
|
@@ -32,6 +32,14 @@ first run it installs `pywrit[polyglot]` from PyPI using your Python 3.9+
|
|
|
32
32
|
environment overrides (`WRIT_PYTHON`, `WRIT_SCAN_NO_INSTALL`), and the
|
|
33
33
|
install test.
|
|
34
34
|
|
|
35
|
+
## Language coverage
|
|
36
|
+
|
|
37
|
+
| Language | `writ scan` | `writ scan --apply` | Notes |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| Python | Yes | Yes, inserts `_writ_check` gates | Parsed with the stdlib `ast`, no extra needed |
|
|
40
|
+
| TypeScript / JavaScript | Yes, with `pywrit[polyglot]` | No, scan only | Needs the extra: `pip install 'pywrit[polyglot]'`. Without it, the report says so loudly: a warning block names the unscanned files instead of reporting zero findings |
|
|
41
|
+
| Go | Yes, with `pywrit[polyglot]` | No, scan only | First detection family only: database/sql Exec/ExecContext, GORM Create/Save/Update/Updates/Delete, HTTP client writes and http.NewRequest with a write method, generated-client <client>.<Resource>.<New\|Update\|Delete\|Create>; package-level generated clients not yet covered. Without the extra, the report names the unscanned Go files in the same warning block as TS/JS |
|
|
42
|
+
|
|
35
43
|
## 60-second quickstart: scan → wrap → gate
|
|
36
44
|
|
|
37
45
|
**1. Scan.** See which functions write, and how many of them are gated.
|
|
@@ -126,8 +134,8 @@ optional extra (tree-sitter based):
|
|
|
126
134
|
pip install 'pywrit[polyglot]'
|
|
127
135
|
writ scan .
|
|
128
136
|
|
|
129
|
-
Without the extra, the scanner prints a
|
|
130
|
-
Python scanning never needs it.
|
|
137
|
+
Without the extra, the scanner prints a prominent warning block naming the
|
|
138
|
+
unscanned TS/JS files and keeps going — Python scanning never needs it.
|
|
131
139
|
|
|
132
140
|
Findings from non-product paths (docs/, scripts/, sandbox/, examples/,
|
|
133
141
|
benchmark/, demo/, and build-tooling files such as gulpfile.js or
|
|
@@ -154,6 +162,14 @@ pipeline (twilio-style generated clients, e.g. `twilio-node`).
|
|
|
154
162
|
|
|
155
163
|

|
|
156
164
|
|
|
165
|
+
### Go (scan-only)
|
|
166
|
+
|
|
167
|
+
`writ scan` also finds write sites in Go. It needs the optional extra (tree-sitter based):
|
|
168
|
+
|
|
169
|
+
pip install 'pywrit[polyglot]'
|
|
170
|
+
|
|
171
|
+
Covered in this first family: `database/sql` `Exec` / `ExecContext`, GORM `Create` / `Save` / `Update` / `Updates` / `Delete`, HTTP client `Post` / `Put` / `Patch` / `Delete` and `http.NewRequest` / `NewRequestWithContext` with a write method, and generated-client calls shaped `<client>.<Resource>.<New|Update|Delete|Create>` with an uppercase resource segment (the stripe-go shape). GET/HEAD requests, `db.Query` / `QueryRow`, and bare constructors are not flagged. `_test.go` files and `vendor/` trees are skipped. Go is **scan-only**: `writ scan --apply` never rewrites `.go` files, gate those by hand. Not yet covered: package-level generated clients (`charge.New(...)`, the pre-v87 stripe-go shape), request-pipeline calls with a variable method, and raw-SQL helpers.
|
|
172
|
+
|
|
157
173
|
## GitHub Action
|
|
158
174
|
|
|
159
175
|
Scan every pull request for ungated write sites. Findings land as check
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pywrit"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.14"
|
|
8
8
|
description = "Python client + CLI for Writ — the gate before the write"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -12,12 +12,13 @@ requires-python = ">=3.9"
|
|
|
12
12
|
dependencies = ["httpx>=0.27"]
|
|
13
13
|
|
|
14
14
|
[project.optional-dependencies]
|
|
15
|
-
# `pip install 'pywrit[polyglot]'`: lets `writ scan` parse TypeScript
|
|
16
|
-
# JavaScript (scan only). Python scanning never needs it.
|
|
15
|
+
# `pip install 'pywrit[polyglot]'`: lets `writ scan` parse TypeScript,
|
|
16
|
+
# JavaScript, and Go (scan only). Python scanning never needs it.
|
|
17
17
|
polyglot = [
|
|
18
18
|
"tree-sitter>=0.23",
|
|
19
19
|
"tree-sitter-typescript>=0.23",
|
|
20
20
|
"tree-sitter-javascript>=0.23",
|
|
21
|
+
"tree-sitter-go>=0.23",
|
|
21
22
|
]
|
|
22
23
|
keywords = ["ai-agents", "policy", "audit-log", "guardrails"]
|
|
23
24
|
|