Merge: 7.0.7 병렬 검수 수정분 통합 — 구조분해·JSON-LD 중복 구현 단일화, 양측 고유 수정 보존

동일 결함 2건(표현식 배열 구조분해 회귀, JSON-LD 이스케이프)을 양 세션이 독립
구현해 충돌. 해소 기준:

- 평가기 구조분해: JS iterator 시맨틱 구현 채택(구 평가기 new Function 패리티가
 회귀 수정의 본래 의도). 관대(undefined) 바인딩 구현과 그 단언 1건은 폐기.
 단위 테스트는 양측 병합(구조분해 10케이스), E2E·시나리오 축은
 destructuring_param 단일 케이스로 통합. 무관 심볼의 @since 소급 변경은 원복.
- JSON-LD: JSON_HEX_TAG|JSON_HEX_AMP(상위집합) 채택, XSS 단위 테스트 중복 제거.
- 양측 고유 수정 각각 보존: composeTitleSuffix 접미사 조립(타 세션) /
 스케줄 확장 명령 웹 검증 폴백·SeoMetaResolverTest 설정 격리(본 세션).
- min.js 는 병합 소스로 core:build --production 재빌드.

검증: SafeExpressionEvaluator 120/120, SeoMetaResolverTest 68/68, 배포 번들
E2E 6/6. 실측 — 게시판 환경설정 권한 섹션 60컨트롤 렌더, 장바구니 담기 201,
봇 title 접미사 공백 복원·매달린 구분자 제거, 검색 XSS 봇/_escaped_fragment_
양 경로 이스케이프 확인.
This commit is contained in:
HeuJung committed 2026-08-18 10:16:50 +09:00
commit 4b986be0b2
10 files changed
+208 -92

No files matched your search

+2 -1
View File
@@ -23,7 +23,7 @@
- 만료된 인증 토큰이 사용자 언어(로케일) 판별에서 여전히 유효한 것으로 취급되던 문제를 수정했습니다. 이제 만료된 토큰은 비로그인과 동일하게 처리합니다. (sir.kr 커뮤니티의 Xbuilder 님께서 제보해주셨습니다.)
- 통합 검색이 로그인한 회원을 비회원으로 취급하던 문제를 수정했습니다. 검색 API 가 로그인 상태를 해석하지 않아, 회원 전용 게시판의 읽기 권한이 있어도 검색 결과와 게시판 필터 목록이 비회원 기준으로만 제한되었습니다. 이제 로그인한 회원은 자신이 열람할 수 있는 게시판 범위 그대로 검색됩니다. 비회원 검색은 종전과 동일합니다.
- 셸 예약 작업의 허용 실행 파일 목록에 `bash`·`python` 같은 인터프리터를 등록했을 때, 인터프리터에 인라인 명령(`bash -c ...` 형태)을 실어 임의 명령이 실행되던 문제를 막았습니다. 이제 인터프리터 뒤에는 절대경로 스크립트 파일만 지정할 수 있으며, 인라인 코드 실행·상대경로·경로 조작이 담긴 명령은 저장·실행 양쪽에서 거부됩니다. 스크립트 파일을 주기 실행하는 정상 사용(예: `python /경로/작업.py`)은 그대로 동작합니다. 이 기능은 현재 메뉴에 노출되지 않아 실제 사용 경로가 없습니다. (KISA 측에서 제보해주셨습니다 — KVE-2026-1653)
- 검색 봇에게 제공되는 서버 렌더링 화면의 구조화 데이터(JSON-LD)에 검색어·게시글 제목 같은 사용자 입력이 담길 때, 스크립트 태그를 닫는 특수한 문자열을 끼워 넣으면 주입된 스크립트가 실행될 수 있던 문제를 수정했습니다. 이제 해당 문자가 안전한 형태로 변환되어 실리며, 검색엔진이 읽는 데이터 내용은 그대로 보존됩니다. 일반 사용자 화면에는 이 블록이 실리지 않으므로 봇 요청 경로에만 해당합니다.
- 검색어·게시글 제목처럼 방문자가 입력한 값이 검색엔진용 구조화 데이터(JSON-LD)에 실릴 때, 스크립트 태그를 닫는 문자열을 끼워 넣으면 그 뒤의 내용이 방문자 브라우저에서 스크립트로 실행될 수 있던 문제를 수정했습니다. 검색엔진 봇에게 제공되는 화면이지만 특정 주소 파라미터로 일반 방문자에게도 같은 화면을 강제할 수 있어 실제 공격 경로가 됩니다. 이제 태그 문자를 이스케이프해 실행을 차단하며, 검색엔진이 읽는 구조화 데이터의 의미는 그대로 유지됩니다.
### Added
@@ -82,6 +82,7 @@
- 확장·코어 업데이트가 중단되며 남은 임시 폴더와 오래된 백업본, 언어팩 설치 임시 파일이 정리되지 않고 계속 쌓이던 문제를 수정했습니다. 사흘이 지난 임시 산출물과 30일이 지난 백업본(최신 1개는 보존)이 매일 자동 정리됩니다.
- 개발 도구의 브라우저 콘솔 로그 파일이 하나의 파일에 무한히 쌓이던 문제를 수정했습니다. 이제 날짜별 파일로 나뉘어 7일간 보관됩니다.
- 예약 작업 저장 화면에서 설치된 확장이 제공하는 Artisan 명령이 "예약 실행이 허용된 명령이 아닙니다" 로 거부되던 문제를 수정했습니다. 터미널에서의 검증은 통과하는 명령이 관리자 화면 저장에서만 거부되었습니다. 이 기능은 현재 메뉴에 노출되지 않아 실제 사용 경로가 없습니다.
- 검색엔진 노출용 페이지 제목에서 타이틀 접미사가 제목과 붙어 표시되던 문제를 수정했습니다. 관리자 화면 안내대로 접미사를 공백으로 시작하게 입력해도 저장 시 선행 공백이 제거되어 "제목| 사이트명" 처럼 접착되었고, 페이지 제목이 없는 화면에서는 "| 사이트명" 처럼 구분자가 매달려 표시되었습니다. 이제 제목이 있으면 공백을 복원해 잇고, 제목이 없으면 구분자를 떼고 사이트명만 표시합니다.
## [7.0.6] - 2026-08-10
+41 -9
View File
@@ -253,6 +253,7 @@ class SeoMetaResolver
return $this->resolveLocalizedValue($value);
}
}
return '';
}
@@ -428,6 +429,37 @@ class SeoMetaResolver
return [$contextIdentifier, $rest];
}
/**
* `<title>` 조립용 접미사를 정규화합니다.
*
* 관리자 저장 경로의 TrimStrings 미들웨어가 접미사의 선행 공백을 제거하므로
* ("` | 그누보드7`" 을 입력해도 "`| 그누보드7`" 로 저장된다), blade 의
* `{{ $title }}{{ $titleSuffix }}` 단순 연결에서 제목과 구분자가 붙어 버린다.
* 이 메서드가 조립 규칙의 SSoT 다:
*
* - 제목이 있고 접미사가 공백으로 시작하지 않으면 공백 하나를 복원해 잇는다.
* - 제목이 비어 있으면 매달린 선행 구분자(`|`,`-`,`·`,`:`,`/`,`–`,`—`)를 떼어
* 사이트명 부분만 남긴다 (홈처럼 페이지 제목이 없는 화면의 "`| 사이트명`" 방지).
*
* @param string $title 최종 페이지 제목 (filter 훅 적용 후)
* @param string $suffix 코어 설정의 타이틀 접미사
* @return string 조립에 사용할 접미사 (제목이 없으면 접미사가 곧 전체 제목)
*/
public static function composeTitleSuffix(string $title, string $suffix): string
{
if (trim($suffix) === '') {
return '';
}
if ($title === '') {
$stripped = (string) preg_replace('/^[\s|·:\/\x{2013}\x{2014}-]+/u', '', $suffix);
return trim($stripped);
}
return preg_match('/^\s/u', $suffix) === 1 ? $suffix : ' '.$suffix;
}
/**
* 레이아웃 meta의 title을 해석합니다 (fallback용).
*
@@ -691,14 +723,14 @@ class SeoMetaResolver
$resolved = array_merge(['@context' => 'https://schema.org'], $structuredData);
// JSON_HEX_TAG: `<`/`>` 를 `<`/`>` 로 이스케이프한다. 이 블록은
// `<script type="application/ld+json">` 안에 그대로 삽입되므로, 사용자 입력
// (검색어·게시글 제목·상품명 등)이 값에 들어올 때 `</script>` 시퀀스가 스크립트
// 태그를 조기 종료시켜 저장형 XSS 로 이어지는 것을 막는다. 값 자체는 JSON 이스케이프
// 형태라 파서가 원문으로 복원한다.
// JSON-LD 는 `<script type="application/ld+json">` 안에 임베드된다. 사용자 제어 값
// (검색어·상품명 등)에 포함된 `</script>` 가 스크립트 컨텍스트를 조기 종료하면 그
// 뒤의 페이로드가 실행 가능한 script 요소로 재생성된다(반사형 XSS — 봇 렌더는
// _escaped_fragment_ 로 일반 UA 도 강제됨). JSON_HEX_TAG 로 `<`·`>` 를 <·>
// 로 이스케이프해 브레이크아웃을 차단한다. JSON_HEX_AMP 는 방어 심화.
return json_encode(
$resolved,
JSON_HEX_TAG | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT,
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_HEX_TAG | JSON_HEX_AMP,
);
}
@@ -798,9 +830,9 @@ class SeoMetaResolver
* 구조화 데이터 하위 객체가 실질적으로 비어있는지 확인합니다.
*
* @type 키가 있는 객체에서, @type 외 필드 중 하나라도 빈 문자열이면
* 해당 객체를 JSON-LD에서 제거합니다.
* 예: aggregateRating의 ratingValue=""이면, bestRating="5"가 있더라도 제거됩니다.
* Google 구조화 데이터 검증에서 필수 필드가 빈 값이면 에러로 처리되기 때문입니다.
* 해당 객체를 JSON-LD에서 제거합니다.
* 예: aggregateRating의 ratingValue=""이면, bestRating="5"가 있더라도 제거됩니다.
* Google 구조화 데이터 검증에서 필수 필드가 빈 값이면 에러로 처리되기 때문입니다.
*
* @param array $resolved 평가된 구조화 데이터 객체
* @return bool 비어있으면 true
+3 -1
View File
@@ -491,7 +491,9 @@ class SeoRenderer implements SeoRendererInterface
$viewData = [
'locale' => $locale,
'title' => $meta['title'],
'titleSuffix' => $meta['titleSuffix'],
// filter 훅이 title 을 바꿨을 수 있으므로 최종 title 기준으로 접미사를 정규화한다
// (TrimStrings 로 선행 공백이 제거된 접미사 복원 + 빈 제목의 매달린 구분자 제거)
'titleSuffix' => SeoMetaResolver::composeTitleSuffix((string) ($meta['title'] ?? ''), (string) ($meta['titleSuffix'] ?? '')),
'description' => $meta['description'],
'keywords' => $meta['keywords'],
'canonicalUrl' => $canonicalUrl,
+1 -1
View File
@@ -9,7 +9,7 @@ Error generating stack: `+u.message+`
`).replace(oT,"")}function RS(t,r){return r=kS(r),kS(t)===r}function Tt(t,r,o,u,p,g){switch(o){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||qa(t,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&qa(t,""+u);break;case"className":xi(t,"class",u);break;case"tabIndex":xi(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":xi(t,o,u);break;case"style":zc(t,u,g);break;case"data":if(r!=="object"){xi(t,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||o!=="href")){t.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=lr(""+u),t.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(o==="formAction"?(r!=="input"&&Tt(t,r,"name",p.name,p,null),Tt(t,r,"formEncType",p.formEncType,p,null),Tt(t,r,"formMethod",p.formMethod,p,null),Tt(t,r,"formTarget",p.formTarget,p,null)):(Tt(t,r,"encType",p.encType,p,null),Tt(t,r,"method",p.method,p,null),Tt(t,r,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=lr(""+u),t.setAttribute(o,u);break;case"onClick":u!=null&&(t.onclick=Rr);break;case"onScroll":u!=null&&at("scroll",t);break;case"onScrollEnd":u!=null&&at("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(a(60));t.innerHTML=o}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}o=lr(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""+u):t.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""):t.removeAttribute(o);break;case"capture":case"download":u===!0?t.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,u):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(o,u):t.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(o):t.setAttribute(o,u);break;case"popover":at("beforetoggle",t),at("toggle",t),In(t,"popover",u);break;case"xlinkActuate":yn(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":yn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":yn(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":yn(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":yn(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":yn(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":yn(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":yn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":yn(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":In(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Vf.get(o)||o,In(t,o,u))}}function zp(t,r,o,u,p,g){switch(o){case"style":zc(t,u,g);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(a(60));t.innerHTML=o}}break;case"children":typeof u=="string"?qa(t,u):(typeof u=="number"||typeof u=="bigint")&&qa(t,""+u);break;case"onScroll":u!=null&&at("scroll",t);break;case"onScrollEnd":u!=null&&at("scrollend",t);break;case"onClick":u!=null&&(t.onclick=Rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`;break;case"t":l+=" ";break;case"r":l+="\r";break;case"b":l+="\b";break;case"f":l+="\f";break;case"v":l+="\v";break;case"0":l+="\0";break;case"\\":l+="\\";break;case"`":l+="`";break;case"$":l+="$";break;default:l+=d;break}n+=2;continue}if(c==="`")return a.push(l),{quasis:a,exprs:i,end:n+1};if(c==="$"&&s[n+1]==="{"){a.push(l),l="",n+=2;const d=n;let f=1;for(;n<s.length&&f>0;){const h=s[n];if(h==="{")f++,n++;else if(h==="}"){if(f--,f===0)break;n++}else h==='"'||h==="'"?n=$w(s,n,h):h==="`"?n=Lg(s,n).end:n++}if(f!==0)throw new Error("Unterminated ${...} in template literal");i.push(s.slice(d,n)),n++;continue}l+=c,n++}throw new Error(`Unterminated template literal at position ${e}`)}function Nw(s){const e=[];let n=0;const a=s.length,i=l=>n+l<a?s[n+l]:"";for(;n<a;){const l=s[n];if(l===" "||l===" "||l===`
`||l==="\r"||l==="\f"||l==="\v"){n++;continue}if(gi(l)||l==="."&&gi(i(1))){const h=n;for(;n<a&&gi(s[n]);)n++;if(s[n]===".")for(n++;n<a&&gi(s[n]);)n++;if(s[n]==="e"||s[n]==="E"){if(n++,(s[n]==="+"||s[n]==="-")&&n++,!gi(s[n]))throw new Error(`Invalid number literal at position ${h}`);for(;n<a&&gi(s[n]);)n++}const m=s.slice(h,n);e.push({type:"num",value:Number(m),pos:h});continue}if(l==='"'||l==="'"){const h=n,m=l;n++;let b="";for(;n<a&&s[n]!==m;)if(s[n]==="\\"){n++;const S=s[n];switch(S){case"n":b+=`
`;break;case"t":b+=" ";break;case"r":b+="\r";break;case"b":b+="\b";break;case"f":b+="\f";break;case"v":b+="\v";break;case"0":b+="\0";break;case"\\":b+="\\";break;case"'":b+="'";break;case'"':b+='"';break;case"`":b+="`";break;default:b+=S;break}n++}else b+=s[n],n++;if(n>=a)throw new Error(`Unterminated string literal at position ${h}`);n++,e.push({type:"str",value:b,pos:h});continue}if(Lw(l)){const h=n;for(n++;n<a&&Mw(s[n]);)n++;e.push({type:"ident",value:s.slice(h,n),pos:h});continue}if(l==="`"){const h=Lg(s,n);e.push({type:"template",value:"",pos:n,quasis:h.quasis,exprs:h.exprs}),n=h.end;continue}const c=n,d=s.substr(n,2);if(s.substr(n,3)==="..."){e.push({type:"punct",value:"...",pos:c}),n+=3;continue}switch(l){case"=":{i(1)===">"?(e.push({type:"punct",value:"=>",pos:c}),n+=2):i(1)==="="?i(2)==="="?(e.push({type:"punct",value:"===",pos:c}),n+=3):(e.push({type:"punct",value:"==",pos:c}),n+=2):(e.push({type:"punct",value:"=",pos:c}),n+=1);continue}case"!":{i(1)==="="?i(2)==="="?(e.push({type:"punct",value:"!==",pos:c}),n+=3):(e.push({type:"punct",value:"!=",pos:c}),n+=2):(e.push({type:"punct",value:"!",pos:c}),n+=1);continue}case"<":{if(i(1)==="=")e.push({type:"punct",value:"<=",pos:c}),n+=2;else{if(i(1)==="<")throw new Error("Bitwise/shift operators are not allowed");e.push({type:"punct",value:"<",pos:c}),n+=1}continue}case">":{if(i(1)==="=")e.push({type:"punct",value:">=",pos:c}),n+=2;else{if(i(1)===">")throw new Error("Bitwise/shift operators are not allowed");e.push({type:"punct",value:">",pos:c}),n+=1}continue}case"&":{if(i(1)==="&")e.push({type:"punct",value:"&&",pos:c}),n+=2;else throw new Error("Bitwise operators are not allowed");continue}case"|":{if(i(1)==="|")e.push({type:"punct",value:"||",pos:c}),n+=2;else throw new Error("Bitwise operators are not allowed");continue}case"?":{i(1)==="."&&!gi(i(2))?(e.push({type:"punct",value:"?.",pos:c}),n+=2):i(1)==="?"?(e.push({type:"punct",value:"??",pos:c}),n+=2):(e.push({type:"punct",value:"?",pos:c}),n+=1);continue}case"+":{if(i(1)==="+")throw new Error("Increment operator is not allowed");if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"+",pos:c}),n+=1;continue}case"-":{if(i(1)==="-")throw new Error("Decrement operator is not allowed");if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"-",pos:c}),n+=1;continue}case"*":{if(i(1)==="=")throw new Error("Assignment operators are not allowed");if(i(1)==="*")throw new Error("Exponentiation operator is not supported");e.push({type:"punct",value:"*",pos:c}),n+=1;continue}case"/":{if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"/",pos:c}),n+=1;continue}case"%":{if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"%",pos:c}),n+=1;continue}case"~":case"^":throw new Error("Bitwise operators are not allowed");case".":case":":case"(":case")":case"[":case"]":case"{":case"}":case",":e.push({type:"punct",value:l,pos:c}),n+=1;continue;case";":e.push({type:"punct",value:";",pos:c}),n+=1;continue;default:throw new Error(`Unexpected character "${l}" at position ${c}`)}}return e}const Iw={"??":1,"||":1,"&&":2,"===":3,"!==":3,"==":3,"!=":3,"<":4,">":4,"<=":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},jw=new Set(["??","||","&&"]);class Hw{constructor(e){$(this,"tokens");$(this,"pos",0);this.tokens=e}atEnd(){return this.pos>=this.tokens.length}peek(e=0){const n=this.pos+e;return n<this.tokens.length?this.tokens[n]:null}next(){if(this.atEnd())throw new Error("Unexpected end of expression");return this.tokens[this.pos++]}isPunct(e,n=0){const a=this.peek(n);return!!a&&a.type==="punct"&&a.value===e}expectPunct(e){const n=this.peek();if(!n||n.type!=="punct"||n.value!==e)throw new Error(`Expected "${e}" but found "${n?n.value:"<end>"}"`);this.pos++}parseExpression(){const e=this.tryParseArrow();return e||this.parseTernary()}tryParseArrow(){const e=this.pos,n=this.peek();if(!n)return null;if(n.type==="ident"&&this.isPunct("=>",1)&&!Ul.has(String(n.value))){this.pos+=1,this.pos+=1;const{body:a,isBlock:i}=this.parseArrowBody();return{type:"Arrow",params:[{name:String(n.value),default:null}],body:a,isBlock:i}}if(n.type==="punct"&&n.value==="("){this.pos+=1;const a=this.tryParseParamList();if(a&&this.isPunct(")")&&(this.pos+=1,this.isPunct("=>"))){this.pos+=1;const{body:i,isBlock:l}=this.parseArrowBody();return{type:"Arrow",params:a,body:i,isBlock:l}}return this.pos=e,null}return this.pos=e,null}tryParseParamList(){const e=[];if(this.isPunct(")"))return e;for(;;){const n=this.peek();let a=null,i;if(n&&n.type==="punct"&&n.value==="["){if(this.pos+=1,i=this.tryParseArrayPatternElements(),!i)return null}else{if(!n||n.type!=="ident"||Ul.has(String(n.value)))return null;a=String(n.value),this.pos+=1}let l=null;if(this.isPunct("=")&&(this.pos+=1,l=this.parseExpression()),e.push(i?{name:a,elements:i,default:l}:{name:a,default:l}),this.isPunct(",")){this.pos+=1;contLine truncated
`;break;case"t":b+=" ";break;case"r":b+="\r";break;case"b":b+="\b";break;case"f":b+="\f";break;case"v":b+="\v";break;case"0":b+="\0";break;case"\\":b+="\\";break;case"'":b+="'";break;case'"':b+='"';break;case"`":b+="`";break;default:b+=S;break}n++}else b+=s[n],n++;if(n>=a)throw new Error(`Unterminated string literal at position ${h}`);n++,e.push({type:"str",value:b,pos:h});continue}if(Lw(l)){const h=n;for(n++;n<a&&Mw(s[n]);)n++;e.push({type:"ident",value:s.slice(h,n),pos:h});continue}if(l==="`"){const h=Lg(s,n);e.push({type:"template",value:"",pos:n,quasis:h.quasis,exprs:h.exprs}),n=h.end;continue}const c=n,d=s.substr(n,2);if(s.substr(n,3)==="..."){e.push({type:"punct",value:"...",pos:c}),n+=3;continue}switch(l){case"=":{i(1)===">"?(e.push({type:"punct",value:"=>",pos:c}),n+=2):i(1)==="="?i(2)==="="?(e.push({type:"punct",value:"===",pos:c}),n+=3):(e.push({type:"punct",value:"==",pos:c}),n+=2):(e.push({type:"punct",value:"=",pos:c}),n+=1);continue}case"!":{i(1)==="="?i(2)==="="?(e.push({type:"punct",value:"!==",pos:c}),n+=3):(e.push({type:"punct",value:"!=",pos:c}),n+=2):(e.push({type:"punct",value:"!",pos:c}),n+=1);continue}case"<":{if(i(1)==="=")e.push({type:"punct",value:"<=",pos:c}),n+=2;else{if(i(1)==="<")throw new Error("Bitwise/shift operators are not allowed");e.push({type:"punct",value:"<",pos:c}),n+=1}continue}case">":{if(i(1)==="=")e.push({type:"punct",value:">=",pos:c}),n+=2;else{if(i(1)===">")throw new Error("Bitwise/shift operators are not allowed");e.push({type:"punct",value:">",pos:c}),n+=1}continue}case"&":{if(i(1)==="&")e.push({type:"punct",value:"&&",pos:c}),n+=2;else throw new Error("Bitwise operators are not allowed");continue}case"|":{if(i(1)==="|")e.push({type:"punct",value:"||",pos:c}),n+=2;else throw new Error("Bitwise operators are not allowed");continue}case"?":{i(1)==="."&&!gi(i(2))?(e.push({type:"punct",value:"?.",pos:c}),n+=2):i(1)==="?"?(e.push({type:"punct",value:"??",pos:c}),n+=2):(e.push({type:"punct",value:"?",pos:c}),n+=1);continue}case"+":{if(i(1)==="+")throw new Error("Increment operator is not allowed");if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"+",pos:c}),n+=1;continue}case"-":{if(i(1)==="-")throw new Error("Decrement operator is not allowed");if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"-",pos:c}),n+=1;continue}case"*":{if(i(1)==="=")throw new Error("Assignment operators are not allowed");if(i(1)==="*")throw new Error("Exponentiation operator is not supported");e.push({type:"punct",value:"*",pos:c}),n+=1;continue}case"/":{if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"/",pos:c}),n+=1;continue}case"%":{if(i(1)==="=")throw new Error("Assignment operators are not allowed");e.push({type:"punct",value:"%",pos:c}),n+=1;continue}case"~":case"^":throw new Error("Bitwise operators are not allowed");case".":case":":case"(":case")":case"[":case"]":case"{":case"}":case",":e.push({type:"punct",value:l,pos:c}),n+=1;continue;case";":e.push({type:"punct",value:";",pos:c}),n+=1;continue;default:throw new Error(`Unexpected character "${l}" at position ${c}`)}}return e}const Iw={"??":1,"||":1,"&&":2,"===":3,"!==":3,"==":3,"!=":3,"<":4,">":4,"<=":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},jw=new Set(["??","||","&&"]);class Hw{constructor(e){$(this,"tokens");$(this,"pos",0);this.tokens=e}atEnd(){return this.pos>=this.tokens.length}peek(e=0){const n=this.pos+e;return n<this.tokens.length?this.tokens[n]:null}next(){if(this.atEnd())throw new Error("Unexpected end of expression");return this.tokens[this.pos++]}isPunct(e,n=0){const a=this.peek(n);return!!a&&a.type==="punct"&&a.value===e}expectPunct(e){const n=this.peek();if(!n||n.type!=="punct"||n.value!==e)throw new Error(`Expected "${e}" but found "${n?n.value:"<end>"}"`);this.pos++}parseExpression(){const e=this.tryParseArrow();return e||this.parseTernary()}tryParseArrow(){const e=this.pos,n=this.peek();if(!n)return null;if(n.type==="ident"&&this.isPunct("=>",1)&&!Ul.has(String(n.value))){this.pos+=1,this.pos+=1;const{body:a,isBlock:i}=this.parseArrowBody();return{type:"Arrow",params:[{name:String(n.value),default:null}],body:a,isBlock:i}}if(n.type==="punct"&&n.value==="("){this.pos+=1;const a=this.tryParseParamList();if(a&&this.isPunct(")")&&(this.pos+=1,this.isPunct("=>"))){this.pos+=1;const{body:i,isBlock:l}=this.parseArrowBody();return{type:"Arrow",params:a,body:i,isBlock:l}}return this.pos=e,null}return this.pos=e,null}tryParseParamList(){const e=[];if(this.isPunct(")"))return e;for(;;){const n=this.peek();let a=null,i;if(n&&n.type==="punct"&&n.value==="["){const c=this.tryParseArrayPattern();if(!c)return null;i=c}else if(n&&n.type==="ident"&&!Ul.has(String(n.value)))a=String(n.value),this.pos+=1;else return null;let l=null;if(this.isPunct("=")&&(this.pos+=1,l=this.parseExpression()),e.push(i?{name:a,elements:i,default:l}:{name:a,default:l}),this.isPunct(",")){this.pos+=1;continue}Line truncated
`).forEach(function(c){i=c.indexOf(":"),n=c.substring(0,i).trim().toLowerCase(),a=c.substring(i+1).trim(),!(!n||e[n]&&N0[n])&&(n==="set-cookie"?e[n]?e[n].push(a):e[n]=[a]:e[n]=e[n]?e[n]+", "+a:a)}),e};function j0(s){let e=0,n=s.length;for(;e<n;){const a=s.charCodeAt(e);if(a!==9&&a!==32)break;e+=1}for(;n>e;){const a=s.charCodeAt(n-1);if(a!==9&&a!==32)break;n-=1}return e===0&&n===s.length?s:s.slice(e,n)}const H0=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),z0=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Nd(s,e){return K.isArray(s)?s.map(n=>Nd(n,e)):j0(String(s).replace(e,""))}const U0=s=>Nd(s,H0),P0=s=>Nd(s,z0);function nm(s){const e=Object.create(null);return K.forEach(s.toJSON(),(n,a)=>{e[a]=P0(n)}),e}const rm=Symbol("internals");function po(s){return s&&String(s).trim().toLowerCase()}function Yl(s){return s===!1||s==null?s:K.isArray(s)?s.map(Yl):U0(String(s))}function B0(s){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(s);)e[a[1]]=a[2];return e}const q0=s=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());function Id(s,e,n,a,i){if(K.isFunction(a))return a.call(this,e,n);if(i&&(e=n),!!K.isString(e)){if(K.isString(a))return e.indexOf(a)!==-1;if(K.isRegExp(a))return a.test(e)}}function G0(s){return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,a)=>n.toUpperCase()+a)}function V0(s,e){const n=K.toCamelCase(" "+e);["get","set","has"].forEach(a=>{Object.defineProperty(s,a+n,{__proto__:null,value:function(i,l,c){return this[a].call(this,e,i,l,c)},configurable:!0})})}let kn=class{constructor(e){e&&this.set(e)}set(e,n,a){const i=this;function l(d,f,h){const m=po(f);if(!m)throw new Error("header name must be a non-empty string");const b=K.findKey(i,m);(!b||i[b]===void 0||h===!0||h===void 0&&i[b]!==!1)&&(i[b||f]=Yl(d))}const c=(d,f)=>K.forEach(d,(h,m)=>l(h,m,f));if(K.isPlainObject(e)||e instanceof this.constructor)c(e,n);else if(K.isString(e)&&(e=e.trim())&&!q0(e))c(I0(e),n);else if(K.isObject(e)&&K.isIterable(e)){let d={},f,h;for(const m of e){if(!K.isArray(m))throw TypeError("Object iterator must return a key-value pair");d[h=m[0]]=(f=d[h])?K.isArray(f)?[...f,m[1]]:[f,m[1]]:m[1]}c(d,n)}else e!=null&&l(n,e,a);return this}get(e,n){if(e=po(e),e){const a=K.findKey(this,e);if(a){const i=this[a];if(!n)return i;if(n===!0)return B0(i);if(K.isFunction(n))return n.call(this,i,a);if(K.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=po(e),e){const a=K.findKey(this,e);return!!(a&&this[a]!==void 0&&(!n||Id(this,this[a],a,n)))}return!1}delete(e,n){const a=this;let i=!1;function l(c){if(c=po(c),c){const d=K.findKey(a,c);d&&(!n||Id(a,a[d],d,n))&&(delete a[d],i=!0)}}return K.isArray(e)?e.forEach(l):l(e),i}clear(e){const n=Object.keys(this);let a=n.length,i=!1;for(;a--;){const l=n[a];(!e||Id(this,this[l],l,e,!0))&&(delete this[l],i=!0)}return i}normalize(e){const n=this,a={};return K.forEach(this,(i,l)=>{const c=K.findKey(a,l);if(c){n[c]=Yl(i),delete n[l];return}const d=e?G0(l):String(l).trim();d!==l&&delete n[l],n[d]=Yl(i),a[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return K.forEach(this,(a,i)=>{a!=null&&a!==!1&&(n[i]=e&&K.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const a=new this(e);return n.forEach(i=>a.set(i)),a}static accessor(e){const a=(this[rm]=this[rm]={accessors:{}}).accessors,i=this.prototype;function l(c){const d=po(c);a[d]||(V0(i,c),a[d]=!0)}return K.isArray(e)?e.forEach(l):l(e),this}};kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),K.reduceDescriptors(kn.prototype,({value:s},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>s,set(a){this[n]=a}}}),K.freezeMethods(kn);const F0="[REDACTED ****]";function K0(s){if(K.hasOwnProp(s,"toJSON"))return!0;let e=Object.getPrototypeOf(s);for(;e&&e!==Object.prototype;){if(K.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function W0(s,e){const n=new Set(e.map(l=>String(l).toLowerCase())),a=[],i=l=>{if(l===null||typeof l!="object"||K.isBuffer(l))return l;if(a.indexOf(l)!==-1)return;l instanceof kn&&(l=l.toJSON()),a.push(l);let c;if(K.isArray(l))c=[],l.forEach((d,f)=>{const h=i(d);K.isUndefined(h)||(c[f]=h)});else{if(!K.isPlainObject(l)&&K0(l))return a.pop(),l;c=Object.create(null);for(const[d,f]of Object.entries(l)){const h=n.has(d.toLowerCase())?F0:i(f);K.isUndefined(h)||(c[d]=h)}}return a.pop(),c};return i(s)}let Oe=class lw extends Error{static from(e,n,a,i,l,c){const d=new lw(e.message,n||e.code,a,i,l);return d.cause=e,d.name=e.name,e.status!=null&&d.status==null&&(d.status=e.status),c&&Object.assign(d,c),d}constructor(e,n,a,i,l){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),a&&(this.config=a),i&&(this.request=i),l&&(this.response=l,this.status=l.status)}toJSON(){const e=this.config,n=e&&K.hasOwnProp(e,"redact")?e.redact:void 0,a=K.isArray(n)&&n.length>0?W0(e,n):K.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a,code:this.code,status:this.status}}};Oe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Oe.ERR_BAD_OPTION="ERR_BAD_OPTION",Oe.ECONNABORTED="ECONNABORTED",Oe.ETIMEDOUT="ETIMEDOUT",Oe.ECONNREFUSED="ECONNREFUSED",Oe.ERR_NETWORK="ERR_NETWORK",Oe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Oe.ERR_DEPRECATED="ERR_DEPRECATED",Oe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Oe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Oe.ERR_CANCELED="ERR_CANCELED",Oe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Oe.ERR_INVALID_URL="ERR_INVALID_URL",Oe.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Y0=null;function jd(s){return K.isPlainObject(s)||K.isArray(s)}function am(s){return K.endsWith(s,"[]")?s.slice(0,-2):s}function Hd(s,e,n){return s?s.concat(e).map(function(i,l){return i=am(i),!n&&l?"["+i+"]":i}).join(n?".":""):e}function X0(s){return K.isArray(s)&&!s.some(jd)}const J0=K.toFlatObject(K,{},null,function(e){return/^is[A-Z]/.test(e)});function Xl(s,e,n){if(!K.isObject(s))throw new TypeError("target must be an object");e=e||new FormData,n=K.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,L){return!K.isUndefined(L[x])});const a=n.metaTokens,i=n.visitor||b,l=n.dots,c=n.indexes,d=n.Blob||typeof Blob<"u"&&Blob,f=n.maxDepth===void 0?100:n.maxDepth,h=d&&K.isSpecCompliantForm(e);if(!K.isFunction(i))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(K.isDate(A))return A.toISOString();if(K.isBoolean(A))return A.toString();if(!h&&K.isBlob(A))throw new Oe("Blob is not supported. Use a Buffer instead.");return K.isArrayBuffer(A)||K.isTypedArray(A)?h&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function b(A,x,L){let M=A;if(K.isReactNative(e)&&K.isReactNativeBlob(A))return e.append(Hd(L,x,l),m(A)),!1;if(A&&!L&&typeof A=="object"){if(K.endsWith(x,"{}"))x=a?x:x.slice(0,-2),A=JSON.stringify(A);else if(K.isArray(A)&&X0(A)||(K.isFileList(A)||K.endsWith(x,"[]"))&&(M=K.toArray(A)))return x=am(x),M.forEach(function(O,B){!(K.isUndefined(O)||O===null)&&e.append(c===!0?Hd([x],B,l):c===null?x:x+"[]",m(O))}),!1}return jd(A)?!0:(e.append(Hd(L,x,l),m(A)),!1)}const S=[],v=Object.assign(J0,{defaultVisitor:b,convertValue:m,isVisitable:jd});function _(A,x,L=0){if(!K.isUndefined(A)){if(L>f)throw new Oe("Object is too deeply nested ("+L+" levels). Max depth: "+f,Oe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(S.indexOf(A)!==-1)throw Error("Circular reference detected in "+x.join("."));S.push(A),K.forEach(A,function(k,O){(!(K.isUndefined(k)||k===null)&&i.call(e,k,K.isString(O)?O.trim():O,x,v))===!0&&_(k,x?x.concat(O):[O],L+1)}),S.pop()}}if(!K.isObject(s))throw new TypeError("data must be an object");return _(s),e}function im(s){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(s).replace(/[!'()~]|%20/g,function(a){return e[a]})} Line truncated
`+c.map(wm).join(`
@@ -9,10 +9,11 @@
### Fixed
#### 화살표/함수 파라미터의 배열 구조 분해 지원 (`([key]) => …`)
#### 화살표/함수 파라미터 배열 구조분해 미지원 회귀 (장바구니/바로구매 불능·권한 computed 공백)
- SafeExpressionEvaluator 파서가 화살표·함수 파라미터를 평문 식별자만 허용해, 레이아웃 전반에서 실사용 중인 `Object.entries(...).filter(([key]) => …)` / `.map(([k, v]) => …)` / `([, v]) => …` 형태가 `Expected ")" but found "=>"` 로 평가 실패했다. 게시판 환경설정의 권한 기본값 computed 4종이 계산되지 않아 권한 섹션이 헤더만 남고 비었고, 플러그인 설정·이커머스 폼의 검증 오류 표시(`([field, messages]) => …`)도 발화 시점에 같은 실패에 걸리는 상태였다 (7.0.7 평가기 교체 회귀 — 배포 레이아웃 60여 파일 사용).
- 파라미터 목록 파서에 평탄한 배열 구조 분해 패턴(식별자 + 엘리전 홀)을 추가하고, 바인딩 시 홀은 건너뛰며 대상이 null/undefined 여도 예외 없이 undefined 를 바인딩한다. 중첩 패턴·rest·객체 구조 분해는 배포 레이아웃 사용이 0건이라 지원하지 않는다(형태가 어긋나면 종전과 같이 arrow 판정을 되돌린다).
- engine-v1.60.0 의 SafeExpressionEvaluator 교체가 구 평가기(`new Function`)가 허용하던 **화살표·함수 파라미터의 배열 구조분해**(`([k, v]) =>`, `([, vid]) =>`)를 수용하지 않아, 해당 문법을 쓰는 표현식이 전부 `Expected ")" but found "=>"` 로 파싱 실패했다. 액션 params 는 미평가 원문 문자열 그대로 서버에 전송되어 422 가 되고(스토어프론트 장바구니 담기·바로 구매가 전 상품에서 불능), 게시판 환경설정의 권한 기본값 computed 4종이 계산되지 않아 권한 섹션이 비었으며, 플러그인 설정·이커머스 폼의 검증 오류 표시(`([field, messages]) => …`)도 발화 시점에 같은 실패에 걸리는 상태였다. 저장소 레이아웃 54개 파일 104곳이 이 문법을 사용 중이었다.
- `tryParseParamList` 에 배열 패턴(식별자 + 홀/elision, 파라미터 기본값 조합 포함)을 추가하고 `bindParams` 가 JS iterator 시맨틱(비-iterable 은 TypeError)으로 분해 바인딩하도록 했다. 중첩 패턴·rest·객체 패턴은 배포 레이아웃 사용 0건이라 지원하지 않는다(발견 시 arrow 아님으로 안전 되돌림).
- 회귀 잠금: 사용 형태 전수(단일/쌍/홀/기본값/function 선언 파라미터/실전 `_purchase_card.json` 본문·게시판 권한 computed·검증 오류 표시) 단위 테스트 + 배포 번들 E2E(`destructuring_param`) 추가.
## [engine-v1.60.4] - 2026-08-14
@@ -248,10 +248,11 @@ type Node =
/**
* 함수/화살표 파라미터 (기본값 지원).
*
* 배열 구조 분해 패턴(`([key]) => …`, `([, v]) => …`)은 `name: null` +
* `elements` 로 표현한다. `elements` 의 `null` 항목은 엘리전 홀(`[, v]`)이다.
* 레이아웃 실사용 형태(`Object.entries(...).map(([k, v]) => …)`)가 이 문법에
* 의존하므로 평문 식별자와 동급으로 지원한다. (engine-v1.60.5)
* `name` 이 null 이면 배열 구조분해 패턴 — `elements` 가 요소 이름 목록이며
* null 요소는 홀(elision)이다 (`([, vid]) =>` → elements: [null, 'vid']).
* 구 평가기(new Function)가 허용하던 형태로, 레이아웃 전반에서 사용된다.
*
* @since engine-v1.60.5
*/
interface Param {
name: string | null;
@@ -766,8 +767,8 @@ class Parser {
}
/**
* 파라미터 목록을 파싱한다: `ident (= 기본값)?` 를 `,` 로 구분. 열림 `(` 는 호출부가
* 이미 소비한 상태이며, 닫힘 `)` 는 소비하지 않는다(호출부가 검사).
* 파라미터 목록을 파싱한다: `(ident | [배열패턴]) (= 기본값)?` 를 `,` 로 구분.
* 열림 `(` 는 호출부가 이미 소비한 상태이며, 닫힘 `)` 는 소비하지 않는다(호출부가 검사).
*
* @return 파싱된 파라미터 배열, 또는 파라미터 형태가 아니면 null(arrow 아님)
*/
@@ -779,16 +780,14 @@ class Parser {
let name: string | null = null;
let elements: (string | null)[] | undefined;
if (p && p.type === 'punct' && p.value === '[') {
// 배열 구조 분해 패턴: [a, b] / [, v] / [a,] — 평탄한 식별자만 허용
this.pos += 1; // [
elements = this.tryParseArrayPatternElements();
if (!elements) return null;
} else {
if (!p || p.type !== 'ident' || FORBIDDEN_KEYWORDS.has(String(p.value))) {
return null;
}
const pattern = this.tryParseArrayPattern();
if (!pattern) return null;
elements = pattern;
} else if (p && p.type === 'ident' && !FORBIDDEN_KEYWORDS.has(String(p.value))) {
name = String(p.value);
this.pos += 1;
} else {
return null;
}
let def: Node | null = null;
if (this.isPunct('=')) {
@@ -808,27 +807,30 @@ class Parser {
}
/**
* 배열 구조 분해 패턴의 요소를 파싱한다. 열림 `[` 는 호출부가 소비했고,
* 닫힘 `]` 까지 소비한다. 엘리전 홀(`[, v]`)은 null 로 표현한다.
* 중첩 패턴·rest·기본값 등 평탄한 식별자 외의 형태는 지원하지 않는다
* (레이아웃 실사용 형태가 전부 평탄 — 형태가 어긋나면 null 로 arrow 판정 자체를 되돌린다).
* 파라미터 위치의 배열 구조분해 패턴 `[a, , b]` 를 파싱한다.
* 요소는 식별자 또는 홀(elision)만 허용 — 중첩 패턴·rest·요소별 기본값은
* 레이아웃 표현식에서 쓰이지 않으므로 지원하지 않는다(발견 시 arrow 아님으로 되돌림).
*
* @return 요소 이름 배열(홀은 null), 또는 패턴 형태가 아니면 null
* @return 요소 이름 배열 (홀은 null), 패턴 형태가 아니면 null
* @since engine-v1.60.5
*/
private tryParseArrayPatternElements(): (string | null)[] | null {
private tryParseArrayPattern(): (string | null)[] | null {
const save = this.pos;
this.pos += 1; // [
const elements: (string | null)[] = [];
for (;;) {
if (this.isPunct(']')) {
this.pos += 1; // ]
this.pos += 1;
return elements;
}
if (this.isPunct(',')) {
this.pos += 1; // 엘리전 홀
elements.push(null);
elements.push(null); // 홀 (elision)
this.pos += 1;
continue;
}
const t = this.peek();
if (!t || t.type !== 'ident' || FORBIDDEN_KEYWORDS.has(String(t.value))) {
this.pos = save;
return null;
}
elements.push(String(t.value));
@@ -838,9 +840,10 @@ class Parser {
continue;
}
if (this.isPunct(']')) {
this.pos += 1; // ]
this.pos += 1;
return elements;
}
this.pos = save;
return null;
}
}
@@ -1558,18 +1561,18 @@ function bindParams(params: Param[], args: unknown[], local: Scope): void {
v = evalNode(p.default, local);
}
if (p.elements) {
// 배열 구조 분해 패턴: 홀(null)은 건너뛰고 각 이름을 인덱스 값으로 바인딩.
// 대상이 배열/문자열이 아니어도(undefined 포함) 예외 없이 undefined 바인딩 —
// 표현식 평가 실패로 화면이 통째로 비는 것보다 관대한 해석이 낫다.
const src = v as Record<number, unknown> | null | undefined;
for (let ei = 0; ei < p.elements.length; ei++) {
const name = p.elements[ei];
if (name === null) continue;
local.vars[name] = src == null ? undefined : src[ei];
// 배열 구조분해 패턴 — JS iterator 시맨틱과 동일하게 null/undefined 는 예외
if (v == null) {
throw new TypeError(`Cannot destructure ${String(v)}: value is not iterable`);
}
continue;
const arr = Array.isArray(v) ? v : Array.from(v as Iterable<unknown>);
for (let e = 0; e < p.elements.length; e++) {
const name = p.elements[e];
if (name !== null) local.vars[name] = arr[e];
}
} else if (p.name !== null) {
local.vars[p.name] = v;
}
local.vars[p.name as string] = v;
}
}
@@ -147,8 +147,69 @@ describe('SafeExpressionEvaluator', () => {
});
});
describe('arrow-function 배열 구조 분해 파라미터 (7.0.7 회귀 — 게시판 환경설정 권한 computed)', () => {
it('([key]) => — Object.entries 필터/맵 (admin_board_settings 실사용 형태)', () => {
describe('arrow param 배열 구조분해 (engine-v1.60.5 회귀 — 장바구니/바로구매 불능)', () => {
// 구 평가기(new Function)가 허용하던 형태 전수: 저장소 레이아웃 54파일 104곳 사용
// (`([code])` 35 · `([field, messages])` 34 · `([k, v])` 등 — _purchase_card.json 이 대표)
it('단일 요소 ([k])', () => {
expect(evalx('Object.entries({ a: 1, b: 2 }).map(([k]) => k)')).toEqual(['a', 'b']);
});
it('두 요소 ([k, v])', () => {
expect(evalx('Object.entries({ a: 1, b: 2 }).map(([k, v]) => k + v)')).toEqual(['a1', 'b2']);
});
it('선행 홀 ([, v])', () => {
expect(evalx('Object.entries({ a: 1, b: null }).filter(([, v]) => v != null).length')).toBe(1);
});
it('배열 인자 직접 분해', () => {
expect(evalx('[[1, 2], [3, 4]].map(([a, b]) => a * b)')).toEqual([2, 12]);
});
it('파라미터 기본값 조합 (([a, b] = []) =>)', () => {
expect(evalx('[undefined].map(([a, b] = [7, 8]) => (a ?? 0) + (b ?? 0))')).toEqual([15]);
});
it('null/undefined 인자 분해는 JS 와 동일하게 예외', () => {
expect(() => evalx('[null].map(([a]) => a)')).toThrow();
});
it('실전 회귀: _purchase_card.json 장바구니 담기 본문 표현식', () => {
const ctx = {
product: { data: { id: 98, has_options: true, options: [{ id: 1 }, { id: 2 }] } },
_local: {
selectedOptionItems: [
{
optionId: 11,
quantity: 2,
additionalOptionSelections: { 5: 50, 6: null },
additionalOptionCustomTexts: { 5: '각인 문구' },
},
],
noOptionQuantity: 1,
},
};
const expr =
'product.data?.has_options && (product.data?.options?.length ?? 0) > 1 ? ' +
'{ product_id: product.data?.id, items: (_local.selectedOptionItems ?? []).map(item => ({ ' +
'product_option_id: item.optionId, quantity: item.quantity, ' +
'additional_option_selections: Object.entries(item.additionalOptionSelections ?? {})' +
'.filter(([, vid]) => vid != null)' +
'.map(([gid, vid]) => ({ additional_option_id: Number(gid), value_id: Number(vid), custom_text: item.additionalOptionCustomTexts?.[Number(gid)] })) ' +
'})) } : { product_id: product.data?.id, items: [{ quantity: _local.noOptionQuantity ?? 1 }] }';
expect(evalx(expr, ctx)).toEqual({
product_id: 98,
items: [
{
product_option_id: 11,
quantity: 2,
additional_option_selections: [{ additional_option_id: 5, value_id: 50, custom_text: '각인 문구' }],
},
],
});
});
it('실전 회귀: 게시판 환경설정 권한 computed (filter([key]) + startsWith)', () => {
const ctx = {
settings: {
data: {
@@ -166,13 +227,7 @@ describe('SafeExpressionEvaluator', () => {
).toEqual(['read', 'write']);
});
it('([k, v]) => — 키·값 동시 바인딩', () => {
expect(evalx("Object.entries(o).map(([k, v]) => k + '=' + v).join(',')", { o: { a: 1, b: 2 } })).toBe(
'a=1,b=2',
);
});
it('([field, messages]) => — 검증 오류 표시 형태 (플러그인 설정 onError 실사용)', () => {
it('실전 회귀: 검증 오류 표시 ([field, messages]) — 플러그인 설정 onError 형태', () => {
const ctx = { errors: { name: ['이름은 필수입니다'], email: ['형식 오류'] } };
expect(evalx("Object.entries(errors ?? {}).map(([field, messages]) => field + ': ' + messages[0])", ctx)).toEqual([
'name: 이름은 필수입니다',
@@ -180,17 +235,9 @@ describe('SafeExpressionEvaluator', () => {
]);
});
it('([,v]) => — 엘리전(홀) 패턴 (_bank_management_modal 실사용)', () => {
expect(evalx('Object.entries(o).map(([,v]) => v)', { o: { a: 10, b: 20 } })).toEqual([10, 20]);
});
it('function 선언 파라미터의 배열 구조 분해', () => {
it('function 선언 파라미터의 배열 구조분해', () => {
expect(evalx('(function f([a, b]) { return a + b; })([3, 4])')).toBe(7);
});
it('구조 분해 대상이 아닌 값(undefined)은 각 이름에 undefined 바인딩', () => {
expect(evalx('[undefined].map(([a]) => a === undefined)[0]')).toBe(true);
});
});
describe('spread (array / object / call)', () => {
@@ -71,34 +71,39 @@ test.describe('레이아웃 표현식 평가 샌드박스', () => {
expect(result.date).toBe(true);
});
// @scenario case=arrow_destructured_params
// @scenario case=destructuring_param
// @effects same_expression_same_value_across_paths
test('화살표 파라미터의 배열 구조 분해가 배포 번들에서 동작한다 (engine-v1.60.5 회귀)', async ({ page }) => {
test('화살표 파라미터 배열 구조분해(([k, v])·홀)가 배포 번들에서 동작한다 (engine-v1.60.5 회귀)', async ({ page }) => {
const result = await page.evaluate(() => {
const g7 = (window as any).G7Core;
const ctx = {
sel: { 5: 50, 6: null },
perms: { 'admin.manage': true, read: true, write: false },
errors: { name: ['이름은 필수입니다'] },
};
return {
// 게시판 환경설정 권한 computed 실사용 형태: entries + filter([key]) + map([key])
// _purchase_card.json 장바구니/바로구매 본문 형태 — 홀 + 쌍 분해
hole: g7.evaluateCondition('{{Object.entries(sel ?? {}).filter(([, vid]) => vid != null).length === 1}}', ctx),
pair: g7.evaluateCondition('{{Object.entries(sel ?? {}).filter(([, v]) => v != null).map(([gid, vid]) => Number(gid) + Number(vid)).includes(55)}}', ctx),
single: g7.evaluateCondition('{{Object.entries(sel ?? {}).map(([k]) => k).includes("5")}}', ctx),
// 게시판 환경설정 권한 computed 형태: filter([key]) + startsWith + map([key])
entriesFilterMap: g7.evaluateCondition(
"{{Object.entries(perms ?? {}).filter(([key]) => !key.startsWith('admin.')).map(([key]) => key).length === 2}}",
ctx,
),
// 검증 오류 표시 실사용 형태: ([field, messages])
// 검증 오류 표시 형태: ([field, messages])
fieldMessages: g7.evaluateCondition(
"{{Object.entries(errors ?? {}).map(([field, messages]) => field + ':' + messages[0])[0] === 'name:이름은 필수입니다'}}",
ctx,
),
// 엘리전 홀: ([, v])
elision: g7.evaluateCondition('{{Object.entries(perms ?? {}).map(([,v]) => v).length === 3}}', ctx),
};
});
expect(result.hole).toBe(true);
expect(result.pair).toBe(true);
expect(result.single).toBe(true);
expect(result.entriesFilterMap).toBe(true);
expect(result.fieldMessages).toBe(true);
expect(result.elision).toBe(true);
});
// @scenario case=constructor_escape
+42 -17
View File
@@ -378,21 +378,17 @@ class SeoMetaResolverTest extends TestCase
}
/**
* 구조화 데이터의 문자열 값이 `</script>` 를 담아도 JSON-LD `<script>` 블록을
* 조기 종료시키지 못한다 — 봇 화면(서버 렌더)에서만 노출되는 저장형 XSS 차단.
*
* 검색어·게시글 제목·상품명 등 사용자 입력이 structured_data 의 name 으로 흘러
* 들어가는데, `json_encode` 가 `<`/`>` 를 이스케이프하지 않으면 문자열 안의
* `</script>` 가 ld+json 스크립트 태그를 닫고 그 뒤 `<script>` 가 실행된다.
* HTML meta 경로(og/twitter/title)는 stripHtml 로 태그를 지우지만 JSON-LD 는
* 별도 경로라 함께 지켜야 한다.
* JSON-LD 는 `<script type="application/ld+json">` 안에 임베드되므로, 사용자
* 제어 값(검색어 등)의 `</script>` 가 스크립트 컨텍스트를 조기 종료해 실행 가능한
* script 요소를 재생성하지 못하도록 `<`·`>` 를 유니코드 이스케이프해야 한다.
* (봇 렌더는 _escaped_fragment_ 로 일반 UA 도 강제되므로 반사형 XSS 벡터가 된다.)
*/
public function test_structured_data_json_ld_escapes_script_breakout(): void
public function test_structured_data_escapes_script_breakout_in_json_ld(): void
{
$seoConfig = [
'structured_data' => [
'@type' => 'SearchResultsPage',
'name' => '{{query.q}}',
'name' => 'G7 - {{query.q}}',
],
];
@@ -400,13 +396,14 @@ class SeoMetaResolverTest extends TestCase
$result = $this->resolver->resolve($seoConfig, $context, null, null, []);
$this->assertNotNull($result['jsonLd']);
// 원문 `<script>` / `</script>` 시퀀스가 출력에 그대로 있으면 안 된다.
$this->assertStringNotContainsString('<script', $result['jsonLd']);
$this->assertStringNotContainsString('</script', $result['jsonLd']);
// 값 자체는 보존되어야 한다(디코드하면 원문 그대로).
// 원문 태그가 그대로 실리면 스크립트 컨텍스트가 조기 종료돼 실행 가능한 script 요소가
// 재생성된다(반사형 XSS). JSON_HEX_TAG 가 태그 문자를 유니코드 이스케이프하므로 산출물에는
// 리터럴 태그 열림/닫힘 문자가 없어야 한다.
$this->assertDoesNotMatchRegularExpression('#</?script#', $result['jsonLd']);
$this->assertStringContainsString(chr(0x5C).'u003C', $result['jsonLd']);
// 이스케이프에도 불구하고 JSON 파싱 시 원래 값이 복원된다(구조화 데이터 의미 보존).
$decoded = json_decode($result['jsonLd'], true);
$this->assertSame('</script><script>alert(1)</script>', $decoded['name']);
$this->assertSame('G7 - </script><script>alert(1)</script>', $decoded['name']);
}
/**
@@ -1597,7 +1594,7 @@ class SeoMetaResolverTest extends TestCase
'page_type' => 'product',
'vars' => [
// 표현식이 다국어 객체를 직접 반환 — substituteVars 까지 array 전달
'product_name' => "{{product.data.name}}",
'product_name' => '{{product.data.name}}',
'commerce_name' => '$module_settings:basic_info.shop_name',
],
];
@@ -1673,4 +1670,32 @@ class SeoMetaResolverTest extends TestCase
$this->assertSame('운동화', $result['og']['description']);
$this->assertSame('https://e.co/ko.jpg', $result['og']['image']);
}
/**
* 접미사 조립: 저장 시 TrimStrings 가 선행 공백을 제거하므로("| 그누보드7"),
* 제목이 있으면 공백을 복원해 잇고, 제목이 비면 매달린 구분자를 떼어낸다.
* (blade 는 title.titleSuffix 단순 연결 — 조립 규칙은 이 메서드가 SSoT)
*/
public function test_compose_title_suffix_restores_space_between_title_and_trimmed_suffix(): void
{
$this->assertSame(' | 그누보드7', SeoMetaResolver::composeTitleSuffix('가죽 크로스백', '| 그누보드7'));
}
public function test_compose_title_suffix_keeps_explicit_leading_space_as_is(): void
{
$this->assertSame(' | 그누보드7', SeoMetaResolver::composeTitleSuffix('가죽 크로스백', ' | 그누보드7'));
}
public function test_compose_title_suffix_strips_dangling_separator_when_title_is_empty(): void
{
$this->assertSame('그누보드7', SeoMetaResolver::composeTitleSuffix('', '| 그누보드7'));
$this->assertSame('그누보드7', SeoMetaResolver::composeTitleSuffix('', ' - 그누보드7'));
}
public function test_compose_title_suffix_returns_empty_when_suffix_is_blank(): void
{
$this->assertSame('', SeoMetaResolver::composeTitleSuffix('가죽 크로스백', ''));
$this->assertSame('', SeoMetaResolver::composeTitleSuffix('', ' '));
$this->assertSame('', SeoMetaResolver::composeTitleSuffix('', '| '));
}
}
@@ -10,7 +10,7 @@ description: |
미실행(전역 canary `window.__g7jsi` 미설정) 양면을 잠근다.
axes:
case: [safe_expression, arrow_template_literal, arrow_destructured_params, constructor_escape, nonstring_key_escape, object_facade_safe]
case: [safe_expression, arrow_template_literal, destructuring_param, constructor_escape, nonstring_key_escape, object_facade_safe]
effects:
- same_expression_same_value_across_paths