@eliceio/cdk-cli 1.5.4 → 1.6.0-entryqa.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 +31 -29
- package/es/commands/create/index.js +1 -0
- package/es/commands/create/scaffold.d.ts +1 -1
- package/es/commands/create/scaffold.js +1 -1
- package/es/core/config.d.ts +61 -2
- package/es/core/config.js +309 -3
- package/es/dev/grading.d.ts +31 -2
- package/es/dev/grading.js +68 -1
- package/es/dev/mock-api.d.ts +3 -1
- package/es/dev/mock-api.js +34 -4
- package/es/dev/server.js +5 -4
- package/es/rules/answers.d.ts +1 -0
- package/es/rules/answers.js +3 -0
- package/es/rules/check.js +8 -1
- package/es/rules/csp.d.ts +7 -0
- package/es/rules/csp.js +24 -3
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/types.d.ts +4 -3
- package/es/rules.json.js +1 -1
- package/package.json +2 -2
- package/rules.json +5 -4
- package/skills/_shared/references/02-design-the-material.md +1 -0
- package/skills/_shared/references/05-screen-code.md +1 -0
- package/templates/_shared/lib/cdk-mock.d.ts +33 -2
- package/templates/_shared/lib/cdk-mock.js +171 -5
- package/templates/_shared/lib/elice-content.d.ts +38 -0
- package/templates/_shared/lib/elice-content.js +85 -2
- package/templates/blank/template.json +1 -1
- package/templates/document/template.json +1 -1
- package/templates/entry/README.md +118 -0
- package/templates/entry/commentary.txt +2 -0
- package/templates/entry/core/autosave.d.ts +13 -0
- package/templates/entry/core/autosave.js +69 -0
- package/templates/entry/core/default-project.d.ts +2 -0
- package/templates/entry/core/default-project.js +139 -0
- package/templates/entry/core/dom.d.ts +13 -0
- package/templates/entry/core/dom.js +83 -0
- package/templates/entry/core/grading.d.ts +51 -0
- package/templates/entry/core/grading.js +125 -0
- package/templates/entry/core/pack.d.ts +12 -0
- package/templates/entry/core/pack.js +71 -0
- package/templates/entry/core/settings.d.ts +33 -0
- package/templates/entry/core/settings.js +79 -0
- package/templates/entry/core/workspace.d.ts +40 -0
- package/templates/entry/core/workspace.js +320 -0
- package/templates/entry/docs/storage.md +44 -0
- package/templates/entry/edit.html +17 -0
- package/templates/entry/gitignore +4 -0
- package/templates/entry/index.html +17 -0
- package/templates/entry/metadata.json +9 -0
- package/templates/entry/package.json +13 -0
- package/templates/entry/screens/edit/panels/answer-project.js +15 -0
- package/templates/entry/screens/edit/panels/grading.d.ts +18 -0
- package/templates/entry/screens/edit/panels/grading.js +516 -0
- package/templates/entry/screens/edit/panels/index.js +25 -0
- package/templates/entry/screens/edit/panels/preference.js +38 -0
- package/templates/entry/screens/edit/panels/project-panel.js +97 -0
- package/templates/entry/screens/edit/panels/start-project.js +6 -0
- package/templates/entry/screens/edit.js +263 -0
- package/templates/entry/screens/learn.js +255 -0
- package/templates/entry/styles.css +872 -0
- package/templates/entry/template.json +6 -0
- package/templates/entry/ui/templates/page.js +81 -0
- package/templates/entry/ui/texts.d.ts +3 -0
- package/templates/entry/ui/texts.js +164 -0
- package/templates/entry/ui/theme.css +17 -0
- package/templates/quiz/template.json +1 -1
- package/templates/steps/template.json +1 -1
- package/templates/video/template.json +1 -1
package/es/rules/answers.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* - partial_pattern: 문항마다 정답 정규식 배열이라 원소마다 위와 같이
|
|
8
8
|
* - rubric: 평가 기준 글 전체
|
|
9
9
|
* - per_question: 문항마다 grader가 pattern이면 위 정규식처럼, rubric이면 채점 기준 글 전체 (문제 글 question은 학생에게도 보이는 글이라 뺀다)
|
|
10
|
+
* - entry: AI 채점(rubrics)이면 기준마다 채점 기준 글 criteria 전체 (정답 작품 answer_project는 묶은 글자라 보지 않음)
|
|
10
11
|
* 흔한 글과 겹치는 짧은 글은 뺀다: 한글이 든 글은 2자 미만, 그 밖(영문 · 숫자 등)은 3자 미만, 숫자만 3자 이하(100 · 0.5)
|
|
11
12
|
*/
|
|
12
13
|
function answerNeedles(grading) {
|
|
@@ -22,6 +23,8 @@ function answerNeedles(grading) {
|
|
|
22
23
|
if (typeof grader?.answer_key === 'string') keys.push(grader.answer_key);
|
|
23
24
|
if (typeof grader?.rubric === 'string') out.push(grader.rubric.trim());
|
|
24
25
|
}
|
|
26
|
+
// entry ai: 기준마다 채점 기준 글 (정답 작품은 묶은 글자라 보지 않음)
|
|
27
|
+
if (Array.isArray(g.rubrics)) for (const r of g.rubrics) if (r && typeof r === 'object' && typeof r.criteria === 'string') out.push(r.criteria.trim());
|
|
25
28
|
for (const k of keys) if (typeof k === 'string') out.push(...regexLiterals(k));
|
|
26
29
|
if (typeof g.rubric === 'string') out.push(g.rubric.trim());
|
|
27
30
|
return [...new Set(out)].filter(s => s.length >= (/[가-힣]/.test(s) ? 2 : 3) && !/^\d{1,3}$/.test(s));
|
package/es/rules/check.js
CHANGED
|
@@ -248,6 +248,12 @@ 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) 출처인지. object · embed는 늘 아님 */
|
|
252
|
+
function framesAllowed(t, spec) {
|
|
253
|
+
if (t.name !== 'iframe' && t.name !== 'frame') return false;
|
|
254
|
+
const src = t.attrs.get('src')?.trim() ?? '';
|
|
255
|
+
return /^https:\/\//i.test(src) && isAllowedExternal(src, 'frame-src', spec);
|
|
256
|
+
}
|
|
251
257
|
function textKind(path) {
|
|
252
258
|
const ext = extname(path);
|
|
253
259
|
if (ext === 'html' || ext === 'htm') return 'html';
|
|
@@ -455,7 +461,8 @@ function checkFiles(input, opts = {}) {
|
|
|
455
461
|
const classic = src !== undefined && t.attrs.get('type')?.trim().toLowerCase() !== 'module' && classifyRef(src) === 'local' ? resolveRef(f.path, src.replace(/[?#].*$/, '')) : null;
|
|
456
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);
|
|
457
463
|
if (t.name === 'img' && !t.attrs.has('alt')) add('html.img-alt', `대체 텍스트(alt)가 없는 이미지입니다.`, f.path, t.line);
|
|
458
|
-
|
|
464
|
+
// 허용 목록(externalAllow frame-src, 서버 CSP와 같게) 출처를 띄우는 iframe은 통과 (예: 엔트리 워크스페이스)
|
|
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 비디오 자료로 따로 올리고, 다른 내용은 이 HTML 안에 넣어 주세요. 코드 미리보기는 srcdoc 사용 가능.` : `<${t.name}>는 LXP 콘텐츠 CSP(object-src 'none')가 막아 빈 칸으로 보입니다. 영상은 Elice 비디오 자료로 따로 올리고, 다른 문서는 내용을 이 HTML 안에 넣어 주세요.`, f.path, t.line);
|
|
459
466
|
if (t.name === 'form') add('html.form', 'form 제출은 sandbox · 콘텐츠 CSP(form-action)가 막습니다. 버튼 click 처리와 SDK 제출을 써 주세요.', f.path, t.line);
|
|
460
467
|
}
|
|
461
468
|
if (kindOf === 'css') continue;
|
package/es/rules/csp.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export interface CspValues {
|
|
|
18
18
|
}
|
|
19
19
|
/** 콘텐츠 CSP 헤더 값. values가 없으면 자리표시({CONTENT_HOST} 등) 그대로 (문서용) */
|
|
20
20
|
export declare function contentCsp(values?: CspValues, spec?: RulesSpec): string;
|
|
21
|
+
/**
|
|
22
|
+
* dev에서만 콘텐츠 CSP 지시어에 더하는 출처 (운영 초안 CONTENT_CSP · rules.json은 넓히지 않는다).
|
|
23
|
+
* - frame-src: 로컬에서 띄운 엔트리 워크스페이스 (entry 템플릿이 ecdk dev에서 이 주소를 iframe으로 띄움)
|
|
24
|
+
*/
|
|
25
|
+
export declare const DEV_ONLY_SOURCES: Readonly<Record<string, readonly string[]>>;
|
|
26
|
+
/** dev CSP: 지시어마다 DEV_ONLY_SOURCES를 더한다 ('none'만 있던 지시어는 'none'을 뺌) */
|
|
27
|
+
export declare function withDevSources(csp: string): string;
|
|
21
28
|
/**
|
|
22
29
|
* 외부 주소가 rules.json `externalAllow`의 그 지시어 출처인지. `//host`(프로토콜 생략)는 https로 본다
|
|
23
30
|
*/
|
package/es/rules/csp.js
CHANGED
|
@@ -8,7 +8,9 @@ import { rules } from './spec.js';
|
|
|
8
8
|
* - `'self'` 대신 호스트를 직접 적는다 (헤더에 allow-same-origin이 없는 서버에서는 출처가 null이라 'self' 해석이 브라우저마다 다를 수 있음)
|
|
9
9
|
* - `webrtc 'block'`은 지원하는 브라우저에서만 (모르는 브라우저는 무시)
|
|
10
10
|
*/
|
|
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'"],
|
|
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
|
+
// 엔트리 AI 채점 피드백의 블록 그림 출처 (서버 CONTENT_CSP_IMG_ORIGINS, 모든 환경). img-src에만, 운영 호스트는 서버가 AI팀과 확인 중
|
|
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}']];
|
|
12
14
|
/** 콘텐츠 CSP 헤더 값. values가 없으면 자리표시({CONTENT_HOST} 등) 그대로 (문서용) */
|
|
13
15
|
function contentCsp(values, spec = rules) {
|
|
14
16
|
const fill = values ? {
|
|
@@ -19,7 +21,26 @@ function contentCsp(values, spec = rules) {
|
|
|
19
21
|
const allow = spec.externalAllow ?? {};
|
|
20
22
|
return CONTENT_CSP.map(([name, ...sources]) => {
|
|
21
23
|
const extra = allow[name] ?? [];
|
|
22
|
-
|
|
24
|
+
// 'none'은 다른 출처와 같이 쓰면 무시되므로(브라우저 경고) 허용 출처가 있으면 뺀다 (frame-src 'none' → 워크스페이스 출처)
|
|
25
|
+
const own = extra.length > 0 ? sources.filter(s => s !== "'none'") : sources;
|
|
26
|
+
return [name, ...own.map(s => fill[s] ?? s), ...extra].join(' ');
|
|
27
|
+
}).join('; ');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* dev에서만 콘텐츠 CSP 지시어에 더하는 출처 (운영 초안 CONTENT_CSP · rules.json은 넓히지 않는다).
|
|
31
|
+
* - frame-src: 로컬에서 띄운 엔트리 워크스페이스 (entry 템플릿이 ecdk dev에서 이 주소를 iframe으로 띄움)
|
|
32
|
+
*/
|
|
33
|
+
const DEV_ONLY_SOURCES = {
|
|
34
|
+
'frame-src': ['http://localhost:9000']
|
|
35
|
+
};
|
|
36
|
+
/** dev CSP: 지시어마다 DEV_ONLY_SOURCES를 더한다 ('none'만 있던 지시어는 'none'을 뺌) */
|
|
37
|
+
function withDevSources(csp) {
|
|
38
|
+
return csp.split('; ').map(part => {
|
|
39
|
+
const [name, ...sources] = part.split(' ');
|
|
40
|
+
const extra = DEV_ONLY_SOURCES[name ?? ''] ?? [];
|
|
41
|
+
if (!name || extra.length === 0) return part;
|
|
42
|
+
const own = sources.filter(s => s !== "'none'" && !extra.includes(s));
|
|
43
|
+
return [name, ...own, ...extra].join(' ');
|
|
23
44
|
}).join('; ');
|
|
24
45
|
}
|
|
25
46
|
/**
|
|
@@ -39,4 +60,4 @@ function allowedOrigins(spec = rules) {
|
|
|
39
60
|
return Object.values(spec.externalAllow ?? {}).flat();
|
|
40
61
|
}
|
|
41
62
|
|
|
42
|
-
export { CONTENT_CSP, allowedOrigins, contentCsp, isAllowedExternal };
|
|
63
|
+
export { CONTENT_CSP, DEV_ONLY_SOURCES, allowedOrigins, contentCsp, isAllowedExternal, withDevSources };
|
package/es/rules/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { checkFiles } from './check.js';
|
|
2
|
-
export { allowedOrigins, CONTENT_CSP, contentCsp, type CspValues, isAllowedExternal, } from './csp.js';
|
|
2
|
+
export { allowedOrigins, CONTENT_CSP, contentCsp, type CspValues, DEV_ONLY_SOURCES, isAllowedExternal, withDevSources, } from './csp.js';
|
|
3
3
|
export { COMPLETION_POLICIES_IGNORED, graderTypeError, LEGACY_COMPLETION_FIELDS, LEGACY_COMPLETION_SCREENS, type ManifestWarning, parseManifest, serializeManifest, stripCompletionPolicy, } from './manifest.js';
|
|
4
4
|
export { globToRegExp } from './path.js';
|
|
5
5
|
export { isLazyBundleFile, LAZY_FILE_MARK, type ScreenSize, screenSizeIssues, screenSizes, } from './size.js';
|
package/es/rules/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { checkFiles } from './check.js';
|
|
2
|
-
export { CONTENT_CSP, allowedOrigins, contentCsp, isAllowedExternal } from './csp.js';
|
|
2
|
+
export { CONTENT_CSP, DEV_ONLY_SOURCES, allowedOrigins, contentCsp, isAllowedExternal, withDevSources } from './csp.js';
|
|
3
3
|
export { COMPLETION_POLICIES_IGNORED, LEGACY_COMPLETION_FIELDS, LEGACY_COMPLETION_SCREENS, graderTypeError, parseManifest, serializeManifest, stripCompletionPolicy } from './manifest.js';
|
|
4
4
|
export { globToRegExp } from './path.js';
|
|
5
5
|
export { LAZY_FILE_MARK, isLazyBundleFile, screenSizeIssues, screenSizes } from './size.js';
|
package/es/rules/types.d.ts
CHANGED
|
@@ -71,10 +71,11 @@ export interface RulesSpec {
|
|
|
71
71
|
regions: string[];
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
|
-
* 콘텐츠 CSP가 허용하는 외부 출처 (지시어 → 출처 목록, 서버 CSP 허용 목록과 같게 유지). 검사는
|
|
75
|
-
* 오류(ref.external-request) 대신 경고(ref.external-font)로,
|
|
74
|
+
* 콘텐츠 CSP가 허용하는 외부 출처 (지시어 → 출처 목록, 서버 CSP 허용 목록과 같게 유지). 검사는 style-src · font-src
|
|
75
|
+
* 출처를 오류(ref.external-request) 대신 경고(ref.external-font)로, frame-src 출처의 `<iframe src>`는 html.iframe 없이
|
|
76
|
+
* 통과시킨다. `ecdk dev`는 CSP 해당 지시어에 더한다 (csp.ts)
|
|
76
77
|
*/
|
|
77
|
-
externalAllow?: Partial<Record<'style-src' | 'font-src', string[]>>;
|
|
78
|
+
externalAllow?: Partial<Record<'style-src' | 'font-src' | 'frame-src', string[]>>;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
81
|
* 비밀 값 탐지 (`sec.secret`). 사내 SAST(semgrep p/secrets + security/semgrep custom)를 옮긴 것.
|
package/es/rules.json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const version="0.21.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"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[]};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:"새 창 열기 (sandbox에서 막힘)"},{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 미리보기는 통과)"},{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:"새 창 열기"},{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.22.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:"새 창 열기 (sandbox에서 막힘)"},{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:"새 창 열기"},{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.6.0-entryqa.0",
|
|
4
4
|
"description": "교육자용 Custom HTML 콘텐츠 CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"rollup": "^4.0.0",
|
|
47
47
|
"tslib": "^2.6.1",
|
|
48
48
|
"typescript": "~5.9.3",
|
|
49
|
-
"@eliceio/cdk": "^1.
|
|
49
|
+
"@eliceio/cdk": "^1.6.0-entryqa.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"prebuild": "del-cli \"buildcache/*\" \"es/*\"",
|
package/rules.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.22.0",
|
|
3
3
|
"manifest": {
|
|
4
4
|
"file": "metadata.json",
|
|
5
5
|
"kinds": ["material", "description"],
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
"material": ["learn", "instructor", "edit"],
|
|
11
11
|
"description": ["learn"]
|
|
12
12
|
},
|
|
13
|
-
"graderTypes": ["pattern", "partial_pattern", "rubric"],
|
|
13
|
+
"graderTypes": ["pattern", "partial_pattern", "rubric", "entry"],
|
|
14
14
|
"commentaryFile": "commentary.txt",
|
|
15
15
|
"defaultEntry": "index.html"
|
|
16
16
|
},
|
|
17
17
|
"externalAllow": {
|
|
18
18
|
"style-src": [],
|
|
19
|
-
"font-src": []
|
|
19
|
+
"font-src": [],
|
|
20
|
+
"frame-src": ["https://entry-workspace.elice.io"]
|
|
20
21
|
},
|
|
21
22
|
"minVersions": {
|
|
22
23
|
"sdk": "1.0.0-alpha.4"
|
|
@@ -620,7 +621,7 @@
|
|
|
620
621
|
"id": "html.iframe",
|
|
621
622
|
"level": "error",
|
|
622
623
|
"scope": "client",
|
|
623
|
-
"title": "src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc
|
|
624
|
+
"title": "src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기 · 허용 목록(externalAllow frame-src) 출처의 iframe은 통과)"
|
|
624
625
|
},
|
|
625
626
|
{
|
|
626
627
|
"id": "html.form",
|
|
@@ -34,6 +34,7 @@ Read or watch / change values and observe (simulation, visualization) / follow s
|
|
|
34
34
|
- **AI grading is `rubric`, saved on the edit screen.** AI가 답을 평가해 점수를 매기는 학습자료는 `settings.grading`을 `rubric`으로 저장한다 (편집 화면 `useSave`의 `getGrading`으로 평가 기준을 rubric 글로 만들어 저장), 학습 화면은 학습자 답만 제출한다, 화면에서 계산한 점수는 서버 채점에 쓰이지 않는다. Without `settings.grading`, `on_graded` scores 0 and never completes and `on_submit` gives 100 whatever the AI said. With `on_graded` + `rubric` the server grades 0–100 and completes at 1 point or more. Never compute the score with `mlapi` in the browser and submit it. Sketch and details: [5](05-screen-code.md) "AI grading".
|
|
35
35
|
- **`partial_pattern` (partial score per question)**: `{ "type": "partial_pattern", "answer_key": ["^…$", "^…$"], "scores": [50, 50] }`. The student submits a **string array** in question order and `answer[i]` is matched against `answer_key[i]` the same way as `pattern` (trimmed, full match). The score is the sum of `scores[i]` of the matched questions, capped at 100. Rules the server enforces on save (422 otherwise): both arrays 1–50 long and the same length, each score an integer 0–100, the sum at least 100 (a lower sum could never complete). Only 100 is `is_correct: true` and completes `on_graded`; a missing item scores 0, extra items are ignored, and an answer that is not an array of strings is rejected (422). The response also carries `answer_correctness` (per question, `answer_key` order; `[]` for `pattern` · `rubric`), in the submit response and the submission lists, so a screen can mark each question right or wrong (SDK `answerCorrectness`). Kit helpers: `validatePartialGrading` (the same rules, for `getGrading`) and `splitScores(n)` (equal integer split summing to 100, e.g. 3 → [33, 33, 34]). The quiz template supports both (6).
|
|
36
36
|
- **`per_question` (regex and AI-graded questions mixed, quiz template 1.11.0+)**: `{ "type": "per_question", "questions": [{ "score": 50, "grader": { "type": "pattern", "answer_key": "^q1=b$" } }, { "score": 50, "grader": { "type": "rubric", "rubric": "…", "question": "the problem text" } }], "pass_score": 60 }`. The answer is a string array in question order; an AI-graded item is the plain answer text (no `qN=`). A question earns `floor(grader score 0–100 × score / 100)`, the total is capped at 100, only 100 is `is_correct: true`, and `on_graded` completes at `pass_score` (1–100, default 100). Save rules (422 otherwise): 1–50 questions, integer scores summing to at least 100, at most 10 `rubric` graders, `rubric` ≤ 10,000 and `question` ≤ 2,000 characters. The response carries `question_results: [{ score, is_correct }]` per question (in the submission lists too). Use the quiz template's AI-graded question rather than writing this by hand.
|
|
37
|
+
- **`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.
|
|
37
38
|
- **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.
|
|
38
39
|
- **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.
|
|
39
40
|
- **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). `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.
|
|
@@ -18,6 +18,7 @@ Do not open `lib/` to learn the API: this table is the API (from `lib/elice-cont
|
|
|
18
18
|
| `app.assets.uploadImage(file, { onProgress?, signal? })` · `optimizeImage(file)` · `IMAGE_RULES` | Images in the content (PNG · JPEG · WebP · GIF, up to 10MB; no SVG). `uploadImage` (edit screen only) shrinks the image once in the browser with the exported `optimizeImage`, then uploads it like `uploadFile` → `{ asset_key, size, original_size, width, height, type }`. `optimizeImage`: PNG · JPEG · WebP are drawn upright (EXIF orientation), scaled to a longest side of 2048px and re-encoded as WebP quality 0.85 (JPEG if the browser cannot make WebP, PNG for a PNG · WebP that may be transparent); re-encoding drops EXIF · GPS. The original is kept when the result is larger, unless it needed scaling or carries EXIF · XMP. GIF is uploaded as is. Errors are `ContentError` `upload_bad_type` · `upload_bad_file` (image wording) · `image_unreadable`. To show it, `fetch` the address from `await app.assets.url(asset_key)` and put `URL.createObjectURL(blob)` in the `<img>`: the content CSP allows images only from the content origin, `data:` and `blob:`, and the file origin only in `connect-src` (the quiz template does this in `core/markdown.js`). Show a "reload" notice when the fetch fails (the signed address expires) |
|
|
19
19
|
| `app.grading` | Saved grading on the edit screen only: `{ type: 'pattern', answer_key }` · `{ type: 'partial_pattern', answer_key: [], scores: [] }` · `{ type: 'rubric', rubric }` or null |
|
|
20
20
|
| `app.submit(answer)` · `app.lastAnswer()` · `app.lastSubmission()` · `app.saveContent(content, grading?)` | Low-level calls under `useSubmit` · `useSave` (rarely needed) |
|
|
21
|
+
| `app.kvstore.get({ key })` · `app.kvstore.post({ key, value })` · `app.kvstore.delete(key)` | The viewer's own storage in this material (SDK `kvstore`, per material and account, about 512KB, 20 writes per second): keep work in progress such as an autosaved project. `key` is a dot path (`progress.step`), `value` any JSON. A tutor only reads the student's value (`post` · `delete` reject with `ContentError` `read_only_mode`), an editor preview keeps it in memory. Errors are `ContentError` (`storage_limit_exceeded`, `rate_limited`, `invalid_param`). Never store personal data |
|
|
21
22
|
| `skeleton(layout?, { parts?, label? })` | Exported: loading placeholder (`.ec-sk`, shimmer, "불러오는 중…" for screen readers only). Put it in `#app` before `await start()`. `'learn'` = one block that fills the screen, `'edit'` = `parts` from the top (default `['bar', 'media']`: file bar + 16:9 preview). Use the same markup in the HTML so it shows before the script runs |
|
|
22
23
|
| `showSnackbar({ text, onAction?, action?, onClose?, focus? })` | Exported: edit screen "되돌리기" message at the bottom (`.ec-snackbar`, 6 s, one at a time, outside `#app`) → `{ element, close() }`. See [13](13-edit-screen-design.md) |
|
|
23
24
|
| `fileBar({ icon?, name, meta?, onChange?, changeLabel?, disabled? })` · `formatFileMeta` · `infoList` | Exported: edit screen uploaded-file row (`.ec-file-bar`, button "다른 파일로 변경") · "120MB, 08:30" · ⓘ list. `icon`: `fileVideoIcon()` (`lib/icons/file-video.js`) or `fileIcon()` (`lib/icons/file.js`); import only the icon you use, so the zip carries only that icon and its license comment |
|
|
@@ -42,6 +42,12 @@ export interface SubmitResult {
|
|
|
42
42
|
answerCorrectness?: boolean[];
|
|
43
43
|
/** 문항별 결과 (서버 question_results, 문항 순서): score는 받은 점수, 만점일 때만 isCorrect. per_question · partial_pattern만, 그 밖은 [] (옛 서버는 없음) */
|
|
44
44
|
questionResults?: { score: number; isCorrect: boolean }[];
|
|
45
|
+
/**
|
|
46
|
+
* entry 채점 피드백 (서버 grading_feedback, 제출 · 미리보기 · /submissions/me 응답): { message, criteria: [{ feedback }] }.
|
|
47
|
+
* criteria는 기준 순서로 questionResults와 같은 길이, 일반(general)은 { message: '', criteria: [] }. mock은 흉내 문구.
|
|
48
|
+
* 옛 SDK(1.5.x까지) submit은 넘기지 않는다 (history로 읽음)
|
|
49
|
+
*/
|
|
50
|
+
gradingFeedback?: { message: string; criteria: { feedback: string }[] } | null;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
export interface Submission extends SubmitResult {
|
|
@@ -52,7 +58,7 @@ export interface Submission extends SubmitResult {
|
|
|
52
58
|
answer: unknown;
|
|
53
59
|
}
|
|
54
60
|
|
|
55
|
-
/** 채점 설정을 서버 모양으로 ({ type: pattern | partial_pattern | rubric | per_question }). camelCase answerKey도 받는다. 채점 방식이 아니면 null */
|
|
61
|
+
/** 채점 설정을 서버 모양으로 ({ type: pattern | partial_pattern | rubric | per_question | entry }). camelCase answerKey도 받는다. 채점 방식이 아니면 null */
|
|
56
62
|
export declare function normalizeGradingSettings(
|
|
57
63
|
grading: unknown
|
|
58
64
|
):
|
|
@@ -69,10 +75,22 @@ export declare function normalizeGradingSettings(
|
|
|
69
75
|
}[];
|
|
70
76
|
pass_score?: number;
|
|
71
77
|
}
|
|
78
|
+
| {
|
|
79
|
+
type: 'entry';
|
|
80
|
+
/** general | ai (모르는 값도 그대로) */
|
|
81
|
+
mode?: string;
|
|
82
|
+
answer_project?: { enc: string; data: string };
|
|
83
|
+
/** mode ai일 때만 */
|
|
84
|
+
rubrics?: { object: string; criteria: string; score: number }[];
|
|
85
|
+
}
|
|
72
86
|
| null;
|
|
87
|
+
/** 엔트리 제출 답 `{ v: 1, project: { enc, data } }`(또는 작품 · 그 JSON 글자)에서 작품을 꺼냄. 없으면 null */
|
|
88
|
+
export declare function entryProjectOf(answer: unknown): { enc: string; data: string } | null;
|
|
73
89
|
/** 채점 설정이 있으면 로컬 채점, 없으면 제출만 받음 (점수 null). partial_pattern은 맞은 문항 점수의 합(최대 100).
|
|
74
90
|
* per_question은 pattern 문항 + AI 채점 흉내 점수(floor(mockRubricScore × score / 100))의 합, mockRubric: true.
|
|
75
|
-
* per_question · partial_pattern은 문항별 결과 questionResults도 (제출 기록에만 남김)
|
|
91
|
+
* per_question · partial_pattern은 문항별 결과 questionResults도 (제출 기록에만 남김).
|
|
92
|
+
* entry general은 작품 글자(enc · data)가 정답 작품과 같으면 100, ai는 기준마다 floor(mockRubricScore(작품 data) × 배점 / 100)의 합 ·
|
|
93
|
+
* 기준 순서 questionResults · 흉내 gradingFeedback, mockRubric: true */
|
|
76
94
|
export declare function gradeLocally(
|
|
77
95
|
grading: unknown,
|
|
78
96
|
answer: unknown
|
|
@@ -149,6 +167,8 @@ export declare class MockEliceCDK {
|
|
|
149
167
|
entries: Partial<Record<Screen, string>>;
|
|
150
168
|
settings: Record<string, unknown>;
|
|
151
169
|
completionPolicy: CompletionPolicy | null;
|
|
170
|
+
/** entry 채점 방식 (실제 SDK는 /me grading_mode). 학습 화면(learn scope · draft 아님)에서 저장된 entry 채점의 mode, 그 밖은 null */
|
|
171
|
+
gradingMode: 'general' | 'ai' | null;
|
|
152
172
|
} | null;
|
|
153
173
|
readonly result: {
|
|
154
174
|
score: number | null;
|
|
@@ -165,3 +185,14 @@ export declare class MockEliceCDK {
|
|
|
165
185
|
dispose(): void;
|
|
166
186
|
reset(): void;
|
|
167
187
|
}
|
|
188
|
+
|
|
189
|
+
/** 묶은 엔트리 작품 { enc, data }을 푼다 (objects 배열이 있는 객체). 풀지 못하면 null */
|
|
190
|
+
export declare function decodeEntryProject(
|
|
191
|
+
project: unknown
|
|
192
|
+
): Promise<{ objects: unknown[]; variables?: unknown[] } | null>;
|
|
193
|
+
/** 작품에 채점거리(블록 묶음이 있는 오브젝트나 전역 리스트)가 있나 (서버 entry_answer_project_empty 규칙) */
|
|
194
|
+
export declare function entryHasGradable(project: { objects: unknown[]; variables?: unknown }): boolean;
|
|
195
|
+
/** 엔트리 채점 설정 저장 검사 중 작품 안 규칙 (서버 422 detail 모양). 문제없으면 null */
|
|
196
|
+
export declare function entrySaveIssue(
|
|
197
|
+
settings: Record<string, unknown>
|
|
198
|
+
): Promise<{ type: string; loc: (string | number)[]; ctx?: Record<string, unknown> } | null>;
|