fix: SQL 인젝션 취약점 및 입력 검증 수정

- r2_migrate_board_files(): SQL 인젝션 방지를 위해 escape 처리
- r2_migrate_board_files(): 테이블명 정규식 검증 추가
- handleUpload(): 파일 배열 필수 키 체크 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-10 14:59:43 +09:00
parent dd86ccb782
commit a7104b66fc
2 changed files with 18 additions and 4 deletions

View File

@@ -117,6 +117,11 @@ class R2FileHandler
*/
public function handleUpload(array $file, string $boTable, int $memberId = 0, string $type = 'board'): array
{
// 필수 키 체크
if (!isset($file['error']) || !isset($file['tmp_name']) || !isset($file['name']) || !isset($file['size'])) {
return ['success' => false, 'error' => 'Invalid file array'];
}
// 업로드 에러 체크
if ($file['error'] !== UPLOAD_ERR_OK) {
return $this->handleUploadError($file['error']);