pawnlogic-security 0.1.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 (38) hide show
  1. pawnlogic_security-0.1.0/LICENSE +21 -0
  2. pawnlogic_security-0.1.0/PKG-INFO +232 -0
  3. pawnlogic_security-0.1.0/README.md +203 -0
  4. pawnlogic_security-0.1.0/pawnlogic_security/__init__.py +5 -0
  5. pawnlogic_security-0.1.0/pawnlogic_security/child_adapter.py +406 -0
  6. pawnlogic_security-0.1.0/pawnlogic_security/cli.py +182 -0
  7. pawnlogic_security-0.1.0/pawnlogic_security/evidence.py +211 -0
  8. pawnlogic_security-0.1.0/pawnlogic_security/extension.py +394 -0
  9. pawnlogic_security-0.1.0/pawnlogic_security/recon.py +583 -0
  10. pawnlogic_security-0.1.0/pawnlogic_security/scope.py +437 -0
  11. pawnlogic_security-0.1.0/pawnlogic_security/scope_file.py +255 -0
  12. pawnlogic_security-0.1.0/pawnlogic_security/scope_manager.py +267 -0
  13. pawnlogic_security-0.1.0/pawnlogic_security/tools.py +422 -0
  14. pawnlogic_security-0.1.0/pawnlogic_security/workflows.py +474 -0
  15. pawnlogic_security-0.1.0/pawnlogic_security.egg-info/PKG-INFO +232 -0
  16. pawnlogic_security-0.1.0/pawnlogic_security.egg-info/SOURCES.txt +36 -0
  17. pawnlogic_security-0.1.0/pawnlogic_security.egg-info/dependency_links.txt +1 -0
  18. pawnlogic_security-0.1.0/pawnlogic_security.egg-info/entry_points.txt +5 -0
  19. pawnlogic_security-0.1.0/pawnlogic_security.egg-info/requires.txt +9 -0
  20. pawnlogic_security-0.1.0/pawnlogic_security.egg-info/top_level.txt +1 -0
  21. pawnlogic_security-0.1.0/pyproject.toml +81 -0
  22. pawnlogic_security-0.1.0/setup.cfg +4 -0
  23. pawnlogic_security-0.1.0/tests/test_child_adapter.py +288 -0
  24. pawnlogic_security-0.1.0/tests/test_ci_workflow.py +60 -0
  25. pawnlogic_security-0.1.0/tests/test_cli.py +124 -0
  26. pawnlogic_security-0.1.0/tests/test_evidence.py +164 -0
  27. pawnlogic_security-0.1.0/tests/test_extension_lifecycle.py +446 -0
  28. pawnlogic_security-0.1.0/tests/test_network_execution_safety.py +233 -0
  29. pawnlogic_security-0.1.0/tests/test_packaging.py +127 -0
  30. pawnlogic_security-0.1.0/tests/test_real_host_integration.py +169 -0
  31. pawnlogic_security-0.1.0/tests/test_recon.py +243 -0
  32. pawnlogic_security-0.1.0/tests/test_release_workflow.py +238 -0
  33. pawnlogic_security-0.1.0/tests/test_scope.py +144 -0
  34. pawnlogic_security-0.1.0/tests/test_scope_enforcement.py +209 -0
  35. pawnlogic_security-0.1.0/tests/test_scope_gated_lifecycle.py +134 -0
  36. pawnlogic_security-0.1.0/tests/test_scope_manager.py +378 -0
  37. pawnlogic_security-0.1.0/tests/test_tools_fail_closed.py +189 -0
  38. pawnlogic_security-0.1.0/tests/test_workflows.py +162 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PawnLogic Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: pawnlogic-security
3
+ Version: 0.1.0
4
+ Summary: Scope-gated security tooling for the PawnLogic agent host
5
+ Author: PawnLogic Contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/john0123412/pawnlogic-security
8
+ Project-URL: Issues, https://github.com/john0123412/pawnlogic-security/issues
9
+ Keywords: pawnlogic,security,extension,reconnaissance
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Security
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: pawnlogic<0.4,>=0.3
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.4; extra == "dev"
23
+ Requires-Dist: pytest-timeout>=2.1; extra == "dev"
24
+ Requires-Dist: ruff>=0.5; extra == "dev"
25
+ Requires-Dist: mypy>=1.8; extra == "dev"
26
+ Requires-Dist: build>=1.0; extra == "dev"
27
+ Requires-Dist: twine>=5.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # pawnlogic-security
31
+
32
+ Scope-gated security tooling for the [PawnLogic](https://github.com/john0123412/PawnLogic)
33
+ agent host, distributed independently of the core package.
34
+
35
+ Installing this package does not authorize or enable it. The PawnLogic
36
+ Extension stays disabled until an operator explicitly enables it, and its
37
+ network tools remain unavailable until a valid Engagement Scope is active.
38
+
39
+ ## Status
40
+
41
+ The current public release is `0.1.0`, published independently of the
42
+ PawnLogic core package. It implements:
43
+
44
+ - a versioned Engagement Scope file with exact hosts, CIDRs, exclusions,
45
+ explicit ports, passive/active actions, expiry, and request, concurrency, and
46
+ duration budgets
47
+ - scope-gated passive DNS, TLS, HTTP-header, and technology reconnaissance
48
+ - scope-gated bounded active port discovery
49
+ - append-only redacted evidence records
50
+ - two built-in, versioned workflows shared by `pawn-security` and `/security`
51
+ - reproducible workflow plans and versioned local run records
52
+ - an optional, default-disabled JSON child-process adapter with Operation Policy
53
+ checks, bounded I/O, timeout cleanup, environment isolation, and output
54
+ redaction
55
+
56
+ It does not implement HTTP replay, external scanner adapters, workflow YAML
57
+ loading, CIDR expansion, exploit or destructive workflows, MCP execution, or
58
+ an AI-generated planner. No built-in workflow invokes the optional child
59
+ adapter.
60
+
61
+ ## Requirements
62
+
63
+ - Python 3.10 or newer
64
+ - `pawnlogic>=0.3,<0.4`
65
+
66
+ ## Install
67
+
68
+ Install the published package:
69
+
70
+ ```bash
71
+ python -m pip install pawnlogic-security
72
+ ```
73
+
74
+ For checkout development:
75
+
76
+ ```bash
77
+ python -m pip install -e .
78
+ ```
79
+
80
+ Nothing is loaded merely because the distribution is installed.
81
+
82
+ ## Enable in PawnLogic
83
+
84
+ ```text
85
+ /extension list
86
+ /extension enable security
87
+ /extension status security
88
+ ```
89
+
90
+ The Extension contributes `/security` after enablement:
91
+
92
+ ```text
93
+ /security status
94
+ /security scope show
95
+ /security scope set <scope-file>
96
+ /security scope clear
97
+ /security plan <objective>
98
+ /security run <workflow>
99
+ /security evidence list
100
+ /security evidence export <run-id>
101
+ ```
102
+
103
+ `/security` is an async host command and writes through the active PawnLogic
104
+ output sink. Scope changes rebuild the complete contribution set atomically:
105
+ the command remains present while security tools appear or disappear.
106
+
107
+ Disable the Extension with:
108
+
109
+ ```text
110
+ /extension disable security
111
+ ```
112
+
113
+ ## Engagement Scope
114
+
115
+ Every operation requires an explicit, unexpired Engagement Scope. A minimal
116
+ passive scope file looks like:
117
+
118
+ ```json
119
+ {
120
+ "version": 1,
121
+ "identifier": "authorized-review",
122
+ "authorized_by": "security-team",
123
+ "reference": "CHANGE-1234",
124
+ "expires_at": 4102444800,
125
+ "targets": ["app.example.com"],
126
+ "exclude": [],
127
+ "ports": ["443"],
128
+ "allow_active": false,
129
+ "actions": ["passive"],
130
+ "destructive": false,
131
+ "max_requests": 20,
132
+ "max_concurrency": 1,
133
+ "max_duration": 300,
134
+ "evidence_dir": "evidence"
135
+ }
136
+ ```
137
+
138
+ Active discovery additionally requires `allow_active: true`, the `active`
139
+ action, and explicit ports, for example `"ports": ["443", "8000-8010"]`.
140
+ Destructive authorization is rejected because destructive workflows are not
141
+ implemented.
142
+
143
+ The passive example explicitly authorizes port `443` because TLS inspection and
144
+ HTTPS header collection make network connections even though they do not send
145
+ active probes.
146
+
147
+ Scope is necessary but never sufficient. The host Network Policy runs after
148
+ scope validation and may still refuse the target. Resolved addresses and
149
+ redirect changes must remain in scope. Model-provided tool arguments cannot
150
+ grant authorization.
151
+
152
+ ## Workflows
153
+
154
+ The built-in workflow manifests have schema version `1` and their own workflow
155
+ version:
156
+
157
+ - `passive-recon` runs `security_passive_recon`
158
+ - `active-discovery` runs `security_active_discovery`
159
+
160
+ Both direct and hosted commands call the same `WorkflowRunner` interface:
161
+
162
+ ```bash
163
+ pawn-security scope validate <scope-file>
164
+ pawn-security run passive-recon --scope <scope-file>
165
+ ```
166
+
167
+ ```text
168
+ /security run passive-recon
169
+ ```
170
+
171
+ The runner sorts explicit host targets and runs one workflow target at a time.
172
+ The execution adapters consume the engagement-wide request budget before
173
+ individual network requests. The runner does not expand a CIDR into hosts.
174
+ `active-discovery` additionally requires an active scope; port-scan concurrency
175
+ remains bounded by the scope.
176
+
177
+ `/security plan <objective>` is deliberately conservative. It returns a
178
+ deterministic suggestion to begin with `passive-recon`, reports that execution
179
+ has not started, and performs no network work.
180
+
181
+ ## Evidence
182
+
183
+ When the active scope sets `evidence_dir`, tool observations and run records
184
+ are written there. A relative `evidence_dir` is resolved from the directory
185
+ containing the scope file. Without `evidence_dir`, they fall back to:
186
+
187
+ ```text
188
+ <runtime home>/security/evidence.jsonl
189
+ ```
190
+
191
+ The direct command uses `PAWNLOGIC_HOME` when set, otherwise
192
+ `~/.pawnlogic`, for that fallback only.
193
+
194
+ Within the selected evidence directory, observations use `evidence.jsonl` and
195
+ completed workflow records use canonical, schema-versioned JSON with
196
+ restrictive permissions under:
197
+
198
+ ```text
199
+ <evidence directory>/runs/<run-id>.json
200
+ ```
201
+
202
+ `/security evidence list` shows run summaries. `/security evidence export
203
+ <run-id>` writes the selected canonical run record to the active output sink.
204
+ Export accepts only a fixed-format run ID; it does not accept an output path
205
+ and does not create an evidence archive.
206
+
207
+ ## Trust boundaries
208
+
209
+ - No scope, an expired scope, an excluded or unmatched target, an unauthorized
210
+ port, or an exhausted budget fails closed.
211
+ - Active work requires explicit active authorization and ports.
212
+ - Loopback, private, link-local, metadata, and credential-bearing targets are
213
+ still governed by PawnLogic Network Policy.
214
+ - The package does not silently download scanners, wordlists, browsers,
215
+ containers, or system packages.
216
+ - The optional child-process adapter is disabled by default. When explicitly
217
+ configured by an integrator, it executes a literal argument vector without a
218
+ shell only after the host Operation Policy allows it; current workflows do
219
+ not call it.
220
+
221
+ ## Development
222
+
223
+ ```bash
224
+ python -m venv .venv
225
+ .venv/bin/python -m pip install -e ".[dev]"
226
+ .venv/bin/python -m pytest -q
227
+ .venv/bin/python -m ruff check .
228
+ ```
229
+
230
+ ## License
231
+
232
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,203 @@
1
+ # pawnlogic-security
2
+
3
+ Scope-gated security tooling for the [PawnLogic](https://github.com/john0123412/PawnLogic)
4
+ agent host, distributed independently of the core package.
5
+
6
+ Installing this package does not authorize or enable it. The PawnLogic
7
+ Extension stays disabled until an operator explicitly enables it, and its
8
+ network tools remain unavailable until a valid Engagement Scope is active.
9
+
10
+ ## Status
11
+
12
+ The current public release is `0.1.0`, published independently of the
13
+ PawnLogic core package. It implements:
14
+
15
+ - a versioned Engagement Scope file with exact hosts, CIDRs, exclusions,
16
+ explicit ports, passive/active actions, expiry, and request, concurrency, and
17
+ duration budgets
18
+ - scope-gated passive DNS, TLS, HTTP-header, and technology reconnaissance
19
+ - scope-gated bounded active port discovery
20
+ - append-only redacted evidence records
21
+ - two built-in, versioned workflows shared by `pawn-security` and `/security`
22
+ - reproducible workflow plans and versioned local run records
23
+ - an optional, default-disabled JSON child-process adapter with Operation Policy
24
+ checks, bounded I/O, timeout cleanup, environment isolation, and output
25
+ redaction
26
+
27
+ It does not implement HTTP replay, external scanner adapters, workflow YAML
28
+ loading, CIDR expansion, exploit or destructive workflows, MCP execution, or
29
+ an AI-generated planner. No built-in workflow invokes the optional child
30
+ adapter.
31
+
32
+ ## Requirements
33
+
34
+ - Python 3.10 or newer
35
+ - `pawnlogic>=0.3,<0.4`
36
+
37
+ ## Install
38
+
39
+ Install the published package:
40
+
41
+ ```bash
42
+ python -m pip install pawnlogic-security
43
+ ```
44
+
45
+ For checkout development:
46
+
47
+ ```bash
48
+ python -m pip install -e .
49
+ ```
50
+
51
+ Nothing is loaded merely because the distribution is installed.
52
+
53
+ ## Enable in PawnLogic
54
+
55
+ ```text
56
+ /extension list
57
+ /extension enable security
58
+ /extension status security
59
+ ```
60
+
61
+ The Extension contributes `/security` after enablement:
62
+
63
+ ```text
64
+ /security status
65
+ /security scope show
66
+ /security scope set <scope-file>
67
+ /security scope clear
68
+ /security plan <objective>
69
+ /security run <workflow>
70
+ /security evidence list
71
+ /security evidence export <run-id>
72
+ ```
73
+
74
+ `/security` is an async host command and writes through the active PawnLogic
75
+ output sink. Scope changes rebuild the complete contribution set atomically:
76
+ the command remains present while security tools appear or disappear.
77
+
78
+ Disable the Extension with:
79
+
80
+ ```text
81
+ /extension disable security
82
+ ```
83
+
84
+ ## Engagement Scope
85
+
86
+ Every operation requires an explicit, unexpired Engagement Scope. A minimal
87
+ passive scope file looks like:
88
+
89
+ ```json
90
+ {
91
+ "version": 1,
92
+ "identifier": "authorized-review",
93
+ "authorized_by": "security-team",
94
+ "reference": "CHANGE-1234",
95
+ "expires_at": 4102444800,
96
+ "targets": ["app.example.com"],
97
+ "exclude": [],
98
+ "ports": ["443"],
99
+ "allow_active": false,
100
+ "actions": ["passive"],
101
+ "destructive": false,
102
+ "max_requests": 20,
103
+ "max_concurrency": 1,
104
+ "max_duration": 300,
105
+ "evidence_dir": "evidence"
106
+ }
107
+ ```
108
+
109
+ Active discovery additionally requires `allow_active: true`, the `active`
110
+ action, and explicit ports, for example `"ports": ["443", "8000-8010"]`.
111
+ Destructive authorization is rejected because destructive workflows are not
112
+ implemented.
113
+
114
+ The passive example explicitly authorizes port `443` because TLS inspection and
115
+ HTTPS header collection make network connections even though they do not send
116
+ active probes.
117
+
118
+ Scope is necessary but never sufficient. The host Network Policy runs after
119
+ scope validation and may still refuse the target. Resolved addresses and
120
+ redirect changes must remain in scope. Model-provided tool arguments cannot
121
+ grant authorization.
122
+
123
+ ## Workflows
124
+
125
+ The built-in workflow manifests have schema version `1` and their own workflow
126
+ version:
127
+
128
+ - `passive-recon` runs `security_passive_recon`
129
+ - `active-discovery` runs `security_active_discovery`
130
+
131
+ Both direct and hosted commands call the same `WorkflowRunner` interface:
132
+
133
+ ```bash
134
+ pawn-security scope validate <scope-file>
135
+ pawn-security run passive-recon --scope <scope-file>
136
+ ```
137
+
138
+ ```text
139
+ /security run passive-recon
140
+ ```
141
+
142
+ The runner sorts explicit host targets and runs one workflow target at a time.
143
+ The execution adapters consume the engagement-wide request budget before
144
+ individual network requests. The runner does not expand a CIDR into hosts.
145
+ `active-discovery` additionally requires an active scope; port-scan concurrency
146
+ remains bounded by the scope.
147
+
148
+ `/security plan <objective>` is deliberately conservative. It returns a
149
+ deterministic suggestion to begin with `passive-recon`, reports that execution
150
+ has not started, and performs no network work.
151
+
152
+ ## Evidence
153
+
154
+ When the active scope sets `evidence_dir`, tool observations and run records
155
+ are written there. A relative `evidence_dir` is resolved from the directory
156
+ containing the scope file. Without `evidence_dir`, they fall back to:
157
+
158
+ ```text
159
+ <runtime home>/security/evidence.jsonl
160
+ ```
161
+
162
+ The direct command uses `PAWNLOGIC_HOME` when set, otherwise
163
+ `~/.pawnlogic`, for that fallback only.
164
+
165
+ Within the selected evidence directory, observations use `evidence.jsonl` and
166
+ completed workflow records use canonical, schema-versioned JSON with
167
+ restrictive permissions under:
168
+
169
+ ```text
170
+ <evidence directory>/runs/<run-id>.json
171
+ ```
172
+
173
+ `/security evidence list` shows run summaries. `/security evidence export
174
+ <run-id>` writes the selected canonical run record to the active output sink.
175
+ Export accepts only a fixed-format run ID; it does not accept an output path
176
+ and does not create an evidence archive.
177
+
178
+ ## Trust boundaries
179
+
180
+ - No scope, an expired scope, an excluded or unmatched target, an unauthorized
181
+ port, or an exhausted budget fails closed.
182
+ - Active work requires explicit active authorization and ports.
183
+ - Loopback, private, link-local, metadata, and credential-bearing targets are
184
+ still governed by PawnLogic Network Policy.
185
+ - The package does not silently download scanners, wordlists, browsers,
186
+ containers, or system packages.
187
+ - The optional child-process adapter is disabled by default. When explicitly
188
+ configured by an integrator, it executes a literal argument vector without a
189
+ shell only after the host Operation Policy allows it; current workflows do
190
+ not call it.
191
+
192
+ ## Development
193
+
194
+ ```bash
195
+ python -m venv .venv
196
+ .venv/bin/python -m pip install -e ".[dev]"
197
+ .venv/bin/python -m pytest -q
198
+ .venv/bin/python -m ruff check .
199
+ ```
200
+
201
+ ## License
202
+
203
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,5 @@
1
+ """Scope-gated security tooling distributed independently of PawnLogic core."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ __all__ = ["__version__"]