Commit Graph

51 Commits

Author SHA1 Message Date
Sacha Al Himdani
4c57d201a4 Make license declarations consistently MIT
The source headers, LICENSE files, and license metadata had drifted
apart. Align the entire project to MIT:

- Convert every source-file header to the MIT text across all comment
  styles (Go, TS, TSX, JS, MJS, SQL, CSS, GraphQL, shell), including
  SPDX-License-Identifier tags
- Set the root and cookie-banner LICENSE files to the MIT text with a
  "MIT License" title line
- Switch the package.json license fields, Docker image label, and
  cookie-banner README to MIT
- Update docs and the genmodels header generator accordingly
- Normalize copyright lines to a single format
  (Copyright (c) <year(s)> Probo Inc <hello@probo.com>.): unify the
  hello@getprobo.com and hello@probo.inc emails to hello@probo.com and
  the comma-separated years to a hyphenated range

Genuine third-party references are intentionally left untouched: the
Lucide icon attributions (Lucide is ISC) and the trivy dependency
license allowlist.

Signed-off-by: Sacha Al Himdani <sacha@probo.com>
2026-07-13 16:21:14 +02:00
Bryan Frimin
771edcc4fd Harden LoadByIDs func
Signed-off-by: Bryan Frimin <bryan@probo.com>
2026-07-03 10:11:50 +02:00
Sacha Al Himdani
9ab8ea2085 Refacto load all functions
Unbounded LoadAll* loaders materialised an entire result set in one
query with no ceiling. A table that is small in development can grow
without bound in production, so these loaders were a latent memory
and query-time hazard.

Remove the LoadAll* methods from pkg/coredata and walk the cursor-
paginated LoadBy* siblings instead through a shared page.LoadAll
helper. The helper advances a MaxCursorSize forward cursor until the
result set is exhausted and concatenates the pages. It caps a single
call at MaxLoadAllPages (20) batches of 500 rows and errors past that
rather than materialising an unbounded set, so a runaway caller fails
loudly instead of exhausting memory.

Callers that genuinely need every row now express that explicitly,
and the coredata load-naming rule and docs are updated to discourage
new unbounded loaders.

Signed-off-by: Sacha Al Himdani <sacha@probo.com>
2026-06-16 14:35:16 +02:00
Sacha Al Himdani
9ac71f948f Update contact email to hello@probo.com
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-06-09 16:45:23 +02:00
Bryan Frimin
bd04f1812a Style
Signed-off-by: Bryan Frimin <bryan@probo.com>
2026-05-23 14:07:37 -07:00
Bryan Frimin
b39d880c0f Switch AuthorizationAttributes to batch and add AuthorizeBatch
Change AuthorizationAttributer.AuthorizationAttributes to take a slice
of resource ids and return policy.AttributesByID, so a single SQL
round-trip can load condition attributes for a whole batch. All
coredata implementations are migrated to a single
`WHERE id = ANY(@resource_ids::text[])` query that returns only the
rows it finds.

Authorizer gains:
  - AuthorizeBatch — all-or-nothing across a homogeneous (same entity
    type, same organization) resource set; rejects mixed entity types,
    mixed organizations, and empty batches with structured errors.
  - AuthorizeMulti — heterogeneous evaluation that returns one error
    per item and writes audit log entries in a single bulk insert.

The single-resource Authorize is rewired to delegate to AuthorizeBatch
so all paths share the same condition evaluation and audit logging.
recordAuditLog is split into buildAuditLogEntry plus a batch insert.

Tests cover the new batch and multi paths, mixed/empty/unsupported
resource cases, audit log batching, and dry-run behaviour.

Signed-off-by: Bryan Frimin <bryan@probo.com>
2026-05-23 13:31:36 -07:00
Émile Ré
9156d6a16a Add wsl linter and fix
Signed-off-by: Émile Ré <emile@probo.com>
2026-05-20 09:27:28 +04:00
Sacha Al Himdani
3ff66757ad Remove deprecated snapshot system
The register/document model has fully replaced the snapshot system.
Delete every snapshot-scoped row and strip the application code that
referenced them: SnapshotID/SourceID struct fields, snapshot_id IS NULL
filters, snapshot columns from SELECT/INSERT statements and named args,
and the eight migrate-*-snapshots-to-documents one-shot tools.

The remaining snapshot_id / source_id columns, the snapshots and
controls_snapshots tables, the snapshots_type enum, and the
snapshot-scoped indexes are now unused; they are dropped in a follow-up
schema migration so this change can roll back cleanly without leaving
orphaned data.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-05-15 23:26:02 +02:00
Sacha Al Himdani
553901e4ad Add risk publish to document system
Replace the old snapshot-based system for risks with the publish
document system, mirroring the prior vendor / processing activity / DPIA
/ TIA migration. Includes the GraphQL mutation, MCP tool, CLI command,
n8n operation, frontend publish dialog, e2e tests, and a prosemirror
register template covering name, description, category, treatment,
owner, inherent and residual scoring, and notes.

The risk register lives as a generated DocumentTypeRegister document on
the organization, reused across publishes (the major version bumps on
every republish). Approvers can be passed in to create a draft pending
approval; otherwise the version is published immediately. The frontend
Risks page exposes a Publish button and a Document link button when the
document exists, and pre-fills the previous default approvers.

Risks was the last remaining snapshot type, so this commit also removes
the entire snapshot system: drop snapshotId from the Risk GraphQL type
and RiskFilter; remove RiskSnapshotter, Risks.Snapshot,
InsertRiskSnapshots, and the SnapshotID/SourceID fields on Risk; delete
Snapshot, ControlSnapshot, SnapshotsType, SnapshotOrderField,
Snapshottable, the SnapshotService, the Snapshot console resolvers and
GraphQL schema, the Snapshot MCP types and operations
(list/get/take/listControlSnapshots), the snapshot CLI (prb snapshot),
the snapshot frontend pages, routes, banner, LinkedSnapshotsCard,
SnapshotGraph, snapshot helpers, and the snapshot n8n resource and
control link/unlink snapshot operations. The snapshot_id columns remain
in the database but are now filtered out with snapshot_id IS NULL.

Add Get/Upsert/Clear GeneratedDocumentID methods on Risk backed by a new
risks_document_id column on generated_documents, matching the
ProcessingActivity/Finding/Vendor pattern. The migration command
migrate-risk-snapshots-to-documents uses raw SQL queries instead of the
Go snapshot types, since those are gone.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-05-04 14:13:42 +02:00
Sacha Al Himdani
808fdffc9b Return computed risk scores after update
Add inherentRiskScore and residualRiskScore to the mutation fragment so
the Relay store gets updated scores. On the backend, use RETURNING to
get the recomputed values from the database generated columns.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-14 18:09:01 +02:00
Bryan Frimin
f17fb7bf49 Upgrade to kit v0.3.0
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-03 11:56:06 +02:00
Bryan Frimin
e74c0a11c6 Update copyright headers to 2025-2026 for modified files
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-25 15:19:47 +01:00
Bryan Frimin
d24712344e Add GraphQL dataloaders for batched record lookups
Introduce dataloadgen-based dataloaders to batch individual
record-by-ID fetches in GraphQL resolvers into single SQL
queries. Each entity type (organization, framework, control,
vendor, document, risk, measure, task, file, report, profile)
gets a LoadByIDs method in coredata and a GetByIDs service
method with variadic arguments and dedicated collection return
types. Resolvers now use dataloader.FromContext instead of
direct service calls for single-record lookups.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-03-25 15:19:46 +01:00
Émile Ré
29371662e2 Fix referenced columns used in certain SQL queries + minor front fixes
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:13 +04:00
Émile Ré
d7e1703ff3 Fix coredata SQL queries using new FKs columms
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:10 +04:00
Émile Ré
e156a428d4 Stop using coredata.People except for people service and people page resolvers
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:09 +04:00
Bryan Frimin
4013b00841 Refactor policies document
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-01-17 11:37:39 -08:00
Bryan Frimin
74fc3b8cd1 Rewrite identity and access management
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-01-17 10:07:34 -08:00
Sacha Al Himdani
288c59a5f2 Make descriptions nullable
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-11-05 17:58:50 +01:00
Bryan Frimin
59aa332ab5 Move to vanity import url
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-10-31 17:01:52 +01:00
Sacha Al Himdani
9a33f7b771 Manage errors
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-10-31 15:14:56 +01:00
Sacha Al Himdani
72a581b66b Order risks by owner name
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-09-18 17:51:03 +02:00
Sacha Al Himdani
16ced9638d Add risk snapshots
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-09-03 15:11:22 +02:00
Bryan Frimin
23b54e7517 Fix SQL errors
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-08-10 18:26:02 +04:00
Bryan Frimin
f4f7326ffd Fix SQL query
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-08-10 16:34:38 +04:00
Bryan Frimin
afa5a822aa Refactor SOA generation
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-07-18 16:24:47 +02:00
Bryan Frimin
c791544f34 Fix count measure sql query
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-13 13:23:46 -07:00
Sacha Al Himdani
069ff4aa9a Fix search queries
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-10 10:45:16 -07:00
Bryan Frimin
c4e6de922c Add risks totalCount support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-06-09 20:58:49 -07:00
Sacha Al Himdani
a9a5f9cf49 Add fulltext search on risks, documents, and measures
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-09 15:11:36 -07:00
Bryan Frimin
98510cb7c4 Fix inherent risk score graphql error
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-06-01 11:18:52 -07:00
Bryan Frimin
b43e61e3b9 Improve data isolation for risks
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-05-23 10:33:57 -07:00
Bryan Frimin
c646808828 Add risk sort keys
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-05-22 16:16:06 -07:00
Bryan Frimin
62a0fb96b7 Use generated column for risk score
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-05-22 16:13:19 -07:00
Bryan Frimin
9c5828b525 Rename severity to score
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-05-22 16:07:40 -07:00
Bryan Frimin
046c42eb48 Add tasks page
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-05-05 22:34:04 -07:00
Bryan Frimin
1cac29f8ef Fix typo on measure
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-30 14:07:14 -07:00
Bryan Frimin
f5a76435f3 Fix measure risks 5xx
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-27 21:09:10 -07:00
Bryan Frimin
cece072619 Add note to risk
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-24 17:47:39 -07:00
Antoine Bouchardy
b137ec6bdf Add categories on risk
Signed-off-by: Antoine Bouchardy <antoine@getprobo.com>
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 20:04:09 -07:00
gearnode
a90de1fdde Update risk matrix
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-15 11:16:24 -07:00
gearnode
3711bb4bbb Rename mitigation into mesure
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-12 21:09:49 -07:00
gearnode
8bbb4f59f1 Add risk ownership
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-12 11:18:20 -07:00
gearnode
e3c7194afc Add risk treatment
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-12 10:39:05 -07:00
gearnode
16efab774a Refactor risk management
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-12 00:18:31 -07:00
gearnode
543958175b Add risk list to mitigations
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-01 10:19:01 +02:00
gearnode
747ed7ec9b Fix missing tenant_id
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-01 10:14:00 +02:00
gearnode
34ed32f6a4 Fix load risk error
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-01 08:09:11 +02:00
gearnode
0ec0c7d6c3 Add mapping between risk and mitigation
Signed-off-by: gearnode <bryan@frimin.fr>
2025-04-01 07:39:29 +02:00
gearnode
7d38882e1f Add risk proba and impact
Signed-off-by: gearnode <bryan@frimin.fr>
2025-03-31 09:49:35 +02:00