Repository navigation
Conversation
expandVars 결과가 1 MiB 를 넘으면 풀지 않는다(풀 수 없는 변수와 같은 처리). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011H9PaYpVbHbYR6geY5QJM1
This was referenced Nov 10, 2026
Owner
Author
|
v7.1.0(#104)에 v7.1 원본에 맞춰 옮겨 반영했습니다 — 이 PR 은 옛 기점(v7.0.x 이전)이라 닫습니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #95
Fixes #96
두 이슈는 서명(
a7d816e89200)과 스택이 같은 중복 보고입니다.원인
harness/hooks/guard.js의expandVars는 같은 명령에서 정한 변수를 정한 그대로(x='$x$x$x$x$x$x'→ 값$x$x$x$x$x$x) 기억해 둡니다.analyzeCommand는 명령 자리 단어에$·%가 있으면 풀고, 바뀌었으면 최대 12번까지 다시 풉니다(guard < 12루프,guard.js:316— 이슈 스택과 같은 자리). 그래서 값 안의 자기 참조가 k 개이면 길이가 k^12 로 불어납니다. k=6 이면 V8 문자열 상한을 넘어RangeError: Invalid string length로 죽습니다. 그 전에 이 컨테이너에서 약 36초가 걸려 훅 시간 상한도 넘깁니다. 예외는main의 catch 로 가서, 명령에 git·삭제 단어가 있으면 막고(fail-closed) 없으면 통과시키며 자동 결함 보고를 남깁니다.수정
expandVars가 바꿔 넣을 때마다 결과 길이를 셉니다. 1 MiB(EXPAND_MAX)를 넘으면 그 단어를 풀지 않고 그대로 돌려줍니다. 이것은 값을 모르는 변수와 같은 처리입니다. 원래 확장 규칙($env:→%X%→$X/${X})은 그대로expandVarsRaw로 옮겼습니다.재현 테스트
tests/unit/test_v5_guard2.js[#95]4건:x='$x$x$x$x$x$x'; $x status가 예외 없이, 3초 안에 판정된다.; git push --force origin main을 붙이면, 그 명령만 단독으로 보낸 것과 같은 판정이 나온다.g=git; $g push --force …)의 판정은 그대로다.수정 전(
harness/를 stash 로 되돌림):THREW:Invalid string length· 36021ms 로 3건이 실패합니다. 수정 후에는 모두 통과합니다.검증
node tests/run.js→ 1106 PASS / 0 FAIL, 종료 코드 0. 이전 PR 들과 같은 이유로GH_TOKEN/GITHUB_TOKEN을 지우고 돌렸습니다(BR-15·16 이 로그인 없음을 가정합니다).적대적 검토
$g→git)와, 확장이 처음 몇 번 안에 명령 이름을 드러내는 경우(x='git push … $x$x…'; $x)는 상한에 닿기 전에 루프가 명령을 읽으므로, git 판정이 그대로 됩니다.%X%·$env:X도 같은 상한을 거칩니다. 경로나 셸 동작은 바뀌지 않습니다.x="$x$x"는 이전 값의 두 배)를 정확히 따르게 하는 것은 판정 의미를 바꾸는 일이라 이 PR 에 넣지 않았습니다.Generated by Claude Code