Skip to content

Answer an unknown public link the same as an expired one - #725

Merged
blaipr merged 1 commit into
mainfrom
fix/public-link-answers-the-same
Aug 13, 2026
Merged

Answer an unknown public link the same as an expired one#725
blaipr merged 1 commit into
mainfrom
fix/public-link-answers-the-same

Conversation

@blaipr

@blaipr blaipr commented Aug 13, 2026

Copy link
Copy Markdown
Member

The bug

The page a public link resolves to is reachable without signing in, and it answered two different ways:

the hash the answer
real, but expired or used up the permission-denied page
never issued the bare string Link not found

The second is not a deliberate response at all — the not-found exception escaped the controller to the generic handler, which rendered it through this action's plain-text type.

So the two were distinguishable from outside. Nobody can walk the hash space — they are long random strings — but it told whoever was already holding a hash whether it had ever been real, which is not something this endpoint should answer.

Found while covering the link refusals (#723), where it was recorded rather than fixed.

The fix

Catch it and fall through to the same refusal. The hash that was tried is logged, so an operator can still see it.

Testing

The test that recorded the difference now asserts the sameness — it goes through the same body checker as the expired and used-up cases, which is the point: all three answers are the one answer.

Both suites green: 3074 unit, 837 integration.

The page a public link resolves to is reachable without signing in. A hash that
had expired or been used up got the permission-denied page; a hash nobody ever
issued let a not-found exception escape to the generic handler, which rendered
it through this action's plain-text type as the bare string 'Link not found'.

So the two were distinguishable from outside. Nobody can walk the hash space —
they are long random strings — but it told whoever was already holding one
whether it had ever been real, which is not something this endpoint should
answer.

Catch it and fall through to the same refusal, logging the hash that was tried
so an operator can still see it.
@blaipr
blaipr merged commit 00c6324 into main Aug 13, 2026
8 checks passed
@blaipr
blaipr deleted the fix/public-link-answers-the-same branch August 13, 2026 20:32
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.

1 participant