Skip to content

Commit a86633f

Browse files
committed
refactor(prover): simplify check scope schema
Signed-off-by: Johnny Greco <[email protected]>
1 parent 680906e commit a86633f

4 files changed

Lines changed: 14 additions & 19 deletions

File tree

‎crates/openshell-prover-cli/src/main.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ struct ScopeJson<'a> {
7676
model_version: &'a str,
7777
policy_version: u32,
7878
domains: Vec<&'a str>,
79-
assumptions: &'a [&'a str],
8079
}
8180

8281
#[derive(Debug, Serialize)]
@@ -358,7 +357,6 @@ fn scope_json(scope: &CheckScope) -> ScopeJson<'_> {
358357
model_version: scope.model_version,
359358
policy_version: scope.policy_version,
360359
domains: scope.domains.iter().map(|domain| domain.as_str()).collect(),
361-
assumptions: scope.assumptions,
362360
}
363361
}
364362

@@ -415,10 +413,6 @@ fn render_text(mut writer: impl Write, envelope: &Envelope<'_>) -> Result<(), St
415413
scope.domains.join(",")
416414
)
417415
.map_err(|error| format!("failed to write output: {error}"))?;
418-
for assumption in scope.assumptions {
419-
writeln!(writer, "assumption: {}", escape_terminal(assumption))
420-
.map_err(|error| format!("failed to write output: {error}"))?;
421-
}
422416
}
423417
if let Some(counterexample) = &envelope.counterexample {
424418
match counterexample {

‎crates/openshell-prover-cli/tests/cli.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ fn contained_policy_returns_stable_json_and_zero() {
7777
assert_eq!(value["check"], "maximum_boundary");
7878
assert_eq!(value["result"], "within_max");
7979
assert_eq!(value["exit_code"], 0);
80-
assert!(value["scope"]["domains"].is_array());
80+
assert_eq!(
81+
value["scope"],
82+
serde_json::json!({
83+
"model_version": "maximum-boundary-v1",
84+
"policy_version": 1,
85+
"domains": ["filesystem", "network_l4", "network_rest"]
86+
})
87+
);
8188
assert!(value["counterexample"].is_null());
8289
}
8390

‎crates/openshell-prover/src/containment.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,26 +406,18 @@ pub struct CheckScope {
406406
pub model_version: &'static str,
407407
pub policy_version: u32,
408408
pub domains: &'static [CheckDomain],
409-
pub assumptions: &'static [&'static str],
410409
}
411410

412411
static DOMAINS: &[CheckDomain] = &[
413412
CheckDomain::Filesystem,
414413
CheckDomain::NetworkL4,
415414
CheckDomain::NetworkRest,
416415
];
417-
static ASSUMPTIONS: &[&str] = &[
418-
"Candidate and maximum use the same sandbox filesystem namespace and mount interpretation.",
419-
"Network containment covers runtime configurations with binary identity checks enabled and disabled.",
420-
"REST witnesses use canonical request methods and paths.",
421-
];
422-
423416
fn check_scope() -> &'static CheckScope {
424417
static SCOPE: CheckScope = CheckScope {
425418
model_version: "maximum-boundary-v1",
426419
policy_version: 1,
427420
domains: DOMAINS,
428-
assumptions: ASSUMPTIONS,
429421
};
430422
&SCOPE
431423
}

‎docs/reference/policy-prover.mdx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ openshell-prover check candidate.yaml \
9393
```
9494

9595
The JSON object includes the result, exit code, input paths, prover version,
96-
model scope, checked policy version, modeled domains, and assumptions. An
97-
exceeding result also includes a filesystem or network counterexample.
98-
Automation should use `result` and `reason_code` instead of parsing the
99-
human-readable explanation.
96+
model version, checked policy version, and modeled domains. The documented
97+
semantics and environmental conditions for that scope are tied to its model
98+
version. An exceeding result also includes a filesystem or network
99+
counterexample. Automation should use `result` and `reason_code` instead of
100+
parsing the human-readable explanation.
100101

101102
The solver has a finite 10-second default budget. Set a different positive
102103
budget with an integer followed by `ms`, `s`, or `m`:
@@ -152,6 +153,7 @@ state. In particular:
152153
identity enforcement enabled and disabled. When enabled, grants and denies
153154
match the executable or an ancestor identity. Network counterexamples report
154155
the configuration and identities that expose the additional authority.
156+
- REST containment witnesses use canonical request methods and paths.
155157
- Both files are interpreted in the same sandbox filesystem namespace and
156158
mount model. The CLI does not resolve sandbox paths against the host.
157159

0 commit comments

Comments
 (0)