fix(core,board,ecommerce,page,pay): 예외→응답 매핑 정비와 저장 배송지 승계 결함 수정
generic catch 가 4xx 를 돌려주면 인프라 장애가 입력 오류로 위장돼 장애 인지가 늦어지고, 이미 번역된 예외 메시지를 응답의 메시지 키 자리에 넘기면 키 해석에 실패해 원문이 그대로 화면에 나간다. 두 형태를 코어와 전 번들 확장에서 함께 정리하고, 판정기를 한 확장이 아닌 코어 모집단에 두어 확장 밖 동형 결함도 red 가 되게 했다 — 그 사각에 실제로 15건이 있었다. 주소록에서 해외 배송지를 고르면 국내 6필드만 옮겨 담아 해외 주소가 통째로 사라지던 결함도 함께 고쳤다. 저장은 200 으로 성공 처리돼 주문 상세를 다시 열기 전에는 드러나지 않았다.
This commit is contained in:
1 parent
b33559e462
commit
b16c5c38a5
166 files changed
+6533
-627
No files matched your search
@@ -8,6 +8,7 @@ use App\Models\LanguagePack;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Services\LanguagePackService;
|
||||
use Database\Seeders\RolePermissionSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
@@ -889,4 +890,63 @@ class LanguagePackControllerTest extends TestCase
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 실패 응답에 예외 원문이 실리지 않는다.
|
||||
*
|
||||
* 종전에는 `$e->getMessage()` 를 응답 errors/messageParams 로 그대로 넘겨,
|
||||
* 검증 실패 메시지에 내부 예외 문자열(경로·드라이버 오류 등)이 노출됐다.
|
||||
* 디버그 노출은 ResponseHelper 가 app.debug 에서만 Throwable 을 펼치는
|
||||
* 기존 메커니즘에 위임한다.
|
||||
*
|
||||
* @scenario endpoint=manifest_preview
|
||||
*
|
||||
* @effects language_pack_manifest_preview_failure_omits_exception_text
|
||||
*/
|
||||
public function test_manifest_preview_failure_does_not_leak_exception_message(): void
|
||||
{
|
||||
config(['app.debug' => false]);
|
||||
|
||||
Sanctum::actingAs($this->manager);
|
||||
|
||||
// ZIP 이 아닌 파일 → previewManifest 내부에서 예외 발생
|
||||
$response = $this->postJson('/api/admin/language-packs/manifest-preview', [
|
||||
'file' => UploadedFile::fake()->createWithContent('broken.zip', 'not-a-zip-archive'),
|
||||
]);
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
$body = $response->getContent();
|
||||
foreach (['ZipArchive', 'SQLSTATE', '.php', 'vendor/', 'Exception'] as $needle) {
|
||||
$this->assertStringNotContainsString(
|
||||
$needle,
|
||||
$body,
|
||||
"실패 응답에 내부 예외 흔적('{$needle}')이 포함되어 있습니다: {$body}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 캐시 갱신 실패 응답에도 예외 원문이 실리지 않는다 (500 축).
|
||||
*
|
||||
* @scenario endpoint=refresh_cache
|
||||
*
|
||||
* @effects language_pack_refresh_cache_failure_omits_exception_text
|
||||
*/
|
||||
public function test_refresh_cache_failure_does_not_leak_exception_message(): void
|
||||
{
|
||||
config(['app.debug' => false]);
|
||||
|
||||
$this->mock(LanguagePackService::class, function ($mock) {
|
||||
$mock->shouldReceive('refreshCache')
|
||||
->andThrow(new \RuntimeException('SQLSTATE[HY000]: internal detail'));
|
||||
});
|
||||
|
||||
Sanctum::actingAs($this->manager);
|
||||
|
||||
$response = $this->postJson('/api/admin/language-packs/refresh-cache');
|
||||
|
||||
$response->assertStatus(500);
|
||||
$this->assertStringNotContainsString('SQLSTATE', $response->getContent());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* generic catch 의 상태코드 · 예외 원문 노출 전수 계약 (#104)
|
||||
*
|
||||
* `catch (\Exception)` / `catch (\Throwable)` 는 도메인 예외가 아닌 것을 잡는 자리다.
|
||||
* 여기서 4xx 를 돌려주면 인프라 장애·코드 결함이 "입력 오류" 로 위장되어 장애 인지가 늦어진다.
|
||||
* 그리고 이미 번역된 예외 메시지를 응답의 메시지 **키** 자리에 넘기면 키 해석에 실패해
|
||||
* 원문(스택 힌트·SQL 상태코드 포함)이 그대로 사용자 화면에 나간다.
|
||||
*
|
||||
* 이 계약은 코어 한 곳에서만 세워졌던 것이 아니다 — 같은 형태가 코어와 번들 확장 양쪽에
|
||||
* 흩어져 있었다. 판정기를 한 확장 안에 두면 그 확장 밖에서 같은 결함이 재발해도 red 가
|
||||
* 되지 않으므로, 코어 + 모든 번들 모듈/플러그인의 컨트롤러를 한 번에 훑는다.
|
||||
*/
|
||||
class GenericCatchStatusCodeContractTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* 의도적으로 4xx 를 유지하는 지점 (사유를 함께 기록한다).
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const INTENTIONAL_4XX = [
|
||||
// 업로드된 zip 의 manifest 해석 실패는 사용자가 올린 파일의 문제다 —
|
||||
// 미리보기 단계이므로 설치 부작용이 없고, 운영자는 파일을 고쳐 다시 올리면 된다.
|
||||
'app/Http/Controllers/Api/Admin/LanguagePackController.php::manifestPreview' => '업로드 파일 해석 실패 = 클라이언트 입력 오류',
|
||||
'app/Http/Controllers/Api/Admin/ModuleController.php::manifestPreview' => '업로드 파일 해석 실패 = 클라이언트 입력 오류',
|
||||
'app/Http/Controllers/Api/Admin/PluginController.php::manifestPreview' => '업로드 파일 해석 실패 = 클라이언트 입력 오류',
|
||||
'app/Http/Controllers/Api/Admin/TemplateController.php::manifestPreview' => '업로드 파일 해석 실패 = 클라이언트 입력 오류',
|
||||
// 카테고리 이미지 서빙은 요청 파라미터 기반 파일 해석(검증성 로직) 비중이 크다.
|
||||
'modules/_bundled/sirsoft-ecommerce/src/Http/Controllers/Admin/CategoryController.php::downloadImage' => '검증성 로직(요청 파라미터 기반 파일 해석) 비중이 큼',
|
||||
'modules/_bundled/sirsoft-ecommerce/src/Http/Controllers/Public/CategoryImageController.php::download' => '검증성 로직(요청 파라미터 기반 파일 해석) 비중이 큼',
|
||||
];
|
||||
|
||||
/**
|
||||
* 예외 원문을 메시지 키로 넘기는 것이 아직 남아 있는 지점.
|
||||
*
|
||||
* 코어 확장 설치 경로는 `\RuntimeException(__('key', [...]))` 형태로 서비스·헬퍼
|
||||
* 40여 곳에서 던져진다. 키를 들고 다니는 예외로 승격하려면 설치/업데이트 경로 전체를
|
||||
* 건드려야 하므로 별도 작업으로 분리한다 — 여기 남겨 두는 이유는 "판정기가 못 봐서
|
||||
* 통과한 것" 과 "알고 남긴 것" 을 구분하기 위해서다. 목록이 늘어나면 실패한다.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private const KNOWN_EXCEPTION_TEXT_AS_KEY = [
|
||||
'app/Http/Controllers/Api/Admin/ModuleController.php:437',
|
||||
'app/Http/Controllers/Api/Admin/ModuleController.php:461',
|
||||
'app/Http/Controllers/Api/Admin/PluginController.php:448',
|
||||
'app/Http/Controllers/Api/Admin/PluginController.php:472',
|
||||
'app/Http/Controllers/Api/Admin/TemplateController.php:352',
|
||||
'app/Http/Controllers/Api/Admin/TemplateController.php:376',
|
||||
];
|
||||
|
||||
/**
|
||||
* 광역 `\RuntimeException` catch 가 4xx 를 반환하는 것이 아직 남아 있는 지점.
|
||||
*
|
||||
* `\RuntimeException` 은 도메인 예외의 부모가 되기 쉬워, 도메인 실패를 typed 로
|
||||
* 승격한 뒤에도 이 catch 를 남겨 두면 남는 것은 인프라 예외뿐인데 그것까지 4xx 로
|
||||
* 뭉갠다. 위 `KNOWN_EXCEPTION_TEXT_AS_KEY` 와 같은 줄이며, 같은 설치 경로 개편에서
|
||||
* 함께 해소된다.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const KNOWN_BROAD_RUNTIME_CATCH_4XX = [
|
||||
'app/Http/Controllers/Api/Admin/ModuleController.php::installFromFile' => '설치 경로가 도메인 실패를 키 없는 RuntimeException 으로 던진다 — 예외 승격과 함께 해소',
|
||||
'app/Http/Controllers/Api/Admin/ModuleController.php::installFromGithub' => '동일',
|
||||
'app/Http/Controllers/Api/Admin/PluginController.php::installFromFile' => '동일',
|
||||
'app/Http/Controllers/Api/Admin/PluginController.php::installFromGithub' => '동일',
|
||||
'app/Http/Controllers/Api/Admin/TemplateController.php::installFromFile' => '동일',
|
||||
'app/Http/Controllers/Api/Admin/TemplateController.php::installFromGithub' => '동일',
|
||||
];
|
||||
|
||||
/**
|
||||
* 스캔 대상 컨트롤러 루트 목록 (코어 + 번들 모듈/플러그인).
|
||||
*
|
||||
* @return array<int, string> 절대 경로 목록
|
||||
*/
|
||||
private function controllerRoots(): array
|
||||
{
|
||||
$roots = [base_path('app/Http/Controllers')];
|
||||
|
||||
// 컨트롤러 위치는 확장마다 규약이 갈린다 — 모듈·일부 플러그인은
|
||||
// `src/Http/Controllers`, PG 플러그인 4종은 `src/Controllers` 를 쓴다.
|
||||
// 한 규약만 보면 다른 규약을 쓰는 확장이 통째로 사각이 된다(실제로 PG
|
||||
// 플러그인 44파일이 그랬고, 그 안에 위반 1건이 살아 있었다).
|
||||
$conventions = ['src/Http/Controllers', 'src/Controllers'];
|
||||
|
||||
foreach (['modules', 'plugins'] as $kind) {
|
||||
$bundled = base_path($kind.'/_bundled');
|
||||
if (! is_dir($bundled)) {
|
||||
continue;
|
||||
}
|
||||
foreach (scandir($bundled) as $entry) {
|
||||
if ($entry === '.' || $entry === '..') {
|
||||
continue;
|
||||
}
|
||||
foreach ($conventions as $convention) {
|
||||
$dir = $bundled.'/'.$entry.'/'.$convention;
|
||||
if (is_dir($dir)) {
|
||||
$roots[] = $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $roots;
|
||||
}
|
||||
|
||||
/**
|
||||
* 루트 아래 PHP 파일을 저장소 상대 경로로 수집합니다.
|
||||
*
|
||||
* @return array<int, array{path: string, rel: string}>
|
||||
*/
|
||||
private function collectFiles(): array
|
||||
{
|
||||
$files = [];
|
||||
$prefix = str_replace('\\', '/', base_path()).'/';
|
||||
|
||||
foreach ($this->controllerRoots() as $root) {
|
||||
$it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root));
|
||||
foreach ($it as $f) {
|
||||
if (! $f->isFile() || ! str_ends_with($f->getFilename(), '.php')) {
|
||||
continue;
|
||||
}
|
||||
$full = str_replace('\\', '/', $f->getPathname());
|
||||
$files[] = ['path' => $f->getPathname(), 'rel' => str_replace($prefix, '', $full)];
|
||||
}
|
||||
}
|
||||
|
||||
usort($files, fn ($a, $b) => strcmp($a['rel'], $b['rel']));
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* generic catch 블록의 응답 상태코드를 추출합니다.
|
||||
*
|
||||
* @return array<int, array{file: string, method: string, line: int, status: int}>
|
||||
*/
|
||||
private function collectGenericCatchStatuses(): array
|
||||
{
|
||||
$found = [];
|
||||
|
||||
foreach ($this->collectFiles() as $file) {
|
||||
$lines = file($file['path'], FILE_IGNORE_NEW_LINES);
|
||||
$method = '?';
|
||||
|
||||
foreach ($lines as $i => $line) {
|
||||
if (preg_match('/public function (\w+)\(/', $line, $m)) {
|
||||
$method = $m[1];
|
||||
}
|
||||
|
||||
// 광역 catch: \Exception / \Throwable / \RuntimeException 단독
|
||||
//
|
||||
// `\RuntimeException` 을 포함하는 이유는 그것이 도메인 예외의 부모가 되기
|
||||
// 때문이다 — 서비스가 도메인 실패를 typed 로 승격하고 나면 이 catch 에
|
||||
// 남는 것은 인프라 예외뿐인데, 4xx 를 돌려주면 그대로 위장된다. 실제로
|
||||
// `User/ProductInquiryController` 4곳이 이 사각에 있었다.
|
||||
if (! preg_match('/\}\s*catch\s*\(\s*\\\\?(Exception|Throwable|RuntimeException)\s*(\$\w+)?\s*\)/', $line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$status = null;
|
||||
for ($j = $i + 1; $j < min($i + 25, count($lines)); $j++) {
|
||||
if (preg_match('/\}\s*catch\s*\(/', $lines[$j])) {
|
||||
break;
|
||||
}
|
||||
if (preg_match('/^\s*(\d{3}),?\s*$/', $lines[$j], $sm)) {
|
||||
$status = (int) $sm[1];
|
||||
break;
|
||||
}
|
||||
// ->error('key', 404) 처럼 한 줄에 쓰인 형태.
|
||||
// 첫 인자에 함수 호출이 올 수 있으므로(`error($e->getMessage(), 422)`)
|
||||
// 괄호를 배제하지 않는다 — 배제하면 그 형태를 통째로 놓친다.
|
||||
if (preg_match('/(?:error|moduleError)\(.*?,\s*(\d{3})\s*[,)]/', $lines[$j], $sm)) {
|
||||
$status = (int) $sm[1];
|
||||
break;
|
||||
}
|
||||
// 상태코드 인자를 아예 생략한 한 줄 호출 — ResponseHelper 기본값 400 이 적용된다.
|
||||
// 숫자만 찾는 판정은 이 형태를 통째로 놓친다 (실제 사각이었다: WishlistController).
|
||||
if (preg_match("/moduleError\(\s*'[^']+',\s*'[^']+'\s*\)/", $lines[$j])
|
||||
|| preg_match("/[^e]error\(\s*'[^']+'\s*\)/", $lines[$j])) {
|
||||
$status = 400;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($status !== null) {
|
||||
$found[] = ['file' => $file['rel'], 'method' => $method, 'line' => $i + 1, 'status' => $status];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* 판정기가 실제로 코어와 확장 양쪽을 보고 있는지 먼저 확인한다.
|
||||
*
|
||||
* 모집단이 비거나 한쪽으로 쏠리면 이후 단언은 초록이어도 아무것도 증명하지 못한다.
|
||||
*/
|
||||
public function test_scanner_population_covers_core_and_bundled_extensions(): void
|
||||
{
|
||||
$files = $this->collectFiles();
|
||||
$rels = array_column($files, 'rel');
|
||||
|
||||
$this->assertNotEmpty($rels, '컨트롤러 스캔 결과가 비어 있습니다 — 판정기가 대상을 못 찾고 있습니다.');
|
||||
|
||||
$core = array_filter($rels, fn ($r) => str_starts_with($r, 'app/Http/Controllers/'));
|
||||
$ext = array_filter($rels, fn ($r) => str_starts_with($r, 'modules/_bundled/') || str_starts_with($r, 'plugins/_bundled/'));
|
||||
|
||||
$this->assertNotEmpty($core, '코어 컨트롤러가 모집단에 없습니다.');
|
||||
$this->assertNotEmpty($ext, '번들 확장 컨트롤러가 모집단에 없습니다.');
|
||||
|
||||
// 이 브랜치가 계약을 세운 세 영역이 모두 잡혀야 한다
|
||||
$this->assertContains('modules/_bundled/sirsoft-ecommerce/src/Http/Controllers/Public/OrderController.php', $rels);
|
||||
$this->assertContains('modules/_bundled/sirsoft-board/src/Http/Controllers/Admin/BoardTypeController.php', $rels);
|
||||
$this->assertContains('app/Http/Controllers/Api/Admin/LanguagePackController.php', $rels);
|
||||
|
||||
// 두 컨트롤러 규약이 모두 잡혀야 한다. `src/Http/Controllers` 앵커만 두면
|
||||
// `src/Controllers` 를 쓰는 확장이 빠져도 이 테스트가 초록으로 남는다.
|
||||
$this->assertContains('plugins/_bundled/sirsoft-pay_nicepayments/src/Controllers/AdminEscrowController.php', $rels);
|
||||
|
||||
// 규약별 확장 수를 세어, 어느 한쪽 규약이 통째로 빠지는 회귀를 막는다.
|
||||
$byConvention = [];
|
||||
foreach ($rels as $rel) {
|
||||
if (preg_match('#^(modules|plugins)/_bundled/([^/]+)/(src/Http/Controllers|src/Controllers)/#', $rel, $m)) {
|
||||
$byConvention[$m[3]][$m[2]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertArrayHasKey('src/Http/Controllers', $byConvention, '`src/Http/Controllers` 규약 확장이 모집단에 없습니다.');
|
||||
$this->assertArrayHasKey('src/Controllers', $byConvention, '`src/Controllers` 규약 확장이 모집단에 없습니다 — PG 플러그인이 사각이 됩니다.');
|
||||
}
|
||||
|
||||
/**
|
||||
* generic catch 는 5xx 를 반환해야 한다 (의도적 예외는 상수에 명시).
|
||||
*
|
||||
* @scenario actor=member, change_mode=manual, address_region=domestic, e2e_browser=chromium
|
||||
*
|
||||
* @effects update_shipping_address_infrastructure_exception_returns_500_not_422, guest_confirm_option_has_no_domain_exception_so_generic_catch_returns_500
|
||||
*/
|
||||
public function test_generic_catch_blocks_never_return_4xx(): void
|
||||
{
|
||||
$sites = $this->collectGenericCatchStatuses();
|
||||
|
||||
$this->assertNotEmpty($sites, 'generic catch 를 하나도 찾지 못했습니다 — 판정기 정규식을 확인하세요.');
|
||||
|
||||
$declared = self::INTENTIONAL_4XX + self::KNOWN_BROAD_RUNTIME_CATCH_4XX;
|
||||
|
||||
$violations = [];
|
||||
$hit = [];
|
||||
foreach ($sites as $s) {
|
||||
if ($s['status'] < 400 || $s['status'] >= 500) {
|
||||
continue;
|
||||
}
|
||||
$key = $s['file'].'::'.$s['method'];
|
||||
if (array_key_exists($key, $declared)) {
|
||||
$hit[$key] = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
$violations[] = "{$s['file']}:{$s['line']} ({$s['method']}) -> {$s['status']}";
|
||||
}
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$violations,
|
||||
"광역 catch 가 4xx 를 반환합니다 (인프라 장애가 입력 오류로 위장됨):\n".implode("\n", $violations)
|
||||
);
|
||||
|
||||
// 면제 목록도 모집단이다 — 해소된 지점이 남아 있으면 "알고 남긴 것" 과
|
||||
// "이미 고쳐진 것" 이 구분되지 않아, 다음 사람이 그 줄을 근거로 삼는다.
|
||||
// `KNOWN_EXCEPTION_TEXT_AS_KEY` 는 이 검사를 갖고 있었는데 4xx 축에는 없었다.
|
||||
$stale = array_values(array_diff(array_keys($declared), array_keys($hit)));
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$stale,
|
||||
"면제 목록에 이미 해소된 항목이 남아 있습니다 (목록을 줄이세요):\n".implode("\n", $stale)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* `$e->getMessage(),` 한 줄이 응답 헬퍼의 **메시지 키 자리**인지 판정한다.
|
||||
*
|
||||
* 여는 호출을 위로 되짚어 `error(` / `moduleError(` 를 찾고, 그 사이에 놓인
|
||||
* 인자 줄 수로 위치를 센다. `error()` 는 0번째, `moduleError()` 는 확장 식별자
|
||||
* 다음인 1번째가 메시지 키다. 그 밖의 호출(도메인 서비스·리다이렉트 헬퍼)은
|
||||
* 아무리 같은 모양이어도 응답 키가 아니므로 위반이 아니다.
|
||||
*
|
||||
* @param array<int, string> $lines 파일 전체 줄
|
||||
* @param int $index `$e->getMessage(),` 가 있는 줄의 0-based 인덱스
|
||||
* @return bool 메시지 키 자리면 true
|
||||
*/
|
||||
private function isResponseMessageKeyPosition(array $lines, int $index): bool
|
||||
{
|
||||
$argLinesBefore = 0;
|
||||
|
||||
// 여는 줄은 멀지 않다 — 인자 6개를 넘겨 쓰는 응답 헬퍼는 없다.
|
||||
for ($j = $index - 1; $j >= 0 && $j >= $index - 7; $j--) {
|
||||
$candidate = trim($lines[$j]);
|
||||
|
||||
if ($candidate === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 여는 호출 발견 — 위치로 판정한다.
|
||||
if (preg_match('/(?:ResponseHelper::)?(?:->)?\b(error|moduleError)\($/', $candidate, $m)) {
|
||||
$keyPosition = $m[1] === 'moduleError' ? 1 : 0;
|
||||
|
||||
return $argLinesBefore === $keyPosition;
|
||||
}
|
||||
|
||||
// 여는 줄에 도달하기 전의 다른 호출/블록 경계면 응답 헬퍼가 아니다.
|
||||
if (str_ends_with($candidate, '(') || str_ends_with($candidate, '{') || str_ends_with($candidate, ';')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$argLinesBefore++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 예외 메시지 원문을 응답 메시지 키 자리에 넘기지 않는다.
|
||||
*
|
||||
* `error($e->getMessage(), 422)` 는 이미 번역된 문장을 키로 해석하려다 실패해
|
||||
* 원문을 그대로 노출한다.
|
||||
*
|
||||
* @scenario actor=member, change_mode=manual, address_region=domestic, e2e_browser=chromium
|
||||
*
|
||||
* @effects update_shipping_address_500_response_excludes_exception_message, guest_action_5xx_responses_exclude_exception_message
|
||||
*/
|
||||
public function test_exception_message_is_not_passed_as_response_message_key(): void
|
||||
{
|
||||
$violations = [];
|
||||
|
||||
foreach ($this->collectFiles() as $file) {
|
||||
$lines = file($file['path'], FILE_IGNORE_NEW_LINES);
|
||||
|
||||
foreach ($lines as $i => $line) {
|
||||
// 한 줄 형태: error($e->getMessage(), 422) / moduleError('mod', $e->getMessage(), …)
|
||||
if (preg_match('/(?:error|moduleError)\((?:[^,]+,\s*)?\$e->getMessage\(\)/', $line)) {
|
||||
$violations[] = $file['rel'].':'.($i + 1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// 여러 줄 형태: 인자가 줄마다 놓인 호출에서 `$e->getMessage(),` 만 있는 줄.
|
||||
// 이 모양 자체는 응답과 무관한 곳에도 흔하다 — 도메인 서비스 호출
|
||||
// (`failPayment($order, 'CODE', $e->getMessage())`)이나 리다이렉트 헬퍼
|
||||
// 인자가 그렇다. 여는 호출을 되짚어 **메시지 키 자리**일 때만 위반이다.
|
||||
if (preg_match('/^\s*\$e->getMessage\(\),\s*$/', $line)
|
||||
&& $this->isResponseMessageKeyPosition($lines, $i)) {
|
||||
$violations[] = $file['rel'].':'.($i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$unexpected = array_values(array_diff($violations, self::KNOWN_EXCEPTION_TEXT_AS_KEY));
|
||||
$stale = array_values(array_diff(self::KNOWN_EXCEPTION_TEXT_AS_KEY, $violations));
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$unexpected,
|
||||
"예외 메시지 원문이 응답 메시지 키로 전달됩니다:\n".implode("\n", $unexpected)
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$stale,
|
||||
"KNOWN_EXCEPTION_TEXT_AS_KEY 에 이미 해소된 항목이 남아 있습니다 (목록을 줄이세요):\n".implode("\n", $stale)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* 실패 리다이렉트 쿼리에 예외 원문을 싣지 않는다는 전수 계약
|
||||
*
|
||||
* 결제 콜백은 응답 본문이 아니라 **리다이렉트 쿼리스트링**으로 실패 사유를 전달한다.
|
||||
* 그래서 응답 메시지 키를 보는 계약(GenericCatchStatusCodeContractTest)의 축 밖에 있고,
|
||||
* 여기에 `$e->getMessage()` 를 실으면 브라우저 주소창과 참조 로그에 내부 오류 원문
|
||||
* (SQL 상태코드·클래스명·경로)이 그대로 남는다. 결제 실패 페이지는 이 값을 화면에
|
||||
* 그대로 출력하므로 구매자에게도 노출된다.
|
||||
*
|
||||
* 사유 식별은 같은 쿼리의 `error` 코드가 담당하고, 사람에게 보일 문구는 다국어 키로
|
||||
* 해석한 문장이어야 한다.
|
||||
*/
|
||||
class RedirectQueryExceptionTextContractTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* 아직 해소하지 못한 지점 (사유와 함께 선언한다).
|
||||
*
|
||||
* 목록이 늘어나면 실패하고, 해소된 항목이 남아 있어도 실패한다.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private const KNOWN_REDIRECT_EXCEPTION_TEXT = [];
|
||||
|
||||
/**
|
||||
* 스캔 대상 컨트롤러 루트 목록 (코어 + 번들 모듈/플러그인).
|
||||
*
|
||||
* 컨트롤러 위치 규약은 확장마다 갈린다 — 결제대행사 플러그인은 `src/Controllers`,
|
||||
* 그 밖은 `src/Http/Controllers` 를 쓴다. 한 규약만 보면 다른 규약이 통째로 사각이 된다.
|
||||
*
|
||||
* @return array<int, string> 절대 경로 목록
|
||||
*/
|
||||
private function controllerRoots(): array
|
||||
{
|
||||
$roots = [base_path('app/Http/Controllers')];
|
||||
$conventions = ['src/Http/Controllers', 'src/Controllers'];
|
||||
|
||||
foreach (['modules', 'plugins'] as $kind) {
|
||||
$bundled = base_path($kind.'/_bundled');
|
||||
if (! is_dir($bundled)) {
|
||||
continue;
|
||||
}
|
||||
foreach (scandir($bundled) as $entry) {
|
||||
if ($entry === '.' || $entry === '..') {
|
||||
continue;
|
||||
}
|
||||
foreach ($conventions as $convention) {
|
||||
$dir = $bundled.'/'.$entry.'/'.$convention;
|
||||
if (is_dir($dir)) {
|
||||
$roots[] = $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $roots;
|
||||
}
|
||||
|
||||
/**
|
||||
* 스캔 대상 PHP 파일을 저장소 상대 경로와 함께 수집합니다.
|
||||
*
|
||||
* @return array<int, array{path: string, rel: string}> 파일 목록
|
||||
*/
|
||||
private function collectFiles(): array
|
||||
{
|
||||
$files = [];
|
||||
$prefix = str_replace('\\', '/', base_path()).'/';
|
||||
|
||||
foreach ($this->controllerRoots() as $root) {
|
||||
$it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root));
|
||||
foreach ($it as $f) {
|
||||
if (! $f->isFile() || ! str_ends_with($f->getFilename(), '.php')) {
|
||||
continue;
|
||||
}
|
||||
$full = str_replace('\\', '/', $f->getPathname());
|
||||
$files[] = ['path' => $f->getPathname(), 'rel' => str_replace($prefix, '', $full)];
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* 판정기가 실제로 결제대행사 플러그인을 보고 있는지 스스로 단언합니다.
|
||||
*
|
||||
* 모집단이 비어 있으면 이 계약은 아무것도 증명하지 못한 채 초록이 된다.
|
||||
*
|
||||
* @scenario contract_check=scanner_population
|
||||
*
|
||||
* @effects redirect_contract_scanner_population_covers_payment_gateway_plugins
|
||||
*/
|
||||
public function test_scanner_population_covers_payment_gateway_plugins(): void
|
||||
{
|
||||
$rels = array_column($this->collectFiles(), 'rel');
|
||||
|
||||
$this->assertNotEmpty($rels, '스캔 대상 파일이 비어 있다.');
|
||||
|
||||
foreach (['sirsoft-pay_kginicis', 'sirsoft-pay_nhnkcp', 'sirsoft-tosspayments', 'sirsoft-pay_nicepayments'] as $plugin) {
|
||||
$hit = array_filter($rels, fn ($r) => str_contains($r, 'plugins/_bundled/'.$plugin.'/'));
|
||||
$this->assertNotEmpty($hit, $plugin.' 의 컨트롤러가 모집단에 없다.');
|
||||
}
|
||||
|
||||
// 리다이렉트 쿼리를 조립하는 지점 자체가 모집단에 있어야 한다.
|
||||
$withFailUrl = array_filter(
|
||||
$this->collectFiles(),
|
||||
fn ($f) => str_contains((string) file_get_contents($f['path']), 'resolveFailUrl(')
|
||||
);
|
||||
$this->assertNotEmpty($withFailUrl, 'resolveFailUrl 을 쓰는 파일이 모집단에 없다.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 리다이렉트 쿼리의 사람이 볼 값에 예외 원문을 싣지 않는다.
|
||||
*
|
||||
* @scenario contract_check=redirect_query_text
|
||||
*
|
||||
* @effects redirect_query_omits_exception_text_repository_wide
|
||||
*/
|
||||
public function test_redirect_query_does_not_carry_exception_text(): void
|
||||
{
|
||||
$violations = [];
|
||||
|
||||
foreach ($this->collectFiles() as $file) {
|
||||
$source = (string) file_get_contents($file['path']);
|
||||
if (! str_contains($source, '$e->getMessage()')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$lines = preg_split('/\r\n|\r|\n/', $source) ?: [];
|
||||
foreach ($lines as $i => $line) {
|
||||
// `'message' => $e->getMessage(),` 처럼 사람이 볼 쿼리 값 자리에 원문을 넣는 형태.
|
||||
if (! preg_match('/[\'"](message|msg|reason|detail)[\'"]\s*=>\s*\$e->getMessage\(\)/', $line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 리다이렉트 URL 조립 블록 안인지 — 위쪽 12줄에서 조립 호출을 되짚는다.
|
||||
$context = implode("\n", array_slice($lines, max(0, $i - 12), min(12, $i)));
|
||||
if (! preg_match('/resolveFailUrl\(|redirect\(|RedirectResponse|->away\(/', $context)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$violations[] = $file['rel'].':'.($i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$unexpected = array_values(array_diff($violations, self::KNOWN_REDIRECT_EXCEPTION_TEXT));
|
||||
$stale = array_values(array_diff(self::KNOWN_REDIRECT_EXCEPTION_TEXT, $violations));
|
||||
|
||||
$this->assertSame([], $unexpected, "리다이렉트 쿼리에 예외 원문을 싣는 지점:\n".implode("\n", $unexpected));
|
||||
$this->assertSame([], $stale, "이미 해소되어 면제 목록에서 지워야 하는 항목:\n".implode("\n", $stale));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
feature: 코어 실패 응답의 예외 원문 비노출 (Exception Response Exposure)
|
||||
|
||||
description: |
|
||||
언어팩 관리 API 가 실패했을 때, 응답의 `message` 자리에 이미 번역된 예외 문구가
|
||||
넘어가면 키 해석에 실패해 원문이 그대로 관리자 화면에 나간다. 원문에는 압축 라이브러리
|
||||
오류·파일 경로·SQL 상태코드가 섞여 있다.
|
||||
|
||||
핵심 설계:
|
||||
- `ResponseHelper::error()` 의 첫 인자는 **다국어 키 전용**이다. 번역문을 그 자리에
|
||||
넘기지 않는다.
|
||||
- 진단 정보 노출은 `ResponseHelper` 가 `app.debug` 에서만 Throwable 을 펼치는
|
||||
기존 메커니즘에 위임한다 — 호출부가 직접 원문을 문자열로 조립하지 않는다.
|
||||
- 상태코드는 바꾸지 않는다. manifestPreview 는 업로드 파일 해석 실패가 대부분
|
||||
클라이언트 입력 오류라 422 를 유지하고, refreshCache 는 500 이다.
|
||||
|
||||
두 테스트는 `app.debug=false` 를 명시적으로 세운 뒤 응답 본문 전체에 내부 흔적
|
||||
(`ZipArchive` `SQLSTATE` `.php` `vendor/` `Exception`)이 없음을 단언한다. 디버그를
|
||||
끄지 않으면 헬퍼가 의도적으로 노출하는 경로와 구분되지 않는다.
|
||||
|
||||
axes:
|
||||
endpoint: [manifest_preview, refresh_cache]
|
||||
|
||||
exclusions: []
|
||||
|
||||
effects:
|
||||
- language_pack_manifest_preview_failure_omits_exception_text
|
||||
- language_pack_refresh_cache_failure_omits_exception_text
|
||||
|
||||
scenarios:
|
||||
- id: failure_responses_never_carry_exception_text_in_the_message_slot
|
||||
description: 설치 전 검증 실패(422)와 캐시 갱신 실패(500) 모두 안내 문구만 전달하고 예외 원문을 싣지 않는다
|
||||
effects:
|
||||
- language_pack_manifest_preview_failure_omits_exception_text
|
||||
- language_pack_refresh_cache_failure_omits_exception_text
|
||||
|
||||
test_files:
|
||||
- tests/Feature/Api/Admin/LanguagePackControllerTest.php
|
||||
|
||||
notes: |
|
||||
이 매니페스트는 5차 감사에서 신설됐다. 두 테스트는 브랜치가 추가했지만
|
||||
`@scenario`/`@effects` 가 없어 어느 매니페스트에도 묶이지 않았고, 선언이 아예 없는
|
||||
effect 는 test-scenario-coverage 의 셀 대상이 아니라 조용히 통과했다.
|
||||
|
||||
같은 파일이 `language-pack-php-whitelist-and-activation-boundary.yaml` 의 test_files
|
||||
에도 등록돼 있으나 그쪽이 다루는 축은 PHP 구문 화이트리스트와 활성화 권한 경계다.
|
||||
실패 응답의 원문 노출은 그 시나리오의 축이 아니므로 별도 매니페스트로 둔다.
|
||||
@@ -52,6 +52,20 @@ effects:
|
||||
- guest_orders_show_response_excludes_admin_memo_user_user_id_promotions_snapshot
|
||||
- guest_orders_show_response_includes_mc_subtotal_discount_shipping_total_amount # 단계 5 그룹 C 보강
|
||||
- guest_orders_cancel_estimate_refund_update_shipping_confirm_option_require_token
|
||||
# 실패 원인 구분(도메인 422 / 검증 422 / 인프라 500)은 입력 axis 가 아니라 결과 축이므로
|
||||
# error_class axis 를 신설하지 않고 effects 로 검증한다 (member-order-change-address.yaml 과 동일 판단).
|
||||
# 인프라 500 은 서비스 mock 으로만 유발 가능해 PHPUnit 이 SSoT 이고, 브라우저는 200/422 축만 담당한다.
|
||||
# 예외 → 상태코드 분리 (공개 #104) — 비회원 액션 전 지점
|
||||
- guest_update_shipping_address_domain_exception_returns_422_infra_returns_500
|
||||
- guest_cancel_domain_exception_returns_422_infra_returns_500
|
||||
- guest_confirm_option_has_no_domain_exception_so_generic_catch_returns_500
|
||||
- guest_action_5xx_responses_exclude_exception_message
|
||||
# 국내/해외 배송지 조합 정합성 (부수 발견 F3)
|
||||
- guest_shipping_address_intl_combination_without_country_code_returns_422_validation_errors
|
||||
- guest_shipping_address_switching_to_intl_clears_domestic_columns
|
||||
- guest_shipping_address_domestic_country_code_requires_zipcode_and_address
|
||||
- guest_shipping_address_foreign_country_code_requires_intl_fields
|
||||
- guest_shipping_address_round_trip_between_domestic_and_intl_clears_opposite_columns
|
||||
# 프론트엔드 진입 (단계 5 그룹 A)
|
||||
- buy_now_when_guest_creates_temp_order_then_navigates_to_login_with_redirect_query
|
||||
- cart_order_when_guest_creates_temp_order_then_navigates_to_login_with_redirect_query
|
||||
|
||||
@@ -25,10 +25,19 @@ description: |
|
||||
axes:
|
||||
actor: [member, guest]
|
||||
change_mode: [saved, manual]
|
||||
address_region: [domestic, intl, intl_without_country_code]
|
||||
e2e_browser: [chromium]
|
||||
|
||||
exclusions:
|
||||
- { actor: guest, change_mode: saved, reason: "비회원은 주소록이 없어 saved(저장된 배송지 선택) 모드 미지원 — 직접입력만" }
|
||||
- { change_mode: saved, address_region: intl_without_country_code, reason: "저장된 주소의 country_code 가 그대로 승계되므로 '국가 코드 미전송' 조합이 성립하지 않음" }
|
||||
|
||||
# saved × intl 은 종전에 "저장된 주소를 그대로 승계하므로 조합이 성립하지 않는다" 는 사유로
|
||||
# 제외돼 있었다. 그 사유가 사실이 아니었다 — address_id 분기가 국내 6필드만 재구성해
|
||||
# 해외 주소를 고르면 주소가 통째로 사라졌고, 제외된 칸이 정확히 결함이 살던 자리였다.
|
||||
|
||||
# 실패 원인 구분(도메인 422 / 검증 422 / 인프라 500)은 입력 axis 가 아니라 결과 축이므로
|
||||
# effects 로 검증한다. 인프라 500 은 서비스 mock 으로만 유발 가능해 PHPUnit 이 SSoT 다.
|
||||
|
||||
effects:
|
||||
# 모달 컨텍스트 — _global 전달 (회원/비회원 공통)
|
||||
@@ -55,6 +64,21 @@ effects:
|
||||
- guest_update_shipping_address_succeeds_with_valid_token
|
||||
- guest_update_shipping_address_blocked_404_without_or_invalid_token
|
||||
- guest_update_shipping_address_validation_422_when_recipient_fields_missing
|
||||
# 예외 → 상태코드 분리 (공개 #104) — 회원/비회원 공통
|
||||
- update_shipping_address_domain_exception_returns_422_with_cannot_modify_address
|
||||
- update_shipping_address_infrastructure_exception_returns_500_not_422
|
||||
- update_shipping_address_500_response_excludes_exception_message
|
||||
# 국내/해외 주소 조합 정합성 (부수 발견 F3)
|
||||
- shipping_address_country_code_is_the_axis_for_domestic_vs_intl_validation
|
||||
- shipping_address_intl_combination_without_country_code_returns_422_validation_errors
|
||||
- shipping_address_domestic_country_code_requires_zipcode_and_address
|
||||
- shipping_address_foreign_country_code_requires_address_line_1_intl_city_intl_postal_code
|
||||
- shipping_address_switching_to_intl_clears_domestic_columns_with_empty_string
|
||||
- shipping_address_switching_to_domestic_clears_intl_columns_with_null
|
||||
- shipping_address_manual_domestic_input_on_intl_order_is_saved_not_discarded
|
||||
# 저장된 배송지(address_id) 승계 정합성
|
||||
- shipping_address_saved_intl_address_preserves_intl_columns
|
||||
- shipping_address_saved_mode_preserves_delivery_memo_from_request
|
||||
|
||||
scenarios:
|
||||
- id: member_change_address_saved_e2e
|
||||
@@ -82,9 +106,51 @@ scenarios:
|
||||
effects:
|
||||
- guest_update_shipping_address_blocked_404_without_or_invalid_token
|
||||
|
||||
- id: change_address_error_class_separation
|
||||
description: |
|
||||
배송지 변경 실패를 원인별로 구분한다 (공개 #104). 도메인 규칙 위반(배송 전 상태 아님)은
|
||||
422 + 기존 안내, 그 외 예외(인프라/코드 결함)는 500. 종전에는 모두 422 로 뭉개져
|
||||
인프라 장애가 "배송 전에만 변경 가능" 이라는 엉뚱한 입력 오류로 위장됐다.
|
||||
500 축은 서비스 mock 이 필요해 PHPUnit 이 SSoT 이고, 브라우저는 200/422 축만 담당한다.
|
||||
effects:
|
||||
- update_shipping_address_domain_exception_returns_422_with_cannot_modify_address
|
||||
- update_shipping_address_infrastructure_exception_returns_500_not_422
|
||||
- update_shipping_address_500_response_excludes_exception_message
|
||||
|
||||
- id: change_address_domestic_intl_combination
|
||||
description: |
|
||||
country_code 를 국내/해외 판정의 기준축으로 삼는다 (부수 발견 F3). 종전에는 zipcode/address 를
|
||||
address_line_1 유무로만 강제해, 해외 필드만 채우고 country_code 를 생략하면 검증을 통과한 뒤
|
||||
서비스가 국내 분기로 떨어져 NOT NULL 컬럼에 null 을 쓰다 SQL 무결성 위반이 났다.
|
||||
전환 시 반대편 컬럼을 초기화해 구 주소 잔존(2차 결함)도 함께 막는다.
|
||||
effects:
|
||||
- shipping_address_country_code_is_the_axis_for_domestic_vs_intl_validation
|
||||
- shipping_address_intl_combination_without_country_code_returns_422_validation_errors
|
||||
- shipping_address_domestic_country_code_requires_zipcode_and_address
|
||||
- shipping_address_foreign_country_code_requires_address_line_1_intl_city_intl_postal_code
|
||||
- shipping_address_switching_to_intl_clears_domestic_columns_with_empty_string
|
||||
- shipping_address_switching_to_domestic_clears_intl_columns_with_null
|
||||
- shipping_address_manual_domestic_input_on_intl_order_is_saved_not_discarded
|
||||
|
||||
- id: change_address_saved_address_carry_over
|
||||
description: |
|
||||
저장된 배송지(address_id) 선택 시 그 주소를 손실 없이 승계한다. 국내 6필드만
|
||||
재구성하던 종전 형태에서는 해외 배송지를 고르면 해외 컬럼이 전부 null 로 덮이고
|
||||
국내 컬럼도 빈 문자열이라 주소가 통째로 사라졌으며, 함께 보낸 배송 메모도 버려졌다.
|
||||
응답은 200 이고 오류도 남지 않아 저장 시점에는 드러나지 않는다.
|
||||
effects:
|
||||
- shipping_address_saved_intl_address_preserves_intl_columns
|
||||
- shipping_address_saved_mode_preserves_delivery_memo_from_request
|
||||
|
||||
test_files:
|
||||
# 백엔드 (비회원 endpoint — 성공/토큰가드 404/검증 422)
|
||||
# 백엔드 (비회원 endpoint — 성공/토큰가드 404/검증 422/국내·해외 조합)
|
||||
- modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/Public/OrderControllerTest.php
|
||||
# 백엔드 (회원 endpoint — 예외→상태코드 분리, 국내/해외 조합, 왕복 전환 초기화)
|
||||
- modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/User/OrderShippingAddressTest.php
|
||||
# 주문 도메인의 다른 액션(취소·구매확정·재주문·입금확인·쿠폰 다운로드) 페어는
|
||||
# 배송지 변경의 축이 아니다 → modules/_bundled/sirsoft-ecommerce/tests/scenarios/order-action-exception-status.yaml
|
||||
# 백엔드 (generic catch 상태코드 전수 계약 — 코어 + 전 번들 확장 컨트롤러)
|
||||
- tests/Feature/Http/GenericCatchStatusCodeContractTest.php
|
||||
# 프론트엔드 핸들러 단위 (endpoint/body/토큰 분기)
|
||||
- modules/_bundled/sirsoft-ecommerce/resources/js/__tests__/handlers/userChangeShippingAddressHandlers.test.ts
|
||||
# 프론트엔드 모달 구조 (Vitest — _global 바인딩, 회원/비회원 분기, 핸들러 호출, 스피너)
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
feature: 실패 리다이렉트 쿼리의 예외 원문 비노출 (Redirect Query Exception Exposure)
|
||||
|
||||
description: |
|
||||
결제 콜백은 실패 사유를 응답 본문이 아니라 **리다이렉트 쿼리스트링**으로 전달한다.
|
||||
그래서 응답 메시지 키를 보는 계약(`tests/Feature/Http/GenericCatchStatusCodeContractTest.php`)
|
||||
의 축 밖에 있다. 그 자리에 예외 원문을 실으면 브라우저 주소창과 참조 로그에 SQL
|
||||
상태코드·클래스명·경로가 남고, 결제 실패 페이지가 그 값을 그대로 출력하므로 구매자에게도
|
||||
노출된다.
|
||||
|
||||
핵심 설계:
|
||||
- 사유 **식별**은 쿼리의 `error` 코드가 담당한다.
|
||||
- 사람에게 보일 **문구**는 다국어 키로 해석한 문장이어야 한다 (`errors.payment_failed`).
|
||||
- 예외 원문은 로그에만 남긴다.
|
||||
|
||||
판정은 소스 전수 스캔이다. 결제대행사 플러그인은 컨트롤러를 `src/Controllers` 에 두고
|
||||
그 밖의 확장은 `src/Http/Controllers` 를 쓰므로, 한 규약만 보면 다른 규약이 통째로
|
||||
사각이 된다. 그래서 모집단이 실제로 그 플러그인들과 리다이렉트 조립 지점을 담고 있는지
|
||||
판정기가 스스로 단언하는 축을 따로 둔다 — 모집단이 비면 위반 0 은 아무것도 증명하지 않는다.
|
||||
|
||||
면제 목록은 비어 있고, 늘어나도 줄어도(해소된 항목이 남아도) 실패한다.
|
||||
|
||||
axes:
|
||||
contract_check: [scanner_population, redirect_query_text]
|
||||
|
||||
exclusions: []
|
||||
|
||||
effects:
|
||||
- redirect_contract_scanner_population_covers_payment_gateway_plugins
|
||||
- redirect_query_omits_exception_text_repository_wide
|
||||
|
||||
scenarios:
|
||||
- id: scanner_actually_sees_the_payment_gateway_convention
|
||||
description: 판정기 모집단이 결제대행사 플러그인 4종과 리다이렉트 URL 조립 지점을 담고 있다
|
||||
effects:
|
||||
- redirect_contract_scanner_population_covers_payment_gateway_plugins
|
||||
|
||||
- id: no_controller_puts_exception_text_in_a_human_visible_redirect_param
|
||||
description: 코어와 전 번들 확장의 컨트롤러 어디에도 리다이렉트 쿼리의 message/msg/reason/detail 자리에 예외 원문을 싣는 지점이 없다
|
||||
effects:
|
||||
- redirect_query_omits_exception_text_repository_wide
|
||||
|
||||
test_files:
|
||||
- tests/Feature/Http/RedirectQueryExceptionTextContractTest.php
|
||||
|
||||
notes: |
|
||||
이 매니페스트는 5차 감사에서 신설됐다. 대상 테스트는 브랜치가 추가했지만 `@scenario`·
|
||||
`@effects` 가 하나도 없어 어느 매니페스트에도 묶이지 않았다. 형제 파일
|
||||
`GenericCatchStatusCodeContractTest.php` 는 매니페스트에 등록돼 있었는데 이 파일만
|
||||
빠져 있었고, 마커도 선언도 없으면 test-scenario-coverage 의 두 방향 검사 어느 쪽에도
|
||||
걸리지 않아 조용히 통과한다.
|
||||
|
||||
응답 본문 축은 `tests/scenarios/exception-response-exposure.yaml` 이 담당한다. 이쪽은
|
||||
통로가 리다이렉트 쿼리라 노출 대상(구매자)과 판정 방식(소스 전수 스캔)이 달라 분리한다.
|
||||
Reference in new issue
Block a user