Commit Graph
7 Commits
Author SHA1 Message Date
Beenu Arora 3364706565 docs: correct the statements recent work made false (#1229)
* docs: correct the statements recent work made false

A sweep of the 375 tracked Markdown/MDX files outside `plans/`, plus every
URL they ship. 50 files corrected, 0 deleted. The ranking is by how wrong a
statement was, not by how visible the page is.

Capabilities described as absent that now exist. The depth wave gave readers
to ABAC conditions, time-boxed elevation and workload identities, shipped
console TOTP, and made the playbook `approval` step a durable pause — and
five documents still said none of that existed. The buyer-facing security
questionnaire was the worst of them: four gap-list rows and two prose answers
telling a prospect that controls they were evaluating us on were absent. Its
own sibling page `access-governance.md` documented those controls and was
missing from the pack index, which is how the contradiction survived.

Capabilities described that do not exist. `faq.md` answered "can I delete a
user's data on request?" with "Yes" and a route — `DELETE
/api/v1/identity/{user_id}/data` — that appears nowhere in the code or in
`docs/openapi.yaml`, while `data-handling.md` says in as many words that no
such route is in the tree. `live-actions.md` called `POST
/api/v1/live-actions/dispatch` "one entry point" for the agent layer; the API
deliberately proxies only `/dry-run`, and its handler says so. The same page
documented `tenant_id` and `requested_by` as caller-supplied fields.

Counts re-derived from the tree, not carried over: executable detections
2,603 -> 2,529 (down, because rules that could not fire stopped being
counted), unreachable 119 -> 45, windowed 5 -> 72, YAML under `detections/`
7,016 -> 7,022, `/metrics` coverage 5-of-17 -> 5-of-19, connectors 69/84 ->
87, marketplace 7,155 -> 7,158, playbook step types 9 -> 25.

Links: every external URL fetched. `docs.tryaisoc.com` does not resolve at
all and was linked from two example pages — sentences rewritten, hostname
allow-list entries removed rather than re-counted, since the exemption had
claimed they were "accurate as written". Sigstore, Wazuh and MITRE CAR links
repointed at destinations that answer 200. Nine internal links fixed,
including two to `PROGRESS.md`, which is gitignored and has never been
committed.

Self-contradictions resolved in place: `observability.md` said both that the
Kafka spine's ends are instrumented and that they are not — the limitation is
real but its stated cause changed, and the bullet now gives the current one.

* docs: carry the corrected detection figure through every surface

#1226 landed the 3.3 corpus correction and the executable figure moved
again, 2529 -> 2511, for the same reason as the first move: rules that
cannot fire stopped being counted as capable of it.

Seventeen documents still carried the old number — the architecture page,
the glossary, the intro, the FAQ, the detections concept page, three
design briefs, two contributing guides, the repository-reality audit and
the claim matrix. A figure copied into prose goes stale silently, which is
why it is re-derived here rather than edited by hand in one place.

The dated DEPTH_PROGRESS log entry keeps 2,529: it records what was true
when 3.1 landed, and rewriting it would be revisionism. The
component-recipes file keeps its list of superseded literals for the same
reason — that list is the warning against hard-coding the figure at all.

readme-gates, the claim matrix, llms --check, comment-paths, merge-markers
and competitor-names all pass.

* docs: make AGENTS.md contributor guidance instead of a leaked session log

The file committed at the repository root was a verbatim session-memory
document. It opened with "Learned User Preferences", referred throughout to
"the user", and published things that have no business in a public
open-source repository: the commercial product's hostname, its Fly.io
hosting topology and internal app names, its billing and registration flow,
and the name of an archived private staging repository.

Most of it was also wrong. The Fly.io apps were reclaimed for non-payment
months ago, so the deployment section described infrastructure that does
not exist, and the service and package lists predated several waves of work.

Rewritten as what an `AGENTS.md` at a project root is for: guidance for
whoever is changing the code, human or agent. One command to get it
running, one event's journey through the services, where things live, the
conventions that are easy to guess wrong, the figures with the command that
re-derives each, and the rules that are not negotiable.

Three choices worth stating. The figures table gives the command rather than
only the number, because a number copied into prose goes stale silently and
several in this repository did. The "if you are an AI agent" section says
plainly that nothing here can make a third-party tool reach for this project
by default — that is registry publication, not documentation. And the Cyble
credit stays: `www.cyble.com` answers 403 to curl, but it is Cloudflare's
"Just a moment" interstitial over a live host, which is bot protection and
not absence.

Every other URL fetched at 200 before committing.

* Merge origin/main, and register AGENTS.md's two service counts

The new contributor guide publishes a CORE and a full service count in its
opening block, and the profile gate requires any published figure to be a
registered claim site — correctly, because an unregistered figure is one
nobody notices going stale, which is how three of them drifted before.

Registered rather than reworded. Proven by setting the CORE figure to 14
and watching the gate name all sixteen services; restored, and it passes at
28 published figures agreeing with docker-compose.yml.
2026-10-09 13:48:27 +05:30
90ea2fdabb Users administration, editable RBAC, and SSO login hardening (lands #1179's reviewed scope) (#1183)
* fix(api): stop the infosec seed from blanking every tenant's permissions

The per-tenant roles seed in 091 made every tenant look RBAC-configured
while granting nothing: resolve_permissions switches from the static map
to the database the moment a tenant has any roles row, so admin lost *
and every permission-checked endpoint 403'd (alerts feed, and the SSO
handoff bouncing back to /login after the dashboard painted once). The
canonical infosec definition lives in ROLE_PERMISSIONS and
GRANTABLE_ROLES, which is what assignment validates against; no roles
row is required. Rows deleted from the live database as well.

Signed-off-by: Alexandru Mateescu <alexandru.mateescu@c8r-tech.com>

* feat(api): alert under AI investigation becomes investigating too

Clicking Start AI investigation from the alert detail opened a case and
launched the agent, but the alert itself stayed New - the board showed
work in flight as untouched. The launch endpoint now forward-advances
the case's linked alerts (new/triaged/triaging -> investigating) in
the same request, tenant-scoped, never blocking the launch, and never
dragging resolved/false-positive/closed or already-running alerts
backwards. Predicate verified live against Postgres; contract locked by
tests/test_alert_investigate_bump.py.

Signed-off-by: Alexandru Mateescu <alexandru.mateescu@c8r-tech.com>

* fix(api): optional_user forwarded the wrong arg slot, 500 on every dashboard poll

alert_writeback.optional_user called get_current_user(credentials, db)
after that dependency gained Request as its first positional parameter;
credentials landed in the request slot and the session in credentials,
raising AttributeError on AsyncSession.credentials as an unhandled 500 on
the authenticated poll. Also makes uvicorn access logs opt-in via
AISOC_ACCESS_LOG=1 so a post-login bounce is attributable, and keeps the
serve wrapper passing --access-log when enabled.

* fix(auth): land the OIDC callback on /login so the fragment survives

The callback appended the session to the requested page (/dashboard),
but the fragment consumer lives on /login and the console guard bounces
unauthenticated visitors to /login?next=... — a query-string redirect
that drops the fragment. Every real browser lost the token at that hop
while curl-level verification (which never runs the guard) kept passing.
The callback now always lands on /login?next=<target>#access_token=...
and refresh_token=...; /login consumes it, persists the session, and
routes to next.

* feat(rbac): seed the role catalog, populate the Roles screen, assign roles end to end

The RBAC tables shipped with schema and no data: roles and
role_permissions were empty, and permission_cache switches a tenant to
database-backed mode the moment roles gains any row - so any seed that
forgets the membership backfill blanks every user's permissions. This
seeds all of it in one transaction and gives the console a real
assignment path.

- 092_rbac_catalog_seed.sql: permission vocabulary (61 rows incl. the
  wildcard the admin role holds), the three system roles with
  descriptions, their grants (38), and user_roles backfilled from
  users.role with viewer as the fallback - idempotent, reversible
  (the rollback block documents the exact DELETEs).
- app/core/rbac_catalog.py: one vocabulary shared by the migration
  scope, the seed endpoint, and SSO provisioning sync.
- rbac endpoints: PUT /users/{id}/role (primary-role replace, reason,
  audit, granter-subset check, disabled-target 400, unknown-role 400
  naming the valid set, last-admin 409); roles list and detail now
  carry user_count and is_sso_default; POST /roles/seed (idempotent,
  admin, audited) backs the empty-state action; revoke gains the same
  last-admin guard; assignment gates moved to roles:write - infosec
  holds users:write, so the old gate let an analyst promote himself.
- sso provisioning: every provision path now syncs user_roles to the
  decided role, so a JIT viewer actually holds viewer permissions on a
  catalog tenant; first_login_only still shields manual assignments.
- console: Roles screen groups permissions by area, shows user counts,
  badges the protected SSO default, offers Seed roles on an empty
  catalog, hides management controls from non-admins; Workspace members
  gain an Assign role modal (preselected, required reason, explicit
  admin confirmation, self-lockout disabled) wired to the API.

Verified live: viewer 403s at every mutating route; admin round trip
viewer->infosec->viewer persists and takes effect on the same token
without re-login; infosec 403 on assignment; unknown role 400;
last-admin demotion 409; audit rows carry actor/target/old/new/reason
with zero secret material.

* docs(rbac): correct rollback semantics for manual assignments across a round trip

* feat(rbac): admin Users screen + fully editable Roles & Permissions

Users (/settings/users, admin-only nav, hidden for viewer/infosec):
- server-side pagination, search, role/status filters, column sorting
- multi-role assignment modal with live merged effective-permission preview
- enable/disable lifecycle actions, audited reasons, session revocation

Roles & Permissions:
- create/edit custom roles (label/description editable, machine name immutable)
- permission checkboxes over the live vocabulary; delete guards 409/403
- roles.label column via migration 093 + orphan role repair

Backend: /api/v1/admin/users CRUD (roles:write gate, last-admin guard,
audit on every write, sessions_revoked_at on change); rbac role CRUD
hardened (slug + reserved-name validation, system roles protected).

Verified against live stack: Users list/filters/pagination 200; custom
role create/edit/delete round-trip; multi-role assignment with effective
perms; disable/enable; viewer 403 on all admin routes; system-role
delete 403; audit rows carry actor/target/reason, no secrets.

* fix(ci): CAST binds in rbac_catalog so live SSO test parses; refresh openapi spec

The catalog SQL still used :param::uuid inside text(), which SQLAlchemy
2.x does not extract as a bind param - the leaked :: cast was a syntax
error at runtime, failing tests/isolation/test_sso_account_binding_live.py
in CI. Same CAST(:x AS uuid) pattern already applied to admin_users.py
and rbac.py. docs/openapi.yaml regenerated with scripts/export_openapi.py
so the Check OpenAPI schema gate passes (adds the admin users surface
plus drift accrued since the last regeneration).

* feat(admin-users): permanent delete with self/last-admin guards, audited

DELETE /admin/users/{id}?reason= - hard delete behind three server guards:
self-deletion 409, last active admin 409 (reuses _guard_last_admin),
reason required 422. Sessions end before the row goes; email/username/
roles/provider snapshot rides the audit payload so attribution survives
audit_log.actor_id SET NULL. Migration 094 flips the one RESTRICT edge
(compliance_evidence.collected_by) to SET NULL, matching every other
actor column - audit history keeps surviving user deletion.

Users screen: red Delete button per row, disabled on self, gated by
reason + typed-email confirmation + final confirm. SSO accounts are
re-provisioned viewer by JIT at next login - stated in the dialog.

* docs: cover admin Users administration, delete semantics, SSO landing in API reference and changelog

- roles-and-permissions.md: new Users administration section (screen
  surface, lifecycle endpoint table, audit-safe delete semantics via
  migration 094, JIT re-provisioning note); last-admin door list now
  includes the admin/users role/disable/delete routes; multi-role is no
  longer described as single-primary (the console assigns with
  checkboxes + live effective-permission preview); live verification
  log gains the delete matrix.
- docs/api/API_REFERENCE.md: section 11a — full /api/v1/admin/users
  surface with guard/error semantics; authentication section documents
  the fragment-landing contract and JIT viewer default.
- CHANGELOG: Unreleased entry for the Users admin feature.

* style(api): clear ruff findings on admin_users and rbac

C416/C401/C400 comprehension cleanups and E501 wraps on the lines the
users-admin feature added; two import blocks sorted. No behavior change —
verified by rebuilding the api image, health 200, and three consecutive
golden-pipeline harness runs at 10/10 stages.

* chore(deps): clear security-audit findings across pnpm / python / go

The security-audit PR gate was red on transitive advisories with a
first_patched_version available, and on two pnpm workspaces that could
not even be scanned. All three arms are now clean:

pnpm (root workspace):
  - overrides added: tinypool ^2.1.2 (GHSA-5gmw-xhrv-c9v3,
    GHSA-85c8-ppgw-ccpr — vitest pins ^1.1.1 so a plain `pnpm update`
    could not lift it), compression ^1.8.2 (GHSA-vc2v-76pw-4v95),
    source-map-js ^1.2.2 (GHSA-68fv-2mgg-jv7q, was resolving the 1.2.1
    duplicate).
  - CI pins pnpm 8.15.1 (package.json packageManager); the 8.15.1
    reinstall keeps lockfileVersion 6.0, so the mobile workspace
    (lockfileVersion 6.0) no longer aborts the audit unparseable.

apps/mobile: source-map-js ^1.2.2 override (own lockfile, not covered
  by the root override).

python: services/agents + services/slack-bot poetry locks bumped
  multidict 6.7.1 -> 6.9.1 (GHSA-54p9-h82j-f925 / CVE-2026-104874).

Unfixable carry-forward (recorded in security_audit_ignores.txt, 90-day
expiry, verbatim "no patched release" from OSV): braces CVE-2026-93687
(<=3.0.3, jest tooling), sprintf-js CVE-2026-97058 (<=1.1.3, js-yaml
transitive), node-forge CVE-2026-85393 (<=1.4.0, expo tooling). None
has a first_patched_version today.

Verified: pnpm arm 0 findings (5 ignored) exit 0; python arm 0 findings,
0 coverage errors exit 0; go arm 0 findings exit 0; validate-ignores 8
entries exit 0; web suite 81 files green with the new lockfile.

* style: ruff format the whole tree (CI format check)

* test(rbac): pin migration 092 to rbac_catalog vocabulary

The rbac_catalog module docstring promises tests/test_rbac_catalog_seed.py
pins migration-092's role/permission vocabulary against the runtime catalog;
the test never existed, and the comment-paths gate caught it. Add the real
pin (static, no DB): permission names, system role names, per-role grant
sets and labels must match exactly between 092_rbac_catalog_seed.sql and
app.core.rbac_catalog. Verified 5 passed inside the api image.

* chore(gate): ratchet the users-console writes the tenant-predicate gate cannot see scoped

The fork's admin console (admin_users delete/disable/role-mirror and
rbac.set_primary_role) issues writes keyed on a user id that the same
request already resolved through a tenant-scoped SELECT; the gate scores
each statement in isolation and cannot follow that dataflow, so each gets
a ratchet entry with its reason. The rbac_catalog <module>::alerts hit
is attribution noise — the flagged line is the PERMISSIONS vocabulary
tuple, the module's only executable SQL is bound to :t. MAX_RATCHET
36->40 with the entries; reverse check passes. check_route_tenant_scope
also green.

* fix(deps): lift source-map-js in the cursor-extension install root too

check_toolchain_pins flagged cross-root drift: the root workspace and
apps/mobile now override source-map-js ^1.2.2 (GHSA-68fv-2mgg-jv7q) but
services/mcp/cursor-extension is a separate npm install root still
resolving 1.2.1. Add the same override there and regenerate its
package-lock.json (resolves 1.2.2). check_toolchain_pins: OK.

* style: ruff format the rbac catalog pin test

* fix(deps): bump golang.org/x/sys to v0.44.0 in go modules with vulnerable pins

osquery-extensions pinned x/sys v0.25.0 (CVE-2026-39824, patched in
v0.44.0); enrichment sat at v0.30.0 on the same path. Surgical go get in
each module — ingest was already on v0.47.0 (unaffected; a go get there
churned unrelated otel/prometheus pins, reverted). go build + go vet +
module tests pass in golang:1.26; security_audit.py go: 0 findings.

* style: clear ruff lint on the lint-step scope (services/scripts/tests/tools)

- sort the admin_users import in v1/router.py and the catalog imports in
  the rbac pin test (the CI lint step covers more than the format check
  fixed earlier)
- wrap the ratchet rationale strings the gate still counts verbatim

* fix(api): keep RoleUpdate.name on the wire; clear mypy baseline findings

openapi_diff vs base flagged [property_removed] RoleUpdate.name — a hard
break for every generated SDK client. Rather than ship the break and ask
for the breaking-change-approved label, the field is re-admitted as a
validated no-op: omit it, or send the role current name; an actual rename
is a 400 naming the three places the machine name is mirrored (users.role,
JWT role map, audit resource strings). Immutability is unchanged on the
server; the wire contract is preserved. Spec regenerated, export --check
clean, openapi_diff vs base: 0 changes.

mypy baseline: two stdlib-logger call-arg findings in cases.py folded into
%-style messages (matching the file own convention and check_logger_kwargs),
and a Match|None union-attr in test_alert_investigate_bump.py pinned with an
assert. check_logger_kwargs still OK.

* fix(audit): record the acting credential on every admin/rbac audit event

check_audit_coverage: 15 emit_audit calls in the users-admin and RBAC
surfaces named an actor but not the credential, so the trail could not
distinguish a session from an API key. Each now passes
api_key_prefix=getattr(current_user, 'api_key_prefix', None), the same
attribution pattern tenants.py and llm_credentials.py already use. Gate
RC=0; ruff check/format, check_tenant_query_predicates, check_logger_kwargs
and mypy on both files green.

* test(rbac): pass request stub to direct handler calls; fix bump matrix parser

Three role-authoring tests called create_role/update_role directly without
the request: Request param the endpoints now take for audit attribution,
breaking collection after b678ba1e. Each call site passes a minimal starlette
Request stub (the refused-before-audit path never reads it).

test_alert_investigate_bump's open-statuses regex parsed the literal '{}'
placeholder once cases.py built the guard from _ALERT_OPEN_STATUSES via
.format(); the helper now resolves the pinned tuple from source. Full suite
in CI's locked env: 4357 passed, 0 failed.

* style(test): place the request stub after the import block

febe66f6 inserted the helper mid-imports (E402/F821 on the forward ref).
Same content, relocated; ruff check/format clean, targeted tests 48/48.

---------

Signed-off-by: Alexandru Mateescu <alexandru.mateescu@c8r-tech.com>
Co-authored-by: Alexandru Mateescu <alexandru.mateescu@c8r-tech.com>
Co-authored-by: Alexandru Mateescu <alex.mateescu34@gmail.com>
2026-10-07 14:41:20 +05:30
Beenu Arora cb89a205fd docs: correct Markdown that describes a tree that no longer exists (#1058)
Forty-nine tracked Markdown files, no code. A wrong document is worse than an
absent one, so where a page had a live audience it was corrected rather than
removed; nothing in this change deletes a file.

Every claim below was verified against this checkout before it was rewritten,
and nothing was re-asserted that could not be checked.

Commands that do not exist
  `pnpm aisoc:submit` is the primary documented way to run all five bundled
  example scenarios and is not a script in any package.json. The real command
  is `aisoc submit <file>`, which each fixture's own `_usage` field already
  names. examples/README.md and the five walkthroughs now say so, with the
  `pip install -e packages/aisoc-cli` step that makes it resolvable.

Guidance that would introduce a known defect
  services/connectors/README.md taught contributors a *four*-tier severity
  ladder collapsing into `info | low | medium | high`. The ladder is five
  tiers and 50 connector modules emit `critical`. Its 16-row connector table
  is replaced with a pointer at the generated count (84), which CI gates.

  profiles/auditd/README.md published a severity table contradicting
  `_KEY_SEVERITY_PREFIXES`: `aisoc_critical_*` mapped to `high` and
  `aisoc_priv_esc_*` to `medium`, where the code says `critical` and `high`.
  Ten of its eleven named detection files do not exist; the replacement names
  26 that do (each checked on disk) and states plainly that it is a topical
  index rather than a wiring contract. `~30 rules` was 47.

Routes and paths that 404
  docs/api/API_REFERENCE.md documented ~30 endpoints under `/v1/...` while the
  router mounts `/api/v1`, so every curl in it failed. Each documented path
  was machine-checked against the route table: 16 resolve after the prefix
  repair, and the rest were wrong in a specific way now recorded - blast
  radius and neighbors take path parameters, not query parameters; federated
  search is `/search`, not `/query`; proposals baselines is plural; hunt runs
  and findings are per-hunt; `/hunts/reload`, `/v1/vulnerabilities`,
  `/cases/{id}/attack-path` and four of the five IOC routes never existed.
  Swagger is at `/api/docs`.

  services/enrichment/README.md documented `POST /v1/enrich` and
  `GET /healthz`; the server serves `/enrich`, `/enrich/bulk` and `/health`,
  and reads `REDIS_URL`, not `REDIS_ADDR`. Shodan, URLScan and IPinfo are
  listed as supported and have no client implementation.

  .github/LICENSES.md had every relative link broken: six named
  `tools/detection-import/` with a hyphen against a directory spelled with an
  underscore, two pointed at a `detections/REVIEW.md` that has never existed,
  and four repo-root-style links resolved against `.github/`. It also claimed
  to be updated automatically by a script that does not exist - nothing in the
  tree writes it. .github/CREDITS.md linked `SECURITY.md` into `.github/`.

  Also: `scripts/validate_packs.py` and the `pack_loader` path in
  packs/README.md; `import.py` in tools/detection_import/README.md; six
  terraform modules documented as eleven; `services/alert-fusion` in four
  files, against a directory named `services/fusion`; a `render-demo-reset.yml`
  workflow; a Slack app manifest; `accordion.tsx`, `(marketing)/page.tsx`,
  `og/route.tsx` and `inc-rt-001.mp4`; `walkthrough.md` for `walkthrough.mdx`;
  a `RB-001`..`RB-006` runbook set under a directory that does not exist; and
  a `/ledger/verify` endpoint offered to operators as a synthetic check.

Documents that describe a removed behaviour
  docs/QUICK_INSTALL.md is the front door - `install.sh`, `install.ps1` and
  both preflight scripts cite it - and it documented the `pnpm aisoc:demo`
  handoff that v8.1.1 deliberately removed, promising a browser opening on a
  seeded LockBit case at `/cases/INC-RT-001?tab=ledger` under a
  `demo@example.com` auto-login. The installer runs `make up`, creates an
  administrator, prints the password once, and then runs the golden pipeline.
  The console starts empty, which is the point. The page now says that, and
  records what it used to say and why that was removed.

  docs/community-feedback/2026-05-12/README.md called itself the **active**
  plan on a v12 tree, pointed at a gitignored root `PROGRESS.md`, and told
  contributors that where a May-2026 draft conflicts with `main`, *the draft
  wins*. The three dated artefacts beside it are untouched - they are kept as
  received and the deferral gate excludes them for that reason - but the
  navigational README now says `main` wins.

Stale findings written in the present tense
  docs/audit/REALITY_REPORT.md is a Phase 0 snapshot that is still selectively
  edited, so a reader cannot tell which findings are live. Four are now false
  and are marked closed where they sit: `services/agents/app/privacy/` exists
  (and docs/trust/data-flows.md describes that redactor as shipped, so two
  tracked docs contradicted each other on whether raw PII leaves the estate);
  Qdrant has `tenant_scope_filter()`; `llm_safety.py` is on disk; and
  `.github/LICENSES.md` no longer says Apache-2.0. A header points forward to
  REPOSITORY_REALITY.md.

  docs/roadmap/v8-progress.md named v12.2.0 as current and listed two open
  items that REPOSITORY_REALITY.md had already withdrawn as wrong diagnoses.

Unpublished packages promised against shipped releases
  Seven package READMEs deferred publication to "v8.0" or "v8.1", four and
  more majors ago, which reads as availability rather than as a caveat. All
  now use the present-tense wording `packages/aisoc-lite/README.md` already
  had. `pnpm --filter @aisoc/sdk-ts` matched nothing; the workspace is
  `@aisoc/sdk`. The press kit and two launch drafts offered
  `npx aisoc triage --demo` with no caveat; `aisoc` is unpublished.

Dead infrastructure described in the present tense
  infra/fly/managed/README.md said `infra/fly/` "hosts the public demo at
  tryaisoc.com" while its own sibling opens with measured NXDOMAIN output for
  the reclaimed apps. It now carries the same status banner. No allow-listed
  hostname occurrence was added or removed, so the bidirectional count in
  `check_hosted_hostname.py` still matches.

Other measured corrections
  Go 1.21 against `go.mod` files declaring 1.26; a "~6 GB" memory budget
  against the published 8 GB; demo-producer's "~24 events/sec" against
  `rate x batch x profiles` = 120, and a missing `--token` step without which
  `/v1/ingest` returns 401; two teams-bot env vars marked required that no
  code reads, and a test file named `test_callbacks.py` that is
  `test_callbacks_approver.py`; a connector service documented as having no
  external port while compose publishes 8088; NATS named as part of the spine.

Verification, with the changes staged
  The full gate set runs 80 pass / 8 fail, byte-identical to the same run on
  `main` before these edits; the 8 are environmental (no `mcp` module, no
  code-scanning token, three gates that refuse to run without an argument,
  and the python 3.14-vs-3.11 mypy baseline skew the gate predicts itself).
  An intermediate revision reddened `check_profile_service_counts.py` by
  publishing "16 services" in a file with no CLAIM_SITES entry; that wording
  was withdrawn rather than the gate widened. `pnpm build` in apps/docs
  succeeds. Every relative link in every changed file was resolved against
  the checkout, which found and fixed three more dangling pointers, one of
  them at the gitignored root `PROGRESS.md`. Every external URL added or kept
  returns HTTP 200; `aisoc.cyble.com` appears nowhere in the tree.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>
2026-09-29 14:14:13 -07:00
Beenu AroraandBeenu Arora 925ded26d6 A first run that ends at a login nobody can perform (#809)
* A first run that ends at a login nobody can perform

`make up` worked, `make smoke` passed 8/8, and then login was impossible.
Three independent things had to be wrong at once, and none was visible to a
test: the only account was `admin@aisoc.local`, and `LoginRequest.email` is a
pydantic `EmailStr`, which rejects RFC 6761 special-use domains with a 422
*before* the password is compared; the bcrypt hash migration 001 seeded
matched neither the `changeme` four documentation pages published nor the
`admin` its own inline comment claimed — checked with the service's own
`verify_password`, every candidate returned False; and nothing existed to
create a user with. `make demo` repaired it incidentally by writing a valid
address, so the demo path worked and running AiSOC on your own data did not.

The first administrator now comes from the deployment rather than the
repository. `bootstrap_admin.py` creates `admin@aisoc.internal`, generates a
password and prints it once; nothing writes it to disk. `make up` calls it, so
the documented quick start ends with a credential on screen. It is idempotent
— a second run reports the existing account and changes nothing — which is
what makes calling it from `up` safe. The address is validated with the same
library the login route uses, so an address that cannot sign in is refused
here with an explanation instead of becoming an account that fails at a login
form with a schema error. 001 seeds no user; 059 deactivates the orphan on
databases that already ran it.

The published `aisoc-web:latest` shipped demo mode baked on, and that is the
image `docker-compose.yml` pulls. Next inlines NEXT_PUBLIC_* at build time, so
there was no runtime escape: a self-hoster's console called their real alerts
demo data, disabled every write control, and offered to help them self-host an
install that already was. The demo is now its own build under `demo` /
`vX.Y.Z-demo`; `latest`, `main` and `vX.Y.Z` are the product. Demo credentials
are no longer compiled into a non-demo bundle at all — the Dockerfile defaulted
them and two components declared them as module-level literals, so gating the
render on isDemoMode() hid the panel and left the strings in every chunk.

Smaller first-run defects from the same pass: `make up` and four other files
still printed the `/docs` URL the README had been corrected away from;
the quick start never said to create `.env`; `make doctor` read `docker
compose ps -q`, which lists containers in any state, so a Postgres that exited
*because* the port was taken was reported as holding it; `make up` met port
conflicts with no explanation and now runs the check first; both compose files
recommended an override that Compose *appends*, leaving the conflicting
binding in place; and the connector fleet badge read "All sources reporting"
over zero connectors.

Verified on a live stack, not only in tests: a foreign process held 5432 and
the new preflight named the container holding it; 059 deactivated a real
orphaned row on an already-migrated database; `make bootstrap` printed a
password that returned HTTP 200 from `/auth/login` and read the
golden-pipeline alert back through the API and the console. `golden-pipeline.yml`
now runs the same two steps, so the quick start's last step is covered by the
job that covers its first.

Each fix ships a test that fails against the code it replaces.

* Do not echo a password the operator supplied

The generated one is printed because it exists nowhere else — that single
line is why it is never written to disk. A password supplied through
AISOC_ADMIN_PASSWORD or --password-stdin is already in the operator's hands,
so echoing it only puts a secret into scrollback and any CI log.

* Record why the password disclosure is an accepted risk

CodeQL flags the generated-password line and is right that it discloses a
secret. Dismissed rather than suppressed, with the reasoning next to the code
instead of only in the alert: without that line nobody can sign in, which is
the defect this script exists to fix.

* Drop the fleet-badge entry; that fix landed separately

The same defect was fixed in #810, which hides the badge entirely rather than
relabelling it — better, because the empty state directly below already says
no connectors are configured. Keeping a second entry would claim work this
branch no longer carries.

---------

Co-authored-by: Beenu Arora <beenu@MacBook-Pro-3.local>
2026-09-24 01:33:23 -07:00
Beenu Arora 9e1287539e docs: update documentation for 2026 H2 capabilities
Update README, Docusaurus docs, and API reference to reflect newly
implemented features: Detection-as-Code (DAC), Hunt-as-Code, federated
search, entity risk / RBA, alert confidence scoring, detection drift
monitoring, ChatOps verification, AI-vs-AI adversary eval, and community
benchmark scoreboard.

Files updated:
- README.md — capabilities list, highlights table, service table, monorepo
  layout, API reference table, contributing section
- apps/docs/docs/concepts/capabilities.md — four new capability groups
- apps/docs/docs/intro.md — expanded feature bullets
- apps/docs/docs/architecture.md — service responsibilities, directory
  layout, connectors + demo-producer entries
- apps/docs/docs/api/rest.md — DAC, federated search, hunt-as-code,
  entity risk, and drift endpoint groups
- apps/docs/docs/benchmark.md — AI-vs-AI adversary eval suite and
  community benchmark scoreboard sections
- docs/api/API_REFERENCE.md — four new sections, renumbered 1-14, updated
  service table
2026-05-07 12:00:27 -07:00
Beenu Arora 790f573ee4 fix: replace hallucinated aisoc.dev domain with real emails/domains
- Update all pyproject.toml authors to Beenu Arora <beenu@cyble.com>
- Replace aisoc.dev with example.com in synthetic data, tests, docs,
  demo code, CI config, and frontend components
- Update project URLs in pyproject.toml to github.com/beenuar/AiSOC

The aisoc.dev domain does not exist and was incorrectly generated.
2026-05-07 11:25:43 -07:00
Beenu Arora 2a4d1d726e feat(v2): enterprise platform — knowledge graph, rule engine, ML fusion, threat intel
Knowledge graph (Neo4j)
- Add Neo4j to docker-compose and bootstrap singleton AsyncDriver
- Implement graph_service: attack-path, blast-radius, neighbors, MITRE coverage
- New /v1/graph endpoints used by SOC console + action gating

Detection rule engine
- Multi-language rule executor: Sigma (pySigma), YARA, KQL, Lucene, Regex
- /v1/rules CRUD + /v1/rules/{id}/execute + /v1/rules/hunt
- Rule lifecycle persisted in Postgres detection_rules table

MITRE ATT&CK integration
- Full STIX 2.1 corpus loader in Go (services/ingest/internal/attck) and
  Python (services/agents/app/tools/mitre_full.py)
- Optional Qdrant embedding for semantic RAG inside agents
- ATT&CK technique tagger wired into the Go ingest pipeline

Threat intel service (services/threatintel)
- New FastAPI service polling TAXII 2.1, MISP, OTX, CISA KEV
- STIX 2.1 parser, Redis Bloom filter dedup
- Triple-sink: OpenSearch (search), Qdrant (semantic), Neo4j (actor↔TTP graph)
- APScheduler-driven feed loop with /v1/iocs and /v1/feeds APIs

Ingest enrichment
- Shodan enrichment + CISA KEV correlation in Go ingest
- Emits vulnerability.matches Kafka topic for KEV-listed CVEs

ML-augmented fusion
- Isolation Forest anomaly score (auto-trained at ≥50 samples)
- LightGBM LambdaRank priority score with analyst feedback loop
- /ml/status, /ml/feedback, /ml/retrain endpoints
- Heuristic fallback so scoring works before models are trained

Infra fixes
- Reconcile fusion (8003), threatintel (8005), connectors (8006) ports across
  Dockerfiles, docker-compose, and README
- Move connectors behind --profile connectors; threatintel runs by default
- Fix Neo4j credentials documented in README

Documentation
- Refreshed README.md (services, ports, run instructions, doc links)
- New docs/architecture/SYSTEM_DESIGN.md
- New docs/api/API_REFERENCE.md
- New docs/runbooks/LOCAL_DEVELOPMENT.md
- Updated PROGRESS.md with v2 roadmap completion
2026-05-01 23:58:11 -07:00