Skip to content

[v18] Fix panic in Firestore backend#56036

Merged
rosstimothy merged 1 commit intobranch/v18from
bot/backport-56030-branch/v18
Jun 24, 2025
Merged

[v18] Fix panic in Firestore backend#56036
rosstimothy merged 1 commit intobranch/v18from
bot/backport-56030-branch/v18

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

Backport #56030 to branch/v18

```
 panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x5af856fc3494]

goroutine 62984 [running]:
github.com/gravitational/teleport/lib/backend/firestore.(*Backend).Items.func3-range1(0xc0001991f0, {0x0?, 0x0?})
        github.com/gravitational/teleport/lib/backend/firestore/firestorebk.go:586 +0x134
github.com/gravitational/teleport/lib/backend/firestore.(*Backend).Items.func3.(*Backend).mergedRecords.2-range1(0x5af85ed273a0?, {0x0, 0x0?})
        github.com/gravitational/teleport/lib/backend/firestore/firestorebk.go:655 +0x4f
github.com/gravitational/teleport/lib/itertools/stream.MergeStreams[...].func1()
        github.com/gravitational/teleport/lib/itertools/stream/stream.go:378 +0x236
github.com/gravitational/teleport/lib/backend/firestore.(*Backend).Items.func3.(*Backend).mergedRecords.2(0xc000e52500)
        github.com/gravitational/teleport/lib/backend/firestore/firestorebk.go:654 +0x89b
github.com/gravitational/teleport/lib/backend/firestore.(*Backend).Items.func3(0xc003bb4cc0)
        github.com/gravitational/teleport/lib/backend/firestore/firestorebk.go:579 +0x3bf
```

The above panic is caused by the snapShot not being set and thus
resulting in a nil dereference. The snapShot is now assigned outside
of the switch to ensure that all records that are successfully
created contain a reference to a valid DocumentSnapshot.
@rosstimothy rosstimothy added the no-changelog Indicates that a PR does not require a changelog entry label Jun 24, 2025
@github-actions github-actions Bot requested review from espadolini and tigrato June 24, 2025 14:20
@rosstimothy rosstimothy enabled auto-merge June 24, 2025 14:29
@rosstimothy rosstimothy requested a review from zmb3 June 24, 2025 14:29
@rosstimothy rosstimothy added this pull request to the merge queue Jun 24, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 24, 2025
@rosstimothy rosstimothy added this pull request to the merge queue Jun 24, 2025
Merged via the queue into branch/v18 with commit e400703 Jun 24, 2025
43 checks passed
@rosstimothy rosstimothy deleted the bot/backport-56030-branch/v18 branch June 24, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport no-changelog Indicates that a PR does not require a changelog entry size/sm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants