[PR #7538] refactor: avoid spread operator for data access #7385

Open
opened 2026-03-13 13:34:18 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7538
Author: @himself65
Created: 1/21/2026
Status: 🔄 Open

Base: canaryHead: himself65/2026/01/21/avoid-spread-operator


📝 Commits (1)

  • 2cc4a2b refactor: avoid spread operator for data access

📊 Changes

1 file changed (+10 additions, -0 deletions)

View changed files

📝 packages/core/src/db/adapter/factory.ts (+10 -0)

📄 Description

Summary by cubic

Prevent spreading of transformed adapter data by adding a guard that throws on object spread to avoid accidental data leakage. Values and APIs remain the same.

  • Refactors

    • Attach an enumerable Symbol with a throwing getter to transformedData to fail fast on object spread.
  • Migration

    • Spreading transformedData (e.g., {...data}) now throws. Access fields directly or via adapter methods; for copies, select fields explicitly.

Written for commit 2cc4a2b276. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7538 **Author:** [@himself65](https://github.com/himself65) **Created:** 1/21/2026 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `himself65/2026/01/21/avoid-spread-operator` --- ### 📝 Commits (1) - [`2cc4a2b`](https://github.com/better-auth/better-auth/commit/2cc4a2b276ae0557bbba325060518a945c865835) refactor: avoid spread operator for data access ### 📊 Changes **1 file changed** (+10 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/db/adapter/factory.ts` (+10 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Prevent spreading of transformed adapter data by adding a guard that throws on object spread to avoid accidental data leakage. Values and APIs remain the same. - **Refactors** - Attach an enumerable Symbol with a throwing getter to transformedData to fail fast on object spread. - **Migration** - Spreading transformedData (e.g., {...data}) now throws. Access fields directly or via adapter methods; for copies, select fields explicitly. <sup>Written for commit 2cc4a2b276ae0557bbba325060518a945c865835. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:34:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7385