feat(sandbox): add OPENSHELL_OCSF_JSONL opt-in for standalone mode#1607
Open
dims wants to merge 1 commit into
Open
feat(sandbox): add OPENSHELL_OCSF_JSONL opt-in for standalone mode#1607dims wants to merge 1 commit into
dims wants to merge 1 commit into
Conversation
The JSONL audit layer is gated by an AtomicBool that the policy poll loop swaps when the gateway-side `ocsf_json_enabled` setting changes. The poll loop only spawns when an `OPENSHELL_ENDPOINT` is configured, so a supervisor running standalone has no way to flip the flag and `/var/log/openshell-ocsf.YYYY-MM-DD.log` stays empty. Seed the initial value from `OPENSHELL_OCSF_JSONL` (matching the boolean-env pattern already used by `OPENSHELL_NO_BROWSER`). The default is unchanged: an unset variable still starts the flag at false. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The OCSF JSONL audit layer in
openshell-sandboxis gated by anAtomicBoolthat the policy poll loop swaps when the gateway-sideocsf_json_enabledsetting changes. The poll loop only spawns whenOPENSHELL_ENDPOINTis set, so a supervisor running standalone has no way to flip the flag and/var/log/openshell-ocsf.YYYY-MM-DD.logstays empty. Seed the initial value from a newOPENSHELL_OCSF_JSONLenv var so standalone supervisors can opt in.Related Issue
None.
Changes
OPENSHELL_OCSF_JSONLconstant inopenshell-core::sandbox_env.ocsf_enabled: AtomicBoolfrom that env var at supervisor startup, using the same boolean-env parsing pattern asOPENSHELL_NO_BROWSER(v == "1" || v.eq_ignore_ascii_case("true")).docs/observability/ocsf-json-export.mdx.The default is unchanged: an unset variable still starts the flag at
false. In gateway-connected mode the first poll cycle overwrites the seeded value with the gateway setting, so the env var only meaningfully changes behavior when no endpoint is configured.Testing
cargo clippy -p openshell-core -p openshell-sandbox --tests --no-deps -- -D warningsclean for the touched codemise run pre-commitpasses (fails in upstreamrust:linton unrelatedcrates/openshell-sandbox/src/process.rs:23unused import:warn— present on pristinemainbefore this branch)OPENSHELL_NO_BROWSER, which is also untested)Checklist