Commit Graph

1578 Commits

Author SHA1 Message Date
Sacha Al Himdani
ff8da296e6 Fix MCP snapshot issues for SOA and vendors
- Fix SnapshotsType enum: STATES_OF_APPLICABILITY → STATEMENTS_OF_APPLICABILITY
- Add snapshot filter to ListStatementsOfApplicability MCP tool
- Add missing organization_id to vendor contacts and compliance reports snapshot inserts

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-10 19:20:00 +02:00
Sacha Al Himdani
eb6c06e683 Move document search_vector from documents to document_versions
Now that title lives on document_versions, the full-text search vector
belongs there too. Drop the generated column and GIN index from
documents, recreate them on document_versions, and update the document
filter to query the latest version's search_vector.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 20:01:32 +02:00
Sacha Al Himdani
221afd8b8d Drop dead description column from documents
The description field on Document and EmployeeDocument was never
populated. Remove it from the database, GraphQL schema, and Go types.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 20:01:32 +02:00
Sacha Al Himdani
b63f043849 Move document title ownership from document to version
Title is now owned by document_versions, following the same pattern as
classification and document_type. The documents.title column is made
nullable with a TODO to drop it. Backend loads title from a
latest_versions CTE for ordering purposes only. The frontend resolves
title from the latest version, and DocumentTitleForm now operates on
DocumentVersion using UpdateDocumentVersion mutation.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 20:01:32 +02:00
Sacha Al Himdani
d519361786 Allow authenticated users to query signUpEnabled
The signUpEnabled field used @session(required: NONE) which rejects
authenticated users. Change it to OPTIONAL so the query works regardless
of authentication state, fixing a crash on the sign-up page for
already-logged-in users.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 19:27:10 +02:00
Sacha Al Himdani
76f6c8f9d1 Show registration unavailable page when signup is disabled
Instead of showing the signup form and returning an internal error on
submit, the SignUpPage now queries signUpEnabled upfront and displays a
friendly message explaining that registration is not available, with a
link back to login.

Adds a signUpEnabled GraphQL query field on the connect/v1 API and
handles ErrSignupDisabled as a FORBIDDEN error in the SignUp resolver.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 18:28:59 +02:00
Sacha Al Himdani
ab5f42ad74 Redesign document approval flow
Replace the per-approver add/remove model with a quorum-based approval
system. Documents now have default approvers that are pre-populated when
requesting approval, and the publish dialog lets users adjust the list
before submitting.

Key changes:

- Add PENDING_APPROVAL document version status with dedicated transitions
- Introduce approval quorums with request/approve/reject/void lifecycle
- Add default approvers per document (stored in document_default_approvers)
  with MERGE-based upsert for efficient sync
- Add NoDuplicates validator for slice fields
- Split ALTER TYPE ADD VALUE migrations into separate files (required by
  PostgreSQL when run inside transactions)
- Use VOIDED consistently for both quorum status and decision state enums
- Expose void/approve/reject through GraphQL and MCP, with e2e tests
- Add approval management UI: publish dialog with approver selection,
  approval list with void support, and external approve/reject page

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 18:18:30 +02:00
Sacha Al Himdani
5fd580e995 Rename State of Applicability to Statement of Applicability
Rename the entity across the full stack: database table
(states_of_applicability → statements_of_applicability), Go model,
GraphQL types, MCP specification, CLI commands, frontend components,
routes, and display labels. Includes a migration to rename the table
and its foreign key column.

Widen sidebar from 260px to 280px to fit the longer label.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 13:06:06 +02:00
Émile Ré
050073ab3c Fix TextLength to count characters instead of bytes
Use utf8.RuneCountInString so multi-byte characters like é count as one
character. Add a unicode test case to cover this.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-09 14:47:48 +04:00
Émile Ré
7cd4606278 Validate document content length by extracted text, not JSON size
Add Node.TextLength() to walk the ProseMirror tree and sum actual user
text. Introduce ProseMirrorDocumentMaxTextLength validator that enforces
a 50k character limit on extracted text, paired with a 500k byte safety
cap on the raw JSON string. Extend e2e tests for content length.

Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-09 14:47:48 +04:00
Bryan Frimin
303455ded6 Move framework_id into filter in ListControlsInput spec
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-09 12:41:08 +02:00
Bryan Frimin
b005b92c77 Fix famework_id filer not working
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-09 12:37:26 +02:00
Sacha Al Himdani
643cf4661a Fix MCP updateRisk not forwarding note field
The MCP UpdateRiskTool resolver was not passing the Note field
to the UpdateRiskRequest, causing note updates via MCP to be
silently ignored. The GraphQL resolver already forwarded it
correctly.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-08 16:43:35 +02:00
Aurélien Sibiril
22ccfaa30f Replace Organization.googleWorkspaceOAuth2Scopes with SCIMBridgeTypeInfo
A Google-Workspace-specific field on the generic Organization type
was future-hostile: each new SCIM bridge type would need its own
top-level field. Replace with a generic SCIMBridgeTypeInfo type
queried through Organization.scimBridgeTypes, parallel to the
ConnectorProviderInfo pattern in console/v1.

ConnectorList looks up the Google Workspace entry from the list
and passes its scopes to GoogleWorkspaceConnector as before.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
ec42409219 Expose oauth2Scopes on Connector instead of AccessSource
The AccessSource.oauth2Scopes field duplicated knowledge that
naturally belongs on the Connector object that AccessSource
already exposes via its connector field. Move it to Connector so
every type that holds a connector (AccessSource, SCIMBridge, etc.)
can reach the scopes through the connector relationship.

AccessSourceRow now queries accessSource.connector { oauth2Scopes }
in its reconnect flow.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
53d6ab09cb Fully expand r.Get call for connectors/complete handler
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
247cae14fa Expose OAuth2 scopes via GraphQL fields
Add per-context fields so the frontend can read scopes from the
type that owns each connection:

- ConnectorProviderInfo.oauth2Scopes: access review providers
- AccessSource.oauth2Scopes: access review reconnect flow
- Organization.slackOAuth2Scopes (console): compliance page Slack
- Organization.googleWorkspaceOAuth2Scopes (connect): SCIM bridge

Resolvers delegate to the constants declared in each owning Go
module. The Google Workspace field lives on Organization, not on
SCIMConfiguration, so the Connect button can read it before any
SCIM configuration exists.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
56c042b7ed Add OAuth2 scope sources for access review, slack, googleworkspace
Each module that initiates an OAuth2 flow now declares its scopes
in its own package instead of duplicating them in the frontend or
in shared connector config:

- pkg/accessreview/drivers: per-provider scopes for the access
  review drivers
- pkg/slack: scopes for the compliance page integration
- pkg/iam/scim/bridge/provider/googleworkspace: scopes for the
  SCIM provisioning bridge

These constants are surfaced to the frontend via GraphQL fields
so the frontend never hardcodes scope strings.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
e006f335b2 Pass OAuth2 scopes to connector at initiate time
Add an InitiateOptions struct to the Connector interface so each
caller can declare the scopes it needs instead of having them baked
into the connector at registration. The HTTP handler reads repeated
?scope= query parameters from /connectors/initiate and forwards them.

Also restore GOOGLE_WORKSPACE and LINEAR provider definitions which
were silently dropped from the bootstrap config refactor.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
4cc0e31214 Preserve continuation URL on OAuth2 error redirect
Use the ContinueURL from the state token so the user is redirected
back to where they initiated the flow instead of the root URL.
The redirect is safe because safeRedirect validates the host.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
47fc9df716 Handle OAuth2 error responses in connector callback
When a provider returns an error (e.g. user denies consent), the
callback now logs the error with provider name and redirects to
the base URL with error and error_description query parameters
instead of falling through to the code exchange.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
b2d5f49bef Extract connector complete handler from NewMux
Reduce closure size in NewMux by extracting the /connectors/complete
handler into a dedicated handleConnectorComplete function. Cache
r.URL.Query() into a local variable to avoid repeated parsing.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
9fc0cd577b Update bootstrap tests for simplified connector config
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
f9ecfcc63e Remove redundant OAuth2 fields from bootstrap builder
Drop RedirectURI, AuthURL, TokenURL, Scopes, ExtraAuthParams, and
TokenEndpointAuth from all connector config blocks. Remove
REDIRECT_URI from env var validation. Fix error wrapping in SAML
credential helpers.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
a4c15c6fb6 Wire provider defaults at connector registration time
Compute the OAuth2 redirect URI from the base URL using the
CallbackPath constant and apply provider defaults before
registering each connector.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
152713b7e0 Reduce ConnectorConfigOAuth2 to ClientID and ClientSecret
All other OAuth2 properties (redirect URI, auth URL, token URL,
scopes, extra params, token endpoint auth) now come from the
connector package provider definitions at wiring time.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
f3db9d186b Simplify ConnectorRegistry to pure store
Remove provider-default mutation from Register; defaults are now
applied via ApplyProviderDefaults before registration. Rename
receiver from cr to r. Fix error messages to follow the cannot
convention. Wrap providerProbeURLs in var () block.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Aurélien Sibiril
f7085f98be Add OAuth2 provider definitions to connector package
Centralise static OAuth2 properties (auth URL, token URL, scopes,
extra params, token endpoint auth) per provider in a single map.
This removes the need to duplicate these values in deployment
config; only ClientID and ClientSecret remain configurable.

Introduces ApplyProviderDefaults to set redirect URI and provider
defaults onto an OAuth2Connector at wiring time.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-08 11:05:12 +02:00
Sacha Al Himdani
96cfbe19d8 Bump Go from 1.26.1 to 1.26.2
Address security vulnerabilities fixed in Go 1.26.2.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-08 09:43:13 +02:00
Sacha Al Himdani
32a97c22cf Set organization ID in MCP task response
The NewTask type helper was not copying OrganizationID from the
coredata Task, causing it to serialize as a zero-value GID.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-07 19:08:28 +02:00
Sacha Al Himdani
e56c3360c5 Fix mcp task creation priority
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-07 18:55:11 +02:00
Émile Ré
ad326224b3 Fix inline code rendering and error handling consistence
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 16:01:51 +04:00
Émile Ré
23eaa4ce24 Fix lint
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 15:35:58 +04:00
Émile Ré
f7e41c7f24 Update mcp types.newDocumentVersion signature - panic from body
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 15:22:39 +04:00
Émile Ré
6d2e9dbe19 Update MCP to handle markdown for all document content tools + fix converter edge case for code fence closing
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 15:13:39 +04:00
Émile Ré
24a9459fb9 Move tests to dedicated file for html converter
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 15:13:39 +04:00
Émile Ré
5280898eb9 Implement prosemirror markdown renderer
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 15:13:38 +04:00
Émile Ré
ab33285c9c Rename files for clarity
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-06 15:13:38 +04:00
Sacha Al Himdani
ef2e99d86c Add measure-document linking
Introduce the ability to link measures to documents, following the
existing pattern used by controls and risks. This includes:

- Database migration for measures_documents join table
- Coredata MeasureDocument struct with insert/delete operations
- Document service methods for listing/counting by measure ID
- Measure service CreateDocumentMapping/DeleteDocumentMapping methods
- Cleanup of measure-document mappings on document archive
- GraphQL mutations, inputs, payloads, and Measure.documents field
- DocumentConnection.TotalCount support for measure resolver
- MCP linkMeasure/unlinkMeasure updated to support documents
- MCP listMeasureDocuments tool
- Frontend MeasureDocumentsTab with LinkedDocumentsCard integration
- Authorization actions for measure document mapping
- E2e tests for measure document mapping

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 17:51:31 +02:00
Sacha Al Himdani
8de7add203 Exclude approved-without-signature documents from employee approvals
Filter out approval decisions where state is APPROVED but
electronic_signature_id is NULL, removing historical approved
entries that lack an electronic signature from the employee
approvals page.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 17:38:28 +02:00
Sacha Al Himdani
2b377a22e7 Sort employee signatures and approvals by most recently updated
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 17:38:28 +02:00
Sacha Al Himdani
b610a19b84 Remove no-changes guard from document version publish
Allow publishing a document version even when the content and title
are identical to the current published version.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 17:27:15 +02:00
Bryan Frimin
7bee5f27d2 Fix SCIM sync
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-03 17:21:08 +02:00
Émile Ré
11a96633ec No need for saferedirect on known connectors
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-03 18:53:02 +04:00
Bryan Frimin
050154ab6a Refactor LLM config into top-level settings
Replace the monolithic agents config with a cleaner structure:
- llm: holds provider credentials and default model settings
- probo-agent: LLM overrides for the probo agent
- evidence-describer: worker config (interval, stale-after,
  max-concurrency) alongside LLM overrides

This makes worker tuning configurable via YAML and env vars
instead of being hardcoded in Go, and separates provider
credentials from per-consumer model settings.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-03 14:06:30 +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
Sacha Al Himdani
8adf26ad20 Add in-progress state to tasks
Introduce IN_PROGRESS as a new task state between TODO and DONE across
the full stack: database enum, Go backend, GraphQL, MCP, and frontend.

The task state icon now cycles forward on click (TODO → IN_PROGRESS →
DONE → TODO), and the action dropdown provides explicit "Move to"
options for any state transition. The "All" tab supports drag-and-drop
between state sections to change a task's state.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 08:33:37 +02:00
Émile Ré
6600f415b7 Allow logo to take doc width
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-04-02 18:44:54 +04:00
Sacha Al Himdani
9a418a7711 Move document type from document to document version
Follow the same pattern used for classification: document type now lives
exclusively on DocumentVersion. A migration copies existing values from
documents to their versions. The document filter uses a subquery on the
latest version. All three API surfaces (GraphQL, MCP, CLI), resolvers,
frontend, and e2e tests are updated accordingly.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-02 16:32:38 +02:00
Aurélien Sibiril
ff20b383d9 Add access review dependencies and enum tests
Add go-vcr dependency, dev config for new providers,
connector service changes for access review, connect
schema updates, and unit tests for enum Scan/Value.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-02 14:49:13 +02:00