Skip to content

fix(Security\Hasher): Guard PASSWORD_ARGON2 constants with defined() check - #65791

Merged
AndyScherzinger merged 1 commit into
nextcloud:masterfrom
hiro-gj:fix/65780-hasher-argon2
Oct 30, 2026
Merged

AndyScherzinger merged 1 commit into
nextcloud:masterfrom
hiro-gj:fix/65780-hasher-argon2

Conversation

@hiro-gj

@hiro-gj hiro-gj commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Guard PASSWORD_ARGON2ID and PASSWORD_ARGON2I constants with defined() checks in Hasher::hash().

On PHP environments compiled without Argon2 support (--with-password-argon2 not enabled), referencing these undefined constants results in a fatal error (Error: Undefined constant "OC\Security\PASSWORD_ARGON2ID") before the bcrypt fallback can be evaluated.

Follow-up to #64733
cc @provokateurin

Checklist

@hiro-gj
hiro-gj requested a review from a team as a code owner October 22, 2026 13:13
@hiro-gj
hiro-gj requested review from Altahrim, icewind1991, leftybournes and provokateurin and removed request for a team October 22, 2026 13:13
Comment thread lib/private/Security/Hasher.php Resolved
@solracsf solracsf added this to the Nextcloud 36 milestone Oct 24, 2026
@artonge

artonge commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

/backport to stable35

@artonge

artonge commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@hiro-gj can you fix the conflicts?

@hiro-gj

hiro-gj commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

can you fix the conflicts?

@artonge Sorry! There was an issue with the line endings.
I’ve converted everything to LF and resolved the conflicts.

https://github.com/nextcloud/server/pull/65791/changes

Thanks!

@artonge artonge added 3. to review Waiting for reviews bug labels Oct 29, 2026
@artonge

artonge commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@hiro-gj can you squash your commits and fix the php-cs and rector errors?

…check

Guard constant references with defined() checks so that systems without Argon2 support can safely fall back to bcrypt without fatal errors.

Follow-up to nextcloud#64733

Fixes nextcloud#65780

Signed-off-by: hiro-gj <49264814+hiro-gj@users.noreply.github.com>
@hiro-gj
hiro-gj force-pushed the fix/65780-hasher-argon2 branch from ee14649 to a27f840 Compare October 30, 2026 00:03
@hiro-gj

hiro-gj commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@hiro-gj can you squash your commits and fix the php-cs and rector errors?

@artonge Sorry My apologies!
I’ve confirmed that the code inconsistencies have been fixed using php-cs and rector, and that the NC35 installation is working correctly.
Thanks!

@AndyScherzinger
AndyScherzinger merged commit 4771acf into nextcloud:master Oct 30, 2026
155 checks passed
@welcome

welcome Bot commented Oct 30, 2026

Copy link
Copy Markdown

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

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 bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: (35.0.2) Fix Undefined constant PASSWORD_ARGON2ID in OCSecurityHasher

4 participants