secpol-audit 1.0.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 (100) hide show
  1. secpol_audit-1.0.0/LICENSE +21 -0
  2. secpol_audit-1.0.0/PKG-INFO +100 -0
  3. secpol_audit-1.0.0/README.md +149 -0
  4. secpol_audit-1.0.0/README_PYPI.md +65 -0
  5. secpol_audit-1.0.0/pyproject.toml +76 -0
  6. secpol_audit-1.0.0/secpol_audit/__init__.py +5 -0
  7. secpol_audit-1.0.0/secpol_audit/__main__.py +8 -0
  8. secpol_audit-1.0.0/secpol_audit/api_server.py +137 -0
  9. secpol_audit-1.0.0/secpol_audit/assets/fallback_dashboard.html +42 -0
  10. secpol_audit-1.0.0/secpol_audit/bench.py +741 -0
  11. secpol_audit-1.0.0/secpol_audit/blast.py +1533 -0
  12. secpol_audit-1.0.0/secpol_audit/blast_html.py +1186 -0
  13. secpol_audit-1.0.0/secpol_audit/build_doctor/__init__.py +481 -0
  14. secpol_audit-1.0.0/secpol_audit/checks.py +976 -0
  15. secpol_audit-1.0.0/secpol_audit/cli.py +1004 -0
  16. secpol_audit-1.0.0/secpol_audit/compile_wrap.py +137 -0
  17. secpol_audit-1.0.0/secpol_audit/demo.py +416 -0
  18. secpol_audit-1.0.0/secpol_audit/diff.py +352 -0
  19. secpol_audit-1.0.0/secpol_audit/equiv.py +107 -0
  20. secpol_audit-1.0.0/secpol_audit/events.py +920 -0
  21. secpol_audit-1.0.0/secpol_audit/explain.py +442 -0
  22. secpol_audit-1.0.0/secpol_audit/extras.py +19 -0
  23. secpol_audit-1.0.0/secpol_audit/firmware.py +776 -0
  24. secpol_audit-1.0.0/secpol_audit/graph_html.py +1372 -0
  25. secpol_audit-1.0.0/secpol_audit/ipc/__init__.py +215 -0
  26. secpol_audit-1.0.0/secpol_audit/ir.py +430 -0
  27. secpol_audit-1.0.0/secpol_audit/mcp_server/__init__.py +411 -0
  28. secpol_audit-1.0.0/secpol_audit/mcp_server/__main__.py +4 -0
  29. secpol_audit-1.0.0/secpol_audit/mkifs_conformance.py +234 -0
  30. secpol_audit-1.0.0/secpol_audit/oracle_diff.py +246 -0
  31. secpol_audit-1.0.0/secpol_audit/parser_ifs.py +1185 -0
  32. secpol_audit-1.0.0/secpol_audit/parser_secpol.py +1086 -0
  33. secpol_audit-1.0.0/secpol_audit/paths.py +653 -0
  34. secpol_audit-1.0.0/secpol_audit/perf/__init__.py +94 -0
  35. secpol_audit-1.0.0/secpol_audit/provenance/__init__.py +480 -0
  36. secpol_audit-1.0.0/secpol_audit/prune.py +282 -0
  37. secpol_audit-1.0.0/secpol_audit/remediate.py +846 -0
  38. secpol_audit-1.0.0/secpol_audit/replay/__init__.py +157 -0
  39. secpol_audit-1.0.0/secpol_audit/runtime.py +408 -0
  40. secpol_audit-1.0.0/secpol_audit/sarif.py +237 -0
  41. secpol_audit-1.0.0/secpol_audit/service.py +393 -0
  42. secpol_audit-1.0.0/secpol_audit/target/__init__.py +339 -0
  43. secpol_audit-1.0.0/secpol_audit/trace.py +389 -0
  44. secpol_audit-1.0.0/secpol_audit/tui/__init__.py +57 -0
  45. secpol_audit-1.0.0/secpol_audit/tui/__main__.py +4 -0
  46. secpol_audit-1.0.0/secpol_audit.egg-info/PKG-INFO +100 -0
  47. secpol_audit-1.0.0/secpol_audit.egg-info/SOURCES.txt +98 -0
  48. secpol_audit-1.0.0/secpol_audit.egg-info/dependency_links.txt +1 -0
  49. secpol_audit-1.0.0/secpol_audit.egg-info/entry_points.txt +5 -0
  50. secpol_audit-1.0.0/secpol_audit.egg-info/requires.txt +14 -0
  51. secpol_audit-1.0.0/secpol_audit.egg-info/top_level.txt +1 -0
  52. secpol_audit-1.0.0/setup.cfg +4 -0
  53. secpol_audit-1.0.0/tests/test_adversarial_policy_corpus.py +54 -0
  54. secpol_audit-1.0.0/tests/test_bench.py +167 -0
  55. secpol_audit-1.0.0/tests/test_blast.py +438 -0
  56. secpol_audit-1.0.0/tests/test_blast_scenario_explorer.py +102 -0
  57. secpol_audit-1.0.0/tests/test_checks.py +459 -0
  58. secpol_audit-1.0.0/tests/test_cli_end_to_end.py +234 -0
  59. secpol_audit-1.0.0/tests/test_codelab.py +52 -0
  60. secpol_audit-1.0.0/tests/test_codelab_challenge_grader.py +45 -0
  61. secpol_audit-1.0.0/tests/test_compile_wrap.py +88 -0
  62. secpol_audit-1.0.0/tests/test_dashboard_generation.py +128 -0
  63. secpol_audit-1.0.0/tests/test_demo.py +71 -0
  64. secpol_audit-1.0.0/tests/test_demo_evidence.py +233 -0
  65. secpol_audit-1.0.0/tests/test_diff.py +117 -0
  66. secpol_audit-1.0.0/tests/test_engine_fix.py +151 -0
  67. secpol_audit-1.0.0/tests/test_engine_provenance_manifest.py +52 -0
  68. secpol_audit-1.0.0/tests/test_events.py +503 -0
  69. secpol_audit-1.0.0/tests/test_evidence_manifest.py +322 -0
  70. secpol_audit-1.0.0/tests/test_explain.py +237 -0
  71. secpol_audit-1.0.0/tests/test_firmware.py +565 -0
  72. secpol_audit-1.0.0/tests/test_generate_manifest.py +222 -0
  73. secpol_audit-1.0.0/tests/test_mcp_new_tools.py +62 -0
  74. secpol_audit-1.0.0/tests/test_mcp_official_sdk.py +68 -0
  75. secpol_audit-1.0.0/tests/test_mcp_stdio_integration.py +83 -0
  76. secpol_audit-1.0.0/tests/test_mcp_structured.py +35 -0
  77. secpol_audit-1.0.0/tests/test_mkifs_conformance.py +111 -0
  78. secpol_audit-1.0.0/tests/test_oracle_diff.py +121 -0
  79. secpol_audit-1.0.0/tests/test_parser_ifs.py +423 -0
  80. secpol_audit-1.0.0/tests/test_parser_secpol.py +398 -0
  81. secpol_audit-1.0.0/tests/test_paths.py +241 -0
  82. secpol_audit-1.0.0/tests/test_phase2_generalized.py +194 -0
  83. secpol_audit-1.0.0/tests/test_platform_suite.py +369 -0
  84. secpol_audit-1.0.0/tests/test_pr14_regressions.py +233 -0
  85. secpol_audit-1.0.0/tests/test_pr19_adversarial.py +884 -0
  86. secpol_audit-1.0.0/tests/test_provenance_path_safety.py +152 -0
  87. secpol_audit-1.0.0/tests/test_provenance_summary_integrity.py +94 -0
  88. secpol_audit-1.0.0/tests/test_prune_and_secpolgen.py +200 -0
  89. secpol_audit-1.0.0/tests/test_remediate.py +420 -0
  90. secpol_audit-1.0.0/tests/test_run46_checksums.py +68 -0
  91. secpol_audit-1.0.0/tests/test_run_qemu.py +222 -0
  92. secpol_audit-1.0.0/tests/test_runtime.py +198 -0
  93. secpol_audit-1.0.0/tests/test_sarif_and_html.py +122 -0
  94. secpol_audit-1.0.0/tests/test_shared_service_contract.py +75 -0
  95. secpol_audit-1.0.0/tests/test_trace.py +262 -0
  96. secpol_audit-1.0.0/tests/test_v9_audit_fixes.py +237 -0
  97. secpol_audit-1.0.0/tests/test_verify_codelab_resmgr.py +33 -0
  98. secpol_audit-1.0.0/tests/test_verify_elf_arch.py +70 -0
  99. secpol_audit-1.0.0/tests/test_verify_m3_fixed.py +72 -0
  100. secpol_audit-1.0.0/tests/test_verify_offline.py +129 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anshika Lamba
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,100 @@
1
+ Metadata-Version: 2.4
2
+ Name: secpol-audit
3
+ Version: 1.0.0
4
+ Summary: Deterministic, fail-closed static and runtime security-policy auditor for QNX Neutrino 8.0
5
+ Author: Anshika Lamba
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://anshika-lamba.github.io/secpol-audit/
8
+ Project-URL: Documentation, https://anshika-lamba.github.io/secpol-audit/codelab/
9
+ Project-URL: Repository, https://github.com/anshika-lamba/secpol-audit
10
+ Project-URL: Issues, https://github.com/anshika-lamba/secpol-audit/issues
11
+ Keywords: qnx,qnx-neutrino,secpol,security-policy,privilege-escalation,static-analysis,runtime-verification,sarif
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Security
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Provides-Extra: web
27
+ Requires-Dist: fastapi>=0.104; extra == "web"
28
+ Requires-Dist: uvicorn>=0.24; extra == "web"
29
+ Provides-Extra: mcp-test
30
+ Requires-Dist: mcp<2,>=1.0.0; extra == "mcp-test"
31
+ Provides-Extra: quality
32
+ Requires-Dist: ruff<1,>=0.11; extra == "quality"
33
+ Requires-Dist: mypy<2,>=1.15; extra == "quality"
34
+ Dynamic: license-file
35
+
36
+ # secpol-audit
37
+
38
+ **A deterministic, fail-closed analyzer for QNX Neutrino 8.0 security policies.** It identifies multi-hop privilege paths, inspects build/IFS relationships, parses selected runtime probe records, and correlates probe results with QNX security-event evidence when the required target captures are supplied.
39
+
40
+ [Project repository](https://github.com/anshika-lamba/secpol-audit) · [Architecture](https://github.com/anshika-lamba/secpol-audit/blob/main/docs/ARCHITECTURE.md) · [QNX codelab](https://anshika-lamba.github.io/secpol-audit/codelab/) · [Blast-Radius Explorer](https://anshika-lamba.github.io/secpol-audit/blast-explorer.html) · [Policy Assurance Workbench](https://anshika-lamba.github.io/secpol-audit/workbench.html)
41
+
42
+ ![secpol-audit system architecture](https://raw.githubusercontent.com/anshika-lamba/secpol-audit/main/docs/assets/secpol-audit-architecture.svg)
43
+
44
+ ## Install
45
+
46
+ Requires Python 3.10 or later. The core package has no mandatory third-party runtime dependencies.
47
+
48
+ ```bash
49
+ python -m pip install secpol-audit
50
+ secpol-audit --version
51
+ secpol-audit --help
52
+ ```
53
+
54
+ ## First static check
55
+
56
+ Point the CLI at a QNX `.secpol` file that you already have:
57
+
58
+ ```bash
59
+ secpol-audit check ./path/to/policy.secpol --no-secpolcompile
60
+ secpol-audit paths ./path/to/policy.secpol --no-secpolcompile
61
+ ```
62
+
63
+ These commands perform host-side analysis of the supplied file. `--no-secpolcompile` explicitly skips the QNX compiler invocation; it does not provide compiler validation or runtime proof.
64
+
65
+ Useful additional entry points:
66
+
67
+ - `secpol-audit-mcp` — read-only JSON-RPC stdio server for MCP-compatible clients.
68
+ - `secpol-audit-tui` — terminal overview of the selected workspace.
69
+ - `secpol-audit-web` — optional local web API and workspace console.
70
+
71
+ ## Optional web extra
72
+
73
+ Install FastAPI and Uvicorn support:
74
+
75
+ ```bash
76
+ python -m pip install "secpol-audit[web]"
77
+ secpol-audit-web --workspace ./path/to/workspace
78
+ ```
79
+
80
+ The web server binds to `127.0.0.1` by default and exposes a read-only workspace API. Do not expose it to an untrusted network without adding appropriate authentication and deployment controls.
81
+
82
+ ## What the PyPI package contains
83
+
84
+ The wheel installs the Python analyzer, command-line entry points, and packaged fallback dashboard asset. It does **not** bundle QNX SDP 8.0, QEMU, sample policy repositories, or the project's committed evidence archive.
85
+
86
+ For the complete QNX/QEMU demonstration, offline evidence replay, starter policies, tests, and codelab, use the [source repository](https://github.com/anshika-lamba/secpol-audit). Live QNX steps require a separately installed and configured QNX SDP 8.0 toolchain; installing this Python package does not grant or supply QNX tooling.
87
+
88
+ ## Evidence boundaries
89
+
90
+ - Static graph analysis predicts relationships from the policy and build inputs supplied to it.
91
+ - A syscall probe result alone is not a kernel-event witness.
92
+ - `OBSERVED_AND_CORRELATED` is reserved for records correlated under the verifier's PID and completeness rules.
93
+ - Missing or dropped telemetry is incomplete evidence, not proof of denial.
94
+ - The demonstrated target runtime is QNX Neutrino 8.0 under QEMU x86_64 TCG. This package does not demonstrate physical CAN-bus access or compromise of a production vehicle.
95
+
96
+ The parser supports a documented subset of QNX policy/build constructs. It does not replace QNX `secpolcompile`, `mkifs`, or target validation.
97
+
98
+ ## License
99
+
100
+ MIT. See the [license file](https://github.com/anshika-lamba/secpol-audit/blob/main/LICENSE).
@@ -0,0 +1,149 @@
1
+ # secpol-audit
2
+
3
+ [![CI](https://github.com/anshika-lamba/secpol-audit/actions/workflows/ci.yml/badge.svg)](https://github.com/anshika-lamba/secpol-audit/actions/workflows/ci.yml)
4
+
5
+ **A QNX security policy can block a direct connection and still permit an indirect path through another process type. Can you find that path, prove what the running system did, and verify the fix?**
6
+
7
+ secpol-audit helps answer that question. It analyzes QNX Neutrino 8.0 security-policy relationships, maps transitive privilege paths, checks selected operations on a QNX target, correlates probe results with kernel security events, and helps reviewers inspect a proposed policy change.
8
+
9
+ You do not need to understand the parser to understand the product. Start with the two visual tools:
10
+
11
+ - **[Open the Blast-Radius Explorer](https://anshika-lamba.github.io/secpol-audit/blast-explorer.html)** — follow a path from a starting security type and inspect the evidence attached to its edges.
12
+ - **[Open the Policy Assurance Workbench](https://anshika-lamba.github.io/secpol-audit/workbench.html)** — inspect findings, vulnerable/fixed captures, evidence records and remediation.
13
+
14
+ [Product overview](https://anshika-lamba.github.io/secpol-audit/) · [QNX codelab](https://anshika-lamba.github.io/secpol-audit/codelab/) · [Architecture and code map](docs/ARCHITECTURE.md) · [Submission and evidence notes](docs/SUBMISSION.md)
15
+
16
+ ---
17
+
18
+ ## Architecture at a glance
19
+
20
+ This is the actual system data flow—not just the three-node attack scenario. The host-side policy model and QNX-side runtime capture remain separate until evidence verification correlates probe results with kernel security events.
21
+
22
+ ![secpol-audit architecture: host-side policy analysis and QNX runtime evidence converge through PID-based correlation into the Explorer and Workbench](docs/assets/secpol-audit-architecture.svg)
23
+
24
+ [Open the full architecture and code map](docs/ARCHITECTURE.md).
25
+
26
+ ## The demonstrated path
27
+
28
+ A process may be denied a direct connection while its allowed type transitions compose into an indirect path:
29
+
30
+ ```text
31
+ ivi_ui_t
32
+ └─ settypeid → diag_helper_t
33
+ └─ settypeid → can_hal_t
34
+ ```
35
+
36
+ The demonstrated vulnerable QNX 8.0 QEMU scenario records a two-hop process lineage:
37
+
38
+ ```text
39
+ ivi_ui_t (PID 16388)
40
+ └─ settypeid → diag_helper_t (PID 20485)
41
+ └─ settypeid → can_hal_t (PID 20486)
42
+ ```
43
+
44
+ The separate fixed-policy experiment blocks the second transition with `EPERM`. These are separate captures, not one continuous before/after trace.
45
+
46
+ **Important boundary:** `can_hal_t` is a protected demonstration service endpoint. This project does not demonstrate physical CAN-bus access, steering/braking control, or compromise of a real vehicle. The committed runtime evidence is QNX Neutrino 8.0 under QEMU x86_64 TCG, not physical hardware.
47
+
48
+ ## How to use the product
49
+
50
+ <details open>
51
+ <summary><strong>1. Explore the blast radius</strong></summary>
52
+
53
+ Open the [Blast-Radius Explorer](https://anshika-lamba.github.io/secpol-audit/blast-explorer.html). Choose a starting security type and inspect the reachable types and paths. Treat the labels as part of the result: a static relationship is not automatically a runtime-observed relationship.
54
+ </details>
55
+
56
+ <details>
57
+ <summary><strong>2. Investigate the evidence and proposed fix</strong></summary>
58
+
59
+ Open the [Policy Assurance Workbench](https://anshika-lamba.github.io/secpol-audit/workbench.html). Inspect the findings, the vulnerable and fixed captures, the remediation proposal and its diff. The tool proposes changes for review; it does not silently deploy a production policy.
60
+ </details>
61
+
62
+ <details>
63
+ <summary><strong>3. Verify what happened on QNX</strong></summary>
64
+
65
+ The target-side probes record selected syscall outcomes. A separate sentry consumes QNX security events through `libsecpolev`. The verifier correlates records under explicit PID and completeness rules. Inspect the [Run 48 evidence index](evidence/run_48/README.md) and [raw QEMU captures](evidence/qemu_logs/).
66
+ </details>
67
+
68
+ ## What the evidence labels mean
69
+
70
+ | Label | What is established | What is not established |
71
+ |---|---|---|
72
+ | `STATIC_ONLY` | The supported policy model predicts a relationship or path. | That a process attempted it or the kernel accepted it. |
73
+ | `SYSCALL_ONLY_UNOBSERVABLE` | A target probe returned an outcome, but no matching kernel-event witness was correlated. | A kernel-event-confirmed result. |
74
+ | `OBSERVED_AND_CORRELATED` | A probe result was matched to a corresponding QNX security event under the verifier's rules. | Physical-hardware behaviour or universal policy safety. |
75
+
76
+ A missing event is not proof of denial. A complete capture means its declared evidence contract was satisfied; it does not mean the policy is secure.
77
+
78
+ ## What is actually validated
79
+
80
+ The canonical committed QNX capture is [Run 48](https://github.com/anshika-lamba/secpol-audit/actions/runs/47307920248). Its oracle exercise covered 10 `secpolcompile` cases and 49 `mkifs` cases, with 14 conservative rejections and zero silent disagreements, parser crashes or `mkifs` execution errors. These are compiler/oracle cases, **not 59 production policies**.
81
+
82
+ The Run 48 workflow also exercised the engine-generated remediation candidate, resource-manager behaviour, independent blast probes and sentry lineage. Read the [evidence notes](docs/SUBMISSION.md) for the exact boundaries and provenance.
83
+
84
+ Known limits:
85
+ - Runtime demonstration: QEMU x86_64 TCG; AArch64 was cross-compiled, not booted.
86
+ - The parser models supported QNX policy/build constructs; it does not replace `secpolcompile` or `mkifs`.
87
+ - The ADAS fixture is a 12-type policy model, not twelve independent production services.
88
+ - The browser graph visualizes analysis/evidence data; it is not a live kernel graph.
89
+
90
+ ## Run the host-side demo
91
+
92
+ Requirements: Python 3.10+ and Git. Live QNX exercises additionally require QNX SDP 8.0 and the configured QEMU toolchain.
93
+
94
+ ```bash
95
+ git clone https://github.com/anshika-lamba/secpol-audit.git
96
+ cd secpol-audit
97
+ python -m venv .venv
98
+ ```
99
+
100
+ Activate the environment:
101
+
102
+ ```bash
103
+ # Windows Command Prompt
104
+ .venv\Scripts\activate.bat
105
+
106
+ # macOS / Linux
107
+ source .venv/bin/activate
108
+ ```
109
+
110
+ Install and run:
111
+
112
+ ```bash
113
+ python -m pip install -e ".[dev]"
114
+ secpol-audit demo --quick
115
+ pytest -q
116
+ ```
117
+
118
+ To replay committed evidence offline (no QNX boot):
119
+
120
+ ```bash
121
+ make verify-offline
122
+ ```
123
+
124
+ ## Codebase map
125
+
126
+ | Directory | What lives there |
127
+ |---|---|
128
+ | `secpol_audit/` | Host parser, policy model, reachability, remediation, verification and service layer. |
129
+ | `qnx_demo/` | QNX-native probes, sentry, resource-manager exercise, policy variants and IFS templates. |
130
+ | `harness/` | QEMU orchestration, capture verification, evidence manifests and UI generators. |
131
+ | `evidence/` | Committed QEMU logs, completeness records, provenance receipts and checksums. |
132
+ | `web-dashboard/` | Workbench source/template. |
133
+ | `docs/` | Published product pages, Explorer, Workbench, codelab and reviewer documentation. |
134
+ | `tests/` | Unit, adversarial, parser, CLI, browser and evidence-replay tests. |
135
+ | `vscode-extension/` | Optional editor integration. |
136
+
137
+ For the full data-flow diagram, file-level entry points, generator relationships and trust boundaries, see **[Architecture and code map](docs/ARCHITECTURE.md)** or the shorter **[reviewer map](docs/REVIEWER_MAP.md)**.
138
+
139
+ ## Why this project
140
+
141
+ I started with a question while exploring QNX security policies: a process can be denied access directly, but what happens if it can become another process, and that process can become something else? Individual permissions can look reasonable while their composition creates a path worth investigating.
142
+
143
+ I wanted to test more than a graph prediction: could I follow a suspected path through a running QNX system, compare the probe result with kernel security events, and then test whether a policy change blocked the same transition?
144
+
145
+ That question became secpol-audit. It is a reproducible demonstration and analysis tool—not a report of a real-world vehicle compromise.
146
+
147
+ ---
148
+
149
+ **Find the path. Prove the boundary. Review the fix.**
@@ -0,0 +1,65 @@
1
+ # secpol-audit
2
+
3
+ **A deterministic, fail-closed analyzer for QNX Neutrino 8.0 security policies.** It identifies multi-hop privilege paths, inspects build/IFS relationships, parses selected runtime probe records, and correlates probe results with QNX security-event evidence when the required target captures are supplied.
4
+
5
+ [Project repository](https://github.com/anshika-lamba/secpol-audit) · [Architecture](https://github.com/anshika-lamba/secpol-audit/blob/main/docs/ARCHITECTURE.md) · [QNX codelab](https://anshika-lamba.github.io/secpol-audit/codelab/) · [Blast-Radius Explorer](https://anshika-lamba.github.io/secpol-audit/blast-explorer.html) · [Policy Assurance Workbench](https://anshika-lamba.github.io/secpol-audit/workbench.html)
6
+
7
+ ![secpol-audit system architecture](https://raw.githubusercontent.com/anshika-lamba/secpol-audit/main/docs/assets/secpol-audit-architecture.svg)
8
+
9
+ ## Install
10
+
11
+ Requires Python 3.10 or later. The core package has no mandatory third-party runtime dependencies.
12
+
13
+ ```bash
14
+ python -m pip install secpol-audit
15
+ secpol-audit --version
16
+ secpol-audit --help
17
+ ```
18
+
19
+ ## First static check
20
+
21
+ Point the CLI at a QNX `.secpol` file that you already have:
22
+
23
+ ```bash
24
+ secpol-audit check ./path/to/policy.secpol --no-secpolcompile
25
+ secpol-audit paths ./path/to/policy.secpol --no-secpolcompile
26
+ ```
27
+
28
+ These commands perform host-side analysis of the supplied file. `--no-secpolcompile` explicitly skips the QNX compiler invocation; it does not provide compiler validation or runtime proof.
29
+
30
+ Useful additional entry points:
31
+
32
+ - `secpol-audit-mcp` — read-only JSON-RPC stdio server for MCP-compatible clients.
33
+ - `secpol-audit-tui` — terminal overview of the selected workspace.
34
+ - `secpol-audit-web` — optional local web API and workspace console.
35
+
36
+ ## Optional web extra
37
+
38
+ Install FastAPI and Uvicorn support:
39
+
40
+ ```bash
41
+ python -m pip install "secpol-audit[web]"
42
+ secpol-audit-web --workspace ./path/to/workspace
43
+ ```
44
+
45
+ The web server binds to `127.0.0.1` by default and exposes a read-only workspace API. Do not expose it to an untrusted network without adding appropriate authentication and deployment controls.
46
+
47
+ ## What the PyPI package contains
48
+
49
+ The wheel installs the Python analyzer, command-line entry points, and packaged fallback dashboard asset. It does **not** bundle QNX SDP 8.0, QEMU, sample policy repositories, or the project's committed evidence archive.
50
+
51
+ For the complete QNX/QEMU demonstration, offline evidence replay, starter policies, tests, and codelab, use the [source repository](https://github.com/anshika-lamba/secpol-audit). Live QNX steps require a separately installed and configured QNX SDP 8.0 toolchain; installing this Python package does not grant or supply QNX tooling.
52
+
53
+ ## Evidence boundaries
54
+
55
+ - Static graph analysis predicts relationships from the policy and build inputs supplied to it.
56
+ - A syscall probe result alone is not a kernel-event witness.
57
+ - `OBSERVED_AND_CORRELATED` is reserved for records correlated under the verifier's PID and completeness rules.
58
+ - Missing or dropped telemetry is incomplete evidence, not proof of denial.
59
+ - The demonstrated target runtime is QNX Neutrino 8.0 under QEMU x86_64 TCG. This package does not demonstrate physical CAN-bus access or compromise of a production vehicle.
60
+
61
+ The parser supports a documented subset of QNX policy/build constructs. It does not replace QNX `secpolcompile`, `mkifs`, or target validation.
62
+
63
+ ## License
64
+
65
+ MIT. See the [license file](https://github.com/anshika-lamba/secpol-audit/blob/main/LICENSE).
@@ -0,0 +1,76 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "secpol-audit"
7
+ version = "1.0.0"
8
+ description = "Deterministic, fail-closed static and runtime security-policy auditor for QNX Neutrino 8.0"
9
+ readme = "README_PYPI.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Anshika Lamba" }]
13
+ requires-python = ">=3.10"
14
+ dependencies = []
15
+ keywords = [
16
+ "qnx",
17
+ "qnx-neutrino",
18
+ "secpol",
19
+ "security-policy",
20
+ "privilege-escalation",
21
+ "static-analysis",
22
+ "runtime-verification",
23
+ "sarif",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 4 - Beta",
27
+ "Environment :: Console",
28
+ "Intended Audience :: Developers",
29
+ "Operating System :: OS Independent",
30
+ "Topic :: Security",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://anshika-lamba.github.io/secpol-audit/"
39
+ Documentation = "https://anshika-lamba.github.io/secpol-audit/codelab/"
40
+ Repository = "https://github.com/anshika-lamba/secpol-audit"
41
+ Issues = "https://github.com/anshika-lamba/secpol-audit/issues"
42
+
43
+ [project.optional-dependencies]
44
+ dev = ["pytest>=7.0"]
45
+ web = ["fastapi>=0.104", "uvicorn>=0.24"]
46
+ mcp-test = ["mcp>=1.0.0,<2"]
47
+ quality = ["ruff>=0.11,<1", "mypy>=1.15,<2"]
48
+
49
+ [project.scripts]
50
+ secpol-audit = "secpol_audit.cli:main"
51
+ secpol-audit-mcp = "secpol_audit.mcp_server:main"
52
+ secpol-audit-tui = "secpol_audit.tui:main"
53
+ secpol-audit-web = "secpol_audit.api_server:main"
54
+
55
+ [tool.setuptools.packages.find]
56
+ include = ["secpol_audit*"]
57
+
58
+ [tool.pytest.ini_options]
59
+ testpaths = ["tests"]
60
+ pythonpath = ["."]
61
+ addopts = "-ra"
62
+
63
+ [tool.setuptools.package-data]
64
+ secpol_audit = ["assets/*.html"]
65
+
66
+ [tool.ruff]
67
+ target-version = "py310"
68
+ line-length = 100
69
+
70
+ [tool.ruff.lint]
71
+ select = ["E4", "E7", "E9", "F"]
72
+
73
+ [tool.mypy]
74
+ python_version = "3.10"
75
+ strict = true
76
+ show_error_codes = true
@@ -0,0 +1,5 @@
1
+ """secpol-audit: Deterministic static & runtime QNX Neutrino 8.0 security policy auditor."""
2
+
3
+ __version__ = "1.0.0"
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,8 @@
1
+ """Module entrypoint for `python3 -m secpol_audit`."""
2
+
3
+ import sys
4
+
5
+ from secpol_audit.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())
@@ -0,0 +1,137 @@
1
+ """Live FastAPI backend server for secpol-audit Web Dashboard (Part M).
2
+
3
+ Binds strictly to 127.0.0.1 by default, enforces read-only workspace confinement
4
+ via `SecpolPlatformService`, and serves both live JSON endpoints and the
5
+ interactive systems-engineering dashboard.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ from importlib.resources import files
12
+ from pathlib import Path
13
+ from typing import Any
14
+
15
+ from fastapi import FastAPI, HTTPException, Query
16
+ from fastapi.responses import HTMLResponse
17
+
18
+ from secpol_audit.service import SecpolPlatformService, WorkspaceSecurityError
19
+
20
+
21
+ def create_app(workspace_root: str | Path) -> FastAPI:
22
+ svc = SecpolPlatformService(workspace_root)
23
+ app = FastAPI(title="secpol-audit QNX 8.0 API", version="1.0.0")
24
+
25
+ @app.get("/api/health")
26
+ def api_health() -> dict[str, Any]:
27
+ return {
28
+ "status": "ok",
29
+ "mode": "LIVE_API",
30
+ "workspace_root": str(svc.workspace_root),
31
+ "toolchain": svc.check_toolchain(),
32
+ }
33
+
34
+ @app.get("/api/policies")
35
+ def api_policies() -> dict[str, Any]:
36
+ return {"policies": svc.list_policies(), "build_files": svc.list_build_files()}
37
+
38
+ @app.get("/api/analyze")
39
+ def api_analyze(
40
+ policy_path: str = Query("qnx_demo/mutants/M3_blast_escalate.secpol"),
41
+ ifs_path: str | None = Query(None),
42
+ ) -> dict[str, Any]:
43
+ try:
44
+ return svc.analyze_policy(policy_path, ifs_path=ifs_path)
45
+ except (WorkspaceSecurityError, FileNotFoundError) as exc:
46
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
47
+
48
+ @app.get("/api/blast")
49
+ def api_blast(
50
+ policy_path: str = Query("qnx_demo/mutants/M3_blast_escalate.secpol"),
51
+ ifs_path: str | None = Query("qnx_demo/build_blast.ifs.in"),
52
+ log_path: str | None = Query("evidence/blast/M3_blast_escalate.log"),
53
+ expected_probes_path: str | None = Query("qnx_demo/blast_expected_probes.json"),
54
+ ) -> dict[str, Any]:
55
+ try:
56
+ return svc.analyze_blast_radius(
57
+ policy_path,
58
+ ifs_path=ifs_path,
59
+ log_path=log_path,
60
+ expected_probes_path=expected_probes_path,
61
+ )
62
+ except (WorkspaceSecurityError, FileNotFoundError) as exc:
63
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
64
+
65
+ @app.get("/api/remediate")
66
+ def api_remediate(
67
+ policy_path: str = Query("qnx_demo/mutants/M3_blast_escalate.secpol"),
68
+ ) -> dict[str, Any]:
69
+ try:
70
+ return svc.preview_remediation(policy_path)
71
+ except (WorkspaceSecurityError, FileNotFoundError) as exc:
72
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
73
+
74
+ @app.get("/api/build-doctor")
75
+ def api_build_doctor(
76
+ build_path: str = Query("qnx_demo/build_blast.ifs.in"),
77
+ secpol_path: str | None = Query("qnx_demo/mutants/M3_blast_escalate.secpol"),
78
+ ) -> dict[str, Any]:
79
+ try:
80
+ return svc.run_build_doctor(build_path, secpol_path=secpol_path)
81
+ except (WorkspaceSecurityError, FileNotFoundError) as exc:
82
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
83
+
84
+ @app.get("/api/target")
85
+ def api_target(
86
+ profile: str = Query("qemu-m3-capture"),
87
+ ) -> dict[str, Any]:
88
+ try:
89
+ return svc.inspect_target(profile)
90
+ except (ValueError, FileNotFoundError, WorkspaceSecurityError) as exc:
91
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
92
+
93
+ @app.get("/api/ipc")
94
+ def api_ipc(
95
+ source: str = Query("qnx-adas-live"),
96
+ ) -> dict[str, Any]:
97
+ try:
98
+ return svc.analyze_ipc_scenario(source)
99
+ except (ValueError, FileNotFoundError, WorkspaceSecurityError) as exc:
100
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
101
+
102
+ @app.get("/api/witness")
103
+ def api_witness(
104
+ target: str = Query("ADAS_12svc_blast"),
105
+ ) -> dict[str, Any]:
106
+ try:
107
+ return svc.build_e2e_witness(target)
108
+ except (ValueError, FileNotFoundError, WorkspaceSecurityError) as exc:
109
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
110
+
111
+ @app.get("/", response_class=HTMLResponse)
112
+ def index() -> str:
113
+ dash = svc.workspace_root / "web-dashboard" / "index.html"
114
+ if dash.is_file():
115
+ return dash.read_text(encoding="utf-8")
116
+ try:
117
+ return files("secpol_audit").joinpath("assets", "fallback_dashboard.html").read_text(encoding="utf-8")
118
+ except (FileNotFoundError, ModuleNotFoundError) as exc:
119
+ raise HTTPException(status_code=404, detail="No workspace dashboard or packaged fallback is available") from exc
120
+
121
+ return app
122
+
123
+
124
+ def main(argv: list[str] | None = None) -> int:
125
+ import uvicorn
126
+
127
+ ap = argparse.ArgumentParser(description="secpol-audit local read-only web console")
128
+ ap.add_argument("--workspace", default=".")
129
+ ap.add_argument("--host", default="127.0.0.1")
130
+ ap.add_argument("--port", type=int, default=8765)
131
+ ns = ap.parse_args(argv)
132
+ uvicorn.run(create_app(ns.workspace), host=ns.host, port=ns.port)
133
+ return 0
134
+
135
+
136
+ if __name__ == "__main__":
137
+ raise SystemExit(main())
@@ -0,0 +1,42 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>secpol-audit · Workspace console</title>
7
+ <style>
8
+ :root{color-scheme:dark;--bg:#0b1115;--panel:#121c21;--line:#26373b;--text:#e6efeb;--muted:#91a39e;--lime:#c7ee78;--red:#ff8179}
9
+ *{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 80% 0%,#1c302b 0,transparent 45%),var(--bg);color:var(--text);font:15px/1.55 system-ui,sans-serif}
10
+ main{width:min(100% - 36px,980px);margin:56px auto}header{display:flex;justify-content:space-between;gap:20px;align-items:center;border-bottom:1px solid var(--line);padding-bottom:22px}
11
+ h1{font-size:clamp(30px,5vw,48px);line-height:1.05;letter-spacing:-.04em;margin:0}h1 span{color:var(--lime)}p{color:var(--muted)}
12
+ .pill{border:1px solid var(--line);border-radius:99px;padding:6px 12px;color:var(--muted);font-size:12px}
13
+ .grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:24px}.card{background:rgba(18,28,33,.92);border:1px solid var(--line);border-radius:12px;padding:20px;min-width:0}
14
+ h2{font-size:16px;margin:0 0 12px}label{display:block;color:var(--muted);font-size:12px;margin:12px 0 5px}
15
+ select,input,button{font:inherit;color:var(--text);background:#0d1519;border:1px solid var(--line);border-radius:7px;padding:10px;width:100%}
16
+ button{cursor:pointer;background:rgba(199,238,120,.12);border-color:rgba(199,238,120,.35);color:var(--lime);font-weight:650;margin-top:12px}
17
+ pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#091014;border:1px solid var(--line);border-radius:8px;padding:14px;min-height:100px;color:#d5e4dd;font:12px/1.55 ui-monospace,monospace}
18
+ .notice{border-left:3px solid var(--lime);padding:10px 14px;background:rgba(199,238,120,.06);margin:22px 0;color:var(--muted)}
19
+ footer{margin-top:24px;color:var(--muted);font-size:12px}
20
+ @media(max-width:680px){main{margin:30px auto}.grid{grid-template-columns:1fr}header{align-items:flex-start;flex-direction:column}}
21
+ </style>
22
+ </head>
23
+ <body>
24
+ <main>
25
+ <header><div><h1>secpol<span>-audit</span></h1><p>QNX Neutrino 8.0 · Read-only workspace console</p></div><span class="pill" id="status">Checking API…</span></header>
26
+ <div class="notice">The full visual workbench is not present in this workspace. This packaged console provides safe API access without returning a 404. To generate the full workbench in a source checkout, run <code>python harness/generate_dashboard.py</code>.</div>
27
+ <div class="grid">
28
+ <section class="card"><h2>Workspace health</h2><p>API and toolchain availability.</p><button id="refresh">Refresh status</button><pre id="health">Waiting for API…</pre></section>
29
+ <section class="card"><h2>Policy analysis</h2><label for="policy">Policy file</label><select id="policy"><option value="">Loading policies…</option></select><label for="ifs">Optional buildfile</label><select id="ifs"><option value="">No buildfile</option></select><button id="analyze">Analyze selected files</button><pre id="result">Select a policy and run analysis.</pre></section>
30
+ </div>
31
+ <footer>Static findings are not compiler confirmation. QNX mkifs and secpolcompile remain the target-side authorities. The server is read-only and should remain bound to loopback unless authenticated deployment controls are added.</footer>
32
+ </main>
33
+ <script>
34
+ 'use strict';
35
+ const $=id=>document.getElementById(id);
36
+ async function get(path){const r=await fetch(path,{headers:{Accept:'application/json'}});if(!r.ok)throw new Error('HTTP '+r.status+' '+r.statusText);return r.json();}
37
+ async function refresh(){try{const d=await get('/api/health');$('status').textContent='API ONLINE';$('health').textContent=JSON.stringify(d,null,2);const f=await get('/api/policies');$('policy').replaceChildren();for(const p of f.policies){const o=document.createElement('option');o.value=p;o.textContent=p;$('policy').append(o);}if(!f.policies.length){const o=document.createElement('option');o.textContent='No .secpol files found';o.value='';$('policy').append(o);} $('ifs').replaceChildren();const none=document.createElement('option');none.value='';none.textContent='No buildfile';$('ifs').append(none);for(const p of f.build_files){const o=document.createElement('option');o.value=p;o.textContent=p;$('ifs').append(o);}}catch(e){$('status').textContent='API UNAVAILABLE';$('health').textContent=String(e);}}
38
+ async function analyze(){const policy=$('policy').value;if(!policy){$('result').textContent='No policy selected.';return;}const q=new URLSearchParams({policy_path:policy});if($('ifs').value)q.set('ifs_path',$('ifs').value);$('result').textContent='Analyzing…';try{$('result').textContent=JSON.stringify(await get('/api/analyze?'+q.toString()),null,2);}catch(e){$('result').textContent=String(e);}}
39
+ $('refresh').addEventListener('click',refresh);$('analyze').addEventListener('click',analyze);refresh();
40
+ </script>
41
+ </body>
42
+ </html>