Repository navigation
fix!: reject repeated provider registration and fix deletion log - #54
Merged
Merged
Conversation
PersistKeysWithDapperInSqlServer and PersistKeysWithDapperInPostgreSQL share one unnamed DapperDataProtectionConfig. A second call, to either provider, silently replaced the storage of the first one, overrode its configuration and ran both validators on it. Both methods now throw an InvalidOperationException when an IDbDataProtectionStorage is already registered. BREAKING CHANGE: calling PersistKeysWithDapperInSqlServer or PersistKeysWithDapperInPostgreSQL more than once now throws an InvalidOperationException. Keep a single call.
Each key was logged as being deleted before Delete() ran, so a failed, rolled-back deletion still showed every key as deleted. The keys are now logged after Delete() returns, as DeletedKeyFromStorage (event id 6), which replaces DeletingKeyFromStorage; both events are new in v2.
The SQL Server INSERT now brackets its column names like every other statement, and both repositories build the SELECT statement once in the constructor instead of on every read.
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.
Follow-up to #53 with the remaining code review findings. One commit per change; each commit builds and passes the full test suite.
PersistKeysWithDapperInSqlServerandPersistKeysWithDapperInPostgreSQLthrow anInvalidOperationExceptionwhen anIDbDataProtectionStorageis already registered. Both providers share one unnamedDapperDataProtectionConfig, so a second call silently replaced the first storage, overrode its configuration and ran both validators on it.Delete()succeeds, asDeletedKeyFromStorage(event id 6, replacingDeletingKeyFromStorage; both are new in v2). A failed, rolled-back deletion no longer logs every key as deleted.INSERTbrackets its column names like every other statement, and both repositories build theSELECTonce in the constructor.README (single registration, deletion logging, v2 migration notes) and AGENTS.md are updated.
Not addressed: restoring the
DeletableStorageWrapperconstructor guard (removed on purpose in #50) and moving the duplicated provider registration into a shared file (not worth it with two providers).BREAKING CHANGE: calling PersistKeysWithDapperInSqlServer or PersistKeysWithDapperInPostgreSQL more than once now throws an InvalidOperationException. Keep a single call.