feat!: opt-in credential encryption via FieldDescriptor isEncrypted() - #7
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 16, 2026
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
Makes credential encryption opt-in per field descriptor instead of guessing from field names — the last piece of the FieldDescriptor schema from the original architecture review, done now while it's still a cheap change (pre-1.0.0).
FieldDescriptorInterface::isEncrypted(): bool(breaking interface addition);FieldFactoryTrait::apiKeyField()marks itself encrypted.SensitiveDataProcessornow receives the registeredAiServiceConfigurationInterface[](di.xml) and decides sensitivity from each service's field schema; public methods take the service code first (breaking signatures). For unknown service codes, or fields absent from a known schema, it falls back to the previous name heuristic (apikey/api_key/token/secret) — covering rows whose third-party provider module was removed, plus defense in depth. Schema is authoritative when it describes a field: an in-schema field namedtokenleft unmarked stays plaintext.passwordinputs for encrypted fields regardless of declared type.Third-party providers now opt fields into encryption explicitly (
'encrypted' => true) regardless of naming.PR chain: #2 → #3 → #4 → #5 → #6 → this. Retargets as bases merge; breaking changes ship unreleased.
Test plan
SensitiveDataProcessortests incl. schema-marked field with non-matching name, in-schema unmarked field staying plaintext, both fallback paths, invalid registration.EncryptedServicesTestexercises the schema path end-to-end (4 tests, pass under full Magento autoload).vendor/bin/phpcsexits 0; suite at 49 tests with only the pre-existing generated-factory environment errors.🤖 Generated with Claude Code