Skip to content

fix: Improved validation for the CreatePublicShare method - #736

Open
2403905 wants to merge 2 commits into
mainfrom
fix/create-public-share-validation
Open

2403905 wants to merge 2 commits into
mainfrom
fix/create-public-share-validation

Conversation

@2403905

@2403905 2403905 commented Sep 11, 2026

Copy link
Copy Markdown

Summary

  • CreatePublicShare now checks Stat's response status (not just the transport error) and propagates it as-is instead of falling through with a nil Info.
  • It persists the resource id verified by Stat instead of blindly trusting the client-supplied one.
  • The json public-share manager rejects a nil/empty resource id at write time (mirrors the existing read-side nil-check in ListPublicShares).

Together these close a write-side gap where a share could be persisted with a nil resource_id, which crashes ListPublicShares with 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 id
  • go test ./pkg/publicshare/... — added coverage for rejecting a nil resource id on write
  • go vet clean, no regressions in existing specs

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.
@2403905
2403905 requested a review from a team as a code owner September 11, 2026 15:38
@kw-security

kw-security commented Sep 11, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@2403905 2403905 changed the title Improved validation for the CreatePublicShare method fix: Improved validation for the CreatePublicShare method Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants