Add four API-key access-review connectors

Add Pylon, OpenRouter, incident.io and Brevo as access-review connectors.
All are API-key, single-tenant providers (Pattern 3): the key identifies
one tenant, so there is no OAuth flow, picker UI, or bootstrap/helm
configuration.

- Pylon: Bearer token, GET /users; resolves each user's opaque role_id to
  a role name via GET /user-roles, with cursor pagination.
- OpenRouter: Bearer management key, GET /api/v1/organization/members. The
  endpoint requires an organization account -- a personal key authenticates
  but returns 404 -- so the connection probe rejects 404 on top of 401/403
  (doProbeRequest gained an opt-in extra-reject set) to surface a non-org
  key at connect time instead of mid-campaign.
- incident.io: Bearer token, GET /v2/users. Its OAuth is outbound-only, so
  the API key is the inbound path; live base_role/custom_roles take
  precedence over the deprecated role enum.
- Brevo: API key in the api-key header (Registration.APIKeyHeader), GET
  /v3/organization/invited/users. A live recording corrected the documented
  schema: is_owner is a JSON boolean (not a string) and an id field is
  present, so it is used as the stable ExternalID.

The OpenRouter and Brevo cassettes are anonymized live recordings; Pylon
and incident.io use hand-authored fixtures (no self-serve test tenant). The
shared three-valued active-status mapping is consolidated into
activeFromStatus in driver.go.

Each adds the enum value, migration, GraphQL binding, provider
Registration, a driver with a cassette-driven test, and a brand logo.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-06-24 14:29:54 +02:00
parent f5f9842df5
commit a0d3806c21
34 changed files with 1922 additions and 15 deletions

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package provider
import (
"context"
"net/http"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/accessreview/drivers"
"go.probo.inc/probo/pkg/coredata"
)
func brevoRegistration() *Registration {
return &Registration{
Provider: coredata.ConnectorProviderBrevo,
DisplayName: "Brevo",
SupportsAPIKey: true,
// Brevo authenticates with an API key sent in the api-key header
// rather than Authorization: Bearer. APIKeyHeader makes the
// APIKeyConnection send api-key instead and omit Authorization. There
// is no OAuth2 flow needed: the key is bound to one Brevo account, so
// there is nothing to pick (Pattern 3): no settings struct, no
// picker.
APIKeyHeader: "api-key",
// ProbeURL lets the connection-status check confirm the key with a
// lightweight GET; the transport attaches the api-key header and a
// dead key returns 401/403.
ProbeURL: "https://api.brevo.com/v3/organization/invited/users",
//
// No NewNameResolver: the invited-users endpoint carries no account
// name, so the source keeps its generic name.
NewDriver: func(_ context.Context, c *http.Client, _ *coredata.Connector, _ *log.Logger) (drivers.Driver, error) {
return drivers.NewBrevoDriver(c), nil
},
}
}

View File

@@ -27,6 +27,7 @@ func NewBuiltinRegistry() *Registry {
asanaRegistration(),
betterStackRegistration(),
bitbucketRegistration(),
brevoRegistration(),
brexRegistration(),
clerkRegistration(),
clickhouseRegistration(),
@@ -42,6 +43,7 @@ func NewBuiltinRegistry() *Registry {
googleWorkspaceRegistration(),
herokuRegistration(),
hubspotRegistration(),
incidentioRegistration(),
intercomRegistration(),
langfuseRegistration(),
linearRegistration(),
@@ -55,8 +57,10 @@ func NewBuiltinRegistry() *Registry {
oktaRegistration(),
onePasswordRegistration(),
openaiRegistration(),
openrouterRegistration(),
posthogRegistration(),
pagerdutyRegistration(),
pylonRegistration(),
qoveryRegistration(),
renderRegistration(),
resendRegistration(),

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package provider
import (
"context"
"net/http"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/accessreview/drivers"
"go.probo.inc/probo/pkg/coredata"
)
func incidentioRegistration() *Registration {
return &Registration{
Provider: coredata.ConnectorProviderIncidentIO,
DisplayName: "incident.io",
SupportsAPIKey: true,
// incident.io publishes an OAuth2 flow, but it is outbound-only (for
// incident.io to call other apps), so access review authenticates
// with an API key presented as Authorization: Bearer, the default
// APIKeyConnection scheme. The key is bound to one organization, so
// there is nothing to pick (Pattern 3): no settings struct, no
// picker.
//
// ProbeURL lets the connection-status check confirm the key with a
// lightweight GET; the transport attaches the Bearer token and a dead
// key returns 401/403.
ProbeURL: "https://api.incident.io/v2/users?page_size=1",
//
// No NewNameResolver: GET /v2/users carries no organization name, so
// the source keeps its generic name.
NewDriver: func(_ context.Context, c *http.Client, _ *coredata.Connector, _ *log.Logger) (drivers.Driver, error) {
return drivers.NewIncidentIODriver(c), nil
},
}
}

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package provider
import (
"context"
"net/http"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/accessreview/drivers"
"go.probo.inc/probo/pkg/coredata"
)
func openrouterRegistration() *Registration {
return &Registration{
Provider: coredata.ConnectorProviderOpenRouter,
DisplayName: "OpenRouter",
SupportsAPIKey: true,
// OpenRouter authenticates with an organization management
// (provisioning) API key presented as Authorization: Bearer, the
// default APIKeyConnection scheme. The key is bound to one
// organization, so there is nothing to pick (Pattern 3): no settings
// struct, no picker.
//
// Probe confirms the key with a lightweight GET against the members
// endpoint; the transport attaches the Bearer token. probeOpenRouter
// rejects 401/403 (revoked/invalid key) and also 404, which a valid
// but personal (non-organization) key returns — so a key that cannot
// list members shows as not-connected rather than failing later.
Probe: probeOpenRouter,
//
// No NewNameResolver: the members endpoint carries no organization
// name, so the source keeps its generic name.
NewDriver: func(_ context.Context, c *http.Client, _ *coredata.Connector, _ *log.Logger) (drivers.Driver, error) {
return drivers.NewOpenRouterDriver(c), nil
},
}
}

View File

@@ -22,6 +22,7 @@ import (
"io"
"net/http"
"net/url"
"slices"
"strings"
"go.probo.inc/probo/pkg/connector"
@@ -29,14 +30,15 @@ import (
)
const (
anthropicAPIVersion = "2023-06-01"
anthropicUsersProbeURL = "https://api.anthropic.com/v1/organizations/users?limit=1"
herokuAccountProbeURL = "https://api.heroku.com/account"
linearGraphQLEndpoint = "https://api.linear.app/graphql"
mondayGraphQLEndpoint = "https://api.monday.com/v2"
posthogOrganizationPath = "/api/organizations/@current/"
posthogUSBaseURL = "https://us.posthog.com"
posthogEUBaseURL = "https://eu.posthog.com"
anthropicAPIVersion = "2023-06-01"
anthropicUsersProbeURL = "https://api.anthropic.com/v1/organizations/users?limit=1"
herokuAccountProbeURL = "https://api.heroku.com/account"
openRouterMembersProbeURL = "https://openrouter.ai/api/v1/organization/members?limit=1"
linearGraphQLEndpoint = "https://api.linear.app/graphql"
mondayGraphQLEndpoint = "https://api.monday.com/v2"
posthogOrganizationPath = "/api/organizations/@current/"
posthogUSBaseURL = "https://us.posthog.com"
posthogEUBaseURL = "https://eu.posthog.com"
)
// ProbeConnection verifies that the connector credential is accepted by the
@@ -112,7 +114,12 @@ func probePOSTJSON(
return doProbeRequest(httpClient, req)
}
func doProbeRequest(httpClient *http.Client, req *http.Request) error {
// doProbeRequest executes a probe request and maps the status to a verdict:
// 401/403 always mean the credential is rejected, any 2xx/other status means
// connected. extraReject lets a provider add statuses that also mean a hard
// rejection (e.g. OpenRouter's 404 for a non-organization key); pass none for
// the default 401/403-only contract.
func doProbeRequest(httpClient *http.Client, req *http.Request, extraReject ...int) error {
resp, err := httpClient.Do(req)
if err != nil {
return fmt.Errorf("probe request failed: %w", err)
@@ -123,7 +130,9 @@ func doProbeRequest(httpClient *http.Client, req *http.Request) error {
_ = resp.Body.Close()
}()
if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {
if resp.StatusCode == http.StatusUnauthorized ||
resp.StatusCode == http.StatusForbidden ||
slices.Contains(extraReject, resp.StatusCode) {
return fmt.Errorf("credential rejected: status %d", resp.StatusCode)
}
@@ -431,6 +440,27 @@ func probeHeroku(
return doProbeRequest(httpClient, req)
}
// probeOpenRouter verifies an OpenRouter management key. Beyond the usual
// 401/403, it treats 404 as a rejection too: a personal (non-organization)
// key authenticates but the members endpoint returns 404 "This endpoint is
// only available for organization accounts" (verified live) — a permanent,
// not transient, signal that the connector can never list anyone, so it
// surfaces at connection time instead of failing a campaign later.
func probeOpenRouter(
ctx context.Context,
httpClient *http.Client,
_ *coredata.Connector,
) error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, openRouterMembersProbeURL, nil)
if err != nil {
return fmt.Errorf("cannot create probe request: %w", err)
}
req.Header.Set("Accept", "application/json")
return doProbeRequest(httpClient, req, http.StatusNotFound)
}
func probePostHog(
ctx context.Context,
httpClient *http.Client,

View File

@@ -112,6 +112,48 @@ func TestBuildPostHogProbeURL(t *testing.T) {
assert.Equal(t, "https://us.posthog.com/api/organizations/@current/", probeURL)
}
func TestProbeOpenRouter(t *testing.T) {
t.Parallel()
// probeOpenRouter must reject 401/403 (bad key) and 404 (a valid but
// personal/non-organization key, which the members endpoint rejects with
// 404), while letting 2xx pass.
cases := []struct {
name string
status int
wantReject bool
}{
{"valid management key", http.StatusOK, false},
{"revoked key", http.StatusUnauthorized, true},
{"forbidden key", http.StatusForbidden, true},
{"personal (non-org) key", http.StatusNotFound, true},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
var gotURL string
client := &http.Client{Transport: probeRoundTripFunc(func(r *http.Request) (*http.Response, error) {
gotURL = r.URL.String()
return &http.Response{StatusCode: tc.status, Body: http.NoBody, Header: make(http.Header)}, nil
})}
err := probeOpenRouter(context.Background(), client, &coredata.Connector{Provider: coredata.ConnectorProviderOpenRouter})
assert.Equal(t, "https://openrouter.ai/api/v1/organization/members?limit=1", gotURL)
if tc.wantReject {
require.Error(t, err)
} else {
require.NoError(t, err)
}
})
}
}
func TestProbeHeroku(t *testing.T) {
t.Parallel()

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package provider
import (
"context"
"net/http"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/accessreview/drivers"
"go.probo.inc/probo/pkg/coredata"
)
func pylonRegistration() *Registration {
return &Registration{
Provider: coredata.ConnectorProviderPylon,
DisplayName: "Pylon",
SupportsAPIKey: true,
// Pylon authenticates with an account API token presented as
// Authorization: Bearer, the default APIKeyConnection scheme. There
// is no third-party OAuth2 flow for the Users API. The token is bound
// to one Pylon organization, so there is nothing to pick (Pattern 3):
// no settings struct, no picker, no SetOrganizationSettings.
//
// ProbeURL lets the connection-status check confirm the token is live
// with a lightweight GET; the transport attaches the Bearer token and
// a dead token returns 401/403.
ProbeURL: "https://api.usepylon.com/users?limit=1",
//
// No NewNameResolver: GET /users carries no organization name, so the
// source keeps its generic name (the source-name worker degrades
// gracefully).
NewDriver: func(_ context.Context, c *http.Client, _ *coredata.Connector, _ *log.Logger) (drivers.Driver, error) {
return drivers.NewPylonDriver(c), nil
},
}
}