Skip to content

Allow custom public share tokens for form links#3311

Open
alexander-rebello wants to merge 13 commits intonextcloud:mainfrom
alexander-rebello:main
Open

Allow custom public share tokens for form links#3311
alexander-rebello wants to merge 13 commits intonextcloud:mainfrom
alexander-rebello:main

Conversation

@alexander-rebello
Copy link
Copy Markdown

This adds admin-gated custom tokens for public Forms share links. By default the feature is disabled, so existing instances keep the current random-token behavior. When enabled by an admin, form owners can edit the token of an existing public link directly in the sharing sidebar, save it explicitly, and the old URL becomes invalid immediately.

It also adds the necessary backend support for token updates, keeps public-link routing compatible with custom tokens, and includes tests plus API documentation updates.

Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Controller/ShareApiController.php 97.43% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Chartman123
Chartman123 previously approved these changes Apr 24, 2026
Copy link
Copy Markdown
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some review comments on the PHP part

Comment thread docs/API_v3.md Outdated
Comment thread lib/Controller/PageController.php Outdated
Comment thread lib/Controller/PageController.php Outdated
#[NoCSRFRequired()]
#[PublicPage()]
#[FrontpageRoute(verb: 'GET', url: '/s/{hash}', requirements: ['hash' => '[a-zA-Z0-9]{24,}'])]
#[FrontpageRoute(verb: 'GET', url: '/s/{hash}', requirements: ['hash' => self::PUBLIC_SHARE_HASH_REQUIREMENT])]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably be good if we can decide here wether custom share tokens are allowed on that instance. But IIRC it's not working with dynamically defined requirements.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning it would be good, but can't be done in this instance? Or should I try?

Comment thread lib/Controller/ShareApiController.php Outdated
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
@alexander-rebello alexander-rebello marked this pull request as draft April 24, 2026 08:53
@alexander-rebello alexander-rebello marked this pull request as ready for review April 24, 2026 08:57
@Chartman123 Chartman123 added enhancement New feature or request 3. to review Waiting for reviews feature: 👥 sharing settings labels Apr 24, 2026
@Chartman123 Chartman123 added this to the 5.3 milestone Apr 24, 2026
@Chartman123 Chartman123 dismissed their stale review April 24, 2026 09:58

Accidentally approved the PR instead of just adding the review comments

Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
@alexander-rebello
Copy link
Copy Markdown
Author

Whats the holdup? Could we check if this version works?

Comment thread .github/workflows/lint-eslint.yml
Comment thread lib/Controller/ShareApiController.php Outdated
alexander-rebello and others added 4 commits April 28, 2026 15:35
Co-authored-by: Christian Hartmann <chris-hartmann@gmx.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
Signed-off-by: Alexander Rebello <me@alexander-rebello.de>
@Chartman123
Copy link
Copy Markdown
Collaborator

Please don't merge the main branch into your dev branch, always rebase your branch on current main. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement New feature or request feature: 👥 sharing settings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants