Skip to content
← All reviews
Leantime/leantime #3653 · gloriafolaron · 4mo ago

feat(users): weekly_hours + employment_type on user (Slice 1)

Needs attention2 findings · openOpen the pull request on GitHub ↗
Panel verdict

The panel surfaced issues that deserve attention before merge.

2
raised by reviewers
2
kept by the panel

Findings

HighSecurityconfidence 0.75

Server-side authorization missing for capacity field writes

The blade template gates the capacity UI section behind Roles::admin, but the controller method that processes the form submission (likely update or a similar method) is not shown in this diff. If the server-side handler does not independently verify the caller has admin privileges before writing weekly_hours or employment_type, any authenticated user could craft a POST request to set these fields on any user (including themselves) via IDOR or direct param tampering. The buildValuesFromPost method in the diff reads these fields directly from $_POST without any ownership or role check. This would allow privilege escalation (setting employment type) and data integrity issues for downstream capacity planning.

MediumArchitectureconfidence 0.90

Tests rely on copied editUser logic via anonymous subclass, creating maintenance drift

The UsersRepositoryTest creates an anonymous subclass that duplicates the real editUser method's updateData construction logic (lines 174–202). While it bridges to the private normalizers via reflection, the core partial-update guard (array_key_exists logic) is reimplemented rather than exercised through the actual production method. Any future change to editUser (adding a new field, altering normalization order) will not automatically cause these tests to fail, creating a false sense of coverage. Prefer to test via the public interface by mocking the DB connection, or extract the normalization and partial-update logic into testable helpers.

3 reviewers · deepseek/deepseek-v4-flash · reviewed in 46s · 9 files, +570 −1

Ship the PR.
Skip the noise.

Free on 2 repositories · No credit card · Advisory only—never blocks a merge