Skip to content

EDR 8: analyst role, incidents, ATT&CK coverage, Entra ID sign-in, Essential Eight and ISM - #69

Merged
jusso-dev merged 5 commits into
mainfrom
feat/server-analyst
Nov 9, 2026
Merged

jusso-dev merged 5 commits into
mainfrom
feat/server-analyst

Conversation

@jusso-dev

Copy link
Copy Markdown
Owner

Stacked on #68; independent of #59 (agent-only), merge either order.

Closes #60. Covers the server side of EDR 8: an analyst role enforced on every route, incident grouping with an explained risk score, ATT&CK coverage, Entra ID sign-in, a Tawny-SOC incident sink, UI, and Essential Eight and ISM docs.

Acceptance criteria

Criterion Status
Users sign in with Entra ID against a mock provider in CI; group mapping sets the role; password sign-in can be limited to break-glass admins Done. routes/oidc.zig: code flow with PKCE; state, nonce and verifier in oauth_states; RS256 via crypto/jwt.zig; iss, aud, exp, nbf, nonce, tid checked; users matched on tid and oid; no mapped group means refused. Client secret encrypted with TAWNY_INTEGRATION_ENCRYPTION_KEY. contract-tests/mock_oidc.py signs RS256 tokens with a key from openssl genrsa made at start-up. Tenant setting password_login: break_glass. See the note under Checks.
analyst role enforced on every route, with tests Done. Each route file declares pub const routes with a permission. http/permissions.zig gates every request before its handler runs; undeclared routes get 404. Its test checks all 83 routes for admin, analyst, viewer, anonymous and agent, and fails if a declared route is missing from the matrix. The contract suite repeats 22 of them against the live server. Matrix in docs/api.md. Destructive actions from an analyst can wait for admin approval (tenant setting).
Related alerts on the same host and lineage group into one incident with an explained risk score; incidents reach Tawny-SOC as cases Grouping and score: done. Migration 0008 adds incidents and incident_alerts with RLS. The three §8 rules apply within 4 h, using process.entity_id lineage. Noisy-OR score with every item and its points. The Office > PowerShell fixture gives one incident in DB tests and the contract suite. Tawny-SOC: partial, see below.
ATT&CK view shows the three states separately Done. rules/attack/coverage.yaml plus an ATT&CK Enterprise 20.1 subset (rules/attack/techniques.json, source sha256 recorded, subset.py regenerates it). GET /api/attack/coverage works out telemetry, detection and response on their own; tests cover each combination. UI matrix at /attack with a platform filter.
Essential Eight and ISM docs with verified control IDs and honest gaps Done. See ISM below.
CI green on the PR See checks below.

Tawny-SOC: decision for Justin

I read Tawny-SOC at fea2da8. app/api/v1/cases has GET only (route.ts lists cases, [id]/route.ts gets one). Nothing creates or updates a case. So Tawny sends each incident through the existing POST /api/ingest/tawny as one alert with a stable alert_id, plus an incident object holding the risk, items, techniques, agents and a link (sinks/tawny_soc.zig, jobs/incident_sink.zig, 30 s debounce). Tawny-SOC opens the case. Tawny does no case management.

Tawny-SOC stores ingested alerts with onConflictDoNothing, so later status or owner changes do not update the stored alert. To get real case create and update you need one of these in Tawny-SOC:

  • a POST /api/v1/cases endpoint (with an upsert by external id), or
  • an upsert in ingestTawny for kind: "incident" alerts.

ISM IDs

All 30 IDs cited were checked against the September 2026 ISM, in two places: the cyber.gov.au /ism/2026-09/guidelines-* pages, and ASD OSCAL release v2026.09.4. None was left blank or unchecked, so there is no issue comment. ISM-1988 (12 months searchable retention) is only partly met, because raw telemetry is purged after 30 days. ISM-1650, ISM-1660 and ISM-1683 are marked not supported.

Other notes and decisions

  • TAWNY_OIDC_ALLOW_LOOPBACK=1 lets the server reach the mock provider over http://127.0.0.1. CI sets it for the server job only; it must never be set in production. Without it, provider endpoints must be https to a public host.
  • The agent route /api/agents/actions/{id}/result is declared in the gate too. My first table had the wrong pattern, and contract run 1 caught it.
  • UI assets were renamed to new hashes because /assets/ is served as immutable for a year.
  • Risk weights come from rule severity (critical 60, high 30, medium 20, low 10, IOC 50), not rule YAML yet. Context (allowlist, trusted signer) is not wired. Both are written up in target-edr §7.
  • Not built: §11 exceptions v2, the lineage graph, the optional per-agent compliance report, and the Windows 4728/4732/4756 subscriptions. The 4728/4732/4756 work is agent-side, so it belongs to EDR 7: Linux depth via eBPF (Tetragon or Falco) or auditd with minimal capabilities #59's area.

Checks run

  • zig test src/main.zig -lc: All 180 tests passed, no SafeAllocator lines (baseline was 158).
  • zig test src/main.zig -lc --test-filter fuzz: All 2 tests passed.
  • zig build -Doptimize=ReleaseSafe: built.
  • /tmp/run-contract.sh (run twice, the limit):
    • Run 1: 3 failures. A wrong route pattern for action results. An all-rules suppression my test created that hid later alerts. A rate limit. All three were fixed.
    • Run 2: 46 of 47 passed. The Entra test's sign-in, group mapping, tid/oid match and every refusal case passed. It then hit the web-admin-mutate limit (30 per minute) while creating a user for the break-glass section. I removed that extra call and made the retry wait out a full window. That last fix has not been run locally, because I had used both runs; CI will run it. The break-glass rule itself also has unit tests.
  • UI: node --check and node ci/ui-fallback.mjs passed (14 routes).
  • /tmp/yamlcheck.sh .github/workflows/*.yml: yaml ok.
  • Prose grep on new docs: no matches.

🤖 Generated with Claude Code

jusso-dev and others added 5 commits November 10, 2026 05:56
Analyst role: admin, analyst, viewer. Each route file declares its routes
and permission; http/permissions.zig gates every request before a handler
runs, and a test checks every route against the matrix for each role.
Analysts triage, run hunts, request response actions (destructive ones can
wait for admin approval, a tenant setting) and add exceptions with a reason.

Incidents (migration 0008, row-level security): alerts group by the
target-edr section 8 rules within 4 hours, using process.entity_id lineage
from process_entities. Risk is the section 7 noisy-OR with every evidence
item and its points stored. List, view, assign and status endpoints, plus
alert acknowledge and resolve.

ATT&CK coverage: rules/attack/coverage.yaml and a vendored subset of ATT&CK
Enterprise 20.1. GET /api/attack/coverage reports telemetry, detection and
response separately.

Entra ID: OIDC code flow with PKCE, state, nonce and verifier in
oauth_states, ID token verified with the RS256 code in crypto/jwt.zig
(iss, aud, exp, nbf, nonce, tid). Users match on tid and oid; groups map
to roles; no group, no account. Tenant setting limits password sign-in to
break-glass admins. Client secret encrypted with
TAWNY_INTEGRATION_ENCRYPTION_KEY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Incidents go to Tawny-SOC through its existing POST /api/ingest/tawny as
an alert with a stable id and the risk breakdown. Tawny-SOC's
app/api/v1/cases is read-only (GET list and GET by id), so Tawny does not
create cases itself. Detection queues one update per incident (30 s
debounce); assign and status changes queue another.

Contract suite: an analyst and a viewer against live routes, the analyst
approval flow, the Office to PowerShell chain as one incident with its
score, the three ATT&CK states, and Entra ID sign-in against a mock OIDC
provider that signs RS256 tokens with a key from openssl genrsa at start-up
(TAWNY_OIDC_ALLOW_LOOPBACK lets the server reach it on 127.0.0.1).

Also: action result route pattern matches /api/agents/actions/:id/result,
admins can mark break-glass users, the bootstrap admin is break-glass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Incidents list with status filter. Incident page: risk breakdown with
each item's points, ATT&CK techniques, alert timeline with triage, and the
process tree (opened at the lineage root) and response panel per agent.
ATT&CK matrix by tactic, filterable by platform, showing telemetry,
detection and response as three separate marks. Analysts get triage,
response and exception controls; admins approve queued actions. Sign-in
page offers Entra ID when configured and says when passwords are
break-glass only. Assets renamed to new hashes since they are served as
immutable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/entra-sso.md: app registration, groups claim, Tawny settings,
break-glass admins, secret rotation and the mock provider used in tests.
docs/api.md: the role and permission matrix per route, tenant settings,
incidents, alert triage and the ATT&CK coverage endpoint.
docs/compliance/essential-eight.md: per strategy, what Tawny shows and
what it does not. Tawny is not application control, a patch scanner or an
MFA product.
docs/compliance/ism.md: Tawny features against September 2026 ISM
controls. Every ID was checked on the cyber.gov.au 2026-09 pages and in
ASD OSCAL v2026.09.4; none is left unchecked. Log retention (ISM-1988) is
only partly met: raw telemetry is kept 30 days in the database.
target-edr: status for sections 6, 7, 8, 11 and 12, and new 12.1 to 12.3
for the analyst role, Entra ID and compliance.

Contract suite: admin writes retry past a full rate-limit window.

Closes #60

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fb70f232-f314-4622-84a1-fa7996df6f77
Commits

Reviewing files that changed from the base of the PR and between 171a4b0 and 3c7d4bc.

Files selected for processing: 48

  • .github/workflows/ci.yml
  • .gitignore
  • ci/ui-fallback.mjs
  • contract-tests/mock_oidc.py
  • contract-tests/suite.py
  • docs/api.md
  • docs/architecture/target-edr.md
  • docs/compliance/essential-eight.md
  • docs/compliance/ism.md
  • docs/entra-sso.md
  • rules/attack/coverage.yaml
  • rules/attack/subset.py
  • rules/attack/techniques.json
  • server/src/db/migrate.zig
  • server/src/db/migrations/0008_server_analyst.sql
  • server/src/detect/attack/coverage.yaml
  • server/src/detect/attack/techniques.json
  • server/src/detect/correlation_test.zig
  • server/src/detect/incidents.zig
  • server/src/detect/incidents_test.zig
  • server/src/http/auth.zig
  • server/src/http/dispatch.zig
  • server/src/http/permissions.zig
  • server/src/jobs/detect.zig
  • server/src/jobs/incident_sink.zig
  • server/src/main.zig
  • server/src/routes/admin_jobs.zig
  • server/src/routes/agent_releases.zig
  • server/src/routes/agents.zig
  • server/src/routes/ai.zig
  • server/src/routes/alerts.zig
  • server/src/routes/attack.zig
  • server/src/routes/auth.zig
  • server/src/routes/feeds.zig
  • server/src/routes/github.zig
  • server/src/routes/hunts.zig
  • server/src/routes/incidents.zig
  • server/src/routes/lookup.zig
  • server/src/routes/oidc.zig
  • server/src/routes/settings.zig
  • server/src/routes/suppressions.zig
  • server/src/routes/tokens.zig
  • server/src/routes/users.zig
  • server/src/routes/yara_rules.zig
  • server/src/sinks/tawny_soc.zig
  • server/ui/assets/app.0094e71d5061.js
  • server/ui/assets/app.d8d71bb8141b.css
  • server/ui/index.html
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@jusso-dev

Copy link
Copy Markdown
Owner Author

Status: all 11 CI checks pass on 3c7d4bc. That includes the contract suite with the Entra mock provider. The break-glass rate-limit fix wasn't run locally before push; this is its first run, and it passed.

Not built here: the §11 exceptions rework, the lineage graph, and the optional per-agent compliance report.

Decisions for Justin:

  • Tawny-SOC case sync. Tawny-SOC's app/api/v1/cases is read only (GET). For now, incidents go in as one alert through POST /api/ingest/tawny, with a stable id, and later status changes don't reach it. Real sync needs either a POST /api/v1/cases with upsert in Tawny-SOC, or an upsert in its ingest.
  • ISM-1988 (12 months searchable) is only partly met. Telemetry is purged after 30 days and alerts are kept for 365. Keep daily backups searchable for 12 months, or forward telemetry to a SIEM.
  • TAWNY_OIDC_ALLOW_LOOPBACK=1 is set in CI only, so the server can reach the mock IdP on 127.0.0.1. Never set it in production.
  • The UI assets were renamed to new hashes, because /assets/ is cached for a year.

All 30 ISM IDs were checked against the September 2026 ISM (OSCAL v2026.09.4), so none was left blank.

Stacked on #68. It's independent of #59 (agent only), so they can merge in either order after #68.

@jusso-dev
jusso-dev changed the base branch from feat/agent-hardening to main November 9, 2026 22:44
@jusso-dev
jusso-dev merged commit eba4b12 into main Nov 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EDR 8: Server, Entra SSO, analyst role, incidents, ATT&CK coverage, Essential Eight and ISM mapping

1 participant