← PHP / Laravel 목차

PHP-007 / 기초

IDOR: 리소스 소유권 검사 누락

A01:2021 Broken Access Control · CWE-639 Authorization Bypass via User-Controlled Key

왜 문제가 될까요?

ID만 바꾸면 타인의 주문/문서에 접근한다.

이렇게 수정하세요

php
public function show(Order $order) {
    $this->authorize('view', $order);  // Policy에서 user_id 비교
    return $order;
}

더 읽기