This repository was archived by the owner on May 29, 2026. It is now read-only.
fix(security): fail closed in ZgwService auth checks (CWE-863)#631
Merged
Conversation
consumerHasScope() and getConsumerAuthorisaties() caught \Throwable and returned a GRANTING value on error (true = has-scope; null = unrestricted), so any exception during the authorisation check silently granted full access. Now fail closed: return false / [] on error (deny). Normal-path returns are unchanged. The remaining catch+return-null the gate flags is validateJwtAuth, whose catch returns a 403 response (already fail-closed) — addressed by a gate-8 precision fix in hydra (only flag return-null INSIDE the catch).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
consumerHasScope()andgetConsumerAuthorisaties()inZgwServicecaught\Throwableand returned a granting value on error —true(has-scope) andnull(= unrestricted per the contract, the caller treats null as allow-all). So any exception during the authorisation check silently granted full access (OWASP A01 / CWE-863, gate-8 unsafe-auth-resolver).Fix
Fail closed on error:
return false/return [](deny). Normal-path returns are unchanged — only thecatch(\Throwable)paths flip grant→deny.Note on gate-8
validateJwtAuth()is also flagged by gate-8 but its catch returns a 403 (already fail-closed); thereturn nullis its success path. That's a gate false-positive addressed by a precision fix to gate-8 in hydra (only flagreturn nullinside the catch block) — analogous to the gate-7 CORS-preflight refinement.