Files
Gnuboard7/tests/scenarios/schedule-artisan-command-allowlist.yaml
T
HeuJung a1e1706ddc fix(release): 7.0.7 회귀 검수 발견 결함 3건 수정 — 표현식 배열 구조 분해·스케줄 확장 명령 웹 검증·JSON-LD 이스케이프
- 표현식 평가기가 화살표/함수 파라미터의 평탄한 배열 구조 분해(([k, v]) =>, 엘리전 홀)를
 지원하지 않아 배포 레이아웃 60여 파일(게시판 권한 computed·검증 오류 표시)이 평가 실패하던
 7.0.7 평가기 교체 회귀 수정 (engine-v1.60.5) + --production 재빌드.
- 스케줄 저장 검증이 HTTP 문맥에서 확장 커맨드를 해석하지 못하던 문제(확장 프로바이더의
 runningInConsole 등록 게이트로 Artisan 레지스트리 부재)를 프로바이더 $commands 선언 폴백으로
 수정 — 판정 기준(클래스 네임스페이스 + 실제 명령명 대조) 동일, fail-closed 유지.
- 봇 렌더 JSON-LD json_encode 에 JSON_HEX_TAG 추가 — 사용자 입력(검색어·게시글 제목)의
 </script> 조기 종료로 인한 저장형 XSS 차단, schema.org 데이터는 무손실.
- SeoMetaResolverTest 의 og_default_site_name 미고정 환경의존 실패를 setUp 고정으로 격리.
- 루트 CHANGELOG 7.0.7 Security/Fixed 각 1건(기출시 결함만), 시나리오 매니페스트 2건 갱신.
2026-08-18 10:00:01 +09:00

96 lines
6.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
feature: 예약 작업 Artisan 명령 허용목록 전환 및 파서 일치
description: |
스케줄의 artisan 타입은 "기본 허용, 차단목록만 거부" 정책이었다. 등록 명령 238개 중
차단은 9개뿐이었고, `migrate:refresh` 가 목록에서 빠져 있는 등 목록 관리 방식이
실패한다는 실증이 코드 안에 이미 있었다. 스케줄 생성·실행 권한을 위임받은 계정이
`make:migration` 으로 임의 경로에 PHP 파일을 만들고 `migrate --path=` 로 실행하는
2단계 체인이 성립했다.
검증 과정에서 보고서보다 짧은 경로를 추가로 발견했다. 검증기는 `preg_split` 의 첫
토큰을 명령명으로 봤지만 실행부는 `Artisan::call($command, [], ...)` 로 문자열째
넘겼고, parameters 가 비면 Laravel 이 문자열 전체를 StringInput 으로 재파싱한다.
그래서 따옴표·백슬래시·선행 옵션 한 쌍이면 차단목록에 있는 `tinker` 가 그대로
실행됐다(`"tinker" --execute=…`). 저장 시점과 실행 시점이 같은 추출기를 공유하므로
이중 검증이 둘 다 뚫렸다.
본 기능은 세 가지를 함께 바꾼다.
- 판정 전환: 3계층(차단목록 최종 거부권 → 코어 정적 허용목록 → 확장 소유 자동 허용)
- 사용법 제한: 허용목록 항목마다 허용 옵션 선언, 위치 인자·단축 옵션 거부
- 파서 일치: 엄격 파서로만 해석하고 실행은 (명령명, 인자배열)로 — 재해석 지점 제거
허용목록으로 바꾸는 것만으로는 해소되지 않는다. 같은 추출기를 쓰면 `"cache:clear"`
로 위장한 뒤 다른 명령이 실행되는 형태로 똑같이 우회되기 때문이다.
axes:
command_class: [core_allowlisted, core_not_allowlisted, denylisted, code_generating, extension_owned, parser_divergent, malformed]
enforcement_point: [validator_unit, store, update, run]
cross_product: |
command_class × enforcement_point 이 핵심이다. 저장 시점과 실행 시점이 같은 판정
함수를 공유해야 하고(한쪽만 고치면 DB 직접 수정이 우회로가 된다), 명령 부류마다
거부 사유가 달라 운영자에게 보이는 메시지가 갈린다.
옵션 형태(허용 옵션 / 미허용 옵션 / 위치 인자 / 단축 옵션)는 별도 axis 로 두지 않는다.
명령명 자체가 거부되는 부류에서는 옵션 형태가 결과를 바꾸지 않고, 허용목록 명령에
대해서만 의미가 있어 축이 비대칭이 된다. 대신 DataProvider 로 전수 전개하고
effects `undeclared_options_and_positional_arguments_are_rejected` 로 대표한다.
파서 분기 4종(큰따옴표 / 작은따옴표 / 백슬래시 / 선행 옵션)도 같은 이유로 축이 아니라
DataProvider 다 — 넷 다 엄격 파서의 같은 규칙 하나에서 걸린다.
exclusions:
- { command_class: extension_owned, enforcement_point: store, reason: "확장 소유 여부는 validator 단일 지점에서 갈린다 — HTTP 계층은 같은 판정 함수를 호출할 뿐 별도 분기가 없다" }
- { command_class: extension_owned, enforcement_point: update, reason: "동일 — 판정 분기 없음" }
- { command_class: extension_owned, enforcement_point: run, reason: "동일 — 판정 분기 없음" }
- { command_class: code_generating, enforcement_point: run, reason: "저장 시점에 거부되어 DB 에 남지 않는다. 실행 시점의 DB 직접 주입 방어는 parser_divergent·core_not_allowlisted 가 대표" }
- { command_class: malformed, enforcement_point: run, reason: "동일 — 실행 시점 대표는 parser_divergent (형식 오류의 대표 사례)" }
- { command_class: core_allowlisted, enforcement_point: update, reason: "update 의 고유 축은 '요청에 type 이 없을 때 저장된 타입으로 폴백' 배선이며 판정 자체는 store 와 같은 Rule — 대표 1건(code_generating)으로 검증" }
- { command_class: core_not_allowlisted, enforcement_point: update, reason: "동일 — 대표 1건으로 검증" }
- { command_class: denylisted, enforcement_point: update, reason: "동일 — 대표 1건으로 검증" }
- { command_class: parser_divergent, enforcement_point: update, reason: "동일 — 대표 1건으로 검증" }
- { command_class: malformed, enforcement_point: update, reason: "동일 — 대표 1건으로 검증" }
effects:
# 판정 계층
- allowlisted_maintenance_commands_still_run
- commands_outside_the_allowlist_are_rejected
- denylist_blocks_destructive_and_code_executing_commands
- denylist_is_evaluated_before_the_allowlist
- make_prefix_blocks_all_code_generating_commands
- extension_owned_commands_are_allowed_by_namespace
- extension_owned_commands_resolved_without_console_registration
- extension_gate_can_be_turned_off
- extension_commands_only_accept_their_own_options
# 사용법 제한
- undeclared_options_and_positional_arguments_are_rejected
- allowed_command_resolves_to_name_and_parameter_array
- rejection_reason_is_reported_per_category
# 파서 일치
- parser_divergent_input_is_rejected
- extracted_name_equals_executed_name
- run_dispatches_artisan_command_as_parsed_parameters
# 설정 불변식
- allowlist_and_denylist_stay_disjoint
- allowlist_matches_real_command_signatures
# 엔드투엔드 차단
- store_rejects_artisan_command_outside_allowlist
- store_rejects_parser_divergent_artisan_command
- store_rejects_allowlisted_command_with_denied_option
- store_allows_allowlisted_command_with_allowed_option
- store_rejects_malformed_artisan_command
- update_falls_back_to_the_stored_type_when_the_request_omits_it
- run_blocks_artisan_schedule_outside_allowlist
- run_blocks_parser_divergent_artisan_schedule
- run_blocks_denylisted_artisan_schedule
- parser_divergent_payload_never_reaches_artisan
- low_privilege_operator_cannot_stage_migration_rce_chain
# E2E axis 없음: 판정은 전부 서버측이고 레이아웃 JSON·컴포넌트 TSX·엔진 TS 변경이 없다.
# 예약 작업 관리 화면은 `config/core.php` 에서 is_active=false 로 비노출 상태라
# 브라우저 경로 자체가 존재하지 않는다 (frontend-change-requires-e2e 룰의 대상이 아님).
test_files:
- tests/Unit/Support/ScheduleCommandValidatorTest.php
- tests/Feature/Security/ScheduleCommandGuardTest.php