@eliceio/cdk-cli 1.8.1-documentqa.0 → 1.9.0-youtubeqa.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/es/commands/create/scaffold.d.ts +1 -1
- package/es/commands/create/scaffold.js +1 -1
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +1 -1
- package/es/dev/host-page.js +1 -1
- package/es/dev/server.d.ts +1 -1
- package/es/dev/server.js +1 -1
- package/es/rules/check.js +3 -3
- package/es/rules/csp.d.ts +3 -3
- package/es/rules/csp.js +32 -7
- package/es/rules.json.js +1 -1
- package/package.json +2 -2
- package/rules.json +3 -3
- package/skills/_shared/references/02-design-the-material.md +1 -1
- package/skills/_shared/references/03-create-the-project.md +1 -0
- package/skills/_shared/references/04-rules.md +1 -1
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +1 -1
- package/skills/_shared/references/18-using-the-lesson-template.md +1 -1
- package/skills/elice-content-create/SKILL.md +1 -1
- package/templates/document/README.md +3 -5
- package/templates/document/core/viewer.js +1 -4
- package/templates/document/screens/learn.js +2 -47
- package/templates/document/styles.css +0 -73
- package/templates/document/template.json +1 -1
- package/templates/document/ui/templates/viewer.js +3 -8
- package/templates/document/ui/texts.js +0 -2
- package/templates/document/ui/theme.css +0 -2
- package/templates/youtube/README.md +66 -0
- package/templates/youtube/commentary.txt +2 -0
- package/templates/youtube/core/dom.d.ts +13 -0
- package/templates/youtube/core/dom.js +83 -0
- package/templates/youtube/core/settings.d.ts +21 -0
- package/templates/youtube/core/settings.js +71 -0
- package/templates/youtube/core/youtube.d.ts +9 -0
- package/templates/youtube/core/youtube.js +111 -0
- package/templates/youtube/edit.html +17 -0
- package/templates/youtube/gitignore +4 -0
- package/templates/youtube/index.html +17 -0
- package/templates/youtube/metadata.json +9 -0
- package/templates/youtube/package.json +13 -0
- package/templates/youtube/screens/edit.js +69 -0
- package/templates/youtube/screens/learn.js +18 -0
- package/templates/youtube/styles.css +101 -0
- package/templates/youtube/template.json +14 -0
- package/templates/youtube/ui/templates/edit.js +60 -0
- package/templates/youtube/ui/templates/player.js +61 -0
- package/templates/youtube/ui/texts.d.ts +3 -0
- package/templates/youtube/ui/texts.js +50 -0
- package/templates/youtube/ui/theme.css +14 -0
package/README.md
CHANGED
|
@@ -196,12 +196,12 @@ ecdk dev --check --screens learn,edit --viewport mobile --json
|
|
|
196
196
|
|
|
197
197
|
터미널에 콘텐츠의 콘솔 오류 · 404가 나오면 고칩니다. 화면 위 기록과 터미널의 **막힌 외부 요청: <주소> (<지시어>)**는 콘텐츠 CSP가 막은 요청입니다 (외부 이미지 · 글꼴 · `fetch`, 라이브러리가 실행 중 부르는 외부 주소). LXP에서도 막히므로 파일을 zip 안에 넣습니다.
|
|
198
198
|
|
|
199
|
-
`ecdk dev`의 콘텐츠는 Vite dev 서버(ecdk 플러그인)가 원본을 바로 줍니다 (고치면 Vite HMR로 다시 뜸). 콘텐츠 응답의 CSP는 서버에 요청한 운영 콘텐츠 CSP 초안과 같고 (`src/rules/csp.ts`, 서버 값이 확정되면 맞춤), `connect-src`에만 Vite HMR 웹소켓(`ws://127.0.0.1:4171`)과 자료 파일 경로 두 개(보기: 콘텐츠 경로 `assets/`, 올리기 PUT: `http://127.0.0.1:4171/__ecdk/blob/`, 문서 템플릿이 씀)를 더합니다. 운영 CSP는 넓히지 않습니다: 운영에서 자료 파일을 쓰려면 서버 CSP의 `connect-src`에 콘텐츠 출처(asset 경로)와 파일 저장소 출처가 더해져야 합니다. `img-src`의 `https://datahub-central-01.elice.io`는 서버가 엔트리 AI 채점 피드백의 블록 그림용으로 더하는 출처(서버 `CONTENT_CSP_IMG_ORIGINS`, 모든 환경)라 그대로 따릅니다 (그림만, `script-src` · `connect-src`에는 없음). dev에서는 `{CONTENT_HOST}` = 콘텐츠 출처(`http://127.0.0.1:4171`), `{MATERIAL_API}` · `{LXP_ORIGINS}` = 흉내 화면(`http://localhost:4170`)이고, 허용 목록(`rules.json` `externalAllow`)의 출처를 해당 지시어에 더합니다 (`'none'`만 있던 지시어는 `'none'`을 뺌). 지금 허용 목록은 `frame-src`의 엔트리 워크스페이스(`https://entry-workspace.elice.io`, entry 템플릿)뿐이고 `style-src` · `font-src`는 비어 있습니다. dev는 `frame-src`에 로컬 엔트리 워크스페이스 `http://localhost:9000`도 더합니다 (운영 CSP에는 없음). 운영 서버 CSP에 워크스페이스
|
|
199
|
+
`ecdk dev`의 콘텐츠는 Vite dev 서버(ecdk 플러그인)가 원본을 바로 줍니다 (고치면 Vite HMR로 다시 뜸). 콘텐츠 응답의 CSP는 서버에 요청한 운영 콘텐츠 CSP 초안과 같고 (`src/rules/csp.ts`, 서버 값이 확정되면 맞춤), `connect-src`에만 Vite HMR 웹소켓(`ws://127.0.0.1:4171`)과 자료 파일 경로 두 개(보기: 콘텐츠 경로 `assets/`, 올리기 PUT: `http://127.0.0.1:4171/__ecdk/blob/`, 문서 템플릿이 씀)를 더합니다. 운영 CSP는 넓히지 않습니다: 운영에서 자료 파일을 쓰려면 서버 CSP의 `connect-src`에 콘텐츠 출처(asset 경로)와 파일 저장소 출처가 더해져야 합니다. `img-src`의 `https://datahub-central-01.elice.io`는 서버가 엔트리 AI 채점 피드백의 블록 그림용으로 더하는 출처(서버 `CONTENT_CSP_IMG_ORIGINS`, 모든 환경)라 그대로 따릅니다 (그림만, `script-src` · `connect-src`에는 없음). dev에서는 `{CONTENT_HOST}` = 콘텐츠 출처(`http://127.0.0.1:4171`), `{MATERIAL_API}` · `{LXP_ORIGINS}` = 흉내 화면(`http://localhost:4170`)이고, 허용 목록(`rules.json` `externalAllow`)의 출처를 해당 지시어에 더합니다 (`'none'`만 있던 지시어는 `'none'`을 뺌). 지금 허용 목록은 `frame-src`의 엔트리 워크스페이스(`https://entry-workspace.elice.io`, entry 템플릿)와 YouTube 플레이어 경로(`https://www.youtube-nocookie.com/embed/`, youtube 템플릿, 이 경로 아래 주소만)뿐이고 `style-src` · `font-src`는 비어 있습니다. dev는 `frame-src`에 로컬 엔트리 워크스페이스 `http://localhost:9000`도 더합니다 (운영 CSP에는 없음). 운영 서버 CSP에 워크스페이스 출처 · YouTube 경로가 들어가기 전에는 LXP에서 entry 템플릿의 워크스페이스 · youtube 템플릿의 플레이어가 뜨지 않습니다.
|
|
200
200
|
|
|
201
201
|
<!-- 콘텐츠 CSP: src/rules/csp.ts contentCsp()와 같아야 한다 (src/docs.test.ts가 확인) -->
|
|
202
202
|
|
|
203
203
|
````text
|
|
204
|
-
sandbox allow-scripts allow-same-origin
|
|
204
|
+
sandbox allow-scripts allow-same-origin;
|
|
205
205
|
default-src 'none';
|
|
206
206
|
script-src {CONTENT_HOST} 'unsafe-inline' 'unsafe-eval' blob:;
|
|
207
207
|
style-src {CONTENT_HOST} 'unsafe-inline';
|
|
@@ -210,7 +210,7 @@ font-src {CONTENT_HOST} data:;
|
|
|
210
210
|
media-src {CONTENT_HOST} data: blob:;
|
|
211
211
|
connect-src {MATERIAL_API};
|
|
212
212
|
worker-src blob:;
|
|
213
|
-
frame-src https://entry-workspace.elice.io
|
|
213
|
+
frame-src https://entry-workspace.elice.io https://www.youtube-nocookie.com/embed/;
|
|
214
214
|
form-action 'none';
|
|
215
215
|
object-src 'none';
|
|
216
216
|
base-uri {CONTENT_HOST};
|
|
@@ -219,7 +219,7 @@ frame-ancestors {LXP_ORIGINS}
|
|
|
219
219
|
``` 파일을 브라우저로 직접 열면(`file://`) 운영과 조건이 달라 확인이 되지 않습니다.
|
|
220
220
|
|
|
221
221
|
```bash
|
|
222
|
-
ecdk build # [ok] dist/content.zip · 파일 6개 · 149.4KB (엔진 vite, 규칙 0.
|
|
222
|
+
ecdk build # [ok] dist/content.zip · 파일 6개 · 149.4KB (엔진 vite, 규칙 0.24.0)
|
|
223
223
|
````
|
|
224
224
|
|
|
225
225
|
`[ok]`면 서버와 같은 규칙을 통과한 것입니다. 오류는 규칙 id로 [검사 규칙](#검사-규칙)을 찾습니다.
|
|
@@ -535,19 +535,19 @@ q1=b;q2=a,d;q3=c,a,b;q4=가중치;q5=g1:a|g2:b,c
|
|
|
535
535
|
|
|
536
536
|
공통 옵션: `--json`(기계용 출력), `--help`, `--version`
|
|
537
537
|
|
|
538
|
-
| 명령
|
|
539
|
-
|
|
|
540
|
-
| `ecdk create <폴더> [--template quiz\|blank\|steps\|document\|survey\|video\|entry\|board\|lesson] [--theme light\|dark] [--no-install]` · `ecdk create --list` | 프로젝트 만들기 (비어 있지 않은 폴더는 거절) + `npm install`(SDK). `--no-install`은 설치를 건너뜀. `--list`는 템플릿 목록 · 버전 · 설명 | 0 · 1 설치 실패(프로젝트는 둠) · 2 |
|
|
541
|
-
| `ecdk dev [폴더] [--port 4170]`
|
|
542
|
-
| `ecdk dev [폴더] --check [--screens …] [--viewport desktop,mobile] [--step all\|1,2] [--theme light\|dark\|all] [--json]`
|
|
543
|
-
| `ecdk validate [폴더\|.zip\|.html]`
|
|
544
|
-
| `ecdk build [폴더]`
|
|
545
|
-
| `ecdk doctor [폴더] [--fix]`
|
|
546
|
-
| `ecdk setup [--only skills\|mcp] [--project] [--url <주소>] [--target claude\|helpycode\|all] [--force]`
|
|
547
|
-
| `ecdk setup --only skills [--project] [--force]`
|
|
548
|
-
| `ecdk setup --only mcp [--url <주소>] [--target claude\|helpycode\|all] [--force]`
|
|
549
|
-
| `ecdk update [--project] [--check]`
|
|
550
|
-
| `ecdk uninstall [--only skills\|mcp] [--project] [--target claude\|helpycode\|all] [--force]`
|
|
538
|
+
| 명령 | 하는 일 | 종료 코드 |
|
|
539
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
540
|
+
| `ecdk create <폴더> [--template quiz\|blank\|steps\|document\|survey\|video\|youtube\|entry\|board\|lesson] [--theme light\|dark] [--no-install]` · `ecdk create --list` | 프로젝트 만들기 (비어 있지 않은 폴더는 거절) + `npm install`(SDK). `--no-install`은 설치를 건너뜀. `--list`는 템플릿 목록 · 버전 · 설명 | 0 · 1 설치 실패(프로젝트는 둠) · 2 |
|
|
541
|
+
| `ecdk dev [폴더] [--port 4170]` | LXP 흉내 화면 + 운영 조건(다른 출처 · sandbox · 콘텐츠 CSP)으로 콘텐츠 띄우기, 막힌 외부 요청 알림, 고치면 다시 검사 · 새로 띄움 | Ctrl+C |
|
|
542
|
+
| `ecdk dev [폴더] --check [--screens …] [--viewport desktop,mobile] [--step all\|1,2] [--theme light\|dark\|all] [--json]` | 같은 서버를 띄워 화면 × 폭마다 헤드리스 브라우저로 열고 확인(그려짐 · 콘솔 오류 · 예외 · 막힌 요청 · 실패한 요청 · 가로 넘침) → 그림 `.ecdk/screens/` → 끝냄 | 0 · 1 문제 있음 · 2 · 3 브라우저 없음 |
|
|
543
|
+
| `ecdk validate [폴더\|.zip\|.html]` | 서버와 같은 규칙으로 검사 (프로젝트는 `ecdk build` 결과를 검사) | 0 통과 · 1 오류 · 2 |
|
|
544
|
+
| `ecdk build [폴더]` | 빼기 → SDK 넣기(`node_modules`) → metadata → 묶기 · 묶은 원본 빼기 → minify(기본) → 검사 → `dist/content.zip` | 0 · 1 검사 오류(zip 없음) · 2 설정 오류 · SDK 미설치 |
|
|
545
|
+
| `ecdk doctor [폴더] [--fix]` | 환경 · 프로젝트 점검, `--fix`는 자동으로 고칠 수 있는 항목만 | 0 · 1 실패 · 2 |
|
|
546
|
+
| `ecdk setup [--only skills\|mcp] [--project] [--url <주소>] [--target claude\|helpycode\|all] [--force]` | 처음 한 번: 스킬 설치(전역) → MCP 등록 → 점검 요약(Node · 스킬 · MCP) → 로그인 안내. 다시 실행해도 됨(있는 것은 건너뛰고 옛 것 · 빠진 것만 고침). MCP는 배포 전 · 직접 할 일이 남아도 실패로 치지 않음("직접 할 일"), `--only` 없이는 `--force`가 MCP에만 | 0 스킬 설치됨 · 1 스킬 실패 · 2 |
|
|
547
|
+
| `ecdk setup --only skills [--project] [--force]` | Claude Code 스킬만 설치 · 갱신. 기본 `~/.claude/skills/`, `--project`면 현재 폴더 `.claude/skills/`. 손으로 고친 스킬 · CLI보다 새 스킬은 `--force`일 때만 바꿈 | 0 · 1 고친 스킬 둠 · 2 |
|
|
548
|
+
| `ecdk setup --only mcp [--url <주소>] [--target claude\|helpycode\|all] [--force]` | 학습자료 서버 MCP(`elice-material`)만 Claude Code · Helpy Code에 등록. 주소는 기본 운영 서버, 다른 서버는 `--url`. 등록 전 서버에 MCP가 있는지 확인(없으면 `--force`), Helpy Code 설정에 주석이 있으면 붙여 넣을 내용만 출력 | 0 · 1 직접 할 일 · 2 |
|
|
549
|
+
| `ecdk update [--project] [--check]` | npm `latest`로 올리기: `npm install -g @eliceio/cdk-cli@<latest>` → 새 ecdk로 `ecdk setup --only skills`(`--project`면 `--only skills --project`, 현재 폴더 `.claude/skills/`) → 프로젝트 폴더면 `npm update @eliceio/cdk`. 같거나 더 새 버전이면 하지 않음(내리지 않음), `npx`면 전역 설치 건너뛰고 스킬은 `npx -y @eliceio/cdk-cli@<latest> setup --only skills`, `--check`는 확인만 | 0 · 1 확인 실패 · 단계 실패 · 2 |
|
|
550
|
+
| `ecdk uninstall [--only skills\|mcp] [--project] [--target claude\|helpycode\|all] [--force]` | `ecdk setup`이 설치한 스킬 5개(옛 ecdk가 다른 이름으로 설치한 스킬 · 옛 가이드 스킬 포함) · MCP 등록(`elice-material`) 지우기. `--only`는 setup과 같음(스킬만 · MCP 등록만), `--project`는 `--only skills`에서만. 손으로 고친 스킬은 `--force`일 때만, 다른 스킬 · MCP 서버 · 프로젝트는 건드리지 않음. CLI는 지우지 않음 ([지우기](#지우기)) | 0 · 1 남긴 것 · 직접 할 일 · 2 |
|
|
551
551
|
|
|
552
552
|
`--json` 출력의 `issues[].id`는 바뀌지 않는 이름이라 스크립트 · Claude가 판단에 씁니다.
|
|
553
553
|
|
|
@@ -555,7 +555,7 @@ q1=b;q2=a,d;q3=c,a,b;q4=가중치;q5=g1:a|g2:b,c
|
|
|
555
555
|
|
|
556
556
|
## 검사 규칙
|
|
557
557
|
|
|
558
|
-
`ecdk validate` · `ecdk build`와 서버 업로드 검사가 같은 규칙 파일(`rules.json`, 지금 0.
|
|
558
|
+
`ecdk validate` · `ecdk build`와 서버 업로드 검사가 같은 규칙 파일(`rules.json`, 지금 0.24.0)을 씁니다. **오류**는 zip을 만들지 않고 업로드도 거절됩니다. **경고**는 통과하지만 확인이 필요합니다.
|
|
559
559
|
|
|
560
560
|
<!-- 검사 규칙 표: rules.json의 모든 id가 있어야 한다 (src/readme.test.ts가 확인) -->
|
|
561
561
|
|
|
@@ -608,7 +608,7 @@ q1=b;q2=a,d;q3=c,a,b;q4=가중치;q5=g1:a|g2:b,c
|
|
|
608
608
|
| `sandbox.module-src` | 경고 | `<script type="module" src>` (zip · HTML 검사) → 콘텐츠 서버의 sandbox 헤더에 `allow-same-origin`이 없는 LXP에서는 CORS로 막혀 "불러오는 중"에서 멈춤. 그런 LXP가 남아 있어 경고로 알림. `ecdk build`는 HTML 안에 묶어 넣으므로 프로젝트에서는 나오지 않음 |
|
|
609
609
|
| `sandbox.fetch-local` | 경고 | zip 안 파일을 `fetch` · 변수 `import()` · `Worker`로 읽음 → 콘텐츠 서버의 sandbox 헤더에 `allow-same-origin`이 없는 LXP에서는 CORS로 막힘. JSON `fetch`와 문자열 `import()`는 `ecdk build`가 처리. `sdk.mlapi.fetch(…)`는 잡지 않음 |
|
|
610
610
|
| `html.img-alt` | 경고 | `alt` 없는 이미지 (꾸밈 이미지는 `alt=""`) |
|
|
611
|
-
| `html.iframe` | 오류 | `src`로 무엇을 띄우는 `<iframe>` · `<frame>`(zip 안 파일도), `<object>` · `<embed>` → 콘텐츠 CSP(`frame-src` · `object-src`)가 막음. 영상은 Elice 비디오 자료로, 다른 내용은 이 HTML 안에. `src` 없는 iframe · `srcdoc`(코드 미리보기) · 허용 목록(`rules.json` `externalAllow` `frame-src`) 출처의 `https://` iframe은 통과
|
|
611
|
+
| `html.iframe` | 오류 | `src`로 무엇을 띄우는 `<iframe>` · `<frame>`(zip 안 파일도), `<object>` · `<embed>` → 콘텐츠 CSP(`frame-src` · `object-src`)가 막음. 영상은 Elice 비디오 자료로, 다른 내용은 이 HTML 안에. `src` 없는 iframe · `srcdoc`(코드 미리보기) · 허용 목록(`rules.json` `externalAllow` `frame-src`) 출처의 `https://` iframe은 통과 (경로가 있는 항목은 그 경로 아래만: YouTube는 `https://www.youtube-nocookie.com/embed/…`만, `youtube.com` · 다른 영상 사이트는 오류) |
|
|
612
612
|
| `html.form` | 경고 | `<form>` 제출 (sandbox · CSP `form-action`이 막음) → 버튼 click + `useSubmit`. form 요소 자체는 동작해 경고 |
|
|
613
613
|
| `api.external-send` | 오류 | 외부 주소로 요청 (학생 정보 유출 위험). `sdk.mlapi.fetch(…)`는 주소의 호스트를 버리고 자료 서버로 보내므로 잡지 않음 |
|
|
614
614
|
| `api.parent-access` | 경고 | `window.parent` · `top` 직접 접근 → 키트 |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const TEMPLATES: readonly ["quiz", "blank", "steps", "document", "survey", "video", "entry", "board", "lesson"];
|
|
1
|
+
export declare const TEMPLATES: readonly ["quiz", "blank", "steps", "document", "survey", "video", "youtube", "entry", "board", "lesson"];
|
|
2
2
|
export type TemplateName = (typeof TEMPLATES)[number];
|
|
3
3
|
/** 화면 테마. dark는 화면 HTML에 data-eds-theme="dark"를 붙여 EDS 어두운 팔레트를 쓴다 */
|
|
4
4
|
export declare const THEMES: readonly ["light", "dark"];
|
|
@@ -5,7 +5,7 @@ import { SDK_PACKAGE } from '../../core/sdk.js';
|
|
|
5
5
|
import { listTemplates } from '../../core/templates.js';
|
|
6
6
|
import { localSdkSpec } from './install.js';
|
|
7
7
|
|
|
8
|
-
const TEMPLATES = ['quiz', 'blank', 'steps', 'document', 'survey', 'video', 'entry', 'board', 'lesson'];
|
|
8
|
+
const TEMPLATES = ['quiz', 'blank', 'steps', 'document', 'survey', 'video', 'youtube', 'entry', 'board', 'lesson'];
|
|
9
9
|
/** 화면 테마. dark는 화면 HTML에 data-eds-theme="dark"를 붙여 EDS 어두운 팔레트를 쓴다 */
|
|
10
10
|
const THEMES = ['light', 'dark'];
|
|
11
11
|
/** 패키지 루트의 templates/ (es/commands/create/와 src/commands/create/ 모두 세 단계 위) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CheckSteps } from '../../dev/check.js';
|
|
2
2
|
import type { CommandResult } from '../../types.js';
|
|
3
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk dev [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] [--port 4170]\n ecdk dev [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] --check [--screens learn,tutoring,instructor,edit] [--viewport desktop,mobile]\n [--step all|1,2] [--theme light|dark|all] [--json]\n\n \uB85C\uCEEC\uC5D0\uC11C \uC6B4\uC601\uACFC \uAC19\uC740 \uC870\uAC74\uC73C\uB85C \uCF58\uD150\uCE20\uB97C \uB744\uC6B4\uB2E4.\n - http://localhost:<port> LXP \uD749\uB0B4 \uD654\uBA74: \uD559\uC0DD \u00B7 \uD29C\uD130\uB9C1 \u00B7 \uAD50\uC721\uC790 \uD654\uBA74 (\uBBF8\uB9AC\uBCF4\uAE30) \u00B7 \uB0B4\uC6A9 \uD3B8\uC9D1\n (\uC8FC\uC18C\uB85C \uACE0\uB974\uAE30: ?view=student|tutor|instructor|edit \u00B7 ?width=360px, \uB2E4\uB978 \uD559\uC0DD\uC740 ?view=student:2 \u00B7 student:3)\n \uAD50\uC721\uC790 \uD654\uBA74\uC740 LXP \uD3B8\uC9D1\uAE30 \uBBF8\uB9AC\uBCF4\uAE30\uC758 \uAD50\uC721\uC790 \uD1A0\uAE00\uCC98\uB7FC \uC5F0\uB2E4 (\uD559\uC2B5 \uD398\uC774\uC9C0\uC758 \uAD50\uC721\uC790\uB294 \uD559\uC0DD \uD654\uBA74\uC744 \uBD04)\n - \uCF58\uD150\uCE20\uB294 \uB2E4\uB978 \uCD9C\uCC98(127.0.0.1:<port+1>)\uC5D0\uC11C \uC6B4\uC601 \uD5E4\uB354(CSP sandbox allow-scripts allow-same-origin
|
|
3
|
+
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk dev [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] [--port 4170]\n ecdk dev [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] --check [--screens learn,tutoring,instructor,edit] [--viewport desktop,mobile]\n [--step all|1,2] [--theme light|dark|all] [--json]\n\n \uB85C\uCEEC\uC5D0\uC11C \uC6B4\uC601\uACFC \uAC19\uC740 \uC870\uAC74\uC73C\uB85C \uCF58\uD150\uCE20\uB97C \uB744\uC6B4\uB2E4.\n - http://localhost:<port> LXP \uD749\uB0B4 \uD654\uBA74: \uD559\uC0DD \u00B7 \uD29C\uD130\uB9C1 \u00B7 \uAD50\uC721\uC790 \uD654\uBA74 (\uBBF8\uB9AC\uBCF4\uAE30) \u00B7 \uB0B4\uC6A9 \uD3B8\uC9D1\n (\uC8FC\uC18C\uB85C \uACE0\uB974\uAE30: ?view=student|tutor|instructor|edit \u00B7 ?width=360px, \uB2E4\uB978 \uD559\uC0DD\uC740 ?view=student:2 \u00B7 student:3)\n \uAD50\uC721\uC790 \uD654\uBA74\uC740 LXP \uD3B8\uC9D1\uAE30 \uBBF8\uB9AC\uBCF4\uAE30\uC758 \uAD50\uC721\uC790 \uD1A0\uAE00\uCC98\uB7FC \uC5F0\uB2E4 (\uD559\uC2B5 \uD398\uC774\uC9C0\uC758 \uAD50\uC721\uC790\uB294 \uD559\uC0DD \uD654\uBA74\uC744 \uBD04)\n - \uCF58\uD150\uCE20\uB294 \uB2E4\uB978 \uCD9C\uCC98(127.0.0.1:<port+1>)\uC5D0\uC11C \uC6B4\uC601 \uD5E4\uB354(CSP sandbox allow-scripts allow-same-origin)\uB85C\n - \uD3EC\uD2B8\uB97C \uB450 \uAC1C(N \u00B7 N+1) \uC4F4\uB2E4. --port \uC5C6\uC774 \uC5F4 \uB54C 4170 \u00B7 4171\uC774 \uC4F0\uC774\uACE0 \uC788\uC73C\uBA74 \uB2E4\uC74C \uC30D(4172 \u00B7 4173 \u2026)\uC744 \uC4F4\uB2E4\n - \uC2E4\uC81C @eliceio/cdk\uAC00 elice-material \uD749\uB0B4 API\uC640 \uD1B5\uC2E0. \uB0B4\uC6A9 \uD3B8\uC9D1\uC5D0\uC11C \uC800\uC7A5\uD55C settings(\uB0B4\uC6A9 + \uCC44\uC810 \uBC29\uC2DD \u00B7 \uB2F5)\uB294\n .ecdk/settings.json\uC5D0 \uC4F4\uB2E4. \uB2E4\uC2DC \uC5F4\uC5B4\uB3C4 \uB0A8\uACE0, zip\uC5D0\uB294 \uB4E4\uC5B4\uAC00\uC9C0 \uC54A\uB294\uB2E4 (\uC6B4\uC601\uC740 SDK saveSettings \u2192 \uC11C\uBC84 settings).\n \uAE30\uBCF8\uC73C\uB85C\uB294 \uB85C\uCEEC\uC5D0\uB9CC \uC788\uACE0, publish \uC2A4\uD0AC\uC774 \uB3D9\uC758\uB97C \uBC1B\uC544 \uC5C5\uB85C\uB4DC\uC640 \uD568\uAED8 \uBCF4\uB0BC \uC218 \uC788\uB2E4\n - \uD559\uC0DD \uBCF4\uAE30 \uC81C\uCD9C: \uC800\uC7A5\uD55C \uCC44\uC810 \uC124\uC815\uC774 \uC788\uC73C\uBA74 \uCC44\uC810\uD558\uACE0, \uC5C6\uC73C\uBA74 \uC81C\uCD9C\uB9CC \uBC1B\uB294\uB2E4\n (\uC644\uB8CC \uC815\uCC45\uC740 LXP\uC5D0 \uC62C\uB9B0 \uB4A4 \uD3B8\uC9D1 \uD398\uC774\uC9C0 '\uC124\uC815' \uD328\uB110\uC5D0\uC11C \uAD50\uC721\uC790\uAC00 \uACE0\uB974\uBBC0\uB85C dev\uB294 \uD749\uB0B4 \uB0B4\uC9C0 \uC54A\uB294\uB2E4)\n - \uD30C\uC77C\uC744 \uACE0\uCE58\uBA74 \uB2E4\uC2DC \uAC80\uC0AC\uD558\uACE0 \uD654\uBA74\uC744 \uC0C8\uB85C \uB744\uC6C0, \uCF58\uD150\uCE20\uC758 \uCF58\uC194 \uC624\uB958\uC640 404\uB97C \uC5EC\uAE30\uC5D0 \uD45C\uC2DC\n\n \uB05D\uB0B4\uAE30: Ctrl+C\n\n--check: \uAC19\uC740 \uC11C\uBC84\uB97C \uBE48 \uD3EC\uD2B8(\uB610\uB294 --port)\uB85C \uB744\uC6CC \uD654\uBA74\uB9C8\uB2E4 \uD5E4\uB4DC\uB9AC\uC2A4 \uBE0C\uB77C\uC6B0\uC800\uB85C \uC5F4\uC5B4 \uBCF4\uACE0 \uB05D\uB0B8\uB2E4 (\uBCF4\uD1B5 30\uCD08 \uC548).\n - \uD654\uBA74: \uAE30\uBCF8\uC740 metadata.json\uC5D0\uC11C \uCF20 \uD654\uBA74 + \uD559\uC0DD \uD654\uBA74\uC774 \uC788\uC73C\uBA74 tutoring. --screens\uB85C \uACE0\uB974\uAE30\n - \uD3ED: desktop(\uCC3D 1280\u00D7860) \u00B7 mobile(dev \uD654\uBA74\uC758 \uBAA8\uBC14\uC77C \uD3ED 360px). --viewport\uB85C \uACE0\uB974\uAE30\n - \uD654\uBA74 \u00D7 \uD3ED\uB9C8\uB2E4: \uADF8\uB824\uC84C\uB294\uC9C0(\uAE00 \u00B7 canvas \u00B7 \uADF8\uB9BC, 8\uCD08 \uC548\uC5D0 \"\uBD88\uB7EC\uC624\uB294 \uC911\u2026\"\uC774 \uC0AC\uB77C\uC9C0\uB294\uC9C0) \u00B7 \uCF58\uC194 \uC624\uB958 \u00B7 \uC608\uC678 \u00B7\n \uB9C9\uD78C \uC678\uBD80 \uC694\uCCAD(\uCF58\uD150\uCE20 CSP) \u00B7 \uC2E4\uD328\uD55C \uC694\uCCAD(4xx \u00B7 5xx) \u00B7 \uAC00\uB85C \uB118\uCE68 \u00B7 \uD0A4\uD2B8 \uBC30\uCE58(render.*: \uAC00\uB824\uC9C4 \uC2A4\uD14C\uD37C \uBC84\uD2BC \u00B7 \uC2A4\uD14C\uD37C \uBC84\uD2BC\uC5D0 \uAE54\uB9B0 \uC870\uC791,\n stage\uC758 \uC2E4\uC2DC\uAC04 \uAC12 \u00B7 \uC870\uC791\uC774 \uCCAB \uD654\uBA74 \uBC16, \uC2E4\uC2DC\uAC04 \uAC12\uC774 \uBB34\uB300 \uADF8\uB9BC\uC744 \uB36E\uC74C, \uB808\uC774\uC544\uC6C3 \uC601\uC5ED \uBC16 \uB0B4\uC6A9),\n \uADF8\uB9BC .ecdk/screens/<\uD654\uBA74>-<\uD3ED>[-<\uD14C\uB9C8>][-step<n>].png (\uB9E4\uBC88 \uB36E\uC5B4\uC500, zip\uC5D0 \uB4E4\uC5B4\uAC00\uC9C0 \uC54A\uC74C)\n - --step all|1,3: \uD0A4\uD2B8 \uC2A4\uD14C\uD37C(app.useStepper)\uAC00 \uC788\uB294 \uD654\uBA74\uC740 \uB2E8\uACC4\uB9C8\uB2E4 \uCC0D\uB294\uB2E4 (canNext\uC640 \uC0C1\uAD00\uC5C6\uC774 \uADF8 \uB2E8\uACC4\uB85C).\n \uC2A4\uD14C\uD37C\uAC00 \uC5C6\uAC70\uB098 \uB2E8\uACC4 \uC218 \uBC16\uC774\uBA74 \uADF8 \uD654\uBA74 \uD55C \uBC88 + \uACBD\uACE0\n - --theme light|dark|all: \uCF58\uD150\uCE20\uC5D0 EDS \uD14C\uB9C8(data-eds-theme)\uB97C \uBD99\uC5EC \uCC0D\uB294\uB2E4. all\uC774\uBA74 \uB458 \uB2E4. \uC5C6\uC73C\uBA74 \uD504\uB85C\uC81D\uD2B8 \uADF8\uB300\uB85C\n - \uBE0C\uB77C\uC6B0\uC800: \uD658\uACBD \uBCC0\uC218 ECDK_BROWSER(\uC2E4\uD589 \uD30C\uC77C \uACBD\uB85C) \u2192 \uC124\uCE58\uB41C Google Chrome \u00B7 Microsoft Edge \u2192 playwright\uAC00 \uBC1B\uC544 \uB454 chromium\n - --json: { ok, screens: [{ screen, viewport, width, rendered, loading, consoleErrors, pageErrors, blocked,\n failedRequests, overflowX, layout, theme, step, missingStep, screenshot, ms }], validate: { errors, warnings, issues }, browser, screenshotsDir }\n - \uC885\uB8CC \uCF54\uB4DC: 0 \uBB38\uC81C \uC5C6\uC74C \u00B7 1 \uBB38\uC81C \uC788\uC74C(\uAC80\uC0AC \uC624\uB958, \uD654\uBA74 \uACBD\uACE0 \uD3EC\uD568) \u00B7 2 \uC0AC\uC6A9\uBC95 \uC624\uB958 \u00B7 3 \uBE0C\uB77C\uC6B0\uC800 \uC5C6\uC74C";
|
|
4
4
|
export interface DevArgs {
|
|
5
5
|
target: string;
|
|
6
6
|
port?: string;
|
package/es/commands/dev/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const usage = `사용법: ecdk dev [프로젝트 폴더] [--port 4170]
|
|
|
8
8
|
- http://localhost:<port> LXP 흉내 화면: 학생 · 튜터링 · 교육자 화면 (미리보기) · 내용 편집
|
|
9
9
|
(주소로 고르기: ?view=student|tutor|instructor|edit · ?width=360px, 다른 학생은 ?view=student:2 · student:3)
|
|
10
10
|
교육자 화면은 LXP 편집기 미리보기의 교육자 토글처럼 연다 (학습 페이지의 교육자는 학생 화면을 봄)
|
|
11
|
-
- 콘텐츠는 다른 출처(127.0.0.1:<port+1>)에서 운영 헤더(CSP sandbox allow-scripts allow-same-origin
|
|
11
|
+
- 콘텐츠는 다른 출처(127.0.0.1:<port+1>)에서 운영 헤더(CSP sandbox allow-scripts allow-same-origin)로
|
|
12
12
|
- 포트를 두 개(N · N+1) 쓴다. --port 없이 열 때 4170 · 4171이 쓰이고 있으면 다음 쌍(4172 · 4173 …)을 쓴다
|
|
13
13
|
- 실제 @eliceio/cdk가 elice-material 흉내 API와 통신. 내용 편집에서 저장한 settings(내용 + 채점 방식 · 답)는
|
|
14
14
|
.ecdk/settings.json에 쓴다. 다시 열어도 남고, zip에는 들어가지 않는다 (운영은 SDK saveSettings → 서버 settings).
|
package/es/dev/host-page.js
CHANGED
|
@@ -91,7 +91,7 @@ function hostPage(opts) {
|
|
|
91
91
|
</header>
|
|
92
92
|
<div id="check">검사 중…</div>
|
|
93
93
|
<pre id="messages" aria-live="polite"></pre>
|
|
94
|
-
<main><iframe id="content" sandbox="allow-scripts allow-same-origin
|
|
94
|
+
<main><iframe id="content" sandbox="allow-scripts allow-same-origin" title="콘텐츠"></iframe></main>
|
|
95
95
|
<script type="module">
|
|
96
96
|
const MATERIAL_ID = ${JSON.stringify(DEV_MATERIAL_ID)};
|
|
97
97
|
const SDK_SOURCE = 'eliceio-content-sdk';
|
package/es/dev/server.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare const devOnlyConnectSrc: (contentOrigin: string) => string[];
|
|
|
36
36
|
* - 호스트(localhost): LXP 흉내 화면 + elice-material 흉내 API(/api) + 콘솔 수집
|
|
37
37
|
* - 콘텐츠(127.0.0.1, 다른 출처): Vite dev 서버(ecdk 플러그인, engines/vite)가 원본을 주고 SDK 등 npm 의존성을 풀어 준다
|
|
38
38
|
* (HMR은 Vite 기본). zip에서 빠지는 파일은 주지 않는다. 운영 콘텐츠 CSP 초안(rules/csp.ts, 서버 수정 제안 1번과 같은 값,
|
|
39
|
-
* sandbox allow-scripts allow-same-origin
|
|
39
|
+
* sandbox allow-scripts allow-same-origin)으로 응답하고, connect-src에만 Vite HMR 웹소켓(같은 콘텐츠 출처)과 올린 파일 경로를 더한다.
|
|
40
40
|
* 콘텐츠는 제 출처(127.0.0.1:<port+1>)로 돌아 저장소는 호스트와 따로 쓰고, 제 파일 요청은 같은 출처라 막히지 않는다.
|
|
41
41
|
* 외부 이미지 · 글꼴 · fetch 등은 LXP에서처럼 막히고, 막힌 요청은 dev 스크립트가 화면 기록 · 터미널에 "막힌 외부 요청"으로
|
|
42
42
|
* 알린다. LXP 자료 파일 서버처럼 CORS 헤더는 주지 않는다
|
package/es/dev/server.js
CHANGED
|
@@ -61,7 +61,7 @@ const listen = (server, port) => new Promise((ok, fail) => {
|
|
|
61
61
|
* - 호스트(localhost): LXP 흉내 화면 + elice-material 흉내 API(/api) + 콘솔 수집
|
|
62
62
|
* - 콘텐츠(127.0.0.1, 다른 출처): Vite dev 서버(ecdk 플러그인, engines/vite)가 원본을 주고 SDK 등 npm 의존성을 풀어 준다
|
|
63
63
|
* (HMR은 Vite 기본). zip에서 빠지는 파일은 주지 않는다. 운영 콘텐츠 CSP 초안(rules/csp.ts, 서버 수정 제안 1번과 같은 값,
|
|
64
|
-
* sandbox allow-scripts allow-same-origin
|
|
64
|
+
* sandbox allow-scripts allow-same-origin)으로 응답하고, connect-src에만 Vite HMR 웹소켓(같은 콘텐츠 출처)과 올린 파일 경로를 더한다.
|
|
65
65
|
* 콘텐츠는 제 출처(127.0.0.1:<port+1>)로 돌아 저장소는 호스트와 따로 쓰고, 제 파일 요청은 같은 출처라 막히지 않는다.
|
|
66
66
|
* 외부 이미지 · 글꼴 · fetch 등은 LXP에서처럼 막히고, 막힌 요청은 dev 스크립트가 화면 기록 · 터미널에 "막힌 외부 요청"으로
|
|
67
67
|
* 알린다. LXP 자료 파일 서버처럼 CORS 헤더는 주지 않는다
|
package/es/rules/check.js
CHANGED
|
@@ -248,7 +248,7 @@ function framesSomething(t) {
|
|
|
248
248
|
const src = t.attrs.get('src')?.trim().toLowerCase();
|
|
249
249
|
return src !== undefined && src !== '' && src !== 'about:blank' && src !== 'about:srcdoc';
|
|
250
250
|
}
|
|
251
|
-
/** iframe · frame의 src가 허용 목록(externalAllow frame-src)
|
|
251
|
+
/** iframe · frame의 src가 허용 목록(externalAllow frame-src) 출처(경로가 있으면 그 아래)인지. object · embed는 늘 아님 */
|
|
252
252
|
function framesAllowed(t, spec) {
|
|
253
253
|
if (t.name !== 'iframe' && t.name !== 'frame') return false;
|
|
254
254
|
const src = t.attrs.get('src')?.trim() ?? '';
|
|
@@ -461,8 +461,8 @@ function checkFiles(input, opts = {}) {
|
|
|
461
461
|
const classic = src !== undefined && t.attrs.get('type')?.trim().toLowerCase() !== 'module' && classifyRef(src) === 'local' ? resolveRef(f.path, src.replace(/[?#].*$/, '')) : null;
|
|
462
462
|
if (classic !== null && opts.publicFiles && !opts.publicFiles.includes(classic)) add('ref.script-not-public', `<script src="${src}">(type="module" 없음)는 build가 묶지 않고 zip에도 넣지 않습니다. type="module"을 붙여 묶거나, 파일을 public/으로 옮겨 그대로 넣어 주세요.`, f.path, t.line);
|
|
463
463
|
if (t.name === 'img' && !t.attrs.has('alt')) add('html.img-alt', `대체 텍스트(alt)가 없는 이미지입니다.`, f.path, t.line);
|
|
464
|
-
// 허용 목록(externalAllow frame-src, 서버 CSP와 같게)
|
|
465
|
-
if (FRAME_TAGS.has(t.name) && framesSomething(t) && !framesAllowed(t, spec)) add('html.iframe', t.name === 'iframe' || t.name === 'frame' ? `<${t.name} src="${t.attrs.get('src')?.trim()}">: 외부 페이지 · 파일을 iframe으로 띄우면 CSP(frame-src 'none')가 막음 (zip 안 파일도). 영상은 Elice 비디오 자료로 따로
|
|
464
|
+
// 허용 목록(externalAllow frame-src, 서버 CSP와 같게) 출처 · 경로를 띄우는 iframe은 통과 (예: 엔트리 워크스페이스, YouTube embed)
|
|
465
|
+
if (FRAME_TAGS.has(t.name) && framesSomething(t) && !framesAllowed(t, spec)) add('html.iframe', t.name === 'iframe' || t.name === 'frame' ? `<${t.name} src="${t.attrs.get('src')?.trim()}">: 외부 페이지 · 파일을 iframe으로 띄우면 CSP(frame-src 'none')가 막음 (zip 안 파일도). 영상은 Elice 비디오 자료로 따로 올리고(YouTube는 https://www.youtube-nocookie.com/embed/영상ID 주소만 허용), 다른 내용은 이 HTML 안에 넣어 주세요. 코드 미리보기는 srcdoc 사용 가능.` : `<${t.name}>는 LXP 콘텐츠 CSP(object-src 'none')가 막아 빈 칸으로 보입니다. 영상은 Elice 비디오 자료로 따로 올리고, 다른 문서는 내용을 이 HTML 안에 넣어 주세요.`, f.path, t.line);
|
|
466
466
|
if (t.name === 'form') add('html.form', 'form 제출은 sandbox · 콘텐츠 CSP(form-action)가 막습니다. 버튼 click 처리와 SDK 제출을 써 주세요.', f.path, t.line);
|
|
467
467
|
}
|
|
468
468
|
if (kindOf === 'css') continue;
|
package/es/rules/csp.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { RulesSpec } from './types.js';
|
|
|
3
3
|
* 운영 콘텐츠 응답 CSP 초안 (서버에 제안한 값).
|
|
4
4
|
* 서버 CSP가 확정되면 이 목록을 맞춘다. `ecdk dev` 콘텐츠 서버가 이 값으로 응답하고, CLI README가 같은 글을 보인다
|
|
5
5
|
* (`docs.test.ts`가 대조). 허용 외부 출처는 rules.json `externalAllow` 한 곳에서 해당 지시어에 더한다.
|
|
6
|
-
* - sandbox는 `allow-same-origin
|
|
6
|
+
* - sandbox는 `allow-same-origin`까지 (LXP iframe 속성과 같게, 콘텐츠는 제 하위 도메인 출처로 돈다)
|
|
7
7
|
* - `'self'` 대신 호스트를 직접 적는다 (헤더에 allow-same-origin이 없는 서버에서는 출처가 null이라 'self' 해석이 브라우저마다 다를 수 있음)
|
|
8
8
|
* - `webrtc 'block'`은 지원하는 브라우저에서만 (모르는 브라우저는 무시)
|
|
9
9
|
*/
|
|
@@ -27,8 +27,8 @@ export declare const DEV_ONLY_SOURCES: Readonly<Record<string, readonly string[]
|
|
|
27
27
|
/** dev CSP: 지시어마다 DEV_ONLY_SOURCES를 더한다 ('none'만 있던 지시어는 'none'을 뺌) */
|
|
28
28
|
export declare function withDevSources(csp: string): string;
|
|
29
29
|
/**
|
|
30
|
-
* 외부 주소가 rules.json `externalAllow`의 그 지시어
|
|
30
|
+
* 외부 주소가 rules.json `externalAllow`의 그 지시어 출처(경로가 있으면 그 경로 아래)인지. `//host`(프로토콜 생략)는 https로 본다
|
|
31
31
|
*/
|
|
32
32
|
export declare function isAllowedExternal(url: string, directive: keyof NonNullable<RulesSpec['externalAllow']>, spec?: RulesSpec): boolean;
|
|
33
|
-
/** 허용
|
|
33
|
+
/** 허용 목록 항목들의 출처 (라이브러리 외부 주소 경고에서 뺄 때. 경로가 있는 항목도 출처로) */
|
|
34
34
|
export declare function allowedOrigins(spec?: RulesSpec): string[];
|
package/es/rules/csp.js
CHANGED
|
@@ -4,11 +4,11 @@ import { rules } from './spec.js';
|
|
|
4
4
|
* 운영 콘텐츠 응답 CSP 초안 (서버에 제안한 값).
|
|
5
5
|
* 서버 CSP가 확정되면 이 목록을 맞춘다. `ecdk dev` 콘텐츠 서버가 이 값으로 응답하고, CLI README가 같은 글을 보인다
|
|
6
6
|
* (`docs.test.ts`가 대조). 허용 외부 출처는 rules.json `externalAllow` 한 곳에서 해당 지시어에 더한다.
|
|
7
|
-
* - sandbox는 `allow-same-origin
|
|
7
|
+
* - sandbox는 `allow-same-origin`까지 (LXP iframe 속성과 같게, 콘텐츠는 제 하위 도메인 출처로 돈다)
|
|
8
8
|
* - `'self'` 대신 호스트를 직접 적는다 (헤더에 allow-same-origin이 없는 서버에서는 출처가 null이라 'self' 해석이 브라우저마다 다를 수 있음)
|
|
9
9
|
* - `webrtc 'block'`은 지원하는 브라우저에서만 (모르는 브라우저는 무시)
|
|
10
10
|
*/
|
|
11
|
-
const CONTENT_CSP = [['sandbox', 'allow-scripts', 'allow-same-origin'
|
|
11
|
+
const CONTENT_CSP = [['sandbox', 'allow-scripts', 'allow-same-origin'], ['default-src', "'none'"], ['script-src', '{CONTENT_HOST}', "'unsafe-inline'", "'unsafe-eval'", 'blob:'], ['style-src', '{CONTENT_HOST}', "'unsafe-inline'"],
|
|
12
12
|
// 엔트리 AI 채점 피드백의 블록 그림 출처 (서버 CONTENT_CSP_IMG_ORIGINS, 모든 환경). img-src에만, 운영 호스트는 서버가 AI팀과 확인 중
|
|
13
13
|
['img-src', '{CONTENT_HOST}', 'data:', 'blob:', 'https://datahub-central-01.elice.io'], ['font-src', '{CONTENT_HOST}', 'data:'], ['media-src', '{CONTENT_HOST}', 'data:', 'blob:'], ['connect-src', '{MATERIAL_API}'], ['worker-src', 'blob:'], ['frame-src', "'none'"], ['form-action', "'none'"], ['object-src', "'none'"], ['base-uri', '{CONTENT_HOST}'], ['webrtc', "'block'"], ['frame-ancestors', '{LXP_ORIGINS}']];
|
|
14
14
|
/** 콘텐츠 CSP 헤더 값. values가 없으면 자리표시({CONTENT_HOST} 등) 그대로 (문서용) */
|
|
@@ -46,20 +46,45 @@ function withDevSources(csp) {
|
|
|
46
46
|
}).join('; ');
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* 허용 목록 항목 하나가 주소에 맞는지 (CSP 출처 식의 https 부분만).
|
|
50
|
+
* - 출처만(`https://host`): 그 출처의 모든 경로
|
|
51
|
+
* - `/`로 끝나는 경로(`https://host/embed/`): 그 경로로 시작하는 주소만 (CSP 경로 접두 매칭과 같게)
|
|
52
|
+
* - `/`로 끝나지 않는 경로: 그 경로와 똑같을 때만
|
|
53
|
+
* 경로는 URL 파서가 정리한 값(`..` · `%2e%2e` 풀림)으로 견준다. 브라우저 CSP도 정리된 주소로 견준다
|
|
54
|
+
*/
|
|
55
|
+
function matchesSource(url, source) {
|
|
56
|
+
let allowed;
|
|
57
|
+
try {
|
|
58
|
+
allowed = new URL(source);
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (allowed.origin !== url.origin) return false;
|
|
63
|
+
// new URL('https://host').pathname === '/' (출처만 적은 항목)
|
|
64
|
+
if (allowed.pathname === '/') return true;
|
|
65
|
+
return allowed.pathname.endsWith('/') ? url.pathname.startsWith(allowed.pathname) : url.pathname === allowed.pathname;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 외부 주소가 rules.json `externalAllow`의 그 지시어 출처(경로가 있으면 그 경로 아래)인지. `//host`(프로토콜 생략)는 https로 본다
|
|
50
69
|
*/
|
|
51
70
|
function isAllowedExternal(url, directive, spec = rules) {
|
|
52
71
|
const list = spec.externalAllow?.[directive] ?? [];
|
|
53
72
|
try {
|
|
54
|
-
const
|
|
55
|
-
return list.
|
|
73
|
+
const parsed = new URL(url.startsWith('//') ? `https:${url}` : url);
|
|
74
|
+
return list.some(source => matchesSource(parsed, source));
|
|
56
75
|
} catch {
|
|
57
76
|
return false;
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
|
-
/** 허용
|
|
79
|
+
/** 허용 목록 항목들의 출처 (라이브러리 외부 주소 경고에서 뺄 때. 경로가 있는 항목도 출처로) */
|
|
61
80
|
function allowedOrigins(spec = rules) {
|
|
62
|
-
return Object.values(spec.externalAllow ?? {}).flat()
|
|
81
|
+
return Object.values(spec.externalAllow ?? {}).flat().flatMap(source => {
|
|
82
|
+
try {
|
|
83
|
+
return [new URL(source).origin];
|
|
84
|
+
} catch {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
63
88
|
}
|
|
64
89
|
|
|
65
90
|
export { CONTENT_CSP, DEV_ONLY_SOURCES, allowedOrigins, contentCsp, isAllowedExternal, withDevSources };
|
package/es/rules.json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const version="0.23.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},graderTypes:["pattern","partial_pattern","rubric","entry"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[],"frame-src":["https://entry-workspace.elice.io"]};const minVersions={sdk:"1.0.0-alpha.4"};const layouts={content:["single","split","stage","media"],regions:["main","aside","stage","controls","readout","actions"]};const limits={maxZipBytes:20971520,maxUnpackedBytes:209715200,maxFiles:300,maxEntries:3000,warnRatio:0.8,maxImageBytes:1048576,maxScreenBytes:1572864};const allowedExtensions=["html","htm","css","js","mjs","json","map","txt","md","csv","xml","vtt","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","mp3","wav","ogg","m4a","mp4","webm","woff","woff2","ttf","otf","glb","gltf","bin","wasm","pdf"];const imageExtensions=["png","jpg","jpeg","gif","webp","avif","bmp","svg"];const excluded={secret:{level:"error",files:[".env",".env.*","elice.config.*","grading.json","answers.*","*.pem","*.key"],dirs:[]},dev:{level:"error",files:[],dirs:[".git","node_modules",".ecdk"]},junk:{level:"warn",files:[".DS_Store","Thumbs.db","desktop.ini"],dirs:["__MACOSX"]}};const forbiddenApis=[{id:"api.parent-access",pattern:"\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",title:"부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"},{id:"api.cookie",pattern:"\\bdocument\\.cookie\\b",title:"쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.eval",pattern:"\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",title:"eval · new Function · 문자열 setTimeout 사용"},{id:"api.dialog",pattern:"\\b(?:alert|confirm|prompt)\\s*\\(",title:"alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"},{id:"api.window-open",pattern:"\\bwindow\\.open\\s*\\(",title:"window.open 새 창 (sandbox 팝업이라 외부 페이지가 깨짐, 외부 링크는 <a href>로 두면 LXP가 새 탭으로 엶)"},{id:"api.external-send",pattern:"(?<!\\bmlapi\\??\\.)\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",title:"외부 주소로 요청을 보냄 (학생 정보 유출 위험)"},{id:"sec.html-injection",pattern:"\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",title:"HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"},{id:"sec.redirect",pattern:"\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",title:"주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"},{id:"sec.postmessage-wildcard",pattern:"\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",title:"postMessage 대상이 * (아무 창이나 받을 수 있음)"},{id:"sandbox.fetch-local",pattern:"(?<!\\bmlapi\\??\\.)\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"}];const secretPatterns=[{source:"elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",title:"개인키",pattern:"-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"},{source:"elice-hardcoded-secret",title:"하드코딩된 비밀 값",pattern:"(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",flags:"i",not:"os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"},{source:"detected-aws-access-key-id-value",title:"AWS 액세스 키",pattern:"\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",not:"example|sample|test|fake"},{source:"detected-aws-secret-access-key",title:"AWS 비밀 키",pattern:"[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",flags:"i",not:"example|sample|test|fake|xxxxxx"},{source:"detected-aws-session-token",title:"AWS 세션 토큰",pattern:"AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",flags:"i",not:"example|sample|test|fake"},{source:"detected-aws-appsync-graphql-key",title:"AWS AppSync 키",pattern:"da2-[a-z0-9]{26}"},{source:"detected-amazon-mws-auth-token",title:"Amazon MWS 토큰",pattern:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{source:"detected-artifactory-token",title:"Artifactory 토큰",pattern:"\\bAKC[a-zA-Z0-9]{10,}\\n",not:"sha(?:128|256|512)"},{source:"detected-artifactory-password",title:"Artifactory 비밀번호",pattern:"[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",not:"sha(?:1|2|3|118|256|512)"},{source:"detected-bcrypt-hash",title:"bcrypt 해시",pattern:"\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"},{source:"detected-codeclimate",title:"Code Climate 토큰",pattern:"codeclima.{0,50}[\"'`]?[0-9a-f]{64}",flags:"i"},{source:"detected-etc-shadow",title:"/etc/shadow 내용",pattern:"^\\s*root:[x!*]*:\\d*:\\d*",flags:"m"},{source:"detected-facebook-access-token",title:"Facebook 액세스 토큰",pattern:"EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"},{source:"detected-facebook-oauth",title:"Facebook OAuth 비밀",pattern:"[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"},{source:"detected-google-gcm-service-account",title:"Google 서비스 계정 키",pattern:"[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"},{source:"detected-google-oauth-access-token",title:"Google OAuth 토큰",pattern:"ya29\\.[0-9A-Za-z_-]+"},{source:"detected-heroku-api-key",title:"Heroku API 키",pattern:"[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"},{source:"detected-hockeyapp",title:"HockeyApp 토큰",pattern:"hockey.{0,50}[\"'`]?[0-9a-f]{32}",flags:"i"},{source:"detected-mailchimp-api-key",title:"Mailchimp API 키",pattern:"[0-9a-f]{32}-us\\d{1,2}"},{source:"detected-mailgun-api-key",title:"Mailgun API 키",pattern:"key-[0-9a-zA-Z]{32}"},{source:"detected-onfido-live-api-token",title:"Onfido API 토큰",pattern:"api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"},{source:"detected-outlook-team",title:"Outlook 웹훅",pattern:"https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"},{source:"detected-paypal-braintree-access-token",title:"PayPal Braintree 토큰",pattern:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"},{source:"detected-picatic-api-key",title:"Picatic API 키",pattern:"sk_live_[0-9a-z]{32}"},{source:"detected-sauce-token",title:"Sauce Labs 토큰",pattern:"sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",flags:"i"},{source:"detected-slack-token",title:"Slack 토큰",pattern:"xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"},{source:"detected-slack-webhook",title:"Slack 웹훅",pattern:"https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",not:"T00000000/B00000000/X{24}"},{source:"detected-sonarqube-docs-api-key",title:"SonarQube 토큰",pattern:"sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",flags:"i"},{source:"detected-square-access-token",title:"Square 액세스 토큰",pattern:"sq0atp-[0-9A-Za-z_-]{22}"},{source:"detected-square-oauth-secret",title:"Square OAuth 비밀",pattern:"sq0csp-[0-9A-Za-z\\\\_-]{43}"},{source:"detected-ssh-password",title:"sshpass 비밀번호",pattern:"sshpass[ ]-p\\s*['\"]"},{source:"detected-stripe-api-key",title:"Stripe API 키",pattern:"sk_live_[0-9a-zA-Z]{24}"},{source:"detected-stripe-restricted-api-key",title:"Stripe 제한 키",pattern:"rk_live_[0-9a-zA-Z]{24}"},{source:"detected-telegram-bot-api-key",title:"Telegram 봇 토큰",pattern:"\\d+:AA[0-9A-Za-z_-]{33}",not:"go\\.mod|v\\d+\\.\\d+\\.\\d+"},{source:"detected-twilio-api-key",title:"Twilio API 키",pattern:"SK[0-9a-fA-F]{32}"},{source:"detected-username-and-password-in-uri",title:"주소에 들어 있는 아이디 · 비밀번호",pattern:"[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"}];const rules=[{id:"manifest.missing",level:"error",scope:"server",title:"metadata.json 없음"},{id:"manifest.invalid",level:"error",scope:"server",title:"metadata.json 형식 오류"},{id:"manifest.entry-missing",level:"error",scope:"server",title:"metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"},{id:"manifest.commentary-missing",level:"error",scope:"server",title:"학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"},{id:"manifest.grading-types",level:"warn",scope:"server",title:"쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-ignored",level:"warn",scope:"client",title:"쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"},{id:"entry.missing",level:"error",scope:"server",title:"학생 화면 진입 파일 없음"},{id:"entry.nested",level:"error",scope:"server",title:"폴더째 묶은 zip (metadata.json이 최상위에 없음)"},{id:"input.not-zip",level:"error",scope:"server",title:"zip이 아닌 업로드 (HTML 파일 하나 등)"},{id:"limit.zip-size",level:"error",scope:"server",title:"zip 크기 한도 초과"},{id:"limit.file-count",level:"error",scope:"server",title:"파일 개수 한도 초과"},{id:"limit.unpacked-size",level:"error",scope:"server",title:"풀면 너무 큰 zip (압축 폭탄 의심)"},{id:"limit.near",level:"warn",scope:"client",title:"한도에 가까움"},{id:"limit.screen-size",level:"warn",scope:"client",title:"화면 하나를 열 때 받는 JS · CSS가 큼 (기준 limits.maxScreenBytes, 큰 라이브러리는 import()로)"},{id:"path.unsafe",level:"error",scope:"server",title:"안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"},{id:"path.case-collision",level:"error",scope:"server",title:"대소문자만 다른 경로"},{id:"path.non-ascii",level:"warn",scope:"client",title:"공백·한글 등 ASCII 밖 문자가 든 경로"},{id:"file.extension",level:"error",scope:"server",title:"허용하지 않는 확장자"},{id:"file.secret",level:"error",scope:"server",title:"정답·비밀 파일 포함"},{id:"file.dev",level:"error",scope:"server",title:"개발용 폴더 포함"},{id:"file.junk",level:"warn",scope:"server",title:"운영체제가 만든 불필요한 파일"},{id:"file.large-image",level:"warn",scope:"client",title:"1MB 넘는 이미지"},{id:"file.encoding",level:"error",scope:"client",title:"UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"},{id:"file.bom",level:"warn",scope:"client",title:"학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"},{id:"content.answer-key",level:"warn",scope:"client",title:"학생에게 내려가는 JSON에 정답처럼 보이는 키"},{id:"grading.no-submit",level:"warn",scope:"client",title:"편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"},{id:"grading.client-score",level:"warn",scope:"client",title:"제출하는 답에 화면에서 계산한 점수(score · scores · points key)를 넣음 (서버는 답 안 점수를 쓰지 않음, settings.grading rubric · pattern으로 채점)"},{id:"grading.ai-without-grading",level:"warn",scope:"client",title:"화면이 AI(mlapi.fetch)를 부르고 제출하는데 편집 화면이 채점 설정(settings.grading)을 저장하지 않음 (on_graded면 0점 · 미완료, on_submit이면 늘 100점. AI 평가는 rubric으로)"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"project.legacy-file",level:"warn",scope:"client",title:"더 쓰지 않는 프로젝트 파일(elice.config.json · content.json · grading.json)이 남아 있음 (프로젝트 검사만, ADR 0011)"},{id:"build.template-unknown",level:"warn",scope:"client",title:"metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"},{id:"layout.unknown",level:"warn",scope:"client",title:"data-ec-layout · data-ec-region에 키트가 모르는 값 (single · split · stage · media, main · aside · stage · controls · readout · actions)"},{id:"layout.own-step-nav",level:"warn",scope:"client",title:"화면 코드가 이전 · 다음 버튼을 직접 그림 (LXP 이전 · 다음 막대와 헷갈림, 키트 app.useStepper)"},{id:"ref.missing",level:"error",scope:"client",title:"참조한 파일이 없음"},{id:"ref.case-mismatch",level:"error",scope:"client",title:"참조 경로의 대소문자가 실제 파일과 다름"},{id:"ref.root-absolute",level:"error",scope:"client",title:"/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"},{id:"ref.external-script",level:"error",scope:"client",title:"외부 스크립트 (zip 안에 넣고 상대경로로)"},{id:"ref.external-request",level:"error",scope:"client",title:"외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"},{id:"ref.external-font",level:"warn",scope:"client",title:"허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"},{id:"ref.insecure",level:"error",scope:"client",title:"http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"},{id:"ref.vendor-external-url",level:"warn",scope:"client",title:"라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"},{id:"ref.script-not-public",level:"error",scope:"client",title:"type=\"module\" 없는 <script src>가 public/ 밖 파일 (프로젝트 검사만. build가 묶지 않고 zip에도 넣지 않음, type=\"module\"을 붙이거나 public/으로)"},{id:"sandbox.module-src",level:"warn",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"warn",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.iframe",level:"error",scope:"client",title:"src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기 · 허용 목록(externalAllow frame-src) 출처의 iframe은 통과)"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"warn",scope:"client",title:"쿠키 사용 (학습 기록이 아님)"},{id:"api.storage",level:"warn",scope:"client",title:"브라우저 저장소 사용 (학습 기록이 아님)"},{id:"api.eval",level:"warn",scope:"client",title:"eval · new Function 사용"},{id:"api.dialog",level:"error",scope:"client",title:"alert · confirm · prompt 사용"},{id:"api.window-open",level:"error",scope:"client",title:"window.open 새 창 (sandbox 팝업)"},{id:"sec.secret",level:"error",scope:"server",title:"비밀 값 (키 · 토큰 · 비밀번호)"},{id:"sec.answer-in-bundle",level:"warn",scope:"client",title:"편집 화면에 저장한 정답(.ecdk/settings.json 채점 설정)과 같은 글이 zip에 들어갈 파일에 있음 (프로젝트 검사만)"},{id:"sec.html-injection",level:"warn",scope:"client",title:"HTML 문자열 삽입"},{id:"sec.redirect",level:"warn",scope:"client",title:"주소를 값으로 바꿈"},{id:"sec.postmessage-wildcard",level:"warn",scope:"client",title:"postMessage 대상 *"},{id:"privacy.personal-field",level:"warn",scope:"client",title:"학습자 개인정보를 받는 입력 칸(전화 · 이메일 · 이름 autocomplete 등)이나 개인정보 · 학습자 이름(account.fullname)을 제출 · 저장 · AI 호출로 보냄 (익명 id account.anonymousId, 이름은 보여 주기만)"},{id:"sdk.outdated",level:"error",scope:"client",title:"SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"error",scope:"client",title:"SDK 복사본 lib/cdk.js (zip에 넣지 않음, 프로젝트 검사만. SDK는 package.json 의존성 @eliceio/cdk를 build가 번들로 묶음)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,layouts:layouts,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
|
|
1
|
+
const version="0.24.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},graderTypes:["pattern","partial_pattern","rubric","entry"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[],"frame-src":["https://entry-workspace.elice.io","https://www.youtube-nocookie.com/embed/"]};const minVersions={sdk:"1.0.0-alpha.4"};const layouts={content:["single","split","stage","media"],regions:["main","aside","stage","controls","readout","actions"]};const limits={maxZipBytes:20971520,maxUnpackedBytes:209715200,maxFiles:300,maxEntries:3000,warnRatio:0.8,maxImageBytes:1048576,maxScreenBytes:1572864};const allowedExtensions=["html","htm","css","js","mjs","json","map","txt","md","csv","xml","vtt","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","mp3","wav","ogg","m4a","mp4","webm","woff","woff2","ttf","otf","glb","gltf","bin","wasm","pdf"];const imageExtensions=["png","jpg","jpeg","gif","webp","avif","bmp","svg"];const excluded={secret:{level:"error",files:[".env",".env.*","elice.config.*","grading.json","answers.*","*.pem","*.key"],dirs:[]},dev:{level:"error",files:[],dirs:[".git","node_modules",".ecdk"]},junk:{level:"warn",files:[".DS_Store","Thumbs.db","desktop.ini"],dirs:["__MACOSX"]}};const forbiddenApis=[{id:"api.parent-access",pattern:"\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",title:"부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"},{id:"api.cookie",pattern:"\\bdocument\\.cookie\\b",title:"쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.eval",pattern:"\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",title:"eval · new Function · 문자열 setTimeout 사용"},{id:"api.dialog",pattern:"\\b(?:alert|confirm|prompt)\\s*\\(",title:"alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"},{id:"api.window-open",pattern:"\\bwindow\\.open\\s*\\(",title:"window.open 새 창 (sandbox 팝업이라 외부 페이지가 깨짐, 외부 링크는 <a href>로 두면 LXP가 새 탭으로 엶)"},{id:"api.external-send",pattern:"(?<!\\bmlapi\\??\\.)\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",title:"외부 주소로 요청을 보냄 (학생 정보 유출 위험)"},{id:"sec.html-injection",pattern:"\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",title:"HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"},{id:"sec.redirect",pattern:"\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",title:"주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"},{id:"sec.postmessage-wildcard",pattern:"\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",title:"postMessage 대상이 * (아무 창이나 받을 수 있음)"},{id:"sandbox.fetch-local",pattern:"(?<!\\bmlapi\\??\\.)\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"}];const secretPatterns=[{source:"elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",title:"개인키",pattern:"-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"},{source:"elice-hardcoded-secret",title:"하드코딩된 비밀 값",pattern:"(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",flags:"i",not:"os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"},{source:"detected-aws-access-key-id-value",title:"AWS 액세스 키",pattern:"\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",not:"example|sample|test|fake"},{source:"detected-aws-secret-access-key",title:"AWS 비밀 키",pattern:"[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",flags:"i",not:"example|sample|test|fake|xxxxxx"},{source:"detected-aws-session-token",title:"AWS 세션 토큰",pattern:"AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",flags:"i",not:"example|sample|test|fake"},{source:"detected-aws-appsync-graphql-key",title:"AWS AppSync 키",pattern:"da2-[a-z0-9]{26}"},{source:"detected-amazon-mws-auth-token",title:"Amazon MWS 토큰",pattern:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{source:"detected-artifactory-token",title:"Artifactory 토큰",pattern:"\\bAKC[a-zA-Z0-9]{10,}\\n",not:"sha(?:128|256|512)"},{source:"detected-artifactory-password",title:"Artifactory 비밀번호",pattern:"[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",not:"sha(?:1|2|3|118|256|512)"},{source:"detected-bcrypt-hash",title:"bcrypt 해시",pattern:"\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"},{source:"detected-codeclimate",title:"Code Climate 토큰",pattern:"codeclima.{0,50}[\"'`]?[0-9a-f]{64}",flags:"i"},{source:"detected-etc-shadow",title:"/etc/shadow 내용",pattern:"^\\s*root:[x!*]*:\\d*:\\d*",flags:"m"},{source:"detected-facebook-access-token",title:"Facebook 액세스 토큰",pattern:"EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"},{source:"detected-facebook-oauth",title:"Facebook OAuth 비밀",pattern:"[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"},{source:"detected-google-gcm-service-account",title:"Google 서비스 계정 키",pattern:"[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"},{source:"detected-google-oauth-access-token",title:"Google OAuth 토큰",pattern:"ya29\\.[0-9A-Za-z_-]+"},{source:"detected-heroku-api-key",title:"Heroku API 키",pattern:"[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"},{source:"detected-hockeyapp",title:"HockeyApp 토큰",pattern:"hockey.{0,50}[\"'`]?[0-9a-f]{32}",flags:"i"},{source:"detected-mailchimp-api-key",title:"Mailchimp API 키",pattern:"[0-9a-f]{32}-us\\d{1,2}"},{source:"detected-mailgun-api-key",title:"Mailgun API 키",pattern:"key-[0-9a-zA-Z]{32}"},{source:"detected-onfido-live-api-token",title:"Onfido API 토큰",pattern:"api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"},{source:"detected-outlook-team",title:"Outlook 웹훅",pattern:"https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"},{source:"detected-paypal-braintree-access-token",title:"PayPal Braintree 토큰",pattern:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"},{source:"detected-picatic-api-key",title:"Picatic API 키",pattern:"sk_live_[0-9a-z]{32}"},{source:"detected-sauce-token",title:"Sauce Labs 토큰",pattern:"sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",flags:"i"},{source:"detected-slack-token",title:"Slack 토큰",pattern:"xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"},{source:"detected-slack-webhook",title:"Slack 웹훅",pattern:"https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",not:"T00000000/B00000000/X{24}"},{source:"detected-sonarqube-docs-api-key",title:"SonarQube 토큰",pattern:"sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",flags:"i"},{source:"detected-square-access-token",title:"Square 액세스 토큰",pattern:"sq0atp-[0-9A-Za-z_-]{22}"},{source:"detected-square-oauth-secret",title:"Square OAuth 비밀",pattern:"sq0csp-[0-9A-Za-z\\\\_-]{43}"},{source:"detected-ssh-password",title:"sshpass 비밀번호",pattern:"sshpass[ ]-p\\s*['\"]"},{source:"detected-stripe-api-key",title:"Stripe API 키",pattern:"sk_live_[0-9a-zA-Z]{24}"},{source:"detected-stripe-restricted-api-key",title:"Stripe 제한 키",pattern:"rk_live_[0-9a-zA-Z]{24}"},{source:"detected-telegram-bot-api-key",title:"Telegram 봇 토큰",pattern:"\\d+:AA[0-9A-Za-z_-]{33}",not:"go\\.mod|v\\d+\\.\\d+\\.\\d+"},{source:"detected-twilio-api-key",title:"Twilio API 키",pattern:"SK[0-9a-fA-F]{32}"},{source:"detected-username-and-password-in-uri",title:"주소에 들어 있는 아이디 · 비밀번호",pattern:"[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"}];const rules=[{id:"manifest.missing",level:"error",scope:"server",title:"metadata.json 없음"},{id:"manifest.invalid",level:"error",scope:"server",title:"metadata.json 형식 오류"},{id:"manifest.entry-missing",level:"error",scope:"server",title:"metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"},{id:"manifest.commentary-missing",level:"error",scope:"server",title:"학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"},{id:"manifest.grading-types",level:"warn",scope:"server",title:"쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-ignored",level:"warn",scope:"client",title:"쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"},{id:"entry.missing",level:"error",scope:"server",title:"학생 화면 진입 파일 없음"},{id:"entry.nested",level:"error",scope:"server",title:"폴더째 묶은 zip (metadata.json이 최상위에 없음)"},{id:"input.not-zip",level:"error",scope:"server",title:"zip이 아닌 업로드 (HTML 파일 하나 등)"},{id:"limit.zip-size",level:"error",scope:"server",title:"zip 크기 한도 초과"},{id:"limit.file-count",level:"error",scope:"server",title:"파일 개수 한도 초과"},{id:"limit.unpacked-size",level:"error",scope:"server",title:"풀면 너무 큰 zip (압축 폭탄 의심)"},{id:"limit.near",level:"warn",scope:"client",title:"한도에 가까움"},{id:"limit.screen-size",level:"warn",scope:"client",title:"화면 하나를 열 때 받는 JS · CSS가 큼 (기준 limits.maxScreenBytes, 큰 라이브러리는 import()로)"},{id:"path.unsafe",level:"error",scope:"server",title:"안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"},{id:"path.case-collision",level:"error",scope:"server",title:"대소문자만 다른 경로"},{id:"path.non-ascii",level:"warn",scope:"client",title:"공백·한글 등 ASCII 밖 문자가 든 경로"},{id:"file.extension",level:"error",scope:"server",title:"허용하지 않는 확장자"},{id:"file.secret",level:"error",scope:"server",title:"정답·비밀 파일 포함"},{id:"file.dev",level:"error",scope:"server",title:"개발용 폴더 포함"},{id:"file.junk",level:"warn",scope:"server",title:"운영체제가 만든 불필요한 파일"},{id:"file.large-image",level:"warn",scope:"client",title:"1MB 넘는 이미지"},{id:"file.encoding",level:"error",scope:"client",title:"UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"},{id:"file.bom",level:"warn",scope:"client",title:"학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"},{id:"content.answer-key",level:"warn",scope:"client",title:"학생에게 내려가는 JSON에 정답처럼 보이는 키"},{id:"grading.no-submit",level:"warn",scope:"client",title:"편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"},{id:"grading.client-score",level:"warn",scope:"client",title:"제출하는 답에 화면에서 계산한 점수(score · scores · points key)를 넣음 (서버는 답 안 점수를 쓰지 않음, settings.grading rubric · pattern으로 채점)"},{id:"grading.ai-without-grading",level:"warn",scope:"client",title:"화면이 AI(mlapi.fetch)를 부르고 제출하는데 편집 화면이 채점 설정(settings.grading)을 저장하지 않음 (on_graded면 0점 · 미완료, on_submit이면 늘 100점. AI 평가는 rubric으로)"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"project.legacy-file",level:"warn",scope:"client",title:"더 쓰지 않는 프로젝트 파일(elice.config.json · content.json · grading.json)이 남아 있음 (프로젝트 검사만, ADR 0011)"},{id:"build.template-unknown",level:"warn",scope:"client",title:"metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"},{id:"layout.unknown",level:"warn",scope:"client",title:"data-ec-layout · data-ec-region에 키트가 모르는 값 (single · split · stage · media, main · aside · stage · controls · readout · actions)"},{id:"layout.own-step-nav",level:"warn",scope:"client",title:"화면 코드가 이전 · 다음 버튼을 직접 그림 (LXP 이전 · 다음 막대와 헷갈림, 키트 app.useStepper)"},{id:"ref.missing",level:"error",scope:"client",title:"참조한 파일이 없음"},{id:"ref.case-mismatch",level:"error",scope:"client",title:"참조 경로의 대소문자가 실제 파일과 다름"},{id:"ref.root-absolute",level:"error",scope:"client",title:"/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"},{id:"ref.external-script",level:"error",scope:"client",title:"외부 스크립트 (zip 안에 넣고 상대경로로)"},{id:"ref.external-request",level:"error",scope:"client",title:"외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"},{id:"ref.external-font",level:"warn",scope:"client",title:"허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"},{id:"ref.insecure",level:"error",scope:"client",title:"http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"},{id:"ref.vendor-external-url",level:"warn",scope:"client",title:"라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"},{id:"ref.script-not-public",level:"error",scope:"client",title:"type=\"module\" 없는 <script src>가 public/ 밖 파일 (프로젝트 검사만. build가 묶지 않고 zip에도 넣지 않음, type=\"module\"을 붙이거나 public/으로)"},{id:"sandbox.module-src",level:"warn",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"warn",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.iframe",level:"error",scope:"client",title:"src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기 · 허용 목록(externalAllow frame-src) 출처 · 경로의 iframe은 통과, YouTube는 https://www.youtube-nocookie.com/embed/ 주소만)"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"warn",scope:"client",title:"쿠키 사용 (학습 기록이 아님)"},{id:"api.storage",level:"warn",scope:"client",title:"브라우저 저장소 사용 (학습 기록이 아님)"},{id:"api.eval",level:"warn",scope:"client",title:"eval · new Function 사용"},{id:"api.dialog",level:"error",scope:"client",title:"alert · confirm · prompt 사용"},{id:"api.window-open",level:"error",scope:"client",title:"window.open 새 창 (sandbox 팝업)"},{id:"sec.secret",level:"error",scope:"server",title:"비밀 값 (키 · 토큰 · 비밀번호)"},{id:"sec.answer-in-bundle",level:"warn",scope:"client",title:"편집 화면에 저장한 정답(.ecdk/settings.json 채점 설정)과 같은 글이 zip에 들어갈 파일에 있음 (프로젝트 검사만)"},{id:"sec.html-injection",level:"warn",scope:"client",title:"HTML 문자열 삽입"},{id:"sec.redirect",level:"warn",scope:"client",title:"주소를 값으로 바꿈"},{id:"sec.postmessage-wildcard",level:"warn",scope:"client",title:"postMessage 대상 *"},{id:"privacy.personal-field",level:"warn",scope:"client",title:"학습자 개인정보를 받는 입력 칸(전화 · 이메일 · 이름 autocomplete 등)이나 개인정보 · 학습자 이름(account.fullname)을 제출 · 저장 · AI 호출로 보냄 (익명 id account.anonymousId, 이름은 보여 주기만)"},{id:"sdk.outdated",level:"error",scope:"client",title:"SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"error",scope:"client",title:"SDK 복사본 lib/cdk.js (zip에 넣지 않음, 프로젝트 검사만. SDK는 package.json 의존성 @eliceio/cdk를 build가 번들로 묶음)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,layouts:layouts,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
|
|
2
2
|
|
|
3
3
|
export { allowedExtensions, rulesJson as default, excluded, externalAllow, forbiddenApis, imageExtensions, layouts, limits, manifest, minVersions, rules, secretPatterns, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliceio/cdk-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-youtubeqa.0",
|
|
4
4
|
"description": "교육자용 Custom HTML 콘텐츠 CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"rollup": "4.62.4",
|
|
49
49
|
"tslib": "2.8.1",
|
|
50
50
|
"typescript": "6.0.3",
|
|
51
|
-
"@eliceio/cdk": "^1.
|
|
51
|
+
"@eliceio/cdk": "^1.9.0-youtubeqa.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"prebuild": "del-cli \"buildcache/*\" \"es/*\"",
|
package/rules.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.24.0",
|
|
3
3
|
"manifest": {
|
|
4
4
|
"file": "metadata.json",
|
|
5
5
|
"kinds": ["material", "description"],
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"externalAllow": {
|
|
18
18
|
"style-src": [],
|
|
19
19
|
"font-src": [],
|
|
20
|
-
"frame-src": ["https://entry-workspace.elice.io"]
|
|
20
|
+
"frame-src": ["https://entry-workspace.elice.io", "https://www.youtube-nocookie.com/embed/"]
|
|
21
21
|
},
|
|
22
22
|
"minVersions": {
|
|
23
23
|
"sdk": "1.0.0-alpha.4"
|
|
@@ -621,7 +621,7 @@
|
|
|
621
621
|
"id": "html.iframe",
|
|
622
622
|
"level": "error",
|
|
623
623
|
"scope": "client",
|
|
624
|
-
"title": "src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기 · 허용 목록(externalAllow frame-src)
|
|
624
|
+
"title": "src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기 · 허용 목록(externalAllow frame-src) 출처 · 경로의 iframe은 통과, YouTube는 https://www.youtube-nocookie.com/embed/ 주소만)"
|
|
625
625
|
},
|
|
626
626
|
{
|
|
627
627
|
"id": "html.form",
|
|
@@ -39,7 +39,7 @@ Read or watch / change values and observe (simulation, visualization) / follow s
|
|
|
39
39
|
- **`entry` (Entry template only, two modes)**: `{ "type": "entry", "mode": "general", "answer_project": { "enc": "gzip+base64", "data": "…" } }` (compared with the answer project, 0 or 100; no other keys) or `{ "type": "entry", "mode": "ai", "answer_project": {…}, "rubrics": [{ "object": "ik8o", "criteria": "…", "score": 100 }] }` (`object` is an object id of the answer project — there is no whole-project criterion, `""` or an unknown id is rejected with 422 `entry_rubric_object_not_found`; the AI mode also needs `settings.entry.startProject`, and the general answer project needs at least one script or global list, else 422 `entry_answer_project_empty`; 1–10 criteria of 1–1,000 characters, integer scores 1–100 summing to 100; `question_results` and `grading_feedback.criteria` per criterion, in the submit response and in the submission history). The Entry template's edit screen saves it; do not write it by hand ([17](17-using-the-entry-template.md)).
|
|
40
40
|
- **Choosing between `pattern` and `partial_pattern` is the person's call.** For a material with several questions, ask: "모두 맞혀야 100점" (`pattern`) or "문항별 부분 점수" (`partial_pattern`). For partial scores, take the per-question scores from the person or from the planning material; if neither gives them, use an equal score and say so in the summary (the quiz template's automatic score is `ceil(100 / questions)` each, 3 → 34 · 34 · 34; the kit's `splitScores` sums to exactly 100, 3 → 33 · 33 · 34). In the quiz template the author can also change the grader and the scores on the edit screen. Scores are integers 0–100 summing to at least 100 (usually exactly 100). Students must answer every question before they submit (the quiz blocks an unanswered question), so a skipped question cannot score 0 by design.
|
|
41
41
|
- **Regexes run on the server in Python `re`**, not JavaScript: for a case-insensitive match put `(?i)` at the very start (`(?i)^(paris|파리)$`); the kit, `ecdk dev` and the local mock turn a leading `(?i)` · `(?s)` · `(?m)` into the JS flag. Avoid what the two engines read differently: `\w` · `\d` · `\b` match Unicode (Korean letters, full-width digits) in Python but only ASCII in JS, so write the characters out (`[0-9]`, `[가-힣A-Za-z]`); named groups are `(?P<name>…)` in Python and `(?<name>…)` in JS (do not use them); lookbehind must be fixed-width in Python; inline flags anywhere but the start fail in both. The generated keys (escaped literals, `(?:…|…)`, `^…$`) mean the same in both.
|
|
42
|
-
- **The completion policy is picked in LXP**, not in the project: the publish skill proposes it from this table and sets it with the upload after the person agrees (graded: the quiz template or settings with `grading` → `on_graded`; the survey template → `on_access` (decided 2026-11-25; may change; it still submits with `useSubmit`); other submits without grading → `on_submit`; no submission → `on_access`), or the instructor chooses it in the '설정' panel at the top of the LXP edit page, which applies at once (ADR 0012). The templates carry a default that the server sets when the template is applied to a page that has never been saved (quiz `on_graded`; survey, document and
|
|
42
|
+
- **The completion policy is picked in LXP**, not in the project: the publish skill proposes it from this table and sets it with the upload after the person agrees (graded: the quiz template or settings with `grading` → `on_graded`; the survey template → `on_access` (decided 2026-11-25; may change; it still submits with `useSubmit`); other submits without grading → `on_submit`; no submission → `on_access`), or the instructor chooses it in the '설정' panel at the top of the LXP edit page, which applies at once (ADR 0012). The templates carry a default that the server sets when the template is applied to a page that has never been saved (quiz `on_graded`; survey, document, video and YouTube `on_access`); a saved page keeps its policy. `on_graded` needs `settings.grading` saved first, so it goes in the same save as settings with `grading`, or later. Do not write it in `metadata.json` (the old `completionPolicies` and `screens.completionPolicy` are ignored with the warning `manifest.completion-policies-ignored`, and `ecdk build` leaves them out of the zip). The content can read the current policy (SDK `material.completionPolicy`) but never sets it. Build what the suggested policy needs: a submission (`useSubmit`) for `on_submit` · `on_graded`, and the grading saved on the edit screen for `on_graded`. The server rejects `on_graded` without `settings.grading` (`MATERIAL_GRADING_REQUIRED`). The edit screen never sends a policy.
|
|
43
43
|
- **Only `on_graded` grades.** `on_submit` completes on any submission and does not grade, even with saved answers: the submission comes back `is_correct: null`, `score: 100`, and the kit shows "제출했어요.". `on_access` completes on open. A quiz with `on_submit` shows no score; that is the policy, not broken grading.
|
|
44
44
|
- Custom HTML does not use manual grading (`manual`) or no grading (`none`). With `pattern` there is no per-question grading: every question must be right for 100 (use `partial_pattern` for a score per question). Changing the answers does not regrade past submissions.
|
|
45
45
|
- Answers never go in the zip (`metadata.json` · data JSON · code), and there is no answer file in the project: answers exist only in `settings.grading`, saved on the edit screen. The old `gradingTypes` field is gone (2026-11-10): `ecdk build` warns when it is still in `metadata.json` or an old `elice.config.json`. A grading with the 11-10 policy and grader fields is rejected with how to rewrite it.
|
|
@@ -10,6 +10,7 @@ Run `ecdk create --list` first: it prints each template with its own version (`q
|
|
|
10
10
|
| The person designs the screens, or an interaction the lesson layouts cannot do (live simulation, game, custom visualization) | `ecdk create <folder> --template blank` (three screens with a small example to replace, "예측하고 확인하기", and the kit content editor on the edit screen: see 5) |
|
|
11
11
|
| A material in several steps (intro → experiment → summary, slides) | `ecdk create <folder> --template steps` (kit stepper `app.useStepper` and a different content layout per step, example "진자의 주기", content editor on the edit screen: see [14](14-layouts.md)) |
|
|
12
12
|
| One document to read (PDF or PPTX, completion on opening) | `ecdk create <folder> --template document` (the edit screen uploads a `.pdf` or `.pptx` and edits PPTX slide text in place; the student screen pages through it; `on_access` picked in LXP; `.ppt` · `.pps` · `.ppsx` must be saved as `.pptx` or `.pdf` first; in `ecdk dev` the file stays in `.ecdk/assets/`; for a page on LXP upload it with the MCP `create_asset_upload`, [12](12-upload-with-the-material-mcp.md) "Images and documents") |
|
|
13
|
+
| A YouTube video (one video URL, completion on opening, like the LXP YouTube material) | `ecdk create <folder> --template youtube` (the edit screen takes one YouTube URL (watch, youtu.be, Shorts, live, embed; a `t=` start time is kept) with a live preview; the student screen shows the `youtube-nocookie.com/embed/` player and a 'YouTube에서 보기' link; no submission, `on_access` picked in LXP; the player shows only where the server's content CSP allows that path) |
|
|
13
14
|
| Block coding or Entry Python practice in Entry, AI blocks included | `ecdk create <folder> --template entry` (the Entry workspace in an iframe, so it works only where the server's content CSP allows the workspace; the person builds the start and answer projects on the edit screen; general or AI grading; then [17](17-using-the-entry-template.md)) |
|
|
14
15
|
| A dark screen | Add `--theme dark` to the above |
|
|
15
16
|
| A problem description | Create with blank, set `metadata.json` to `{ "kind": "description", "screens": { "learn": { "enabled": true, "entry": "index.html" } }, "commentary": "commentary.txt" }`, delete the other screen files |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- **Never collect a learner's personal data** (name, phone number, email, address, date of birth, student number, resident registration number, bank account, face photo, location …) through any of these: a submission, `kvstore`, the edit screen's content (`settings`, sent to every viewer), a file upload (`assets`) or an AI call (`mlapi`, sent to an outside model). Submissions and `kvstore` values stay on the server where instructors and operators read them. Use `app.account.anonymousId` to tell learners apart ([2](02-design-the-material.md) "Personal data").
|
|
7
7
|
- The check warns about it (`privacy.personal-field`): an input that takes personal data (`type="tel"` · `type="email"`, an `autocomplete` of name · tel · email · address · birthday · card, or an input whose `name` · `id` · `placeholder` · `<label>` says 전화 · 이메일 · 학번 · 주민 · phone · email …), a personal key (`phone` · `email` · `studentId` · `연락처` …) in `submit` · `useSubmit` · `kvstore.post`, or `account.fullname` inside `submit` · `useSubmit` · `kvstore.post` · `saveSettings` · `useSave` · `mlapi.fetch` · `assets.post`. Remove the field or the value; do not silence it. Only code that never stores or sends the value (a regex lab that checks an email format on screen) may use `ecdk-ignore-next-line privacy.personal-field` with the reason.
|
|
8
8
|
4. **Libraries and media go inside the zip.** Download libraries for charts, visualization or physics (for example Chart.js, D3, p5.js) into `vendor/` and load them by relative path instead of a CDN. Fonts, images and sounds also go in the zip. Limits: zip 20 MB, 300 files. Upload long videos separately as Elice video materials.
|
|
9
|
-
- The content CSP (same as LXP) blocks every external image, font, video, CSS file, `<iframe src>`/`<object>`/`<embed>` and `fetch` (errors `ref.external-request` · `html.iframe`; an `<iframe>` filled with `srcdoc` for a code preview is fine). Fonts go in the zip as files or data URIs: external fonts (Google Fonts too) are blocked for now; they open once the server allowlist is settled.
|
|
9
|
+
- The content CSP (same as LXP) blocks every external image, font, video, CSS file, `<iframe src>`/`<object>`/`<embed>` and `fetch` (errors `ref.external-request` · `html.iframe`; an `<iframe>` filled with `srcdoc` for a code preview is fine). The only external frames allowed are the `rules.json` `externalAllow` `frame-src` entries: the Entry workspace and YouTube players under `https://www.youtube-nocookie.com/embed/` (not `youtube.com`, no IFrame API script; use the youtube template). Fonts go in the zip as files or data URIs: external fonts (Google Fonts too) are blocked for now; they open once the server allowlist is settled.
|
|
10
10
|
- A library may call outside hosts while it runs (web fonts, wasm, map tiles, APIs) and the CSP blocks them. `ref.vendor-external-url` warns about outside addresses in library files; open `ecdk dev` and look for "막힌 외부 요청" in the log, then put those files in the zip and point the library at them by relative path.
|
|
11
11
|
5. **Use relative paths** (`img/a.png`). Paths starting with `/` break. Match file name case. Prefer letters, digits, `-` and `_`.
|
|
12
12
|
6. **Switch views inside one HTML.** Show and hide steps or pages within the same HTML. Moving to another HTML or reloading loses the access token and shows "please reopen the material".
|
|
@@ -64,7 +64,7 @@ Next time, read it, confirm the page with the person as above (기관 · 과목
|
|
|
64
64
|
|
|
65
65
|
**Completion policy** (2026-11-12: the upload can set it)
|
|
66
66
|
|
|
67
|
-
The completion policy is not in the project or the zip (ADR 0012): it is a setting of the LXP page, independent of versions, and it applies as soon as it is set. The publish skill proposes one and sets it with the save after the person agrees, when the save tool takes it. Detect support like `settings`: use `completion_policy` only when the input schema of `save_draft` (or `update_material`) lists it in `payload`. If no tool has it, tell the person after saving which one to pick in the '설정' panel opened from the top of the LXP edit page (choosing applies at once). The templates carry a default that the server sets when the template is applied to a page that has never been saved (quiz and Entry `on_graded`; survey, document, video and board `on_access`); a saved page keeps its policy, so still check `get_material` and propose as below.
|
|
67
|
+
The completion policy is not in the project or the zip (ADR 0012): it is a setting of the LXP page, independent of versions, and it applies as soon as it is set. The publish skill proposes one and sets it with the save after the person agrees, when the save tool takes it. Detect support like `settings`: use `completion_policy` only when the input schema of `save_draft` (or `update_material`) lists it in `payload`. If no tool has it, tell the person after saving which one to pick in the '설정' panel opened from the top of the LXP edit page (choosing applies at once). The templates carry a default that the server sets when the template is applied to a page that has never been saved (quiz and Entry `on_graded`; survey, document, video, YouTube and board `on_access`); a saved page keeps its policy, so still check `get_material` and propose as below.
|
|
68
68
|
|
|
69
69
|
| The material | Propose |
|
|
70
70
|
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
@@ -4,7 +4,7 @@ the lesson template (`ecdk create <folder> --template lesson`) makes a **learnin
|
|
|
4
4
|
|
|
5
5
|
## When to use it
|
|
6
6
|
|
|
7
|
-
- **The default** for a learning material when the request is not one of the type templates (quiz, survey, PDF/PPT document, video, Entry, board) and the person has not specified their own screen layout: explanations, guided practice, workshop material, "학습 자료 · 교육 자료 · 실습 자료 · 강의 자료 만들어줘".
|
|
7
|
+
- **The default** for a learning material when the request is not one of the type templates (quiz, survey, PDF/PPT document, video, YouTube video, Entry, board) and the person has not specified their own screen layout: explanations, guided practice, workshop material, "학습 자료 · 교육 자료 · 실습 자료 · 강의 자료 만들어줘".
|
|
8
8
|
- **Not lesson**: a type template fits (use that template), the person describes their own screens, or the activity needs an interaction the layouts cannot do (a simulation whose picture changes with the values, a game, a custom visualization) → the blank template ([3](03-create-the-project.md)). Tell the person the choice in one line.
|
|
9
9
|
- A graded test is the quiz template: lesson quizzes are **self-check only** (the student sees right or wrong and the explanation on the page; nothing is submitted or graded, and the answers are in the content, which students can read). Suggest the completion policy `on_access` (done on open) in LXP. The template has no instructor screen.
|
|
10
10
|
|