feat(probo): validate reconnects and preserve dropped token fields
Reconnect now takes a ReconnectConnectorRequest carrying the expected OrganizationID and Provider. It validates inside the same transaction that the loaded connector belongs to the requested org, provider and OAUTH2 protocol before mutating the row. This blocks cross-org and cross-provider corruption via a crafted connector_id reaching the OAuth callback through the HMAC-signed state token. preserveConnectionFields copies fields from the existing connection onto the new one when the new one omits them: - OAuth2 refresh_token: Google drops it on incremental-auth reuse when prompt=consent is skipped. - Slack webhook URL, channel and channel ID: access review Slack reconnects without the incoming-webhook scope return a token response with no incoming_webhook field. GetByOrganizationIDAndProvider now routes through the widest-scope coredata loader, and GetWithConnection exposes a by-ID load that returns the fully decrypted connector so the initiate handler can read the stored scope set. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -225,7 +225,15 @@ func handleConnectorComplete(
|
||||
return
|
||||
}
|
||||
|
||||
cnnctr, err = svc.Connectors.Reconnect(r.Context(), connectorID, connection)
|
||||
cnnctr, err = svc.Connectors.Reconnect(
|
||||
r.Context(),
|
||||
probo.ReconnectConnectorRequest{
|
||||
ConnectorID: connectorID,
|
||||
OrganizationID: organizationID,
|
||||
Provider: connectorProvider,
|
||||
Connection: connection,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot reconnect connector: %w", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user