Repository navigation
fix: repo review: msearch hidden wildcards, OCSF src_endpoint, OCSF bucket check, SCIM pathless remove - #306
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYX2oXyeHMAAYugn6jg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYX2oXyeHMAAYugn6jg
…check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYX2oXyeHMAAYugn6jg
…ept any-case Bearer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYX2oXyeHMAAYugn6jg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYX2oXyeHMAAYugn6jg
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.
What and why
Five small fixes from a scheduled review of the repository. I checked the open PRs (#300–#304, #276) first so this doesn't duplicate their work.
expand_wildcardsin_msearchheader lines was never checked (crates/limen-worker/src/search/rules.rs).grant_allowsrefused hidden-index wildcard expansion only when the query string asked for it. Elasticsearch and OpenSearch also acceptexpand_wildcardsin each_msearchheader, so{"index":"logs-*","expand_wildcards":"all"}got past that check.src_endpoint(crates/limen-audit/src/ocsf.rs).client_addrasSocketAddr::to_string()(203.0.113.9:51234,[2001:db8::1]:22) inlimen-proxy/src/sessions.rs:126andkube.rs. The OCSF mapper parsed only a bareIpAddr, so SSH, DB and Kubernetes session events and proxy denials lost the source IP without any warning. SIEM rules that match on source IP never fired for them.src_endpoint.ipplusport. A bare IP gives the same output as before.crates/limen-control-plane/src/config.rs).--audit-s3-endpoint https://s3.us-east-1.amazonaws.com, an OCSF endpoint in another region and the same bucket name, the endpoints counted as "different stores". S3 bucket names are global, so both flags pointed at the one bucket that holds recordings.removeon a Group replaced its members (crates/limen-control-plane/src/scim.rs,plan_patch).{"op":"remove","value":{"members":[{"value":"<bob>"}]}}becameStep::Replace([bob]). That removed every other member and ended their logins. An unknown or missingopdid the same.noTarget(RFC 7644 §3.5.2.2), an unknown op returns 400, andaddandreplacebehave as before.Bearerscheme is now matched case-insensitively (RFC 7235 §2.1).demos/README.mdcited ADR-0048 (SCIM) for the OCSF demo. It now cites ADR-0049.Related: ADR-0048, ADR-0049; no phase work.
How it was verified
cargo fmt --all --check: clean.cargo clippy --locked -p limen-audit -p limen-worker -p limen-control-plane --all-targets --all-features -- -D warnings: clean. This covers only the crates I touched, not the whole workspace.cargo test --locked -p limen-audit -p limen-worker -p limen-control-plane --lib: 39, 153 and 359 passed, 0 failed.search::rules::tests::msearch_headers_cannot_ask_for_hidden_indicesocsf::tests::a_socket_address_becomes_an_endpoint_with_its_portscim::tests::a_pathless_members_patch_needs_a_known_opscim::tests::the_bearer_scheme_is_case_insensitiveconfig::tests::ocsf_settings_cannot_share_the_audit_bucket_or_key_or_outgrow_the_spoolremovethey send has a path, so they are unaffected.Not verified
tests/scim.rs,tests/ocsf_sink.rsand the e2e suite were not run.gitleaksandcargo denywere not run becausemiseisn't installed here. No dependencies changed._msearchbypass isunverifiedagainst a real Elasticsearch or OpenSearch. The missing check is confirmed in code; how far a real engine's expansion reaches into hidden indices was not tested.Review guide
Each fix is its own commit. The deeper findings below were left unfixed on purpose. Each needs a design decision or an integration test I couldn't run here:
source='idp_login'(scim.rs:412-424together with theeffective_groups!macro inconsole/store.rs).idp_groupsis NULL, for example on an IdP whose refreshed tokens leave out the groups claim.enforceskips them when they are removed from a pushed group, so their login is not ended.source='scim'on adoption, but that changes what the Users page shows. Owner's call.apply_grouptogether witheffective_groups!). The old name is no longer inscim_groups, so it survives theEXCEPT. This contradicts ADR-0048.lock_usercommits the lock but its audit write fails,end_logins_ofis skipped. Okta's retry then finds the person already inactive, so tracked logins are never ended. The lock still blocks access in the meantime.db/pg.rsinspect). A rejected re-Parse of a name (42P05), or anything sent after an error before Sync, can make an Execute audit event name a statement that didn't run. The same maps can also grow without bound. The fix needs a pending queue that is committed on ParseComplete or BindComplete, which is a larger change.limen-verify/src/client.rs), so a hung PUT might stall the OCSF consumer beforeocsf_may_skipis ever checked.last_okand counted inshipped_total.--audit-ocsf-max-lag-byteswithin one record of--audit-spool-max-bytespasses the config check, but then skipping can never start.Checklist
cargo fmtandcargo clippy ... -D warningsclean (on the touched crates)Compatibility and rollback
remove(or an unknown op) on Group members now gets 400 instead of a silent replace._msearchthat asks for hidden indices in a header, under a grant without a dot-pattern, is now refused.Generated by Claude Code