fix(connectors-sdk): BaseSettings serialization and security issues (#7100)#7101
Open
Powlinett wants to merge 5 commits into
Open
fix(connectors-sdk): BaseSettings serialization and security issues (#7100)#7101Powlinett wants to merge 5 commits into
Powlinett wants to merge 5 commits into
Conversation
5 tasks
This comment was marked as off-topic.
This comment was marked as off-topic.
5 tasks
This comment was marked as off-topic.
This comment was marked as off-topic.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7101 +/- ##
===========================================
+ Coverage 35.64% 66.60% +30.96%
===========================================
Files 2048 1308 -740
Lines 125310 70265 -55045
===========================================
+ Hits 44672 46803 +2131
+ Misses 80638 23462 -57176
📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses serialization and secret-handling issues in connectors-sdk settings models by switching OPENCTI_TOKEN to SecretStr, normalizing CONNECTOR_SCOPE JSON serialization via field_serializer, making deprecated fields optional for safer dumping, and extracting _SettingsLoader into a dedicated module. It also updates downstream connector tests to reflect the new SecretStr behavior.
Changes:
- Update
BaseSettings/BaseConnectorSettingsto treatOPENCTI_TOKENasSecretStrand selectively reveal it only forpyctihelper config output. - Standardize
CONNECTOR_SCOPEserialization forpyctiviafield_serializer, and refactor_SettingsLoaderintoconnectors_sdk.settings._settings_loader. - Update SDK and connector test suites/fixtures to align with new token typing and updated scope/log-level fixture values.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| stream/microsoft-sentinel-intel/tests/microsoft_sentinel_intel/test_config.py | Adjust expected OpenCTI token representation in dumped config. |
| internal-enrichment/qualys-cve-enrichment/tests/test_connector/test_settings.py | Update token assertions for SecretStr. |
| internal-enrichment/polyswarm-sandbox/tests/test_connector.py | Update token assertions for SecretStr. |
| internal-enrichment/censys-enrichment/tests/censys_enrichment/test_config.py | Update token assertions for SecretStr. |
| external-import/flare/tests/test_connector/test_settings.py | Ensure helper config contains clear token via get_secret_value(). |
| external-import/ctm360-hackerview-feed/tests/test_connector/test_settings.py | Update token assertions for SecretStr. |
| external-import/ctm360-cyna-feed/tests/test_connector/test_settings.py | Update token assertions for SecretStr. |
| external-import/ctm360-cyberblindspot-feed/tests/test_connector/test_settings.py | Update token assertions for SecretStr. |
| connectors-sdk/tests/test_settings/test_settings_loader.py | Add dedicated tests for new _SettingsLoader module behavior. |
| connectors-sdk/tests/test_settings/test_deprecation_migration.py | Update scope fixtures to match comma-separated behavior. |
| connectors-sdk/tests/test_settings/test_base_settings.py | Update base settings tests for SecretStr token + scope serialization changes. |
| connectors-sdk/tests/test_settings/test_annotated_types.py | Remove tests tied to ListFromString JSON serialization behavior that was moved. |
| connectors-sdk/tests/test_settings/data/config.test.yml | Update config fixture scope/log-level values. |
| connectors-sdk/tests/test_settings/data/.env.test | Update env fixture scope/log-level values. |
| connectors-sdk/tests/test_settings/conftest.py | Point fixtures to _settings_loader module + update scope fixture. |
| connectors-sdk/connectors_sdk/settings/base_settings.py | Implement SecretStr token, per-field serialization rules, deprecated-field optionality, and improved deprecated namespace handling. |
| connectors-sdk/connectors_sdk/settings/annotated_types.py | Remove ListFromString JSON serializer now that scope serialization is handled in settings models. |
| connectors-sdk/connectors_sdk/settings/_settings_loader.py | Extract _SettingsLoader into a dedicated module. |
Powlinett
force-pushed
the
feat/7100-connectors-sdk-base-settings-fixes
branch
from
July 24, 2026 15:08
e96aa2c to
62c844f
Compare
… sensitive data in logs) comment #6559 (comment)
allow `model_dump()` method to work with `exclude_none` arg
Powlinett
force-pushed
the
feat/7100-connectors-sdk-base-settings-fixes
branch
from
July 24, 2026 15:16
62c844f to
f6908d0
Compare
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.
Proposed changes
SecretStrtype forOPENCTI_TOKENenv var to avoid leaking credentials in logsfield_serializerforCONNECTOR_SCOPEfor consistencymodel_dump()withexclude_none)_SettingsLoaderinto its own dedicated moduleOPENCTI_TOKENtype changeRelated issues
Checklist
Further comments
This PR is part of a split from #6559. The logger module work continues in a stacked PR based on this branch.