Skip to content

fix: [stable-9.0][OCISDEV-1140] check the grant read result before the expiration - #804

Merged
2403905 merged 4 commits into
stable-9.0from
fix/9.0/OCISDEV-1140
Nov 12, 2026
Merged

2403905 merged 4 commits into
stable-9.0from
fix/9.0/OCISDEV-1140

Conversation

@2403905

@2403905 2403905 commented Nov 11, 2026 •

Copy link
Copy Markdown

Description

owncloud/ocis#13436

The storage provider could stop when it read the permissions of a user.
The function ReadUserPermissions in pkg/storage/utils/decomposedfs/node/node.go checked the expiration of a grant before it checked the read error.
A failed read returned a nil grant. The check then used the nil grant.

Changes

  • Check the expiration only when the grant read succeeds.
  • Return false from isGrantExpired for a nil grant.
  • Add the node path to the log message for a failed grant read.
  • Add a unit test for isGrantExpired in pkg/storage/utils/decomposedfs/node/grant_expired_test.go.
  • Add the changelog entry changelog/unreleased/bugfix-decomposedfs-nil-grant-panic.md.

Checks

  • The unit tests in pkg/storage/utils/decomposedfs/node pass.
  • The other callers of isGrantExpired and ReadGrant handle a nil grant correctly.

🤖 Generated with Claude Code

@2403905
2403905 requested a review from a team as a code owner November 11, 2026 11:59
@kw-security

kw-security commented Nov 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 and others added 3 commits November 11, 2026 22:31
The function ReadUserPermissions in
pkg/storage/utils/decomposedfs/node/node.go checked the expiration of a
grant before it checked the read error. A failed read returned a nil
grant, and the check caused a nil pointer panic.

- Check the expiration only when the grant read succeeds.
- Return false from isGrantExpired for a nil grant.
- Add the node path to the log message for a failed grant read.
- Add a unit test for isGrantExpired.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Add a test for the function ReadUserPermissions in
  pkg/storage/utils/decomposedfs/node/node_test.go. The test stores a
  grant that ReadGrant cannot read. The test checks that the function
  does not panic and gives no permissions.
- Add the license header to
  pkg/storage/utils/decomposedfs/node/grant_expired_test.go.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The function Unmarshal in pkg/storage/utils/ace/ace.go ignored the error
from unmarshalKV and then read a field of a nil value. The function also
read the first byte of an empty value. Both cases caused a panic.

- Return the error when unmarshalKV fails.
- Return an error for an empty value.
- Add tests in pkg/storage/utils/ace/ace_test.go.
- Update the changelog entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mzner
mzner previously approved these changes Nov 12, 2026
Comment thread pkg/storage/utils/ace/ace.go Resolved
Comment thread pkg/storage/utils/ace/ace.go Resolved
Comment thread pkg/storage/utils/ace/ace.go Resolved
The function Unmarshal in pkg/storage/utils/ace/ace.go read the first
character of the principal without a length check. An empty principal
caused a panic. A principal with one character passed the check, and
the function Grant in pkg/storage/utils/ace/ace.go then caused a panic.
The function unmarshalKV in pkg/storage/utils/ace/ace.go read the value
of a field without an equals sign, and this also caused a panic.

- Return an error for a principal that does not have the form "<type>:<id>".
- Return an error for a field without an equals sign.
- Keep the full value when the value contains an equals sign.
- Ignore empty fields, as the old parser did.
- Add tests in pkg/storage/utils/ace/ace_test.go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@2403905
2403905 force-pushed the fix/9.0/OCISDEV-1140 branch from a08df7a to e3b96ab Compare November 12, 2026 10:33
@2403905
2403905 merged commit fa46423 into stable-9.0 Nov 12, 2026
14 checks passed
@2403905
2403905 deleted the fix/9.0/OCISDEV-1140 branch November 12, 2026 12:09
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.

5 participants