Skip to content

feat: block email domains for guest invitations - #1734

Open
jbhs wants to merge 1 commit into
nextcloud:mainfrom
jbhs:feat/block-guest-email-domains
Open

jbhs wants to merge 1 commit into
nextcloud:mainfrom
jbhs:feat/block-guest-email-domains

Conversation

@jbhs

@jbhs jbhs commented Oct 20, 2026 •

Copy link
Copy Markdown

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI.

The implementation, testing, and security review were carried out with the support of Claude (Claude Code). I reviewed the changes, ran lint/build and unit tests, and manually tested the feature on Nextcloud 34, 35 and 36.

Description

This feature adds a field in the admin area that allows you to exclude specific email domains and their subdomains from creating guest accounts. This is useful, for example, to prevent guest accounts from being created for email addresses that are intended to register as full accounts or that are intended to use the Federated Share feature.

The restriction applies in the guest creation API (i.e., in the share dialog). An error message is displayed in this case. For the command occ guests:add.

The ability for an admin to convert an existing account into a guest account has been intentionally left enabled.

User Interface

Admin

admin-area

User

invite-guest

Closes #925

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T20:51:20.312152Z
We couldn’t complete this review. Comment @codex review to try again.
e936873 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jbhs

jbhs commented Oct 20, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jbhs
jbhs force-pushed the feat/block-guest-email-domains branch from e936873 to d660dfb Compare October 20, 2026 21:02

@skjnldsv skjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, nice feature and good tests! Could you drop the merge commit with a rebase on main, and use a conventional title like feat: block email domains for guest invitations?

Comment thread package-lock.json Outdated
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.1.tgz",
"integrity": "sha512-FNvFGzoMLWmE6Yj9spb/zjd7yiNCHiAW9/Tg9CXrQ8wuu32HtlJOwWO11OJafl5FfY3DxTdQ0vj42zU1kvv5jg==",
"version": "1.16.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This downgrades follow-redirects from 1.16.1 to 1.16.0, probably from an older local install. Please revert the lockfile, the PR doesn't need npm changes.

Comment thread src/views/GuestSettings.vue Outdated
}
// The server validates and de-duplicates entries, show what it stored.
try {
const { data } = await axios.get(generateUrl('apps/guests/config'))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fetching the whole config again just to see what the server kept is a bit much. Could setConfig return the stored blockedDomains instead? Then you can use that directly, and an invalid domain no longer shows the error twice (once from the client check, once from this diff).

@skjnldsv skjnldsv added 3. to review Waiting for reviews enhancement New feature or request labels Oct 29, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@jbhs jbhs closed this Nov 8, 2026
@jbhs
jbhs force-pushed the feat/block-guest-email-domains branch from 758255d to 2d93b9b Compare November 8, 2026 17:30
Add an admin setting with a list of email domains for which no guest
accounts can be created. An entry blocks the domain and all of its
subdomains, but not unrelated domains sharing the same suffix.

The check is enforced in the guest creation API and in occ guests:add.
Entries are normalised (lower-case, leading "@", "*." and dots removed)
and invalid entries are dropped. Internationalized domains are compared
in their punycode form, so "bücher.de" also blocks "xn--bcher-kva.de"
and upper-case variants. Existing guests are not affected.

Saving the settings returns the stored blocklist, so the admin UI shows
exactly what the server kept.

Closes nextcloud#925

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDY7TLSfZ2zVWLDsTsnqrF
Signed-off-by: Johannes B. Hartmann <mail@jbhs.de>
@jbhs jbhs reopened this Nov 8, 2026
@jbhs jbhs changed the title Feat/block guest email domains feat: block email domains for guest invitations Nov 8, 2026
@jbhs

jbhs commented Nov 8, 2026

Copy link
Copy Markdown
Author

Thank you very much for the feedback! I reverted the commit to “main” as a single commit with a conventional title, reset the lock file, and ‘setConfig’ now returns the saved “blockedDomains,” which are used directly by the user interface. The extra request and the duplicate error message have now been fixed.

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 feedback-requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blacklisting of mail domains for invitations

2 participants