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());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user