Commit Graph

28 Commits

Author SHA1 Message Date
Aurélien Sibiril
a6379bb9f4 Always send Bearer auth for OAuth2 connectors
Provider token_type values are not reliably valid HTTP auth schemes
(Slack returns "bot" / "user", some providers send an empty string),
which produces a malformed Authorization header on subsequent
requests. Every OAuth2 connector in this codebase actually uses a
bearer token, so we always send "Bearer".

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-22 11:15:48 +02:00
Bryan Frimin
472ca703b5 Mitiate SSRF attack
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-20 12:11:17 +02:00
Aurélien Sibiril
c7ec1bcab3 Validate Slack OAuth2 token response
Check the ok and error fields from Slack's token
response and reject flows with a missing access token.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +02:00
Aurélien Sibiril
c6a5d98755 Drop grouped brackets for single declarations
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +02:00
Aurélien Sibiril
cc6d271f10 Remove unused ScopesCover function
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +02:00
Aurélien Sibiril
1def3a4136 Remove unused request param from InitiateWithState
The r *http.Request parameter was not read inside
InitiateWithState — all test call sites passed nil.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +02:00
Aurélien Sibiril
71f6364df0 feat(connector): support OAuth2 scope preservation and incremental auth
Extend the OAuth2 connector so a reconnect can request the union of
previously granted and newly requested scopes without losing either.
Four related changes:

- Connection gains Scopes() []string so callers no longer need a type
  switch to reach the scope set. OAuth2Connection and APIKeyConnection
  implement it; SlackConnection inherits via embedding.
- OAuth2State carries RequestedScopes and CompleteWithState falls
  back to it when the provider omits the scope field (RFC 6749 §5.1
  allows this when granted equals requested). Without the fallback
  the stored Scope would be empty and the next reconnect would have
  no diff base.
- providerDefinition gains SupportsIncrementalAuth, set only for
  Google Workspace. When the flag is true and the caller passes
  InitiateOptions.IncludeGrantedScopes, the auth URL carries
  include_granted_scopes=true and the prompt=consent param is
  dropped so reuse flows see only the delta consent screen.
- InitiateOptions gains ConnectorID so the reconnect case is passed
  explicitly instead of relying on the caller to mutate r.URL.Query.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +02:00
Aurélien Sibiril
62bab0f732 fix(connector): relax Slack incoming webhook requirement
ParseSlackTokenResponse treated the incoming_webhook field as
mandatory, which blocked any Slack OAuth2 flow that did not request
the incoming-webhook scope. Access review Slack connects only ask
for users:read and users:read.email and would fail at token parsing.

Treat incoming_webhook as optional: populate SlackSettings when it
is present, leave them empty otherwise. The existing compliance-page
webhook URL is preserved through Reconnect in a later commit.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +02:00
Aurélien Sibiril
d0fedcf39e feat(connector): add scope parsing utilities
ParseScopeString, FormatScopeString, UnionScopes and ScopesCover
encapsulate OAuth2 scope-set arithmetic. ParseScopeString accepts
both the RFC 6749 space-separated form and GitHub's comma-separated
non-compliant form in one pass, so callers can stay format-agnostic.

These primitives are the foundation for scope-preserving reconnect:
later commits compute the union of stored and requested scopes so
a reconnect never drops a previously granted scope.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-13 19:24:46 +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
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
Aurélien Sibiril
46dee27bcf Add connector infrastructure for access review
Add API key connector protocol, OAuth2 client credentials
grant, token refresh config, provider info endpoint,
ConnectorProviders helper, and bootstrap configs for all
OAuth providers. Move OAuth2 state decode near type.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
2026-04-02 14:37:29 +02:00
Sacha Al Himdani
8c02c53315 Update copyright headers across all Go files
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-25 17:38:32 +01:00
Bryan Frimin
ece54f1616 Fix golint errors
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-02 18:42:50 +01:00
Bryan Frimin
3d4b215b8f Add bridge backend for sync
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-02 09:14:39 +01:00
Bryan Frimin
bc5bbdae81 Add scim bridge with connector
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-02 09:14:38 +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
de004ce8d7 Add slack integration
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-10-23 15:10:54 +02:00
Bryan Frimin
16a5f0c7f9 Remove debug log
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-05-14 08:08:35 -07:00
Bryan Frimin
fdd596233e Fix continue ignored
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:32:13 -07:00
Bryan Frimin
82f95a354e Fix silient token reponse error
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:20:23 -07:00
Bryan Frimin
9aeed6da4a Add settins connector view
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:16:49 -07:00
Bryan Frimin
44a05be1af Encrypt connector sensitive data
Add database field level encryption level to sensitive data to reduce
the risk in term of data leak. I dedice to have only one key for now in
a near future I may move to one master key and one encryption key per
organization to make rotation easiest.

I don't use built-in pg_crypto function to have clear seperation and
avoid any encryption key leak.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:16:18 -07:00
Bryan Frimin
868c45b15d Fix empty string secret for state token
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:16:17 -07:00
Bryan Frimin
fd698d8485 Fix no error with duplicate connector name
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:16:17 -07:00
Bryan Frimin
7d3a9e6d3b Remove debug log
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:16:17 -07:00
Bryan Frimin
8c516c1689 Add connector with OAuth2 support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-04-20 21:16:16 -07:00