feat(security_integration): implement custom OAuth integration (OAUTH_CLIENT = CUSTOM)#37
Open
GClunies wants to merge 1 commit into
Open
feat(security_integration): implement custom OAuth integration (OAUTH_CLIENT = CUSTOM)#37GClunies wants to merge 1 commit into
GClunies wants to merge 1 commit into
Conversation
…_CLIENT = CUSTOM) Add SnowflakeCustomOAuthSecurityIntegration so custom OAuth clients (e.g. Claude.ai's Snowflake MCP connector) can be managed declaratively instead of via manual SQL. Property changes always apply via ALTER SECURITY INTEGRATION - never CREATE OR REPLACE, which would rotate the Snowflake-issued client_id/client_secret and break live clients. The immutable oauth_client_type is marked triggers_replacement so changing it fails at plan time instead of emitting an ALTER Snowflake rejects. Fetch normalizes DESC output for drift-free plans: role lists are case-canonicalized and sorted on both sides, always-blocked admin roles (shared ALWAYS_BLOCKED_OAUTH_ROLES constant) are stripped, and empty values map to None. oauth_alternate_redirect_uris is create-only (not returned by DESC as far as we can confirm), documented as such. Closes datacoves#29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
SnowflakeCustomOAuthSecurityIntegration(TYPE = OAUTH, OAUTH_CLIENT = CUSTOM), closing #29. Custom OAuth clients — e.g. Claude.ai's Snowflake MCP connector — can now be managed declaratively instead of via manual SQL. Property changes are always applied withALTER SECURITY INTEGRATION; the lifecycle never recreates the integration, which would rotate the Snowflake-issuedclient_id/client_secretand break live clients.Changes
SnowflakeCustomOAuthSecurityIntegrationresource supportingoauth_client_type,oauth_redirect_uri,oauth_alternate_redirect_uris,oauth_issue_refresh_tokens,oauth_refresh_token_validity,oauth_use_secondary_roles,oauth_enforce_pkce,network_policy,pre_authorized_roles_list,blocked_roles_list;_resolverno longer raisesNotImplementedErrorforOAuthClient.CUSTOMoauth_client_typeis markedtriggers_replacement, so changing it fails at plan time rather than emitting an ALTER Snowflake rejects (and never auto-recreates)fetch_security_integrationgains a CUSTOM arm with drift-free normalization: role lists case-canonicalized and sorted on both sides, always-blocked admin roles (ALWAYS_BLOCKED_OAUTH_ROLESinbuiltins.py, enforced with aValueErroron the spec side) stripped from DESC output, empty values mapped toNoneoauth_alternate_redirect_urisis create-only (fetchable=False; DESC support unconfirmed) and documented as such--snowflake)docs/resources/snowflake_custom_oauth_security_integration.mdgenerated from the class docstring, wired intomkdocs.ymlnav anddocs/SUMMARY.mdTesting
pytest tests/ --ignore=tests/integration→ 1552 passedpytest tests/integration/data_provider/test_fetch_resource.py -k custom_oauth --snowflake) still needs a run against a test account withCREATE INTEGRATION ON ACCOUNT