fix(core): 레이아웃 첨부 URL 이 항상 프록시로 발급되던 결함 수정
공개 자산 스토리지를 설정해도 레이아웃 배경 이미지가 매번 오리진 PHP 를 거쳐 서빙되던 결함을 고친다 (https://github.com/gnuboard/g7/issues/134). 판정 기준은 운영자가 명시 선언한 core.storage.public_asset_disk 와 행 disk 의 일치다 — 디스크의 url 설정 유무로 판정하면 비공개 버킷에 공개 URL 이 설정된 구성에서 발급된 주소가 403 이 되어 그 이미지가 전부 깨진다. 전수조사에서 함께 처리한 것: 게시판 첨부 응답 url 칸(항상 null → 게이트가 살아 있는 서빙 URL), 페이지의 미배선 메서드 삭제, 확장 카테고리별 저장소 URL·경로 조회 교정, 그리고 이번 변경이 새로 만드는 고아 disk 위험 방어 (무인증 공개 서빙 라우트가 500 이 되는 것을 404 로 degrade). 문서화 하네스도 함께 보강한다. 실측을 수행하고도 이력 문서에는 판정만 남기면 대화 로그가 사라진 뒤 아무에게도 도달하지 않는데, 그 강제가 보고 형식에만 있었다.
This commit is contained in:
1 parent
e160a86f0d
commit
5c2e42c133
42 files changed
+1427
-83
No files matched your search
@@ -4,6 +4,12 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.1.2] - 2026-09-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- 첨부파일을 올린 뒤 돌려주는 응답의 파일 주소 칸이 늘 비어 있던 문제를 수정했습니다. 이 칸을 읽어 연동하던 외부 도구는 주소를 얻지 못했습니다. 이제 게시판의 첨부 다운로드 주소가 채워지며, 이 주소는 비밀글·삭제글 확인을 그대로 거치므로 볼 수 없는 첨부가 열리지는 않습니다.
|
||||
|
||||
## [1.1.1] - 2026-09-06
|
||||
|
||||
### Added
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<!-- @generated:badges START — ext:docgen 이 갱신. 이 블록 안은 직접 수정하지 않는다 -->
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-1.1.1-0066FF?style=flat-square" alt="version 1.1.1">
|
||||
<img src="https://img.shields.io/badge/version-1.1.2-0066FF?style=flat-square" alt="version 1.1.2">
|
||||
<img src="https://img.shields.io/badge/type-%EB%AA%A8%EB%93%88-555555?style=flat-square" alt="type 모듈">
|
||||
<img src="https://img.shields.io/badge/%EA%B7%B8%EB%88%84%EB%B3%B4%EB%93%9C7-%3E%3D7.0.10-1F883D?style=flat-square" alt="그누보드7 >=7.0.10">
|
||||
<img src="https://img.shields.io/badge/license-MIT-8250DF?style=flat-square" alt="license MIT">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "modules/sirsoft-board",
|
||||
"description": "Board module for Gnuboard7",
|
||||
"type": "library",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f3ccc886d4904110ff4788fd5bc9e15d",
|
||||
"content-hash": "dd055a1a5b6c59b9e30d2eaeb74b3416",
|
||||
"packages": [],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"ko": "게시판",
|
||||
"en": "Board"
|
||||
},
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"description": {
|
||||
"ko": "게시판 관리를 위한 모듈",
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@g7/sirsoft-board",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@g7/sirsoft-board",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"devDependencies": {
|
||||
"jsdom": "^27.4.0",
|
||||
"typescript": "^5.3.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@g7/sirsoft-board",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "그누보드7 게시판 모듈 프론트엔드 에셋",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -792,6 +792,10 @@ class AttachmentService
|
||||
/**
|
||||
* 첨부파일 URL 조회
|
||||
*
|
||||
* 게시판 첨부는 비밀글·삭제글 게이트가 걸린 서빙 경로를 통해서만 내보낸다.
|
||||
* 직접 URL(CDN)로 바꾸면 그 게이트가 통째로 우회되므로, 게이트가 살아 있는
|
||||
* 다운로드 서빙 URL 을 돌려준다.
|
||||
*
|
||||
* @param string $slug 게시판 식별자
|
||||
* @param int $id 첨부파일 ID
|
||||
* @return string|null 파일 URL 또는 없을 경우 null
|
||||
@@ -800,11 +804,7 @@ class AttachmentService
|
||||
{
|
||||
$attachment = $this->repository->findById($slug, $id);
|
||||
|
||||
if (! $attachment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->storage->url('attachments', $attachment->path);
|
||||
return $attachment?->download_url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -823,29 +823,54 @@ class AttachmentServiceTest extends ModuleTestCase
|
||||
HookManager::clearAction('sirsoft-board.attachment.after_download');
|
||||
}
|
||||
|
||||
/**
|
||||
* 업로드 응답의 url 칸이 게이트가 살아 있는 서빙 URL 이어야 합니다.
|
||||
*
|
||||
* 이전에는 비공개 디스크에서 항상 null 이 나가 응답의 url 칸이 늘 비어 있었다.
|
||||
* 게시판 첨부는 비밀글·삭제글 게이트가 걸려 있으므로 직접 URL 로 바꾸지 않고,
|
||||
* 그 게이트를 통과하는 다운로드 서빙 URL 로 채운다.
|
||||
*
|
||||
* @effects board_upload_response_url_uses_gated_route, download_url_falls_back_to_api_path_when_direct_unavailable
|
||||
*/
|
||||
#[Test]
|
||||
public function test_get_url_returns_url(): void
|
||||
public function test_get_url_returns_gated_serving_url(): void
|
||||
{
|
||||
// Arrange
|
||||
$attachment = new Attachment([
|
||||
'id' => 1,
|
||||
'path' => 'notice/2025/01/21/test.jpg',
|
||||
]);
|
||||
$attachment->hash = 'abc123def456';
|
||||
$attachment->setRelation('board', new Board(['slug' => 'notice']));
|
||||
|
||||
$this->repository->shouldReceive('findById')
|
||||
->once()
|
||||
->with('notice', 1)
|
||||
->andReturn($attachment);
|
||||
|
||||
$this->storage->shouldReceive('url')
|
||||
->once()
|
||||
->with('attachments', 'notice/2025/01/21/test.jpg')
|
||||
->andReturn('https://example.com/storage/modules/sirsoft-board/attachments/notice/2025/01/21/test.jpg');
|
||||
// 직접 URL 은 시도조차 하지 않는다 (게이트 우회 차단)
|
||||
$this->storage->shouldNotReceive('url');
|
||||
|
||||
// Act
|
||||
$result = $this->service->getUrl('notice', 1);
|
||||
|
||||
// Assert
|
||||
$this->assertEquals('https://example.com/storage/modules/sirsoft-board/attachments/notice/2025/01/21/test.jpg', $result);
|
||||
$this->assertSame(
|
||||
'/api/modules/sirsoft-board/boards/notice/attachment/abc123def456',
|
||||
$result
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부가 없으면 null 이어야 합니다 (기존 계약 유지).
|
||||
*/
|
||||
#[Test]
|
||||
public function test_get_url_returns_null_when_attachment_missing(): void
|
||||
{
|
||||
$this->repository->shouldReceive('findById')
|
||||
->once()
|
||||
->with('notice', 99)
|
||||
->andReturnNull();
|
||||
|
||||
$this->assertNull($this->service->getUrl('notice', 99));
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,13 @@
|
||||
관계없이 같은 방식으로 자산 URL 을 내도록 묶습니다. 표에 모델처럼 잡힌 것은 수집기가 클래스
|
||||
파일 단위로 세기 때문이며, 테이블이 `(규약)` 인 것이 그 표식입니다.
|
||||
|
||||
이 규약은 **권한 검사가 걸린 자산에는 배선하지 않는 것이 원칙**입니다 — 직접 URL 은 서버
|
||||
스트리밍 경로의 검사를 우회합니다. 예외가 하나 있습니다: `ProductReviewImage` 는 이 규약을
|
||||
씁니다. 리뷰 노출 상태는 리소스 층에서 걸러지므로 숨김 리뷰의 이미지는 응답에 실리지
|
||||
않지만, 공개 자산 디스크를 켠 상태에서 **이미 발급된 직접 URL 을 아는 쪽은 노출→숨김 전환
|
||||
이후에도 그 파일에 접근할 수 있습니다.** 노출 상태를 접근 차단 수단으로 써야 하는 운용이라면
|
||||
그 카테고리에 공개 자산 디스크를 적용하지 않아야 합니다.
|
||||
|
||||
**`HasUserOverrides` 를 쓰는 셋**(`ClaimReason` · `ShippingCarrier` · `ShippingType`)은 시더가
|
||||
기본값을 넣지만 운영자가 고칠 수 있는 테이블입니다. 시더를 다시 돌려도 운영자 수정분은
|
||||
보존되므로, 이 셋의 기본 데이터를 바꿀 때는 시더만 고쳐서는 기설치본에 반영되지 않습니다.
|
||||
|
||||
@@ -16,6 +16,13 @@ use Modules\Sirsoft\Ecommerce\Support\AssetStorage;
|
||||
* 이미지 외의 완전 공개 자산 모델도 재사용할 수 있습니다. 단, 권한 검사가 걸린
|
||||
* 첨부파일(비밀글/회원 전용 게시판 등)에는 배선하지 않습니다 — 직접 URL 은
|
||||
* 서버 스트리밍 경로의 권한 검사를 우회합니다.
|
||||
*
|
||||
* 알려진 예외와 그 한계 — `ProductReviewImage` 는 이 trait 을 씁니다. 리뷰 노출 상태는
|
||||
* 리소스 층에서 걸러지므로 HIDDEN 리뷰의 이미지는 응답에 실리지 않지만, 공개 자산
|
||||
* 디스크를 켠 상태에서 **이미 발급된 직접 URL 을 알고 있는 쪽은 VISIBLE→HIDDEN 전환
|
||||
* 이후에도 그 파일에 접근할 수 있습니다.** 직접 URL 은 저장소의 파일을 직접 가리키므로
|
||||
* 응답에서 감추는 것으로는 회수되지 않습니다. 노출 상태를 접근 차단 수단으로 써야 하는
|
||||
* 운용이라면 그 카테고리에 공개 자산 디스크를 적용하지 않아야 합니다.
|
||||
*/
|
||||
trait HasDirectAssetUrl
|
||||
{
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.1.2] - 2026-09-08
|
||||
|
||||
### Removed
|
||||
|
||||
- 사용되지 않던 첨부파일 주소 조회 기능을 제거했습니다. 화면·API 어디에서도 호출되지 않았고 항상 빈 값을 돌려주던 기능이라 실제 동작 변화는 없습니다.
|
||||
|
||||
## [1.1.1] - 2026-09-06
|
||||
|
||||
### Added
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<!-- @generated:badges START — ext:docgen 이 갱신. 이 블록 안은 직접 수정하지 않는다 -->
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-1.1.1-0066FF?style=flat-square" alt="version 1.1.1">
|
||||
<img src="https://img.shields.io/badge/version-1.1.2-0066FF?style=flat-square" alt="version 1.1.2">
|
||||
<img src="https://img.shields.io/badge/type-%EB%AA%A8%EB%93%88-555555?style=flat-square" alt="type 모듈">
|
||||
<img src="https://img.shields.io/badge/%EA%B7%B8%EB%88%84%EB%B3%B4%EB%93%9C7-%3E%3D7.0.10-1F883D?style=flat-square" alt="그누보드7 >=7.0.10">
|
||||
<img src="https://img.shields.io/badge/license-MIT-8250DF?style=flat-square" alt="license MIT">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "modules/sirsoft-page",
|
||||
"description": "Page module for Gnuboard7",
|
||||
"type": "library",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b5b9d14252427e57c4bc8c36e891c5de",
|
||||
"content-hash": "024fea001a7af7fa7570756507a49ec2",
|
||||
"packages": [],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"ko": "페이지",
|
||||
"en": "Page"
|
||||
},
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"description": {
|
||||
"ko": "정적 페이지(정보/정책/안내) 관리 모듈",
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@g7/sirsoft-page",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@g7/sirsoft-page",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"devDependencies": {
|
||||
"jsdom": "^27.4.0",
|
||||
"typescript": "^5.3.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@g7/sirsoft-page",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "그누보드7 페이지 모듈 프론트엔드 에셋",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -470,17 +470,6 @@ class PageAttachmentService
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 URL을 반환합니다.
|
||||
*
|
||||
* @param PageAttachment $attachment 첨부파일 모델
|
||||
* @return string|null 파일 URL 또는 null
|
||||
*/
|
||||
public function getUrl(PageAttachment $attachment): ?string
|
||||
{
|
||||
return $this->storage->url('attachments', $attachment->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일 삭제 권한을 확인합니다.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user