From 24e5305a801973d5827ca6b4c1d60a9fcf82829e Mon Sep 17 00:00:00 2001 From: Junseong Park <39112954+jsparkdev@users.noreply.github.com> Date: Mon, 9 Jun 2025 10:29:36 +0900 Subject: [PATCH 1/3] i18n(ko-KR): update `csp.mdx` --- .../ko/reference/experimental-flags/csp.mdx | 78 ++++++++++--------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/src/content/docs/ko/reference/experimental-flags/csp.mdx b/src/content/docs/ko/reference/experimental-flags/csp.mdx index 6b981bc66f469..c3e18541989ca 100644 --- a/src/content/docs/ko/reference/experimental-flags/csp.mdx +++ b/src/content/docs/ko/reference/experimental-flags/csp.mdx @@ -12,9 +12,9 @@ import Since from '~/components/Since.astro'

- **타입:** `boolean | object`
- **기본값:** `false`
- +**타입:** `boolean | object`
+**기본값:** `false`
+

[콘텐츠 보안 정책 (CSP)](https://developer.mozilla.org/ko/docs/Web/HTTP/Guides/CSP) 지원을 활성화하여 문서가 로드할 수 있는 리소스를 제어함으로써 특정 유형의 보안 위협을 최소화합니다. 이는 [교차 사이트 스크립팅 (XSS)](https://developer.mozilla.org/ko/docs/Glossary/Cross-site_scripting) 공격에 대한 추가적인 보호를 제공합니다. @@ -86,7 +86,7 @@ export default defineConfig({

-**타입:** `CspDirective[]`
+**타입:** `CspDirective[]`
**기본값:** `[]`

@@ -103,7 +103,7 @@ export default defineConfig({ csp: { directives: [ "default-src 'self'", - "image-src 'self' 'https://images.cdn.example.com'" + "img-src 'self' 'https://images.cdn.example.com'" ] } } @@ -117,18 +117,18 @@ export default defineConfig({ http-equiv="content-security-policy" content=" default-src 'self'; - image-src 'self' 'https://images.cdn.example.com'; + img-src 'self' 'https://images.cdn.example.com'; script-src 'self' 'sha256-somehash'; style-src 'self' 'sha256-somehash'; " > ``` -### `styleDirective` and `scriptDirective` +### `styleDirective` 및 `scriptDirective`

-**타입:** `object`
+**타입:** `object`
**기본값:** `{}`

@@ -141,7 +141,7 @@ export default defineConfig({

-**타입:** `string[]`
+**타입:** `string[]`
**기본값:** `[]`

@@ -192,7 +192,7 @@ export default defineConfig({

-**타입:** `CspHash[]`
+**타입:** `CspHash[]`
**기본값:** `[]`

@@ -234,8 +234,8 @@ export default defineConfig({ ``` @@ -244,7 +244,7 @@ export default defineConfig({

-**타입:** `boolean`
+**타입:** `boolean`
**기본값:** `false`

@@ -264,34 +264,36 @@ export default defineConfig({ } }); ``` + ## 런타임 API `.astro` 컴포넌트의 런타임 API (`Astro` global을 통해 사용 가능) 또는 엔드포인트 및 미들웨어의 `APIContext` 타입을 통해 페이지별 `` 요소를 사용자 정의할 수 있습니다. -### `addDirective` +### `insertDirective`

- **타입:** `(directive: CspDirective) => void`
- + +**타입:** `(directive: CspDirective) => void`
+

현재 페이지에 하나의 지시어를 추가합니다. 이 메서드를 여러 번 호출하여 여러 지시어를 추가할 수도 있습니다. ```astro --- -Astro.addDirective("default-src 'self'"); -Astro.addDirective("img-src 'self' 'https://images.cdn.example.com'"); +Astro.insertDirective("default-src 'self'"); +Astro.insertDirective("img-src 'self' 'https://images.cdn.example.com'"); --- ``` -빌드 후, 이 페이지의 `` 요소는 포함된 `style-src` 및 `script-src` 지시어에 새로운 지시어를 추가합니다. +빌드 후, 이 페이지의 `` 요소는 기존 `script-src` 및 `style-src` 지시어와 추가 지시어를 함께 배치합니다. ```html - **타입:** `(resource: string) => void`
- + +**타입:** `(resource: string) => void`
+

`style-src` 지시어에 사용할 새 리소스를 삽입합니다. ```astro --- -Astro.insertStyleResource("'https://styles.cdn.example.com'"); +Astro.insertStyleResource("https://styles.cdn.example.com"); --- ``` @@ -325,19 +328,19 @@ Astro.insertStyleResource("'https://styles.cdn.example.com'"); > ``` - -### `addStyleHash` +### `insertStyleHash`

- **타입:** `(hash: CspHash) => void`
- + +**타입:** `(hash: CspHash) => void`
+

`style-src` 지시어에 새 해시를 추가합니다. ```astro --- -Astro.addStyleHash("sha512-styleHash"); +Astro.insertStyleHash("sha512-styleHash"); --- ``` @@ -353,20 +356,19 @@ Astro.addStyleHash("sha512-styleHash"); > ``` - ### `insertScriptResource`

- **타입:** `(resource: string) => void`
- + +**타입:** `(resource: string) => void`
+

`script-src` 지시어에 사용할 새 유효한 소스를 삽입합니다. - ```astro --- -Astro.insertScriptResource("'https://scripts.cdn.example.com'"); +Astro.insertScriptResource("https://scripts.cdn.example.com"); --- ``` @@ -382,19 +384,19 @@ Astro.insertScriptResource("'https://scripts.cdn.example.com'"); > ``` -### `addScriptHash` +### `insertScriptHash`

- **타입:** `(hash: CspHash) => void`
- + +**타입:** `(hash: CspHash) => void`
+

`script-src` 지시어에 새 해시를 추가합니다. - ```astro --- -Astro.addScriptHash("sha512-scriptHash"); +Astro.insertScriptHash("sha512-scriptHash"); --- ``` From 7e083687bb7ea4c4075427bc332e71db07280678 Mon Sep 17 00:00:00 2001 From: Junseong Park <39112954+jsparkdev@users.noreply.github.com> Date: Tue, 10 Jun 2025 10:15:31 +0900 Subject: [PATCH 2/3] apply new changes --- src/content/docs/ko/reference/experimental-flags/csp.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/content/docs/ko/reference/experimental-flags/csp.mdx b/src/content/docs/ko/reference/experimental-flags/csp.mdx index c3e18541989ca..da3c279eb7371 100644 --- a/src/content/docs/ko/reference/experimental-flags/csp.mdx +++ b/src/content/docs/ko/reference/experimental-flags/csp.mdx @@ -1,5 +1,5 @@ --- -title: 실험적 콘텐츠 보안 정책 +title: 실험적 콘텐츠 보안 정책 (CSP) sidebar: label: 콘텐츠 보안 정책 i18nReady: true @@ -21,7 +21,9 @@ import Since from '~/components/Since.astro' 이 기능을 활성화하면 기본적으로 **Astro에 의해 처리되고 번들링된 스크립트 및 스타일에** 추가 보안이 적용되며, 이러한 콘텐츠 유형과 추가적인 콘텐츠 유형을 더욱 세밀하게 구성할 수 있습니다. -이 실험적인 CSP 기능에는 몇 가지 제한 사항이 있습니다. 인라인 스크립트는 기본적으로 지원되지 않지만, 외부 및 인라인 스크립트에 [자체 해시를 제공](#hashes)할 수 있습니다. 또한 ``를 사용하는 [Astro의 뷰 전환](/ko/guides/view-transitions/)은 아직 완전히 지원되지 않습니다. 다른 페이지로 이동할 때 일부 스타일이 적용되지 않거나 일부 스크립트가 실행되지 않을 수 있습니다. +이 실험적인 CSP 기능에는 몇 가지 제한 사항이 있습니다. 인라인 스크립트는 기본적으로 지원되지 않지만, 외부 및 인라인 스크립트에 [자체 해시를 제공](#hashes)할 수 있습니다. + +``를 사용하는 [Astro의 뷰 전환](/ko/guides/view-transitions/)은 지원되지 않습니다. 하지만 Astro를 사용하여 네이티브 뷰 전환 및 탐색 API를 향상시키지 않는 경우, [브라우저의 네이티브 뷰 전환 API로 마이그레이션하는 것을 고려](https://events-3bg.pages.dev/jotter/astro-view-transitions/)할 수 있습니다. :::note Vite 개발 서버의 특성상, `dev` 모드에서 작업하는 동안에는 이 기능이 지원되지 않습니다. 대신 `build` 및 `preview`를 사용하면 Astro 프로젝트에서 이 기능을 테스트할 수 있습니다. From b6bd7324cfc442070d86521ba7a05cc375427c68 Mon Sep 17 00:00:00 2001 From: Junseong Park <39112954+jsparkdev@users.noreply.github.com> Date: Tue, 10 Jun 2025 10:16:29 +0900 Subject: [PATCH 3/3] fix line --- src/content/docs/ko/reference/experimental-flags/csp.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/content/docs/ko/reference/experimental-flags/csp.mdx b/src/content/docs/ko/reference/experimental-flags/csp.mdx index da3c279eb7371..ca1a1537e1c8d 100644 --- a/src/content/docs/ko/reference/experimental-flags/csp.mdx +++ b/src/content/docs/ko/reference/experimental-flags/csp.mdx @@ -21,9 +21,7 @@ import Since from '~/components/Since.astro' 이 기능을 활성화하면 기본적으로 **Astro에 의해 처리되고 번들링된 스크립트 및 스타일에** 추가 보안이 적용되며, 이러한 콘텐츠 유형과 추가적인 콘텐츠 유형을 더욱 세밀하게 구성할 수 있습니다. -이 실험적인 CSP 기능에는 몇 가지 제한 사항이 있습니다. 인라인 스크립트는 기본적으로 지원되지 않지만, 외부 및 인라인 스크립트에 [자체 해시를 제공](#hashes)할 수 있습니다. - -``를 사용하는 [Astro의 뷰 전환](/ko/guides/view-transitions/)은 지원되지 않습니다. 하지만 Astro를 사용하여 네이티브 뷰 전환 및 탐색 API를 향상시키지 않는 경우, [브라우저의 네이티브 뷰 전환 API로 마이그레이션하는 것을 고려](https://events-3bg.pages.dev/jotter/astro-view-transitions/)할 수 있습니다. +이 실험적인 CSP 기능에는 몇 가지 제한 사항이 있습니다. 인라인 스크립트는 기본적으로 지원되지 않지만, 외부 및 인라인 스크립트에 [자체 해시를 제공](#hashes)할 수 있습니다. ``를 사용하는 [Astro의 뷰 전환](/ko/guides/view-transitions/)은 지원되지 않습니다. 하지만 Astro를 사용하여 네이티브 뷰 전환 및 탐색 API를 향상시키지 않는 경우, [브라우저의 네이티브 뷰 전환 API로 마이그레이션하는 것을 고려](https://events-3bg.pages.dev/jotter/astro-view-transitions/)할 수 있습니다. :::note Vite 개발 서버의 특성상, `dev` 모드에서 작업하는 동안에는 이 기능이 지원되지 않습니다. 대신 `build` 및 `preview`를 사용하면 Astro 프로젝트에서 이 기능을 테스트할 수 있습니다.