Verify Crisp website ownership before connecting

Crisp is a managed (Model B) connector: Probo holds one plugin token
server-side and each connection carries only a Website ID. Nothing
stops one organization from entering another organization's Website
ID, so prove control of the website before creating the connection.

Probo derives a per-(organization, website) verification code as an
HMAC over the token secret and exposes it through a new
crispVerificationCode query. The customer pastes it into the Probo
plugin's per-website settings; at connect time the resolver reads the
setting back through the managed plugin token and requires a
constant-time match before any row is written. The managed key and
plugin ID come from bootstrap, so the connector stays hidden until the
deployment configures them.

The settings fetch is injected so the create-time gate's branch wiring
is unit-tested (mismatch and not-subscribed reject, internal errors
stay generic, a matching code passes), and the managed-versus-client
key resolution is covered too.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-07-11 16:50:32 +02:00
parent 6435a52f47
commit 37121e7bac
24 changed files with 1294 additions and 18 deletions

View File

@@ -513,6 +513,32 @@ func (b *Builder) Build() (*probodconfig.FullConfig, error) {
)
}
// Crisp is a ManagedAPIKey (Model B) connector: Probo holds one
// Marketplace plugin token (the verbatim "identifier:key" pair) shared
// across all customer connections, and each connection carries only a
// Website ID. The plugin ID is a separate value (the token's Basic
// identifier is not the plugin ID) required by the per-website plugin API
// that verifies website ownership at connect time. Both must be set to
// activate the connector; until then it stays hidden from the driver
// catalog, so it ships deactivated and activates the moment Crisp
// validates the production plugin and both values are configured.
crispPluginToken := b.resolver.getEnv("PROBOD_CONNECTOR_CRISP_PLUGIN_TOKEN")
crispPluginID := b.resolver.getEnv("PROBOD_CONNECTOR_CRISP_PLUGIN_ID")
if crispPluginToken != "" && crispPluginID != "" {
cfg.Probod.Connectors = append(
cfg.Probod.Connectors,
probodconfig.ConnectorConfig{
Provider: "CRISP",
Protocol: "api_key",
RawConfig: probodconfig.ConnectorConfigAPIKey{
APIKey: crispPluginToken,
ResourceID: crispPluginID,
},
},
)
}
if b.resolver.Err() != nil {
return nil, b.resolver.Err()
}