FeathersJS service exposes data publicly when authentication before hook is omitted
0 reputation · 03 Mar 2024, 13:25 UTC
Goal: Confirm that a FeathersJS service protected by a before hook that validates the presence of params.user will reject requests lacking a valid authentication token, preventing unintended public exposure of data.
Uncertainty: It is unclear whether the authentication middleware reliably sets params.user before the hook executes, and whether placing the validation hook after a data‑fetching hook could still allow data to leak. Additionally, there is ambiguity about how to verify that every sensitive service has the hook registered in the correct order without introducing false positives.
- Does the authentication middleware guarantee that params.user is defined only when a request is truly authenticated?
- If a validation hook is registered after a service method hook, can the service still return data to an unauthenticated client?
- What is the minimal configuration needed to ensure that all services enforce the authentication before hook without overlooking any?