Skip to content

Conversation

@Altahrim
Copy link
Collaborator

@Altahrim Altahrim commented Jul 12, 2024

Summary

Restrict admin actions to IP ranges
When administrator IP address is not in specified range, all admin actions are hidden/forbidden.

Checklist

@Altahrim Altahrim added 2. developing Work in progress security php Pull requests that update Php code labels Jul 12, 2024
@Altahrim Altahrim self-assigned this Jul 12, 2024
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from 71c789d to 5fff029 Compare July 12, 2024 14:33
@AndyScherzinger AndyScherzinger added this to the Nextcloud 30 milestone Jul 12, 2024
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from 5fff029 to 741dca0 Compare July 12, 2024 14:47
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

No in-if assignments please

@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch 4 times, most recently from 90da5d8 to 8b24270 Compare July 16, 2024 10:00
@Altahrim Altahrim marked this pull request as ready for review July 16, 2024 10:01
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch 5 times, most recently from f534588 to da6dd95 Compare July 17, 2024 07:20
@Altahrim Altahrim added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 17, 2024
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Definitely needs documentation, so that other "admin alike endpoints" are aware and can integrate it and use IGroupManager::isAdmin() instead of checking for the admin group.

@Altahrim Altahrim added the pending documentation This pull request needs an associated documentation update label Jul 17, 2024
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from da6dd95 to d1007db Compare July 17, 2024 12:35
@nickvergessen nickvergessen force-pushed the feat/restrict_admin_to_ips branch from 3391801 to 791b066 Compare July 17, 2024 13:33
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch 3 times, most recently from 17a6845 to fb9866d Compare July 19, 2024 09:08
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from 6682c99 to 6cdb1c7 Compare July 19, 2024 13:30
* Creates a range from string
*
* @since 30.0.0
* @throws on invalid range

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OCP\Security\Ip\on does not exist
* Creates a address from string
*
* @since 30.0.0
* @throws on invalid IP

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OCP\Security\Ip\on does not exist
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from 6cdb1c7 to e511bab Compare July 19, 2024 13:54
@joshtrichards
Copy link
Member

Related open issues this PR may close: #29294 & #38609


$this->registerAlias(IRemoteAddress::class, RemoteAddress::class);

$this->registerAlias(\OCP\Security\Ip\Factory::class, \OC\Security\Ip\Factory::class);

Check failure

Code scanning / Psalm

UndefinedClass

Class, interface or enum named OCP\Security\Ip\Factory does not exist
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from e511bab to 07264dd Compare July 19, 2024 14:27
Altahrim and others added 3 commits July 19, 2024 16:28
…king for "in range"

Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Benjamin Gaussorgues <[email protected]>
@Altahrim Altahrim force-pushed the feat/restrict_admin_to_ips branch from 07264dd to f1d97a3 Compare July 19, 2024 14:28
@nickvergessen nickvergessen requested a review from kesselb July 22, 2024 06:40
@szaimen
Copy link
Contributor

szaimen commented Jul 22, 2024

Cool feature 🎉🎉🎉🎉🎉

I wonder, would it make sense to document this under https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html?

@AndyScherzinger
Copy link
Member

I wonder, would it make sense to document this under https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html?

Yes, exactly there. I think @sorbaugh already discusses this with @Altahrim - we talked about this 30 minutes ago 😁

@Altahrim
Copy link
Collaborator Author

Added here: nextcloud/documentation#12059

@Altahrim Altahrim removed 3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update labels Jul 24, 2024
@blizzz blizzz mentioned this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

php Pull requests that update Php code security 🍂 2024-Autumn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants