Skip to content

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

Open
hiro-gj wants to merge 4 commits into
nextcloud:masterfrom
hiro-gj:fix/65780-hasher-argon2
Open

hiro-gj wants to merge 4 commits into
nextcloud:masterfrom
hiro-gj:fix/65780-hasher-argon2

Conversation

@hiro-gj

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

Copy link
Copy Markdown

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

…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: User Name <user@example.com>
@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 Outdated
@solracsf solracsf added this to the Nextcloud 36 milestone Oct 24, 2026
Hasher.php
SHA-512 Hash:
`fcc70008dd3bdd28be13c1e457954b34acefe6796e0cd63a774cb916e7d798caced1842e922bbae106421400686a5ab96612bc35fa8000add77488d1a839e0d2`

Signed-off-by: hiro-gj <49264814+hiro-gj@users.noreply.github.com>
…1feb8

fix/Hasher-argon2_before_commit_ee1feb8
@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?

…e line endings to LF

Keep the legacy hash validation fix from c0525c3 while applying the
defined() check for PASSWORD_ARGON2 constants in Hasher::hash().

Fixes nextcloud#65780

Signed-off-by: hiro-gj <49264814+hiro-gj@users.noreply.github.com>
Signed-off-by: User Name <user@example.com>
@hiro-gj

hiro-gj commented Oct 29, 2026

Copy link
Copy Markdown
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?

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants