norviq 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 (158) hide show
  1. norviq-0.1.0/LICENSE +201 -0
  2. norviq-0.1.0/PKG-INFO +148 -0
  3. norviq-0.1.0/PYPI-README.md +80 -0
  4. norviq-0.1.0/README.md +224 -0
  5. norviq-0.1.0/norviq/__init__.py +0 -0
  6. norviq-0.1.0/norviq/api/__init__.py +0 -0
  7. norviq-0.1.0/norviq/api/admin_reset.py +84 -0
  8. norviq-0.1.0/norviq/api/api_keys.py +121 -0
  9. norviq-0.1.0/norviq/api/audit_hub.py +57 -0
  10. norviq-0.1.0/norviq/api/audit_retention.py +187 -0
  11. norviq-0.1.0/norviq/api/auth.py +415 -0
  12. norviq-0.1.0/norviq/api/body_limit.py +98 -0
  13. norviq-0.1.0/norviq/api/db/__init__.py +42 -0
  14. norviq-0.1.0/norviq/api/db/models.py +372 -0
  15. norviq-0.1.0/norviq/api/db/session.py +357 -0
  16. norviq-0.1.0/norviq/api/jwks.py +89 -0
  17. norviq-0.1.0/norviq/api/main.py +353 -0
  18. norviq-0.1.0/norviq/api/packs.py +146 -0
  19. norviq-0.1.0/norviq/api/passwords.py +116 -0
  20. norviq-0.1.0/norviq/api/rate_limit.py +263 -0
  21. norviq-0.1.0/norviq/api/redteam_efficacy.py +155 -0
  22. norviq-0.1.0/norviq/api/retention.py +77 -0
  23. norviq-0.1.0/norviq/api/routers/__init__.py +4 -0
  24. norviq-0.1.0/norviq/api/routers/agents.py +542 -0
  25. norviq-0.1.0/norviq/api/routers/attack_graph_compute.py +55 -0
  26. norviq-0.1.0/norviq/api/routers/audit.py +403 -0
  27. norviq-0.1.0/norviq/api/routers/auth_login.py +272 -0
  28. norviq-0.1.0/norviq/api/routers/cluster_info.py +69 -0
  29. norviq-0.1.0/norviq/api/routers/coverage.py +259 -0
  30. norviq-0.1.0/norviq/api/routers/deployments.py +54 -0
  31. norviq-0.1.0/norviq/api/routers/evaluate.py +105 -0
  32. norviq-0.1.0/norviq/api/routers/fleet_enroll.py +171 -0
  33. norviq-0.1.0/norviq/api/routers/graph.py +109 -0
  34. norviq-0.1.0/norviq/api/routers/graphs.py +618 -0
  35. norviq-0.1.0/norviq/api/routers/health.py +63 -0
  36. norviq-0.1.0/norviq/api/routers/keys.py +135 -0
  37. norviq-0.1.0/norviq/api/routers/me.py +32 -0
  38. norviq-0.1.0/norviq/api/routers/mitre.py +824 -0
  39. norviq-0.1.0/norviq/api/routers/packs.py +260 -0
  40. norviq-0.1.0/norviq/api/routers/policies.py +1092 -0
  41. norviq-0.1.0/norviq/api/routers/redteam.py +507 -0
  42. norviq-0.1.0/norviq/api/routers/search.py +126 -0
  43. norviq-0.1.0/norviq/api/routers/settings_router.py +171 -0
  44. norviq-0.1.0/norviq/api/routers/system_health.py +128 -0
  45. norviq-0.1.0/norviq/api/routers/threats.py +1463 -0
  46. norviq-0.1.0/norviq/api/routers/version.py +37 -0
  47. norviq-0.1.0/norviq/api/schemas/graphs.py +58 -0
  48. norviq-0.1.0/norviq/api/schemas/threats.py +187 -0
  49. norviq-0.1.0/norviq/api/session_revocation.py +98 -0
  50. norviq-0.1.0/norviq/api/siem.py +112 -0
  51. norviq-0.1.0/norviq/api/synthetic.py +103 -0
  52. norviq-0.1.0/norviq/api/threat_intent.py +719 -0
  53. norviq-0.1.0/norviq/api/token_mint.py +72 -0
  54. norviq-0.1.0/norviq/cli/__init__.py +4 -0
  55. norviq-0.1.0/norviq/cli/api_client.py +88 -0
  56. norviq-0.1.0/norviq/cli/formatters.py +43 -0
  57. norviq-0.1.0/norviq/cli/main.py +411 -0
  58. norviq-0.1.0/norviq/config.py +383 -0
  59. norviq-0.1.0/norviq/engine/__init__.py +11 -0
  60. norviq-0.1.0/norviq/engine/attack_graph.py +440 -0
  61. norviq-0.1.0/norviq/engine/attack_graph_models.py +38 -0
  62. norviq-0.1.0/norviq/engine/audit_emitter.py +155 -0
  63. norviq-0.1.0/norviq/engine/cache.py +504 -0
  64. norviq-0.1.0/norviq/engine/capability/__init__.py +40 -0
  65. norviq-0.1.0/norviq/engine/capability/source_registry.py +525 -0
  66. norviq-0.1.0/norviq/engine/confusables.py +69 -0
  67. norviq-0.1.0/norviq/engine/evaluator.py +1507 -0
  68. norviq-0.1.0/norviq/engine/graph/__init__.py +25 -0
  69. norviq-0.1.0/norviq/engine/graph/analyzer.py +71 -0
  70. norviq-0.1.0/norviq/engine/graph/asset_graph.py +280 -0
  71. norviq-0.1.0/norviq/engine/graph/attack_graph.py +172 -0
  72. norviq-0.1.0/norviq/engine/graph/models.py +84 -0
  73. norviq-0.1.0/norviq/engine/graph/store.py +115 -0
  74. norviq-0.1.0/norviq/engine/identity.py +153 -0
  75. norviq-0.1.0/norviq/engine/inproc_cache.py +94 -0
  76. norviq-0.1.0/norviq/engine/masking.py +60 -0
  77. norviq-0.1.0/norviq/engine/opa-capabilities.json +5378 -0
  78. norviq-0.1.0/norviq/engine/opa_client.py +237 -0
  79. norviq-0.1.0/norviq/engine/policy_loader.py +809 -0
  80. norviq-0.1.0/norviq/engine/trust/__init__.py +11 -0
  81. norviq-0.1.0/norviq/engine/trust/calculator.py +339 -0
  82. norviq-0.1.0/norviq/engine/trust/history.py +63 -0
  83. norviq-0.1.0/norviq/engine/trust/models.py +36 -0
  84. norviq-0.1.0/norviq/engine/trust/profile.py +169 -0
  85. norviq-0.1.0/norviq/engine/trust/signals/__init__.py +22 -0
  86. norviq-0.1.0/norviq/engine/trust/signals/base.py +19 -0
  87. norviq-0.1.0/norviq/engine/trust/signals/chain_depth.py +26 -0
  88. norviq-0.1.0/norviq/engine/trust/signals/param_entropy.py +45 -0
  89. norviq-0.1.0/norviq/engine/trust/signals/scope_drift.py +28 -0
  90. norviq-0.1.0/norviq/engine/trust/signals/session_velocity.py +38 -0
  91. norviq-0.1.0/norviq/engine/trust/signals/time_decay.py +42 -0
  92. norviq-0.1.0/norviq/engine/trust/signals/tool_novelty.py +28 -0
  93. norviq-0.1.0/norviq/engine/trust/signals/violation_rate.py +32 -0
  94. norviq-0.1.0/norviq/exceptions.py +59 -0
  95. norviq-0.1.0/norviq/fleet/__init__.py +0 -0
  96. norviq-0.1.0/norviq/fleet/bundle.py +71 -0
  97. norviq-0.1.0/norviq/fleet/db.py +87 -0
  98. norviq-0.1.0/norviq/fleet/join_token.py +80 -0
  99. norviq-0.1.0/norviq/fleet/main.py +57 -0
  100. norviq-0.1.0/norviq/fleet/models.py +115 -0
  101. norviq-0.1.0/norviq/fleet/oidc_cc.py +58 -0
  102. norviq-0.1.0/norviq/fleet/pinned_transport.py +121 -0
  103. norviq-0.1.0/norviq/fleet/routers/__init__.py +0 -0
  104. norviq-0.1.0/norviq/fleet/routers/fleet.py +244 -0
  105. norviq-0.1.0/norviq/fleet/routers/fleet_policy.py +335 -0
  106. norviq-0.1.0/norviq/fleet/routers/health.py +32 -0
  107. norviq-0.1.0/norviq/fleet/routers/ingest.py +97 -0
  108. norviq-0.1.0/norviq/fleet/schemas.py +108 -0
  109. norviq-0.1.0/norviq/fleet/ssrf_guard.py +110 -0
  110. norviq-0.1.0/norviq/fleet_puller.py +207 -0
  111. norviq-0.1.0/norviq/fleet_relay.py +149 -0
  112. norviq-0.1.0/norviq/redteam/__init__.py +20 -0
  113. norviq-0.1.0/norviq/redteam/attacks.py +101 -0
  114. norviq-0.1.0/norviq/redteam/reporter.py +93 -0
  115. norviq-0.1.0/norviq/redteam/runner.py +101 -0
  116. norviq-0.1.0/norviq/redteam/simulator.py +199 -0
  117. norviq-0.1.0/norviq/sdk/__init__.py +67 -0
  118. norviq-0.1.0/norviq/sdk/autogen/__init__.py +0 -0
  119. norviq-0.1.0/norviq/sdk/autogen/adapter.py +87 -0
  120. norviq-0.1.0/norviq/sdk/client/__init__.py +8 -0
  121. norviq-0.1.0/norviq/sdk/client/engine.py +224 -0
  122. norviq-0.1.0/norviq/sdk/core/__init__.py +0 -0
  123. norviq-0.1.0/norviq/sdk/core/audit.py +61 -0
  124. norviq-0.1.0/norviq/sdk/core/decisions.py +41 -0
  125. norviq-0.1.0/norviq/sdk/core/events.py +50 -0
  126. norviq-0.1.0/norviq/sdk/core/interceptor.py +85 -0
  127. norviq-0.1.0/norviq/sdk/core/recorder.py +116 -0
  128. norviq-0.1.0/norviq/sdk/core/trust.py +56 -0
  129. norviq-0.1.0/norviq/sdk/core/wrapping.py +74 -0
  130. norviq-0.1.0/norviq/sdk/crewai/__init__.py +0 -0
  131. norviq-0.1.0/norviq/sdk/crewai/adapter.py +74 -0
  132. norviq-0.1.0/norviq/sdk/langchain/__init__.py +0 -0
  133. norviq-0.1.0/norviq/sdk/langchain/adapter.py +123 -0
  134. norviq-0.1.0/norviq/sdk/langgraph/__init__.py +0 -0
  135. norviq-0.1.0/norviq/sdk/langgraph/adapter.py +89 -0
  136. norviq-0.1.0/norviq/sdk/semantic_kernel/__init__.py +0 -0
  137. norviq-0.1.0/norviq/sdk/semantic_kernel/adapter.py +111 -0
  138. norviq-0.1.0/norviq/sidecar/__init__.py +5 -0
  139. norviq-0.1.0/norviq/sidecar/__main__.py +31 -0
  140. norviq-0.1.0/norviq/sidecar/http_fallback.py +95 -0
  141. norviq-0.1.0/norviq/sidecar/proxy.py +200 -0
  142. norviq-0.1.0/norviq/sidecar/remote_evaluator.py +199 -0
  143. norviq-0.1.0/norviq/telemetry/__init__.py +9 -0
  144. norviq-0.1.0/norviq/telemetry/exporter.py +23 -0
  145. norviq-0.1.0/norviq/telemetry/metrics.py +158 -0
  146. norviq-0.1.0/norviq/telemetry/middleware.py +35 -0
  147. norviq-0.1.0/norviq/telemetry/provider.py +62 -0
  148. norviq-0.1.0/norviq/telemetry/spans.py +60 -0
  149. norviq-0.1.0/norviq.egg-info/PKG-INFO +148 -0
  150. norviq-0.1.0/norviq.egg-info/SOURCES.txt +156 -0
  151. norviq-0.1.0/norviq.egg-info/dependency_links.txt +1 -0
  152. norviq-0.1.0/norviq.egg-info/entry_points.txt +2 -0
  153. norviq-0.1.0/norviq.egg-info/requires.txt +55 -0
  154. norviq-0.1.0/norviq.egg-info/top_level.txt +1 -0
  155. norviq-0.1.0/pyproject.toml +113 -0
  156. norviq-0.1.0/setup.cfg +4 -0
  157. norviq-0.1.0/tests/test_config.py +82 -0
  158. norviq-0.1.0/tests/test_exceptions.py +76 -0
norviq-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
norviq-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: norviq
3
+ Version: 0.1.0
4
+ Summary: Runtime policy enforcement for LLM agent tool calls on Kubernetes.
5
+ Author: Norviq
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://norviq.dev
8
+ Project-URL: Documentation, https://docs.norviq.dev
9
+ Project-URL: Repository, https://github.com/norviq-dev/norviq
10
+ Keywords: llm,agents,security,policy-enforcement,opa,kubernetes,ai-safety
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: click>=8.1
21
+ Requires-Dist: pydantic>=2.0
22
+ Requires-Dist: pydantic-settings>=2.0
23
+ Requires-Dist: structlog>=23.0
24
+ Requires-Dist: httpx>=0.24
25
+ Requires-Dist: opentelemetry-api>=1.20
26
+ Requires-Dist: opentelemetry-sdk>=1.20
27
+ Requires-Dist: opentelemetry-exporter-otlp>=1.20
28
+ Requires-Dist: opentelemetry-exporter-prometheus>=0.41b0
29
+ Requires-Dist: prometheus-client>=0.20
30
+ Requires-Dist: redis>=5.0
31
+ Requires-Dist: sqlalchemy[asyncio]>=2.0
32
+ Requires-Dist: asyncpg>=0.29
33
+ Requires-Dist: alembic>=1.13
34
+ Requires-Dist: networkx>=3.0
35
+ Requires-Dist: fastapi>=0.109
36
+ Requires-Dist: uvicorn>=0.27
37
+ Requires-Dist: websockets>=12
38
+ Requires-Dist: pyjwt[crypto]>=2.8
39
+ Requires-Dist: passlib[bcrypt]>=1.7
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=8.0; extra == "dev"
42
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
43
+ Requires-Dist: httpx; extra == "dev"
44
+ Requires-Dist: ruff>=0.2; extra == "dev"
45
+ Provides-Extra: spiffe
46
+ Requires-Dist: spiffe>=0.2; extra == "spiffe"
47
+ Provides-Extra: langchain
48
+ Requires-Dist: langchain-core>=0.2; extra == "langchain"
49
+ Provides-Extra: langgraph
50
+ Requires-Dist: langgraph>=0.2; extra == "langgraph"
51
+ Provides-Extra: crewai
52
+ Requires-Dist: crewai>=0.80; extra == "crewai"
53
+ Provides-Extra: autogen
54
+ Requires-Dist: autogen-core>=0.4; extra == "autogen"
55
+ Requires-Dist: autogen-agentchat>=0.4; extra == "autogen"
56
+ Requires-Dist: autogen-ext[openai]>=0.4; extra == "autogen"
57
+ Provides-Extra: semantic-kernel
58
+ Requires-Dist: semantic-kernel>=1.0; extra == "semantic-kernel"
59
+ Provides-Extra: frameworks
60
+ Requires-Dist: langchain-core>=0.2; extra == "frameworks"
61
+ Requires-Dist: langgraph>=0.2; extra == "frameworks"
62
+ Requires-Dist: crewai>=0.80; extra == "frameworks"
63
+ Requires-Dist: autogen-core>=0.4; extra == "frameworks"
64
+ Requires-Dist: autogen-agentchat>=0.4; extra == "frameworks"
65
+ Requires-Dist: autogen-ext[openai]>=0.4; extra == "frameworks"
66
+ Requires-Dist: semantic-kernel>=1.0; extra == "frameworks"
67
+ Dynamic: license-file
68
+
69
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
70
+ <!--
71
+ This is the PyPI long description, not the repo landing page (README.md).
72
+
73
+ Two reasons it is separate. (1) PyPI cannot resolve relative links or images, so every README.md
74
+ link would render dead on pypi.org — every URL below is absolute. (2) The audiences differ: someone
75
+ on pypi.org came for the Python SDK, whereas README.md opens with `git clone` + `helm install`,
76
+ which is the wrong first instruction for them.
77
+
78
+ Keep it short and keep the links absolute.
79
+ -->
80
+
81
+ # Norviq
82
+
83
+ **Runtime policy enforcement for LLM agent tool calls.**
84
+
85
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/norviq-dev/norviq/blob/main/LICENSE)
86
+ [![Docs](https://img.shields.io/badge/docs-docs.norviq.dev-00a576)](https://docs.norviq.dev)
87
+
88
+ Norviq is a policy enforcement point (PEP) that sits between an agent's reasoning loop and the tools
89
+ it can call. Every tool call is evaluated against OPA/Rego policy and then **allowed, blocked,
90
+ escalated, or audited** — *before* the tool function runs. It turns "the model decided to call
91
+ `execute_sql`" from implicit trust into an enforced, auditable decision.
92
+
93
+ This package is the **Python SDK**: it wraps your existing tools so enforcement happens in-process.
94
+ The full platform (control plane, console, Kubernetes admission webhook, sidecar injection) is
95
+ installed with the Helm chart — see the [documentation](https://docs.norviq.dev).
96
+
97
+ ## Install
98
+
99
+ ```bash
100
+ pip install "norviq[langchain]" # LangChain / LangGraph
101
+ pip install "norviq[crewai]" # CrewAI
102
+ pip install "norviq[autogen]" # AutoGen
103
+ pip install "norviq[semantic-kernel]" # Semantic Kernel
104
+ pip install "norviq[frameworks]" # all of the above
105
+ ```
106
+
107
+ ## Use
108
+
109
+ ```python
110
+ from norviq.sdk import PolicyEngineClient, ToolInterceptor
111
+ from norviq.sdk.langchain.adapter import protect
112
+
113
+ engine = PolicyEngineClient() # NRVQ_POLICY_ENGINE_URL + NRVQ_API_TOKEN
114
+ interceptor = ToolInterceptor(evaluator=engine)
115
+
116
+ # Every tool is wrapped: policy runs before the tool body, on every call the model makes.
117
+ tools = protect([search_kb, execute_sql, delete_record], interceptor, session_id="session-1")
118
+ ```
119
+
120
+ A blocked call raises `NorviqBlockError`, which carries the full `PolicyDecision` — including the
121
+ `rule_id` that fired and a human-readable `reason` — so you can surface a refusal instead of
122
+ performing the action:
123
+
124
+ ```python
125
+ from norviq.sdk import NorviqBlockError
126
+
127
+ try:
128
+ result = agent.invoke({"messages": [("user", "delete all customer records")]})
129
+ except NorviqBlockError as exc:
130
+ print(f"blocked by {exc.decision.rule_id}: {exc.decision.reason}")
131
+ ```
132
+
133
+ Two things to know before your first run, because either one makes a correct setup look broken:
134
+
135
+ - **Norviq is deny-by-default.** With no policy loaded for the scope you evaluate against, the
136
+ decision is `deny`. Load a policy for your namespace/agent-class first.
137
+ - **`POST /api/v1/evaluate` requires a bearer token.** Without one the client fails closed.
138
+
139
+ ## Links
140
+
141
+ - **Documentation** — https://docs.norviq.dev
142
+ - **Integration guide** (all supported frameworks) —
143
+ https://github.com/norviq-dev/norviq/blob/main/docs/guides/integrating-agents.md
144
+ - **Runnable examples** — https://github.com/norviq-dev/norviq/blob/main/examples/README.md
145
+ - **Source** — https://github.com/norviq-dev/norviq
146
+ - **Security policy** — https://github.com/norviq-dev/norviq/blob/main/SECURITY.md
147
+
148
+ Apache 2.0 licensed.
@@ -0,0 +1,80 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!--
3
+ This is the PyPI long description, not the repo landing page (README.md).
4
+
5
+ Two reasons it is separate. (1) PyPI cannot resolve relative links or images, so every README.md
6
+ link would render dead on pypi.org — every URL below is absolute. (2) The audiences differ: someone
7
+ on pypi.org came for the Python SDK, whereas README.md opens with `git clone` + `helm install`,
8
+ which is the wrong first instruction for them.
9
+
10
+ Keep it short and keep the links absolute.
11
+ -->
12
+
13
+ # Norviq
14
+
15
+ **Runtime policy enforcement for LLM agent tool calls.**
16
+
17
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/norviq-dev/norviq/blob/main/LICENSE)
18
+ [![Docs](https://img.shields.io/badge/docs-docs.norviq.dev-00a576)](https://docs.norviq.dev)
19
+
20
+ Norviq is a policy enforcement point (PEP) that sits between an agent's reasoning loop and the tools
21
+ it can call. Every tool call is evaluated against OPA/Rego policy and then **allowed, blocked,
22
+ escalated, or audited** — *before* the tool function runs. It turns "the model decided to call
23
+ `execute_sql`" from implicit trust into an enforced, auditable decision.
24
+
25
+ This package is the **Python SDK**: it wraps your existing tools so enforcement happens in-process.
26
+ The full platform (control plane, console, Kubernetes admission webhook, sidecar injection) is
27
+ installed with the Helm chart — see the [documentation](https://docs.norviq.dev).
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pip install "norviq[langchain]" # LangChain / LangGraph
33
+ pip install "norviq[crewai]" # CrewAI
34
+ pip install "norviq[autogen]" # AutoGen
35
+ pip install "norviq[semantic-kernel]" # Semantic Kernel
36
+ pip install "norviq[frameworks]" # all of the above
37
+ ```
38
+
39
+ ## Use
40
+
41
+ ```python
42
+ from norviq.sdk import PolicyEngineClient, ToolInterceptor
43
+ from norviq.sdk.langchain.adapter import protect
44
+
45
+ engine = PolicyEngineClient() # NRVQ_POLICY_ENGINE_URL + NRVQ_API_TOKEN
46
+ interceptor = ToolInterceptor(evaluator=engine)
47
+
48
+ # Every tool is wrapped: policy runs before the tool body, on every call the model makes.
49
+ tools = protect([search_kb, execute_sql, delete_record], interceptor, session_id="session-1")
50
+ ```
51
+
52
+ A blocked call raises `NorviqBlockError`, which carries the full `PolicyDecision` — including the
53
+ `rule_id` that fired and a human-readable `reason` — so you can surface a refusal instead of
54
+ performing the action:
55
+
56
+ ```python
57
+ from norviq.sdk import NorviqBlockError
58
+
59
+ try:
60
+ result = agent.invoke({"messages": [("user", "delete all customer records")]})
61
+ except NorviqBlockError as exc:
62
+ print(f"blocked by {exc.decision.rule_id}: {exc.decision.reason}")
63
+ ```
64
+
65
+ Two things to know before your first run, because either one makes a correct setup look broken:
66
+
67
+ - **Norviq is deny-by-default.** With no policy loaded for the scope you evaluate against, the
68
+ decision is `deny`. Load a policy for your namespace/agent-class first.
69
+ - **`POST /api/v1/evaluate` requires a bearer token.** Without one the client fails closed.
70
+
71
+ ## Links
72
+
73
+ - **Documentation** — https://docs.norviq.dev
74
+ - **Integration guide** (all supported frameworks) —
75
+ https://github.com/norviq-dev/norviq/blob/main/docs/guides/integrating-agents.md
76
+ - **Runnable examples** — https://github.com/norviq-dev/norviq/blob/main/examples/README.md
77
+ - **Source** — https://github.com/norviq-dev/norviq
78
+ - **Security policy** — https://github.com/norviq-dev/norviq/blob/main/SECURITY.md
79
+
80
+ Apache 2.0 licensed.
norviq-0.1.0/README.md ADDED
@@ -0,0 +1,224 @@
1
+ <div align="center">
2
+
3
+ <img src=".github/assets/norviq-mark.svg" alt="Norviq" height="76" />
4
+
5
+ # Norviq
6
+
7
+ **Runtime policy enforcement for LLM agent tool calls on Kubernetes.**
8
+
9
+ [![FOSSA Security](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fnorviq-dev%2Fnorviq.svg?type=shield&issueType=security)](https://app.fossa.com/projects/git%2Bgithub.com%2Fnorviq-dev%2Fnorviq?ref=badge_shield&issueType=security)
10
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
11
+ [![Kubernetes](https://img.shields.io/badge/Kubernetes-1.30%2B-326CE5?logo=kubernetes&logoColor=white)](https://kubernetes.io)
12
+ [![OPA](https://img.shields.io/badge/policy-OPA%2FRego-7D4698?logo=openpolicyagent&logoColor=white)](https://www.openpolicyagent.org)
13
+ [![Docs](https://img.shields.io/badge/docs-docs.norviq.dev-00a576)](https://docs.norviq.dev)
14
+
15
+ **[Documentation](https://docs.norviq.dev)** · **[Website](https://norviq.dev)** · **[Getting started](https://docs.norviq.dev/getting-started/)**
16
+
17
+ </div>
18
+
19
+ Norviq is a policy enforcement point (PEP) that sits between an AI agent's reasoning loop and the
20
+ tools it can call. Every tool call is intercepted, evaluated against OPA/Rego policies scoped to the
21
+ workload's Kubernetes/SPIFFE identity, and then **allowed, blocked, escalated, or audited** — before
22
+ the tool runs. It turns "the model decided to call `execute_sql` / `send_email` / `shell`" from an
23
+ implicit trust into an enforced, per-identity, auditable decision.
24
+
25
+ ---
26
+
27
+ ## Why
28
+
29
+ LLM agents are given real tools — databases, shells, email, cloud APIs, internal services. The model
30
+ chooses which to call at runtime, and a single prompt injection or reasoning error can turn a benign
31
+ agent into an exfiltration or destruction path. Norviq puts a deterministic, policy-driven gate on
32
+ that surface, so a tool call only happens if an explicit policy for that agent's identity allows it.
33
+
34
+ ## How it works
35
+
36
+ Every tool call takes a round trip through the engine before it executes:
37
+
38
+ ```mermaid
39
+ sequenceDiagram
40
+ autonumber
41
+ participant Agent as Agent (LangGraph / SDK)
42
+ participant PEP as Norviq sidecar / SDK
43
+ participant Engine as Norviq API / engine
44
+ participant OPA as OPA / Rego
45
+ Agent->>PEP: tool call — {tool, params, identity}
46
+ PEP->>Engine: POST /evaluate
47
+ Note over Engine: resolve SPIFFE identity<br/>collect policy tiers + overlays
48
+ Engine->>OPA: evaluate
49
+ OPA-->>Engine: decision
50
+ Engine-->>PEP: allow / block / escalate / audit<br/>+ rule_id + reason
51
+ PEP-->>Agent: enforced decision
52
+ Engine->>Engine: audit log · trust score · asset/attack graph
53
+ ```
54
+
55
+ - **Interception** — an injected sidecar (or the SDK) forwards each tool call to the engine's `/evaluate`.
56
+ - **Identity** — decisions are scoped to the calling workload's SPIFFE identity (SPIRE SVID), not a
57
+ shared secret, so policy is per-agent-class and per-namespace.
58
+ - **Policy** — Rego policies are layered in tiers (agent-class → namespace baseline → cluster baseline)
59
+ with tighten-only overlays; the most-restrictive matching rule wins.
60
+ - **Modes** — `block` (deny + reason), `escalate`, `audit` (log only / monitor mode), so you can roll
61
+ out enforcement observably before turning it on.
62
+
63
+ ### Deployed components
64
+
65
+ ```mermaid
66
+ flowchart LR
67
+ subgraph tenant["Agent namespace"]
68
+ pod["Agent pod<br/>+ Norviq sidecar (PEP)"]
69
+ end
70
+ subgraph norviq["norviq namespace"]
71
+ api["API<br/>+ OPA sidecar"]
72
+ engine["Engine<br/>+ OPA sidecar"]
73
+ pg[("PostgreSQL")]
74
+ redis[("Redis")]
75
+ ui["Console UI"]
76
+ webhook["Admission<br/>webhook"]
77
+ end
78
+ pod -->|POST /api/v1/evaluate| api
79
+ api --> pg
80
+ api --> redis
81
+ engine --> pg
82
+ engine --> redis
83
+ webhook -. injects sidecar .-> pod
84
+ webhook -. syncs NrvqPolicy/NrvqClass .-> api
85
+ ui --> api
86
+ ```
87
+
88
+ Both the API and the Engine evaluate **in-process** against their own OPA sidecar (one OPA per replica,
89
+ bound to `127.0.0.1`) — neither proxies to the other. In the default injection mode
90
+ (`webhook.injection.sidecarMode: proxy`) the injected sidecar POSTs every tool call to the central API,
91
+ so Postgres, Redis, and policy loading stay centralized and nothing is evaluated per-pod. The Engine
92
+ Deployment runs that same evaluator as a standalone cluster workload (`NRVQ_SIDECAR_MODE=embedded`,
93
+ exposed as `norviq-engine:8282`) for callers that want to evaluate without going through the API.
94
+
95
+ ## Works with your agent framework
96
+
97
+ The sidecar above is zero-code-change. For in-process interception instead — no sidecar, your
98
+ own event loop — the SDK (`norviq/sdk/`) wraps the tool-calling point of these frameworks so a
99
+ block/escalate decision raises before the tool ever runs. See
100
+ **[docs/guides/integrating-agents.md](docs/guides/integrating-agents.md)** for setup and snippets.
101
+
102
+ - **LangChain** — `norviq.sdk.langchain.adapter.protect(tools, interceptor)`
103
+ - **LangGraph** — `norviq.sdk.langgraph.adapter.GuardedToolNode(tools, interceptor)`
104
+ - **CrewAI** — `norviq.sdk.crewai.adapter.protect(tools, interceptor)`
105
+ - **AutoGen** — `norviq.sdk.autogen.adapter.protect(tools, interceptor)`
106
+ - **Azure / Semantic Kernel** — `norviq.sdk.semantic_kernel.adapter.policy_filter(interceptor)`
107
+
108
+ **[`examples/chatbot/`](examples/chatbot/)** is a runnable LangChain/LangGraph chatbot (Groq) where a
109
+ real model decides the tool calls and Norviq blocks the dangerous ones before they run — with a
110
+ `Dockerfile` and `k8s/` manifests for running it in-cluster behind the injected sidecar.
111
+
112
+ ## Features
113
+
114
+ - **Policy enforcement** — OPA/Rego evaluated per tool call, sub-second, fail-closed.
115
+ - **Kubernetes-native** — `NrvqPolicy` / `NrvqClass` / `NrvqConfig` CRDs, a mutating webhook that
116
+ injects the enforcement sidecar, and a Helm chart.
117
+ - **Workload identity** — SPIFFE/SPIRE SVIDs (with a mock mode for non-SPIRE clusters).
118
+ - **Console UI** — policy catalog + editor, attack graph, asset graph, agent trust, audit stream.
119
+ - **Red-team suite** — built-in adversarial tests (prompt injection, encoding/nesting evasion, SQLi,
120
+ PII/PCI exfil) that prove a policy actually blocks.
121
+ - **Compliance mapping** — MITRE ATLAS and OWASP LLM Top-10 coverage with generate-enforcing-policy
122
+ remediation.
123
+ - **High availability** — multi-replica with cross-replica policy propagation and DB-authoritative
124
+ deletes; HPA/PDB/anti-affinity for multi-node clusters.
125
+ - **Multi-cluster (fleet)** — signed policy-bundle distribution across a hub and spoke clusters.
126
+
127
+ ## Quick start
128
+
129
+ **Prerequisites:** a Kubernetes cluster (1.30+), `kubectl`, and Helm 3.
130
+
131
+ ```bash
132
+ git clone https://github.com/norviq-dev/norviq.git
133
+ cd norviq
134
+
135
+ # 1. Install the CRDs
136
+ kubectl apply -f helm/norviq/crds/
137
+
138
+ # 2. Install Norviq (pulls the public images from ghcr.io/norviq-dev by default)
139
+ kubectl create namespace norviq
140
+ helm install norviq ./helm/norviq -n norviq \
141
+ --set 'policyQuotaNamespaces={default}' \
142
+ --set config.dbSslMode=disable # the bundled Postgres has no TLS; omit if you point at an external TLS DB
143
+ ```
144
+
145
+ `policyQuotaNamespaces` is the list of tenant namespaces that will run agents — it is **required**, not
146
+ optional. The chart installs a fail-closed `strict` namespace baseline for each entry, so an empty list
147
+ fails the install by design rather than shipping a cluster with no baseline. Add every agent namespace
148
+ you plan to use.
149
+
150
+ The chart deploys the API, engine, console UI, mutating webhook, and bundled PostgreSQL + Redis + OPA.
151
+ Port-forward the console:
152
+
153
+ ```bash
154
+ kubectl -n norviq port-forward svc/norviq-ui 8080:80
155
+ # open http://localhost:8080
156
+ ```
157
+
158
+ Sign in as `admin`. The chart generates a random first password on install (it only uses a literal
159
+ password if you set `auth.adminPassword` yourself) — read it back, then change it when the console
160
+ prompts you:
161
+
162
+ ```bash
163
+ kubectl get secret norviq-secrets -n norviq -o jsonpath='{.data.NRVQ_AUTH_ADMIN_PASSWORD}' | base64 -d
164
+ ```
165
+
166
+ Sidecar injection ships **off** (`webhook.injection.enabled: false`). Turn it on, then label the same
167
+ namespaces you listed in `policyQuotaNamespaces` — the label alone does nothing until the webhook is
168
+ enabled:
169
+
170
+ ```bash
171
+ helm upgrade norviq ./helm/norviq -n norviq --reuse-values --set webhook.injection.enabled=true
172
+ kubectl label namespace <your-agent-namespace> norviq-injection=enabled
173
+ ```
174
+
175
+ Every new pod in a labeled namespace then gets the enforcement sidecar injected.
176
+
177
+ > Trying it locally? A single-node [kind](https://kind.sigs.k8s.io/) cluster is enough to evaluate
178
+ > everything except multi-node HA. See **[docs/getting-started.md](docs/getting-started.md)**.
179
+
180
+ ## Documentation
181
+
182
+ Full documentation is at **[docs.norviq.dev](https://docs.norviq.dev)**:
183
+
184
+ - **[Getting started](https://docs.norviq.dev/getting-started/)** — install, first login, sidecar injection, first policy
185
+ - **[Concepts](https://docs.norviq.dev/concepts/)** — agent classes, policy tiers, enforcement modes, trust score, SPIFFE identity
186
+ - **[Writing policies](https://docs.norviq.dev/guides/writing-policies/)** — the Rego contract, packages, tighten-only overlays, validation
187
+ - **[Policy cookbook](https://docs.norviq.dev/guides/policy-cookbook/)** — copy-paste `NrvqPolicy` recipes + validated Rego building blocks
188
+ - **[Asset & attack graphs](https://docs.norviq.dev/guides/graphs/)** — real reach, kill chains, Simulate, Defend, tool classification
189
+ - **[Compliance & coverage](https://docs.norviq.dev/guides/compliance/)** — MITRE ATLAS / OWASP LLM coverage, gaps, remediation, evidence pack
190
+ - **[Integrating agents](https://docs.norviq.dev/guides/integrating-agents/)** — the SDK: LangChain, LangGraph, CrewAI, AutoGen, Semantic Kernel
191
+ - **[CLI reference](https://docs.norviq.dev/cli/)** — `norviq login`, policies, audit, agents, red-team, fleet
192
+ - **[Configuration](https://docs.norviq.dev/configuration/)** — Helm `values.yaml` reference
193
+ - **[Deployment](https://docs.norviq.dev/deployment/)** — production HA, cloud (AKS / EKS / GKE), and multi-cluster fleet
194
+ - **[Security model](https://docs.norviq.dev/security-model/)** — trust boundaries and the threat model
195
+
196
+ Runnable examples live under [`examples/`](examples/); engineering references under
197
+ [`docs/engineering/`](docs/engineering/).
198
+
199
+ ## Development
200
+
201
+ ```bash
202
+ pip install -e ".[dev]" # backend + test tooling
203
+ make test # pytest tests/
204
+ make lint # ruff check norviq/ tests/
205
+ ```
206
+
207
+ The console suite runs from `ui/` with `npm test` (vitest). The shipped Rego is v0-syntax, so its suite
208
+ needs the compatibility flag:
209
+
210
+ ```bash
211
+ opa test --v0-compatible webhook/presets/ comprehensive.rego
212
+ ```
213
+
214
+ The stack is Python (FastAPI) + OPA/Rego for the engine, React + Vite (TypeScript) for the console, and
215
+ Go for the admission webhook. See **[CONTRIBUTING.md](CONTRIBUTING.md)**.
216
+
217
+ ## Security
218
+
219
+ Found a vulnerability? Please follow the coordinated-disclosure process in **[SECURITY.md](SECURITY.md)** —
220
+ do not open a public issue for security reports.
221
+
222
+ ## License
223
+
224
+ [Apache 2.0](LICENSE).
File without changes
File without changes