Skip to content

update policies#184

Merged
ht3aa merged 1 commit intomainfrom
fix/perimssions
Apr 3, 2026
Merged

update policies#184
ht3aa merged 1 commit intomainfrom
fix/perimssions

Conversation

@ht3aa
Copy link
Copy Markdown
Owner

@ht3aa ht3aa commented Apr 3, 2026

No description provided.

@ht3aa ht3aa added the fix label Apr 3, 2026
@ht3aa ht3aa merged commit b535502 into main Apr 3, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the CompanyJobPolicy by removing email verification requirements for viewing and creating jobs. The review feedback highlights that these changes introduce security risks and logical inconsistencies. Specifically, the viewAny method may now exclude legitimate HR or Admin users from the dashboard, and the create method is now overly permissive, allowing any authenticated user to post jobs. It is recommended to implement explicit role-based checks to maintain proper access control.

Comment on lines 16 to 17
return $user->isSuperAdmin()
|| $user->hasVerifiedEmail()
|| $user->can('ViewAny:Jobs');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Removing the access check for regular users in viewAny while still allowing them to own and update jobs (as seen in the update and view methods) creates a logical inconsistency. Users who own jobs (such as HR or Admin users) will no longer be able to access the list view in the dashboard (Filament resource). If the intention is to remove the dependency on email verification, it is recommended to replace it with explicit role checks for HR and Admin users to ensure they maintain access to their job listings.

        return $user->isSuperAdmin()
            || $user->isAdmin()
            || $user->isHR()
            || $user->can('ViewAny:Jobs');

public function create(User $user): bool
{
return $user->hasVerifiedEmail();
return true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Changing the create policy to return true is overly permissive as it allows any authenticated user, including those with the DEVELOPER role, to post jobs. This could lead to spam and data integrity issues. It is recommended to restrict job creation to specific roles like HR or Admin, or to users with a specific permission, consistent with the other methods in this policy.

        return $user->isSuperAdmin()
            || $user->isAdmin()
            || $user->isHR()
            || $user->can('Create:Jobs');

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.

1 participant