Skip to content

fix(ocs): never hand out signing keys to link visitors - #4093

Merged
fschade merged 1 commit into
mainfrom
fix/signing-key-guard
Nov 23, 2026
Merged

fschade merged 1 commit into
mainfrom
fix/signing-key-guard

Conversation

@butonic

@butonic butonic commented Nov 23, 2026

Copy link
Copy Markdown
Member

GetSigningKey now refuses guests and users with a public-share-role in the opaque, before reading or creating the key.

A public link token carries the link owner as user, so a link visitor reaching this handler would get the owner's signing key. Today the proxy public paths and the reva link scope already keep link visitors away from the endpoint, this adds the check in the handler itself. Web does not sign urls for guests (signUrl: !authStore.isGuestContext) and uses the link signature for archive downloads on password protected links, so nothing should rely on getting a key in these contexts.

Ported from owncloud/ocis#12332, only the handler guard and the tests. The proxy and reva parts of that PR remove paths we never added.

$ go test -count=1 -run TestGetSigningKey -v ./services/ocs/pkg/service/v0/
--- PASS: TestGetSigningKey (0.00s)
--- PASS: TestGetSigningKeyRefusesPublicLinkAndGuests (0.00s)
    --- PASS: TestGetSigningKeyRefusesPublicLinkAndGuests/public_link (0.00s)
    --- PASS: TestGetSigningKeyRefusesPublicLinkAndGuests/guest (0.00s)
    --- PASS: TestGetSigningKeyRefusesPublicLinkAndGuests/does_not_create_a_key (0.00s)

The refusal tests fail with the guard disabled.

fixes https://github.com/opencloud-eu/omega/issues/879

AI assistance: Claude Code (claude-opus-5-5) ported the guard and wrote the tests.

A public link token carries the link owner as user. If a link visitor
ever reaches GetSigningKey they get the owner's signing key and can sign
urls for everything the owner can read, until the key expires. Today the
proxy public paths and the reva link scope keep visitors away from the
endpoint, this adds the check in the handler itself.

We now refuse guests and users with a public-share-role in the opaque,
before reading or creating the key.

ported from owncloud/ocis#12332
related: opencloud-eu/omega#879

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@butonic butonic self-assigned this Nov 23, 2026
@codacy-production

codacy-production Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity

Metric Results
Complexity 6

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.03% coverage variation

Metric Results
Coverage variation ✅ +0.03% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d43947a) 94350 28356 30.05%
Head commit (9f1fbc4) 94354 (+4) 28390 (+34) 30.09% (+0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4093) 4 4 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@fschade
fschade merged commit e002af3 into main Nov 23, 2026
62 checks passed
@fschade
fschade deleted the fix/signing-key-guard branch November 23, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants