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건 갱신.
This commit is contained in:
1 parent
b3d0da9355
commit
a1e1706ddc
13 files changed
+359
-28
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\G7Testing\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\G7Testing\Console\FakeExtensionScheduleCommand;
|
||||
|
||||
/**
|
||||
* 스케줄 Artisan 허용목록의 "확장 소유 명령" 계층을 HTTP 문맥에서 검증하기 위한
|
||||
* 테스트 전용 서비스 프로바이더.
|
||||
*
|
||||
* 실제 확장 프로바이더는 `$this->app->runningInConsole()` 일 때만 커맨드를 Artisan 에
|
||||
* 등록하므로, HTTP 요청(관리자 화면의 스케줄 저장 검증)에서는 `Artisan::all()` 에
|
||||
* 확장 커맨드가 존재하지 않는다. 검증기는 이 경우 프로바이더가 선언한 `$commands`
|
||||
* 기본값을 폴백으로 해석해야 한다 — 이 픽스처는 그 상황(커맨드 미등록 + 프로바이더의
|
||||
* `$commands` 선언만 존재)을 재현한다.
|
||||
*
|
||||
* `Tests\` PSR-4 네임스페이스가 아니므로 오토로드되지 않는다 — 사용처에서 require 한다.
|
||||
*/
|
||||
class FakeExtensionScheduleServiceProvider extends ServiceProvider
|
||||
{
|
||||
/** @var array<int, class-string> 실제 확장 프로바이더와 동일한 선언 형태 */
|
||||
protected array $commands = [
|
||||
FakeExtensionScheduleCommand::class,
|
||||
];
|
||||
}
|
||||
@@ -71,6 +71,36 @@ test.describe('레이아웃 표현식 평가 샌드박스', () => {
|
||||
expect(result.date).toBe(true);
|
||||
});
|
||||
|
||||
// @scenario case=arrow_destructured_params
|
||||
// @effects same_expression_same_value_across_paths
|
||||
test('화살표 파라미터의 배열 구조 분해가 배포 번들에서 동작한다 (engine-v1.60.5 회귀)', async ({ page }) => {
|
||||
const result = await page.evaluate(() => {
|
||||
const g7 = (window as any).G7Core;
|
||||
const ctx = {
|
||||
perms: { 'admin.manage': true, read: true, write: false },
|
||||
errors: { name: ['이름은 필수입니다'] },
|
||||
};
|
||||
return {
|
||||
// 게시판 환경설정 권한 computed 실사용 형태: entries + filter([key]) + map([key])
|
||||
entriesFilterMap: g7.evaluateCondition(
|
||||
"{{Object.entries(perms ?? {}).filter(([key]) => !key.startsWith('admin.')).map(([key]) => key).length === 2}}",
|
||||
ctx,
|
||||
),
|
||||
// 검증 오류 표시 실사용 형태: ([field, messages])
|
||||
fieldMessages: g7.evaluateCondition(
|
||||
"{{Object.entries(errors ?? {}).map(([field, messages]) => field + ':' + messages[0])[0] === 'name:이름은 필수입니다'}}",
|
||||
ctx,
|
||||
),
|
||||
// 엘리전 홀: ([, v])
|
||||
elision: g7.evaluateCondition('{{Object.entries(perms ?? {}).map(([,v]) => v).length === 3}}', ctx),
|
||||
};
|
||||
});
|
||||
|
||||
expect(result.entriesFilterMap).toBe(true);
|
||||
expect(result.fieldMessages).toBe(true);
|
||||
expect(result.elision).toBe(true);
|
||||
});
|
||||
|
||||
// @scenario case=constructor_escape
|
||||
// @effects sandbox_escape_blocked, dangerous_payload_does_not_set_global
|
||||
test('constructor 체인 샌드박스 탈출이 코드를 실행하지 못한다', async ({ page }) => {
|
||||
|
||||
@@ -33,6 +33,9 @@ class SeoMetaResolverTest extends TestCase
|
||||
Config::set('g7_settings.core.seo.google_analytics_id', 'GA-12345');
|
||||
Config::set('g7_settings.core.seo.google_site_verification', '');
|
||||
Config::set('g7_settings.core.seo.naver_site_verification', '');
|
||||
// 운영자가 로컬에 저장한 값(storage/app/settings/seo.json)이 부팅 시 config 로
|
||||
// 실려 들어오므로, 미고정 시 og site_name fallback 단언이 환경에 좌우된다.
|
||||
Config::set('g7_settings.core.seo.og_default_site_name', '');
|
||||
Config::set('g7_settings.core.general.site_name', '그누보드7 쇼핑몰');
|
||||
}
|
||||
|
||||
@@ -374,6 +377,38 @@ class SeoMetaResolverTest extends TestCase
|
||||
$this->assertSame('나이키 에어맥스', $jsonLd['description']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 구조화 데이터의 문자열 값이 `</script>` 를 담아도 JSON-LD `<script>` 블록을
|
||||
* 조기 종료시키지 못한다 — 봇 화면(서버 렌더)에서만 노출되는 저장형 XSS 차단.
|
||||
*
|
||||
* 검색어·게시글 제목·상품명 등 사용자 입력이 structured_data 의 name 으로 흘러
|
||||
* 들어가는데, `json_encode` 가 `<`/`>` 를 이스케이프하지 않으면 문자열 안의
|
||||
* `</script>` 가 ld+json 스크립트 태그를 닫고 그 뒤 `<script>` 가 실행된다.
|
||||
* HTML meta 경로(og/twitter/title)는 stripHtml 로 태그를 지우지만 JSON-LD 는
|
||||
* 별도 경로라 함께 지켜야 한다.
|
||||
*/
|
||||
public function test_structured_data_json_ld_escapes_script_breakout(): void
|
||||
{
|
||||
$seoConfig = [
|
||||
'structured_data' => [
|
||||
'@type' => 'SearchResultsPage',
|
||||
'name' => '{{query.q}}',
|
||||
],
|
||||
];
|
||||
|
||||
$context = ['query' => ['q' => '</script><script>alert(1)</script>']];
|
||||
|
||||
$result = $this->resolver->resolve($seoConfig, $context, null, null, []);
|
||||
|
||||
$this->assertNotNull($result['jsonLd']);
|
||||
// 원문 `<script>` / `</script>` 시퀀스가 출력에 그대로 있으면 안 된다.
|
||||
$this->assertStringNotContainsString('<script', $result['jsonLd']);
|
||||
$this->assertStringNotContainsString('</script', $result['jsonLd']);
|
||||
// 값 자체는 보존되어야 한다(디코드하면 원문 그대로).
|
||||
$decoded = json_decode($result['jsonLd'], true);
|
||||
$this->assertSame('</script><script>alert(1)</script>', $decoded['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 구조화 데이터가 없으면 jsonLd는 null입니다.
|
||||
*/
|
||||
|
||||
@@ -675,6 +675,40 @@ class ScheduleCommandValidatorTest extends TestCase
|
||||
$this->assertSame(ScheduleCommandValidator::ARTISAN_REASON_OPTION, $verdict['reason']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Artisan 에 커맨드가 등록되지 않은 문맥(HTTP 요청)에서도, 활성 프로바이더가
|
||||
* `$commands` 로 선언한 확장 소유 명령은 자동 허용된다.
|
||||
*
|
||||
* 실제 확장 프로바이더는 `runningInConsole()` 일 때만 커맨드를 등록하므로,
|
||||
* 관리자 화면의 스케줄 저장 검증(HTTP)에서는 `Artisan::all()` 에 확장 커맨드가
|
||||
* 없다. 등록 인스턴스가 없으면 프로바이더 선언(클래스 네임스페이스 + 실제 명령명
|
||||
* 대조)을 폴백으로 해석해야 한다 — 없으면 "설치된 확장 명령 자동 허용" 약속이
|
||||
* 웹 저장 경로에서 통째로 동작하지 않는다 (7.0.7 검수 발견).
|
||||
*
|
||||
* @scenario command_class=extension_owned, enforcement_point=validator_unit
|
||||
*
|
||||
* @effects extension_owned_commands_resolved_without_console_registration
|
||||
*/
|
||||
#[Test]
|
||||
public function it_allows_provider_declared_extension_commands_without_console_registration(): void
|
||||
{
|
||||
require_once __DIR__.'/../../Fixtures/Extension/FakeExtensionScheduleCommand.php';
|
||||
require_once __DIR__.'/../../Fixtures/Extension/FakeExtensionScheduleServiceProvider.php';
|
||||
|
||||
// Artisan::registerCommand 를 호출하지 않는다 — HTTP 문맥 재현.
|
||||
$this->app->register(\Modules\G7Testing\Providers\FakeExtensionScheduleServiceProvider::class);
|
||||
|
||||
$verdict = ScheduleCommandValidator::inspectArtisanCommand('g7-testing-fake-extension-command --scope=all');
|
||||
|
||||
$this->assertTrue($verdict['allowed'], '프로바이더 선언 확장 명령이 HTTP 문맥에서 거부됨');
|
||||
$this->assertSame('g7-testing-fake-extension-command', $verdict['name']);
|
||||
|
||||
// 자기 정의에 없는 옵션은 같은 폴백 경로에서도 거부되어야 한다.
|
||||
$optionVerdict = ScheduleCommandValidator::inspectArtisanCommand('g7-testing-fake-extension-command --g7-not-a-real-option');
|
||||
$this->assertFalse($optionVerdict['allowed']);
|
||||
$this->assertSame(ScheduleCommandValidator::ARTISAN_REASON_OPTION, $optionVerdict['reason']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 확장 네임스페이스를 비워도 코어 허용목록은 그대로 동작한다 (계층 독립성).
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ description: |
|
||||
미실행(전역 canary `window.__g7jsi` 미설정) 양면을 잠근다.
|
||||
|
||||
axes:
|
||||
case: [safe_expression, arrow_template_literal, constructor_escape, nonstring_key_escape, object_facade_safe]
|
||||
case: [safe_expression, arrow_template_literal, arrow_destructured_params, constructor_escape, nonstring_key_escape, object_facade_safe]
|
||||
|
||||
effects:
|
||||
- same_expression_same_value_across_paths
|
||||
|
||||
@@ -59,6 +59,7 @@ effects:
|
||||
- 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
|
||||
# 사용법 제한
|
||||
|
||||
Reference in new issue
Block a user