fix(delete-user-data): gate RTDB deletion on a configured instance - #2988
Open
CorieW wants to merge 2 commits into
Open
fix(delete-user-data): gate RTDB deletion on a configured instance#2988CorieW wants to merge 2 commits into
CorieW wants to merge 2 commits into
Conversation
The extension deletes RTDB data only when `rtdbPaths && databaseURL`, where the URL derives from SELECTED_DATABASE_INSTANCE. The kit gated on `rtdbPaths` alone and then called `ctx.database.ref(path).remove()` against whatever default instance the app resolves -- so RTDB_PATHS with an empty SELECTED_DATABASE_INSTANCE could delete data from an unintended database. Tracked in #2974 as the kit's deletion risk. handleClear now requires getDatabaseUrl(rtdbInstance, rtdbLocation) to resolve before scheduling RTDB deletion, logging rtdbNotConfigured otherwise, matching the extension. Existing rtdb tests gain the instance/location config; a new test asserts the skip.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the user data deletion handler to ensure Realtime Database (RTDB) deletion only runs when a database URL can be successfully derived from the configured instance and location. This aligns the behavior with the extension and prevents deletion against unintended default instances. The tests have been updated to reflect these configuration requirements and verify that RTDB deletion is skipped when no database instance is configured. There are no review comments, and I have no additional feedback to provide.
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
rtdbPaths && databaseURL; the kit gated onrtdbPathsalone and deleted against whatever default RTDB instance the app resolved.handleClearnow requiresgetDatabaseUrl(rtdbInstance, rtdbLocation)to resolve before scheduling RTDB deletion, loggingrtdbNotConfiguredotherwise — matching the extension's behaviour withRTDB_PATHSset andSELECTED_DATABASE_INSTANCEempty.rtdbInstance/rtdbLocationconfig; a new test asserts paths are skipped (not deleted) when no instance is configured.Testing
tsc --noEmitclean; all 85 tests pass (84 existing + 1 new skip-assertion).npm packed, re-vendored into its function-kits source.lib, via the consumer install):rtdbPathsset with no instance → zero removals and the "Realtime Database paths are not configured, skipping" log; instance + location configured → deletes the expected path.a91f6c2e,recursive) — all 6 functions updated, 0 failures.