-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCargo.toml
More file actions
526 lines (508 loc) · 20 KB
/
Copy pathCargo.toml
File metadata and controls
526 lines (508 loc) · 20 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 Praxis Contributors
# Workspace root for the Praxis Policy Engine.
#
# Edition 2024 and resolver 3. The import landed on the source tree's edition 2021
# and resolver 2 so it would compile unchanged; this move is deliberately its own
# change, gated on the imported suite, so an edition behavior difference stays
# separable from the move.
[workspace]
resolver = "3"
members = [
"crates/ppe",
"crates/ppe-core",
"crates/ppe-orchestration",
"crates/ppe-apl-core",
"crates/ppe-apl-cmf",
"crates/ppe-apl-runtime",
"crates/ppe-pdp-diff",
"builtins/plugins/identity-jwt",
"builtins/plugins/delegator-oauth",
"builtins/plugins/elicitation-ciba",
"builtins/pdps/cedar-direct",
"builtins/pdps/cel",
"builtins/pdps/opa",
"builtins/session/valkey",
# Reference implementations, not published and not in the `builtins`
# umbrella. Workspace members so they stay built, linted and tested, and so
# they keep working as examples of an out-of-tree plugin. Each manifest says
# why it is not a builtin.
"reference/plugins/pii-scanner",
"reference/plugins/audit-logger",
]
# The session store pulls a redis client and a TLS stack, which slows a default
# build noticeably. Excluding it from default-members keeps everyday iteration
# fast; `--workspace` still picks it up, and CI runs the full sweep.
default-members = [
"crates/ppe",
"crates/ppe-core",
"crates/ppe-orchestration",
"crates/ppe-apl-core",
"crates/ppe-apl-cmf",
"crates/ppe-apl-runtime",
"crates/ppe-pdp-diff",
"builtins/plugins/identity-jwt",
"builtins/plugins/delegator-oauth",
"builtins/plugins/elicitation-ciba",
"builtins/pdps/cedar-direct",
"builtins/pdps/cel",
"builtins/pdps/opa",
# Reference implementations, not published and not in the `builtins`
# umbrella. Workspace members so they stay built, linted and tested, and so
# they keep working as examples of an out-of-tree plugin. Each manifest says
# why it is not a builtin.
"reference/plugins/pii-scanner",
"reference/plugins/audit-logger",
]
[workspace.package]
version = "0.2.0"
edition = "2024"
# MSRV. Keep in sync with rust-toolchain.toml `channel` and clippy.toml `msrv`.
rust-version = "1.96"
license = "Apache-2.0"
authors = ["Teryl Taylor", "Fred Araujo"]
repository = "https://github.com/praxis-proxy/policy"
# Inherited by the facade crate for its crates.io page. Points at the repository
# until there is a docs site to point at.
homepage = "https://github.com/praxis-proxy/policy"
keywords = ["ai", "agent", "security", "policy", "plugin"]
categories = ["development-tools"]
# Shared crate README resolved from this root. Members opt in with
# `readme.workspace = true` so there is one source and no per-crate copy.
readme = "README.md"
# =============================================================================
# Shared dependencies
# =============================================================================
#
# Third-party entries only. Every imported crate manifest inherits these via
# `{ workspace = true }`, so this table has to exist before the import lands or
# the import fails on unresolved inheritance rather than on anything
# interesting.
#
[workspace.dependencies]
# Minimal tokio feature floor for crates that take `tokio = { workspace = true }`
# without their own `features`. Production code uses time, sync, task/spawn and
# a multi-threaded runtime; `net` and `io` appear only in tests, and the HTTP
# stack unions those back in through feature unification where needed.
tokio = { version = "1", features = ["rt", "rt-multi-thread", "sync", "time", "macros"] }
tokio-util = { version = "0.7", features = ["rt"] }
serde = { version = "1", features = ["derive", "rc"] }
serde_yaml = "0.9"
serde_json = "1"
async-trait = "0.1"
# HTTP types only (no client, no I/O) for the `HttpTransport` seam in
# praxis-policy-core. Both are already in the tree via the plugins' HTTP
# clients, so this adds nothing transitively.
http = "1"
bytes = "1"
thiserror = "2"
tracing = "0.1"
uuid = { version = "1", features = ["v4", "serde"] }
paste = "1"
futures = "0.3"
hashbrown = "0.17"
arc-swap = "1.9"
wildmatch = "2"
rmp-serde = "1"
serde_bytes = "0.11"
chrono = { version = "0.4", features = ["serde"] }
regex = "1"
# Internal crates. Single source of truth for each one's path and version
# requirement; members depend on these with `{ workspace = true }` so a version
# bump touches only this table. The `version` is required because these publish:
# at publish time cargo substitutes it for the `path`.
#
# The keys are package names, which still carry the engine's previous naming.
# Renaming them is a manifest change across every crate and lands separately, so
# that the import stays a move and the rename stays a rename.
praxis-policy-core = { path = "crates/ppe-core", version = "0.2.0" }
praxis-policy-orchestration = { path = "crates/ppe-orchestration", version = "0.2.0" }
praxis-policy-apl-core = { path = "crates/ppe-apl-core", version = "0.2.0" }
praxis-policy-apl-cmf = { path = "crates/ppe-apl-cmf", version = "0.2.0" }
praxis-policy-apl-runtime = { path = "crates/ppe-apl-runtime", version = "0.2.0" }
praxis-policy-plugin-identity-jwt = { path = "builtins/plugins/identity-jwt", version = "0.2.0" }
praxis-policy-plugin-delegator-oauth = { path = "builtins/plugins/delegator-oauth", version = "0.2.0" }
praxis-policy-plugin-elicitation-ciba = { path = "builtins/plugins/elicitation-ciba", version = "0.2.0" }
praxis-policy-pdp-cedar-direct = { path = "builtins/pdps/cedar-direct", version = "0.2.0" }
praxis-policy-pdp-cel = { path = "builtins/pdps/cel", version = "0.2.0" }
praxis-policy-pdp-opa = { path = "builtins/pdps/opa", version = "0.2.0" }
praxis-policy-session-valkey = { path = "builtins/session/valkey", version = "0.2.0" }
# Cross-crate inlining and dead-code elimination, one codegen unit for
# optimization quality.
#
# `panic = "abort"` is deliberately not set. This is a library: aborting would
# take the host process down on a recoverable policy panic and would break any
# consumer that relies on unwinding across the engine boundary.
# Line tables instead of full debug info. Panic locations and llvm-cov line
# coverage both need only line tables, so full DWARF buys nothing here and
# costs link time and disk on every debug and test build.
[profile.dev]
debug = "line-tables-only"
[profile.test]
debug = "line-tables-only"
[profile.release]
lto = true
codegen-units = 1
strip = true
# =============================================================================
# Lint policy
# =============================================================================
#
# Adopted from Praxis so this project holds the same bar. Member crates opt in
# with `[lints] workspace = true`.
#
# Not every rule Praxis denies is denied here. The set that is not is listed at
# the end of this file, grouped by why, and it is a settled decision rather than
# a backlog: each group's comment says why those lints cannot silently change an
# enforcement decision. Do not add new violations of one.
#
# Each group below carries its own reason. If you need to count occurrences of a
# lint, take the number from clippy rather
# than by reading source, and measure one lint at a time: some clippy lints
# suppress each other, and `rustdoc::` lints are not checked by clippy at all.
# A site inside a `#[cfg(test)]` module or a tests/ target does not count, since
# test code carries its own scoped allows.
[workspace.lints.rust]
# --- Enforced ---
unused_imports = "deny"
unused_variables = "deny"
trivial_numeric_casts = "deny"
macro_use_extern_crate = "deny"
unused_macro_rules = "deny"
meta_variable_misuse = "deny"
keyword_idents_2024 = "deny"
non_ascii_idents = "deny"
noop_method_call = "deny"
redundant_lifetimes = "deny"
# A stale feature name in a `cfg` predicate is otherwise only a warning, which
# is how a rename can silently disable a gated export. Denying it turns that
# into a build error at the moment the rename happens.
unexpected_cfgs = "deny"
# Closed from the import backlog: measured at zero violations across
# --workspace --all-targets --all-features, so enforcing costs no code change.
unused_extern_crates = "deny"
unreachable_pub = "deny"
unused_mut = "deny"
trivial_casts = "deny"
# The crate contains no unsafe code. Two hand-written Send/Sync impls on a
# zero-sized capability token were the only occurrence; they were unnecessary,
# since the token's sole field is `()` and the auto traits already applied. A
# compile-time assertion stands in their place.
unsafe_code = "forbid"
missing_docs = "deny"
# Lifetime clarity (extended)
unused_lifetimes = "deny"
# Visibility hygiene
unnameable_types = "deny"
# Import hygiene (extended)
redundant_imports = "deny"
# Binding hygiene
unit_bindings = "deny"
# Bound clarity
explicit_outlives_requirements = "deny"
# Unused items fail the build. Public host-facing API with no in-tree
# caller is kept with a reason on the item; everything else is deleted.
dead_code = "deny"
# --- Not enforced: a settled list, see the header ---
#
# style: Formatting and idiom preference. No effect on behavior.
elided_lifetimes_in_paths = "allow"
single_use_lifetimes = "allow"
#
# hygiene: Unused qualifications and drop-of-underscore. Closing these is
# cleanup; none of them can change what live code does.
let_underscore_drop = "allow"
unused_qualifications = "allow"
#
# api: Public surface shape. Matters at publish time, not at runtime, and some
# of these are blocked by third-party types that lack the required impls.
missing_debug_implementations = "allow"
private_interfaces = "allow"
[workspace.lints.clippy]
# --- Enforced: async and concurrency safety ---
await_holding_lock = "deny"
await_holding_refcell_ref = "deny"
let_underscore_future = "deny"
# --- Enforced: memory and allocation ---
implicit_clone = "deny"
inefficient_to_string = "deny"
vec_init_then_push = "deny"
# --- Enforced: idiomatic Rust ---
checked_conversions = "deny"
cloned_instead_of_copied = "deny"
explicit_into_iter_loop = "deny"
flat_map_option = "deny"
from_iter_instead_of_collect = "deny"
manual_instant_elapsed = "deny"
manual_ok_or = "deny"
unnecessary_get_then_check = "deny"
# --- Enforced: borrow and clarity ---
needless_borrow = "deny"
match_bool = "deny"
mut_mut = "deny"
needless_for_each = "deny"
range_plus_one = "deny"
redundant_else = "deny"
semicolon_if_nothing_returned = "deny"
# --- Enforced: import hygiene ---
enum_glob_use = "deny"
macro_use_imports = "deny"
# --- Enforced: clarity ---
same_functions_in_if_condition = "deny"
stable_sort_primitive = "deny"
string_add = "deny"
string_lit_as_bytes = "deny"
trait_duplication_in_bounds = "deny"
type_repetition_in_bounds = "deny"
zero_sized_map_values = "deny"
fn_params_excessive_bools = "deny"
# --- Enforced: safety and correctness ---
or_fun_call = "deny"
rc_mutex = "deny"
mutex_atomic = "deny"
mutex_integer = "deny"
disallowed_methods = "deny"
# --- Enforced: no placeholders ---
dbg_macro = "deny"
todo = "deny"
unimplemented = "deny"
# --- Enforced: closed from the import backlog ---
# Each measured at zero violations across --workspace --all-targets
# --all-features before being enforced, so none of these required a code change.
# Panic and abort sources first: these are the reason the gate exists.
unwrap_used = "deny"
panic = "deny"
exit = "deny"
mem_forget = "deny"
# Concurrency and lifetime hazards.
future_not_send = "deny"
significant_drop_in_scrutinee = "deny"
debug_assert_with_mut_call = "deny"
infinite_loop = "deny"
zombie_processes = "deny"
empty_drop = "deny"
# Numeric and pointer conversions.
lossy_float_literal = "deny"
ptr_as_ptr = "deny"
verbose_bit_mask = "deny"
unseparated_literal_suffix = "deny"
# Diagnostics and test rigor.
print_stdout = "deny"
missing_assert_message = "deny"
missing_safety_doc = "deny"
# API and type shape.
error_impl_error = "deny"
option_option = "deny"
ref_option_ref = "deny"
large_types_passed_by_value = "deny"
empty_structs_with_brackets = "deny"
expl_impl_clone_on_copy = "deny"
same_name_method = "deny"
try_err = "deny"
# Dead state.
collection_is_never_read = "deny"
no_effect_underscore_binding = "deny"
used_underscore_binding = "deny"
# Style and idiom.
if_not_else = "deny"
inconsistent_struct_constructor = "deny"
string_add_assign = "deny"
semicolon_inside_block = "deny"
redundant_type_annotations = "deny"
manual_clamp = "deny"
set_contains_or_insert = "deny"
rest_pat_in_fully_bound_structs = "deny"
empty_line_after_outer_attr = "deny"
missing_panics_doc = "deny"
uninlined_format_args = "deny"
redundant_closure_for_method_calls = "deny"
explicit_iter_loop = "deny"
unnested_or_patterns = "deny"
wildcard_imports = "deny"
manual_string_new = "deny"
manual_assert = "deny"
unreadable_literal = "deny"
single_match_else = "deny"
str_to_string = "deny"
string_slice = "deny"
deref_by_slicing = "deny"
if_then_some_else_none = "deny"
unused_trait_names = "deny"
unnecessary_safety_comment = "deny"
needless_raw_strings = "deny"
needless_raw_string_hashes = "deny"
unused_result_ok = "deny"
unnecessary_wraps = "deny"
map_err_ignore = "deny"
cast_lossless = "deny"
cast_possible_truncation = "deny"
cast_possible_wrap = "deny"
cast_sign_loss = "deny"
cast_precision_loss = "deny"
undocumented_unsafe_blocks = "deny"
# Panic sources. A library must not abort on operator input. The volume lives in
# tests, which are scope-allowed; the counts below are the library's own surface.
# `string_slice` above belongs to this group and is the largest of them.
expect_used = "deny"
indexing_slicing = "deny"
print_stderr = "deny"
# Absent from Praxis's table. Added here because both abort on reachable input
# and the gate is meant to cover panic sources, not a fixed list of lint names.
unreachable = "deny"
get_unwrap = "deny"
derivable_impls = "deny"
extra_unused_type_parameters = "deny"
field_reassign_with_default = "deny"
manual_repeat_n = "deny"
unnecessary_map_or = "deny"
unwrap_or_default = "deny"
useless_vec = "deny"
bool_comparison = "deny"
collapsible_match = "deny"
iter_kv_map = "deny"
empty_line_after_doc_comments = "deny"
collapsible_if = "deny"
doc_lazy_continuation = "deny"
doc_markdown = "deny"
doc_overindented_list_items = "deny"
missing_errors_doc = "deny"
# --- Enforced: new-tier lints from conventions ---
# Float correctness: no direct float equality comparisons
float_cmp = "deny"
# Endianness safety: no native-endian byte conversions on the wire
host_endian_bytes = "deny"
# Restriction: unit enum variants use no brackets
empty_enum_variants_with_brackets = "deny"
# Restriction: build PathBuf with from/join, not push chains
pathbuf_init_then_push = "deny"
# Restriction: prefer iterator repetition over mapped ranges
map_with_unused_argument_over_ranges = "deny"
# Restriction: no read-and-write of one variable in a single expression
mixed_read_write_in_expression = "deny"
# Restriction: use `..` instead of `field: _` in patterns
unneeded_field_pattern = "deny"
# Restriction: no `self` imports of items
unnecessary_self_imports = "deny"
# Restriction: use fs::read / fs::read_to_string over manual reads
verbose_file_reads = "deny"
# Restriction: `^` is not exponentiation
suspicious_xor_used_as_pow = "deny"
# API design (extended)
pub_underscore_fields = "deny"
pub_without_shorthand = "deny"
ref_option = "deny"
# Test quality: unwrap results in tests so failures print the error
assertions_on_result_states = "deny"
# --- Not enforced: a settled list, see the header ---
#
# docs: Documentation of private items, which never reaches docs.rs. The public
# API is documented in full and enforced; this is for readers of the source.
missing_docs_in_private_items = "allow"
#
# style: Formatting and idiom preference. No effect on behavior.
default_trait_access = "allow"
items_after_statements = "allow"
manual_let_else = "allow"
map_unwrap_or = "allow"
match_same_arms = "allow"
match_wildcard_for_single_variants = "allow"
needless_continue = "allow"
ref_patterns = "allow"
#
# perf: Allocation, copying, and future size. Affects throughput, never a decision.
assigning_clones = "allow"
clone_on_ref_ptr = "allow"
format_push_string = "allow"
large_enum_variant = "allow"
large_futures = "allow"
large_stack_frames = "allow"
needless_pass_by_value = "allow"
rc_buffer = "allow"
trivially_copy_pass_by_ref = "allow"
#
# hygiene: Unused qualifications, unused async/self, and drop-of-underscore.
# Closing these is cleanup; none of them can change what live code does.
let_underscore_must_use = "allow"
multiple_inherent_impl = "allow"
unused_async = "allow"
unused_self = "allow"
#
# complexity: Size and shape metrics. Splitting a function to satisfy a threshold is
# churn, and the policy parser's size is inherent to the grammar it accepts.
cognitive_complexity = "allow"
struct_excessive_bools = "allow"
too_many_arguments = "allow"
too_many_lines = "allow"
type_complexity = "allow"
#
# api: Public surface shape. Matters at publish time, not at runtime, and some
# of these are blocked by third-party types that lack the required impls.
needless_pass_by_ref_mut = "allow"
renamed_function_params = "allow"
return_self_not_must_use = "allow"
#
# attributes: Suppression style. `allow_attributes` wants `#[expect]`, which asserts
# the lint still fires; two feature-gated bodies here cannot satisfy that under
# every feature set, so no single attribute is correct.
allow_attributes = "allow"
allow_attributes_without_reason = "allow"
#
# concurrency: Lock hold duration, and a judgment call per site. The scopes where
# tightening removed a real hazard are closed; the rest hold a guard across a
# synchronous call deliberately. `await_holding_lock`, which covers the case that
# actually deadlocks, is enforced above.
significant_drop_tightening = "allow"
#
# test-hygiene: Test placement. Applies to one helper that must live outside a
# `cfg(test)` module because an integration test also uses it.
tests_outside_test_module = "allow"
#
# naming: Single-char bindings (`v`, `e`, `i`) and `'a` lifetimes are idiomatic
# in closures, match arms, and short generic contexts. 430+ sites in the engine
# use them; renaming adds noise without improving comprehension. Similarly,
# struct field prefixes match their domain vocabulary (e.g. `content_type` on a
# `Content*` struct).
min_ident_chars = "allow"
single_char_lifetime_names = "allow"
struct_field_names = "allow"
#
# casting: The rule engine uses `as` conversions and unchecked arithmetic in
# numeric evaluation and attribute coercion paths. Converting to From/TryFrom
# and checked_*/saturating_* across 59+ arithmetic and 6 cast sites would be a
# significant refactor with marginal safety gain in this context.
arithmetic_side_effects = "allow"
as_conversions = "allow"
#
# pattern: Wildcard match arms, `impl Trait` params, mixed pub fields, and
# shadow rebinding are pervasive API design choices in the policy engine:
# 31 wildcard arms, 53 `impl Trait` params, 3 mixed-pub payload structs, and
# 6 shadow rebindings in the parser/evaluator.
wildcard_enum_match_arm = "allow"
impl_trait_in_params = "allow"
partial_pub_fields = "allow"
shadow_unrelated = "allow"
#
# determinism: The engine iterates HashMap/HashSet in 10+ sites where order is
# irrelevant to correctness (config validation, attribute merging). Switching to
# BTreeMap would add overhead without benefit.
iter_over_hash_type = "allow"
#
# module: The codebase uses `mod.rs` for three module directories. Switching to
# file-adjacent style requires structural file renames across the tree.
mod_module_files = "allow"
#
# test-naming: 222+ test functions use the `test_` prefix convention from before
# this lint existed. Renaming them all would be pure churn with no behavior change.
redundant_test_prefix = "allow"
[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
private_intra_doc_links = "deny"
invalid_codeblock_attributes = "deny"
redundant_explicit_links = "deny"
unescaped_backticks = "deny"
invalid_html_tags = "deny"
bare_urls = "deny"
private_doc_tests = "deny"
# --- Not enforced: a settled list, see the header ---
#
missing_crate_level_docs = "deny"