Generic tag-probing + Sophos Central events/alerts polling - #19
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds the two build steps that came out of the wireless-AP-monitoring research (#18): - `probe`: try ad-hoc XML API tag names against a live firewall and report per-tag success/element-count/error, for validating hypothesized entity names (e.g. Wireless-section tags) without waiting on docs. - Wireless category in the registry: `WirelessGrouping` (corroborated by a live Sophos docs page path), plus unconfirmed sibling-tag guesses. - `sfos_sdk::central`: a Sophos Central cloud API client — OAuth2 client-credentials auth, `whoami` tenant/region resolution, and `/siem/v1/events` / `/siem/v1/alerts` polling with cursor-based resume, ported from the architecture of the official Sophos-Central-SIEM-Integration reference client. `central-events`/`central-alerts` CLI commands poll one page and persist the cursor to a state file between runs. - `--wireless-only` applies a best-effort client-side filter on the event `type` field, documented as unconfirmed: Central's events/alerts endpoints have no server-side category filter, and the exact wireless event type string needs validating against a live tenant with an enrolled AP. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SJEMQBLTY3DdAv2Jd2fpbS Signed-off-by: Claude <noreply@anthropic.com>
b8fb00e to
33b2d76
Compare
Pre-existing transitive dependency via reqwest; unrelated to this PR's diff (unchanged on main, just newly advised). Patch bump only. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SJEMQBLTY3DdAv2Jd2fpbS Signed-off-by: Claude <noreply@anthropic.com>
Closes #18.
Research recap
A crawl of the official Sophos tooling (details in #18) surfaced two steal-worthy patterns and one correction worth calling out here:
sophos/sophos-firewall-sdk: genericget_tag(xml_tag=...)fetches any XML entity, documented or not — the validation path for hypothesized entity names instead of waiting on docs. A live Sophos docs page path (.../API/PROTECT/Wireless/wirelessgrouping/...) confirmsWirelessis a real, documented API section.sophos/Sophos-Central-SIEM-Integration: OAuth2 client-credentials auth (id.sophos.com/api/v2/oauth2/token), tenant/region resolution viawhoami/v1, and/siem/v1/events+/siem/v1/alertspolling with a JSON cursor file for resume.api_client.py/config.ini.sample/name_mapping.pydirectly (no wireless entries anywhere). "Wireless-only" filtering has to happen client-side on thetypefield, and the exact type string is unconfirmed without a live tenant with an enrolled AP.What this PR adds
sfos-sdkcentralmodule (new): a Sophos Central cloud API client — OAuth2 auth with token caching,whoamitenant/region resolution,/siem/v1/eventsand/siem/v1/alertspolling (PollQuery/EventsPage), andCentralStatefor JSON-file cursor persistence across runs.is_wireless_event()is the best-effort, explicitly-caveated client-side type filter.registry: newWirelesscategory —WirelessGrouping(corroborated by the docs path above) plus three unconfirmed sibling-tag guesses (WirelessNetwork,AccessPoint,MeshNetwork), documented as such.export/export_allnow probe these resiliently like every other entity.sfos-cliprobe <TAG>...: fire ad-hocGetrequests at a live firewall for arbitrary tag names and report per-tag OK/element-count/error — for validating a hypothesized entity name (e.g.probe AccessPoint WirelessAP WirelessAccessPointStatus) before it earns a spot in the registry.central-events/central-alerts: poll one page from Sophos Central and persist the resume cursor to--state-file(defaultstate/central-cursor.json);--wireless-onlyapplies the best-effort filter above. Auth via--client-id/--client-secret/--tenant-idorSFOS_CENTRAL_CLIENT_ID/SFOS_CENTRAL_CLIENT_SECRET/SFOS_CENTRAL_TENANT_ID.Docs:
README.md,docs/cli-reference.md,docs/sdk-guide.md,docs/playbooks.md,CHANGELOG.mdupdated for the new commands/module and the registry's new entity/category counts (66→70 entities, 15→16 categories).Not in this PR: the third build-order step (netmiko-style Device Console scripting for
wireless-controllerdebug/pktcap) — deferred until steps 1–2 show what structured signal actually exists on a live box/tenant.Test plan
cargo build --workspace— cleancargo test --workspace— 47/47 passing (all offline; the Central/XML HTTP round-trips can't be exercised without live credentials, same convention as the existingclientmodule — request-building, token-caching/expiry, and cursor-state logic are unit-tested)cargo clippy --workspace --all-targets— cleancargo fmt --check— clean--helpforprobeandcentral-events, andentitiesto confirm the new Wireless category rendersprobe/central-events/central-alertsagainst a live firewall/tenant (needs real credentials — flagged as the next step in Wireless AP monitoring: research findings + build order #18)Generated by Claude Code