Skip to content

Prevent cross-gateway asset data leakage - #3547

Open
wborn wants to merge 10 commits into
mainfrom
gateway-data-leakage
Open

wborn wants to merge 10 commits into
mainfrom
gateway-data-leakage

Conversation

@wborn

@wborn wborn commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Description

  • Introduce V2 asset ID mapping using all 22 characters of the gateway ID to prevent collisions between gateways with identical local asset IDs
  • Preserve legacy V1 mapping for gateways registered before the upgrade to version 1.35.0
  • Track first activation timestamps of normalized application versions to maintain a stable mapping cutoff across upgrades, restarts and rollbacks
  • Enforce gateway asset ownership for creates, updates, moves, deletions and attribute events using persisted asset ancestry
  • Add database locking to prevent concurrent modifications from bypassing ownership checks
  • Keep cached gateway ownership checks as preliminary event filters, with authoritative validation performed during persistence operations
  • Reject conflicting asset IDs and invalid synchronization inventories, including duplicate IDs, missing parents and cyclic hierarchies
  • Abort gateway synchronization on asset processing failures to prevent unintended modifications or obsolete-asset cleanup
  • Process cached asset and attribute events before synchronization cleanup, including when the initial asset inventory is empty
  • Improve gateway ownership conflict logging and cleanup of pending synchronization tasks on disconnect
  • Add unit and integration tests covering V1/V2 mapping, cross-gateway ownership isolation, asset type conflicts, synchronization failures and reconnection

Closes #2427

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass
  • 3. Changes are manually tested by you and the reviewer
  • 4. Documentation is written or updated

@wborn wborn added the Bug Error or issue in the system label Nov 5, 2026
- Introduce V2 asset ID mapping using all 22 characters of the gateway ID to reduce mapping collisions
- Preserve legacy V1 mapping for gateways registered before the upgrade to version 1.34.0
- Track first activation timestamps of normalized application versions to maintain a stable mapping cutoff across upgrades, restarts and rollbacks
- Enforce gateway asset ownership for creates, updates, deletions and attribute events using persisted asset ancestry
- Add database locking to prevent concurrent changes from bypassing ownership checks
- Reject conflicting asset IDs and invalid synchronization inventories to prevent unintended asset modifications or deletions
- Abort gateway synchronization when asset operations fail instead of continuing with inconsistent state
- Add unit and integration tests covering ID mapping, version tracking, ownership isolation and synchronization failures

Closes #2427
wborn added 6 commits November 6, 2026 12:13
- Serialize empty asset inventories so gateways can complete valid empty syncs
- Use inserts for gateway assets to prevent ID collisions from overwriting existing assets
- Add regression tests for inventory serialization and independent asset creation
- Process cached creates and attribute refreshes for empty inventories
- Reuse locked parent ancestry and identify ownership conflicts in logs
- Cover ownership rejection and cleanup after reconnect
@wborn
wborn marked this pull request as ready for review November 19, 2026 15:16
@wborn
wborn force-pushed the gateway-data-leakage branch from a1c24a6 to 64bfdad Compare November 19, 2026 16:44
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error or issue in the system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent gateway descendant asset data leakage

2 participants