Validate allowed_values in ConnectorRunner fixture setup#7577
Conversation
Integration tests using ConnectorRunner bypassed the SaaS schema allowed_values validation because _connection_config calls ConnectionConfig.create directly, skipping the Pydantic model validator. Additionally, FIDES__DEV_MODE=True in docker-compose disables domain validation in the schema anyway. Call validate_value_against_allowed_list directly in _connection_config so connector fixtures fail fast with a clear error if a secret domain does not match the connector's allowed_values, regardless of dev mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
📝 WalkthroughWalkthroughAdded runtime validation for connector endpoint parameters within the connection config initialization. The enhancement iterates through connector parameters and validates string values of type "endpoint" against their respective allowed values lists using an existing validation function. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds early Key observations:
Confidence Score: 5/5
Last reviewed commit: dcfb42d |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/ops/integration_tests/saas/connector_runner.py`:
- Around line 386-387: The current branch in connector_runner.py that handles
endpoint params skips validation when value is not a string; change it to fail
fast: in the block that checks param_type == "endpoint" and allowed_values, if
value is not None and not isinstance(value, str) raise a clear error (ValueError
or TypeError) referencing the param name so invalid types (dict/int) fail
immediately; if value is a string, continue to call
validate_value_against_allowed_list(name, value, allowed_values) as before.
Ensure you update the same conditional that currently uses isinstance(value,
str) and keep references to param_type, allowed_values, name, value, and
validate_value_against_allowed_list so the check is enforced for non-string
endpoint secrets.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 63d264d7-734e-4578-93c6-0af22aafe69d
📒 Files selected for processing (1)
tests/ops/integration_tests/saas/connector_runner.py
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Description Of Changes
Integration tests using
ConnectorRunnerwere silently bypassingallowed_valuesvalidation for SaaS connector secrets. Two issues compounded this:_connection_config()callsConnectionConfig.create()directly, which never runs the Pydantic schema validator that enforcesallowed_values.FIDES__DEV_MODE=Trueis set in all docker-compose test environments, which causesis_domain_validation_disabled()to returnTrueand skip validation anyway.The fix calls
validate_value_against_allowed_listdirectly in_connection_config()before persisting theConnectionConfig. This bypasses the dev mode gate intentionally — the goal is to catch misconfigured test secrets at fixture setup time with a clear error, not to test the production validation path (which is already covered by unit tests).Code Changes
tests/ops/integration_tests/saas/connector_runner.py- Validateendpoint-type connector params withallowed_valuesagainst the provided secrets before creating theConnectionConfigSteps to Confirm
ConnectorRunnerwith a connector that hasallowed_values(e.g. Stripe) — test setup should succeed with a valid domain (api.stripe.com)evil.example.com) and confirm the fixture fails immediately with a validation error rather than failing later during the HTTP requestPre-Merge Checklist
CHANGELOG.mdupdatedSummary by CodeRabbit