mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-18 20:34:52 +00:00
🔒 **Enforce authorization for meetup edit and update views**
Added `authorizeAccess` method to restrict access to the meetup's creator, ensuring proper authorization during view rendering and updates.
This commit is contained in:
@@ -83,6 +83,18 @@ class extends Component {
|
||||
\Flux\Flux::modal('add-city')->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce that only the meetup's creator may load or update this view.
|
||||
* Mirrors services/edit and lecturer-edit. Removing this guard reopens
|
||||
* the IDOR closed by 90835f8 (security: critical fixes / edit authz).
|
||||
*/
|
||||
protected function authorizeAccess(): void
|
||||
{
|
||||
if (! is_null($this->meetup->created_by) && auth()->id() !== $this->meetup->created_by) {
|
||||
abort(403);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whitelist the keys allowed inside github_data and coerce types so a
|
||||
* tampered payload cannot smuggle arbitrary keys into the stored JSON.
|
||||
@@ -114,6 +126,8 @@ class extends Component {
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->authorizeAccess();
|
||||
|
||||
$this->meetup->load('media');
|
||||
|
||||
// Basic Information
|
||||
@@ -146,6 +160,8 @@ class extends Component {
|
||||
|
||||
public function updateMeetup(): void
|
||||
{
|
||||
$this->authorizeAccess();
|
||||
|
||||
$validated = $this->validate([
|
||||
'name' => ['required', 'string', 'max:255', Rule::unique('meetups')->ignore($this->meetup->id)],
|
||||
'city_id' => ['nullable', 'exists:cities,id'],
|
||||
|
||||
Reference in New Issue
Block a user