Conversation
CreatePublicShare trusted the client-supplied ResourceInfo instead of the one it had just verified via Stat, and never checked Stat's own status code, so a failed/not-found Stat could flow through as if it had succeeded. Combined with a missing nil-check on write, this let a public share be persisted with a nil resource_id, which later crashes ListPublicShares with a nil-pointer panic for the whole tenant. - Check Stat's response status, not just the transport error, and propagate it as-is instead of falling through with a nil Info. - Persist the resource id verified by Stat instead of the one the client sent. - Reject resource infos with a nil/empty resource id in the share manager before persisting.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
mzner
approved these changes
Sep 11, 2026
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
CreatePublicSharenow checksStat's response status (not just the transport error) and propagates it as-is instead of falling through with a nilInfo.Statinstead of blindly trusting the client-supplied one.jsonpublic-share manager rejects a nil/empty resource id at write time (mirrors the existing read-side nil-check inListPublicShares).Together these close a write-side gap where a share could be persisted with a nil
resource_id, which crashesListPublicShareswith a nil-pointer panic for the whole tenant on every subsequent read.Test plan
go test ./internal/grpc/services/publicshareprovider/...— added coverage for stat-status propagation and for using the verified resource idgo test ./pkg/publicshare/...— added coverage for rejecting a nil resource id on writego vetclean, no regressions in existing specs