mirror of
https://github.com/beenuar/AiSOC.git
synced 2026-11-26 02:05:36 +08:00
* depth2 Phase 0: kickoff, re-derived baseline and the SIEM-scope decision
Phase 0.1-0.4 of the wave-2 depth plan, which lands here locked beside the
other four plans.
0.2 re-derives every figure the plan captured. All twenty reproduce exactly
except the cloud/identity/SaaS/code condition count, which the plan itself
flagged as approximate: measured 344 against 'about 358'. D1 records why,
and the finding underneath it — no script in the tree implements that
sentence, so every published value of it was hand-counted with a slightly
different product set, and windowed rules contribute zero because they
carry no product field at all. Phase 2.1's gate has to decide that
explicitly.
0.3 captures the baselines, including 'make up-full' — the one the first
depth plan recorded as never captured (its D2). 22 containers on the full
profile; CORE passed 'make smoke' 10 of 10. The baseline host had nine
unrelated containers on it including a foreign Postgres on 5432, and
'make up-full' failed its first bind before the port resolver's overlay
landed. D2 records the sequence and, deliberately, does not claim a defect
from it: the preceding state is not replayable, so it carries a clean-host
reproduction as a follow-up instead.
0.4 is ADR-0015: AiSOC federates to the SIEM rather than replacing it. The
README's 'Not a drop-in SIEM replacement' is now a decided position with its
cost argument — compliance search needs raw-payload retention outside the
8 GB CORE budget and an availability promise this project has no measured
evidence it can keep. Proposed, and nothing in this plan builds from it.
* chore(depth2): claim Lane B migration 130-137 and ADR 0018 block
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* test(ingest): failing test for anonymizer and hosting classes at ingest
Depth plan wave 2 item 1.6. The reproduction, through the real Normalize
entry point rather than the classifier in isolation:
internal/normalizer/ipclass_stamp_test.go:68:20:
act.Location.IPClass undefined (type activity.Location has no field)
No class is stamped on any event today and no dataset exists to stamp it
from. The test drives Normalize so that a classifier package with passing
unit tests and no caller cannot satisfy it.
Also lands the downloader half of the dataset pair (the fidelity-corpus
rule: a loader without a downloader cannot be refreshed or audited) and the
pinned snapshot it produced: 21,726 records, 1,228 tor_exit from the Tor
Project bulk exit list (CC BY 3.0 US) and 20,498 hosting_provider from each
cloud's own published range endpoint. Per-source provenance, terms link and
upstream digest are in manifest.json.
vpn, public_proxy and residential_proxy ship with no records on purpose.
The widely cited community list for the first two carries no licence file
at all (its LICENSE path answers 404 on the default branch), so it cannot be
redistributed from an MIT repository. Those three classes are tenant-
supplied only.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* feat(ingest): stamp anonymizer and hosting classes on public IPs at ingest
Depth plan wave 2, item 1.6.
Reproduced first: the Go test committed before this one failed to compile
because `activity.Location` had no `IPClass` field and nothing classified
anything. It now passes, and reverting the single `stampIPClass` call in
`Project` fails it again with
ip 2.56.10.36: ip_class = "", want "tor_exit"
ip 1.178.1.0: ip_class = "", want "hosting_provider"
What runs where. One classifier, in Go, in `Project` rather than in the
normalizer's call site, so every caller gets it: a classifier wired into one
site is the built-but-unwired shape this tree keeps finding. The dataset is
embedded in the binary, so a CORE install classifies with no enrichment
service and no network call of any kind.
The trap the plan names, closed in two places. Live, the stamp lands nested
at `activity.location.ip_class`, where the matcher's plain `event.get`
cannot see it, so `DetectionEngine._raw_fields` now lifts it into the flat
namespace beside the `raw_event` merge that fixed the same shape one level
in. In replay, a committed fixture carries only a `src_ip`, so `enrich`
classifies it through the vendored loader. Without both halves a rule
matching `ip_class` would pass its fixtures and never fire live, or the
reverse. `check_ip_class_dataset.py` runs the Go classifier and the Python
one over 400 sampled addresses and requires identical answers.
Carried end to end: three ClickHouse columns (fresh-volume DDL and lake
migration 005 in lockstep, because a column added to one alone lands on new
deployments and silently not on old ones), two `alerts` columns (migration
130), the alert API response, and a rail section.
Absent is never false. Three of the five classes ship with no records, so an
unclassified address is the ordinary case: the column is NULL, the rail
renders nothing, and no surface says "not an anonymizer". The dataset
version travels with every stamp because the dataset is refreshed and a
class that cannot be dated cannot be re-read.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* docs(depth2): ADR 0018, setup page and claim row for IP classification
Depth plan wave 2, item 1.6.
ADR 0018 records which classes ship and which are refused, and why the
refusal is on the licence rather than on the data: the community list the
obvious candidate would have come from carries no licence file at all, which
an MIT repository cannot redistribute.
The setup page leads with the table saying three of the five classes have no
records, so a reader learns that before they write a rule against one. Its
last section says tenant-supplied lists are not implemented rather than
implying a configuration step exists.
Claim matrix moves 334/329/5 to 335/330/5 across all three published
tallies. The row leads with the uncovered classes, because a row that read
"five anonymizer classes at ingest" would be true of the code and
misleading about the data.
Gate wired twice, deliberately: the cheap half in python-lint with
--skip-go, the Go/Python parity probe in the one job that has both
toolchains. The gate now fails rather than reporting 'not checked' when Go
is missing and --skip-go was not passed.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* test(connectors): failing test for HR and device context reaching triage
Depth plan wave 2, item 1.3. The reproduction, on the current tree:
ModuleNotFoundError: No module named 'app.connectors.bamboohr'
and the measured state behind it:
* 88 connectors registered in _CONNECTOR_CLASSES, none of them HR and
none of them MDM;
* `import_context` has exactly one production caller, the manual POST
route in services/api/app/api/v1/endpoints/graph.py:725, so a tenant's
HR context is only ever as current as the last file somebody uploaded.
The test asserts registration, scheduler wiring and vendor shape, in that
order of severity, because a connector the scheduler never syncs is
indistinguishable from no connector at all.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* feat(connectors): HR and device context connectors that the scheduler actually syncs
Depth plan wave 2, item 1.3, first half.
Three connectors, each against a public reference verified on 2026-11-01
and cited in its module docstring:
bamboohr GET /employees/directory to enumerate, then
GET /employees/{id}?fields=... per employee.
rippling GET https://rest.ripplingapis.com/workers/, scope
workers.read, cursor paging on next_link.
microsoft_intune GET /deviceManagement/managedDevices on Graph v1.0,
permission DeviceManagementManagedDevices.Read.All.
The BambooHR shape is worth stating because the obvious read is wrong. The
directory endpoint is one request and its own reference rules it out twice:
it never includes employment status or history in any configuration, and it
excludes former employees entirely. That removes every field 1.3 asks for
and the whole population the feature exists to see, which is the person who
left on Friday whose account authenticated on Saturday. So the directory
enumerates ids and each employee's fields are named in the request.
Wiring, which is the half that makes this real. import_context had exactly
one production caller, a manual POST route, so a tenant's HR data was only
ever as current as the last file somebody uploaded. The scheduler now calls
_sync_workforce_context on every poll, in its own try, modelled on
_sync_vulnerability_findings beside it: a context sync that fails must not
cost the poll its events.
Migration 131 puts the context in Postgres, so it exists on CORE. The graph
import stays and is richer; it is in the full profile, so a CORE install
would otherwise have no HR dimension at all and every triage input reading
it would be silently dead.
Data minimisation is in the request and in the schema, not in a filter.
Every vendor here returns compensation, date of birth and home address; none
is requested, and there is no column that could hold one. Encryption is a
tri-state because FALSE is a finding and NULL is not, and an unrecognised
employment status is "unknown", because deciding somebody still works here
on a value nobody recognises is the wrong direction to be wrong in.
* feat(1.3): HR and device context reaches the verdict, on CORE, cited
Depth plan wave 2, item 1.3, second half.
The context now gets all the way to a triage input instead of stopping at a
table. Four facts are derived from the rows the context readers already
return, each rendered in the prompt and each cited separately in the
confidence basis: tenure, departing within 30 days, contractor status, and
the compliance state of the principal's enrolled devices.
Both halves are asserted for all four, which is the point of the test file.
A fact in the prompt and not the basis is one a reviewer cannot see moved a
verdict; a fact in the basis and not the prompt is one the model never had.
Every absence keeps its direction, and each of the four is a reassurance the
data cannot support if it goes the other way:
no start date is not a new joiner, so no tenure is reported
no end date is not "staying", so no departure claim is made
unmapped type is not an employee, so no contractor claim is made
unevaluated device is not a compliant one, and says so in the prompt
Encryption stays tri-state through all of it. FALSE is a finding; NULL is
nobody reporting, and only FALSE renders.
CORE. The identity-context route merged the Postgres entity store beside the
graph read, graph rows first because that import carries relationships the
table does not. Neo4j is a full-profile service, so without this the whole
dimension was dead on the deployment make up produces.
Migration 131's policies gained the FORCE and the unbound-session arm the
RLS shape gate requires: the connector scheduler writes these rows on a
connection that binds no tenant GUC, and without the arm it would have seen
and written zero rows while reporting success. The real control for those
writers is the explicit tenant predicate every statement carries.
hr and mdm are their own connector categories for the reason ai is: these
produce context about people and devices and emit no events at all, and a
reader looking for where their employee data comes from should not have to
find it among twenty-two SaaS audit sources.
Connector count regenerated, not edited: 87 to 90. Conformance matrix
regenerated: 90/90. Claim matrix 335/330/5 to 336/331/5 across all three
published tallies.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* docs(depth2): record Phase 8 reproductions and 8.4 as blocked
Lane B. Three items are written up without being built, and one is closed
as blocked, which is what the plan asks for in each case.
8.4 is closed. Both halves are blocked on hardware and neither on code, so
"recorded as blocked with exactly what is needed" is the outcome the plan
names. The cloud-hardware run needs a cloud account and one named instance
type; the harness already records the hardware fingerprint, the load shape
and the commit, and the gate already refuses a result that drops any of
them. The managed-cluster run needs a managed Kubernetes cluster with three
worker nodes. No figure was produced by extrapolating from the laptop runs:
a laptop VM's disk, network and CPU scheduling are not an instance type's,
and a number derived that way becomes a promise nobody can keep.
8.1, 8.2 and 8.3 are reproduced rather than asserted, because a gap nobody
reproduced is a rumour. Measured on this tree:
8.1 wiz.py declares exactly one GraphQL operation, query IssuesTable,
and each of orca, prisma_cloud, lacework and sysdig reads only its
own alert stream.
8.2 no extrahop and no corelight. ExtraHop's REST guide answers 200 and
is buildable; Corelight's docs answer 401, so it is blocked on a
documentation account or one recorded payload. Corelight's Zeek
output is open and already covered by zeek_suricata, which is a
different thing from the sensor's detection API and must not be
passed off as it.
8.3 the gap is wider than the plan states. services/enrichment is a Go
service with zero occurrences of "tenant" in its enricher or its
config, so per-tenant is absent rather than partial, and there is no
vault reference anywhere in the service. RATE_LIMIT_RPS and
RATE_LIMIT_BURST are parsed, assigned to struct fields, and read by
nothing else. URLSCAN_API_KEY is a config field with no client. The
design decision this needs is named rather than left to be
discovered: a Go service cannot hold the vault write path, so either
it learns a vendored read-path decrypt or the fan-out moves behind an
API route that resolves the tenant's credentials first.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* docs(depth2): record that no Lane B check has been graded yet
The head commit of depth2/lane-b-sources has total_count: 0 check runs
while the repository has 19 queued and 18 in-progress workflow runs. No
check has failed because no check has started, and the two cases look
identical from a PR page. The one-call measurement that tells them apart is
recorded so the next reader does not debug a branch that is only waiting.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* docs(depth2): correct D7 - zero check runs was a conflicted PR, not the pool
The original entry blamed the shared runner pool because 19 runs were
queued at that moment. The pool had drained to one. The real cause was that
Wave 0 was squash-merged into main, so main and the Lane B base each
carried DEPTH2_PROGRESS.md and the plan file by different histories: an
add/add conflict, both PRs mergeStateStatus DIRTY, and GitHub creates no
check runs at all for a pull request whose merge ref it cannot compute.
The durable half is the one call that tells the two apart, because a busy
queue is the ordinary state here and is true at the same moment either way:
gh pr view <n> --json mergeStateStatus -q .mergeStateStatus
DIRTY means nothing can be graded and no amount of waiting will change it.
BLOCKED or UNSTABLE with zero runs is the pool. Checking the queue first is
what produced the wrong answer.
Measured after the base merge: 108 and 109 check runs, against zero.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* fix(1.6): regenerate the OpenAPI spec and close the semgrep finding at source
Two real CI failures on this branch, both from this change.
The spec was stale because AlertResponse gained src_ip_class and
src_ip_class_dataset_version and the committed document did not. Regenerated
with scripts/export_openapi.py; the diff is exactly those two optional
nullable fields on AlertResponse and AlertDetailResponse.
Semgrep went 112 to 113: dynamic-urllib-use-detected on the dataset
fetcher's urlopen. The ceiling is not the thing to move. The rule exists to
ask whether a caller can steer the URL, and urllib honours file://, so the
fix is to make that unrepresentable: _fetch now refuses any URL that is not
byte-identical to one declared in SOURCES. That is tighter than the scheme
allow-list the rule would settle for, because this script reaches a fixed,
reviewed set of endpoints and an address outside it is a bug rather than a
configuration choice.
The rule matches on the call shape and cannot see a guard, so the one-line
scoped suppression follows the precedent already in scripts/run_replay_eval.py:
it names the rule, it sits on the reported line, and any other urlopen added
to this file still fails the scan.
Measured locally with the pinned semgrep 1.86.0 against the vendored packs:
113 findings before, 112 after, which is the ceiling unchanged.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* fix(1.3): a connector must not pull a database driver into its import graph
CI on this branch failed "Validate & summarise detection rules", which
names detections and has nothing to do with them:
File "scripts/connector_normalize_worker.py", line 39, in main
from app.connectors import _CONNECTOR_CLASSES
File "services/connectors/app/workforce.py", line 45, in <module>
from sqlalchemy import text
ModuleNotFoundError: No module named 'sqlalchemy'
That worker imports the whole connector registry with a minimal dependency
set to replay detections through real connectors. workforce.py held both
the record shapes and the Postgres upsert, so importing a shape imported
SQLAlchemy, and the three new connectors put it in the registry's import
graph. Every connectors test passed throughout, because that suite installs
the service's full locked set.
Split: workforce.py holds the shapes and carries no database dependency,
workforce_store.py does the writing and may. The scheduler imports the
store.
The general rule is pinned by a test that imports the registry in a
subprocess with sqlalchemy blocked at the meta-path. A subprocess and not a
monkeypatched sys.modules entry, because this process has already imported
it and the patch would not reproduce the worker's environment. The next
connector that reaches for a driver now fails in the connectors suite
rather than in a job whose name points somewhere else.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* test(1.6): assert the source-address section on the rail's Details face
CI caught this and the local run could not: the rail opens on the story
view and every structured section lives behind the Details tab, so the
assertions were looking at a face the section is not on.
Unable to find an element with the text: Tor exit relay
Fixed by clicking through to Details first, following renderDetails in
InvestigationRail.test.tsx. Asserting without the click would have passed
only if the section were on the story face, which would be the wrong place
for it: the story face is the narrative, and this is a structured fact
about the source address.
Found because the web suite needs a pnpm install this machine does not
have, which is recorded in the pull request rather than implied as a pass.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
(cherry picked from commit f7e84c2094)
* fix(1.3): record the OCSF decision for the HR and MDM connectors
CI caught two things this branch got wrong, and the first corrects a
deviation I recorded.
D6 said these connectors need no ingest profile and cited a Go test that
does not ask that question. The test that does is
TestEveryDeclaredConnectorHasAnOCSFDecision, and it failed:
connector "bamboohr" has no entry in connectorOCSFClass: its events
take the 2001 default, which is always promoted, and nothing records
that as a decision
The conclusion in D6 was right and the evidence for it was not. These
connectors publish no events at all -- fetch_alerts returns an empty list
on each by design, and their output is slowly-changing context the
scheduler writes to workforce_members and workforce_devices, never to
ingest. But connectorOCSFClass exists precisely to tell "decided" apart
from "nobody looked", and an HR connector with no entry reads as the
second. All three now carry a genericReason saying what they are.
Second: the marketplace index moved when the three plugin manifests
landed, and apps/web/src/data/corpus-stats.json was stale against it.
Regenerated, not edited: 2,530 executable across 7 categories, 7,015
indexed on disk, 83 plugins.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* docs(depth2): correct D6 - the original evidence named the wrong test
The conclusion held: HR and MDM connectors publish no events, so an ingest
profile would be an entry nothing can reach. The evidence did not. D6 cited
TestConnectorTypeCanonicalTargetsAreDeclaredAndUnshadowed, which asserts
that every alias target is declared and asks nothing about a connector
having a profile. The test that asks is
TestEveryDeclaredConnectorHasAnOCSFDecision, and it failed in CI.
A local suite passing is not evidence that the specific question was asked.
Signed-off-by: beenuar <beenu.a.arora@gmail.com>
* chore(1.3): regenerate the connector-type union for the HR and MDM connectors
* chore(1.3): regenerate the bundled connector catalog for the HR and MDM connectors
* fix(1.3): the profile gate tells a context-only connector from an unreachable one
The gate failed the three HR and MDM connectors as
strict-mode-unreachable, and lane B's D6 had recorded that no gate
wanted a profile for them. The gate did want one, so D6 was wrong --
but so was the gate's reading of these three.
fetch_alerts on all three is a declared no-op returning an empty list:
an HR system or an MDM reports state, not security events, and the
workforce sync writes through context_import rather than ingest. The
hazard this check exists for is an event that strict mode rejects and
lenient mode resolves to a bare title. A connector that emits no
events has no such event.
So the gate learns the distinction rather than the connectors
acquiring a profile describing events they never send. Deliberately
narrow: only a body whose single statement is counts, so a
connector that fetches anything still needs its profile, and one that
later starts emitting stops matching and is asked again -- proven by
mutating bamboohr's fetch_alerts to return a record and watching the
detector go False. Self-test still catches all 16 injected defects.
* style: ruff format
* fix(ingest): count context-only connectors apart from the generic-mapping ceiling
The OCSF coverage gate counted bamboohr, rippling and microsoft_intune
against MAX_GENERIC, taking it from 42 to 45 and failing the build. Raising
the ceiling would have been wrong: the bucket measures one thing, events
taking the lenient 2001 default, and all three connectors return an empty
list from fetch_alerts. Their data reaches the platform through the
scheduler's workforce_members / workforce_devices writers and never passes
the normalizer at all, so they carry none of the debt the figure describes.
The gate lacked the distinction, so it is taught it rather than relaxed:
- connectorClass gains a `contextOnly` marker, set on the three entries.
- The gate verifies the claim against the connector's own fetch_alerts by
AST rather than believing the free-text reason, which would otherwise
have made the exemption available to anyone who typed the right words.
It is conservative in one direction only: a connector is credited with
emitting nothing only when that is provable, so an inherited, absent or
generator fetch_alerts stays counted.
- A false claim fails `context-only-emits-events` *and* keeps the
connector in the counted bucket, so it buys no headroom.
MAX_GENERIC stays at 42. Self-test grows to 14 cases, three of them new,
including the control that an unsupported context-only claim still trips
`generic-count-grew`. Verified end to end against the real tree as well: a
bamboohr fetch_alerts edited to return an event takes the count to 43 and
reports both findings.
* fix(actions): mirror the two workforce capabilities into KNOWN_CAPABILITIES
The connectors Capability enum gained pull_workforce and
pull_device_inventory with this wave's HR and MDM connectors; the actions
mirror did not move with them, and check_action_contract compares the two
in both directions.
Not cosmetic: a verb absent from KNOWN_CAPABILITIES is a verb governed
dispatch answers executor_not_found for, so the scheduler branch that pulls
workforce context would have had no governed path at all.
---------
Signed-off-by: beenuar <beenu.a.arora@gmail.com>