@routinecrew/routinecode 2.31.57 → 2.31.58
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/bin/cli.sh +65 -41
- package/bin/prompt-vault.js +1 -1
- package/bin/rc-credit-turn.js +30 -4
- package/bin/rc-grant.js +79 -0
- package/bin/seal-open.js +5 -2
- package/bin/setup.js +1 -1
- package/hooks/lib/i18n.py +7 -0
- package/hooks/lib/rt_cleanup.py +61 -0
- package/hooks/lib/scrub_stream.py +43 -0
- package/hooks/lib/secret_filter.py +298 -1
- package/hooks/lib/supplements_sig.py +70 -0
- package/hooks/post-knowledge-query.sh +14 -0
- package/hooks/post-secret-detect.sh +12 -27
- package/hooks/pre-account-guard.sh +5 -1
- package/hooks/pre-agent-spawn.mjs +1 -1
- package/hooks/pre-bash-guard.sh +11 -0
- package/hooks/pre-credit-guard.sh +33 -27
- package/hooks/pre-edit-domain-gate.sh +3 -1
- package/hooks/pre-edit-knowledge-gate.sh +3 -1
- package/hooks/pre-grep-guard.sh +11 -0
- package/hooks/pre-read-guard.sh +9 -0
- package/hooks/pre-read-knowledge-inject.sh +3 -1
- package/hooks/session-start.sh +11 -5
- package/hooks/stop-knowledge-remind.sh +45 -10
- package/hooks/tests/in-project-relax.test.py +2 -1
- package/hooks/tests/knowledge-loop.test.sh +89 -0
- package/hooks/tests/secret-guard.test.sh +2 -1
- package/hooks/tests/secret-premask.test.py +166 -0
- package/hooks/user-prompt-submit.sh +18 -12
- package/mcp-db-manager/dist/analyzers/duplicate-detector.js +1 -1
- package/mcp-db-manager/dist/core/model-parser.js +1 -1
- package/mcp-db-manager/dist/core/schema-reader.js +1 -1
- package/mcp-db-manager/dist/executors/migration-executor.js +1 -1
- package/mcp-db-manager/dist/generators/migration-generator.js +1 -1
- package/mcp-db-manager/dist/index.js +1 -1
- package/mcp-db-manager/dist/validators/schema-validator.js +1 -1
- package/mcp-dev-tester/dist/analyzers/auth-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/analyzers/backend-analyzer.js +1 -1
- package/mcp-dev-tester/dist/analyzers/endpoint-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/analyzers/frontend-analyzer.js +1 -1
- package/mcp-dev-tester/dist/analyzers/runtime-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/analyzers/type-comparator.js +1 -1
- package/mcp-dev-tester/dist/analyzers/validation-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/attestation.js +1 -1
- package/mcp-dev-tester/dist/browser/playwright-manager.js +1 -1
- package/mcp-dev-tester/dist/browser/ui-tester.js +1 -1
- package/mcp-dev-tester/dist/config/project-config.js +1 -1
- package/mcp-dev-tester/dist/index.js +1 -1
- package/mcp-dev-tester/dist/testers/api-tester.js +1 -1
- package/mcp-doc-fetcher/dist/index.js +1 -1
- package/mcp-html-renderer/dist/index.js +1 -1
- package/mcp-html-renderer/dist/preview.js +1 -1
- package/mcp-html-renderer/dist/template-engine.js +1 -1
- package/mcp-intelligence/dist/concept-catalog.js +1 -1
- package/mcp-intelligence/dist/concept-server-proxy.js +1 -1
- package/mcp-intelligence/dist/config-auth.js +1 -1
- package/mcp-intelligence/dist/contracts.generated.js +1 -1
- package/mcp-intelligence/dist/domain-templates.js +1 -1
- package/mcp-intelligence/dist/grounding.d.ts +1 -0
- package/mcp-intelligence/dist/grounding.d.ts.map +1 -1
- package/mcp-intelligence/dist/grounding.js +1 -1
- package/mcp-intelligence/dist/handlers.js +1 -1
- package/mcp-intelligence/dist/index.js +1 -1
- package/mcp-intelligence/dist/intelligence-file.js +1 -1
- package/mcp-intelligence/dist/knowledge-critic.js +1 -1
- package/mcp-intelligence/dist/knowledge-handlers.d.ts +20 -0
- package/mcp-intelligence/dist/knowledge-handlers.d.ts.map +1 -1
- package/mcp-intelligence/dist/knowledge-handlers.js +1 -1
- package/mcp-intelligence/dist/mention-extractor.js +1 -1
- package/mcp-intelligence/dist/provenance.js +1 -1
- package/mcp-intelligence/dist/semantic-embedder.js +1 -1
- package/mcp-log-watcher/dist/config-auth.js +1 -1
- package/mcp-log-watcher/dist/file-watcher.js +1 -1
- package/mcp-log-watcher/dist/index.js +1 -1
- package/mcp-log-watcher/dist/known-solutions.js +1 -1
- package/mcp-log-watcher/dist/log-store.js +1 -1
- package/mcp-log-watcher/dist/websocket-server.js +1 -1
- package/mcp-plan-manager/dist/__tests__/plan-parser.test.js +1 -1
- package/mcp-plan-manager/dist/file-ops.js +1 -1
- package/mcp-plan-manager/dist/index.js +1 -1
- package/mcp-plan-manager/dist/plan-parser.js +1 -1
- package/mcp-project-context/dist/git-ops.js +1 -1
- package/mcp-project-context/dist/index.js +1 -1
- package/mcp-project-context/dist/project-analysis.js +1 -1
- package/mcp-routinecode/dist/agent-tracker.js +1 -1
- package/mcp-routinecode/dist/attestation.js +1 -1
- package/mcp-routinecode/dist/blast-radius.js +1 -1
- package/mcp-routinecode/dist/changeset.js +1 -1
- package/mcp-routinecode/dist/config-auth.js +1 -1
- package/mcp-routinecode/dist/contracts.generated.js +1 -1
- package/mcp-routinecode/dist/coverage.js +1 -1
- package/mcp-routinecode/dist/explorer-advisor.js +1 -1
- package/mcp-routinecode/dist/failure-tracker.js +1 -1
- package/mcp-routinecode/dist/file-lock-registry.js +1 -1
- package/mcp-routinecode/dist/file-risk-scorer.js +1 -1
- package/mcp-routinecode/dist/index.js +1 -1
- package/mcp-routinecode/dist/known-solutions.js +1 -1
- package/mcp-routinecode/dist/ledger-miner.js +1 -1
- package/mcp-routinecode/dist/observed-draft.js +1 -1
- package/mcp-routinecode/dist/pattern-matcher.js +1 -1
- package/mcp-routinecode/dist/route-match.js +1 -1
- package/mcp-routinecode/dist/routines.js +1 -1
- package/mcp-routinecode/dist/rule-engine.js +1 -1
- package/mcp-routinecode/dist/rule-promoter.js +1 -1
- package/mcp-routinecode/dist/telemetry-analyzer.js +1 -1
- package/mcp-routinecode/dist/test-runner.js +1 -1
- package/mcp-routinecode/dist/verification.js +0 -0
- package/mcp-routinecode/dist/viral-loop.js +1 -1
- package/package.json +1 -1
- package/plugin/agents/analyzer.md.sealed +1 -0
- package/plugin/agents/crawler.md.sealed +1 -0
- package/plugin/agents/explorer.md.sealed +1 -0
- package/plugin/agents/implementor.md.sealed +1 -0
- package/plugin/agents/looker.md.sealed +1 -0
- package/plugin/agents/planner.md.sealed +1 -0
- package/plugin/agents/recorder.md.sealed +1 -0
- package/plugin/agents/reviewer.md.sealed +1 -0
- package/plugin/agents/verifier.md.sealed +1 -0
- package/plugin/commands/analyze.md.sealed +1 -0
- package/plugin/commands/plan.md.sealed +1 -0
- package/plugin/commands/rc.md.sealed +1 -0
- package/plugin/commands/receipt.md.sealed +1 -0
- package/plugin/commands/routines.md.sealed +1 -0
- package/plugin/commands/share.md.sealed +1 -0
- package/plugin/routinecode-prompt.md.sealed +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""scrub_stream — Bash 출력 필터 (pre-bash-guard 가 비밀 파일·환경변수 덤프 명령을 감쌀 때 사용).
|
|
3
|
+
|
|
4
|
+
stdin 을 줄 단위로 읽어 비밀 값을 MASK_TOKEN 으로 바꿔 stdout 에 즉시 흘린다.
|
|
5
|
+
가리는 값: argv 로 받은 비밀 파일에서 뽑은 값 + 이름이 비밀스러운 환경변수 값 + 알려진 토큰 패턴.
|
|
6
|
+
출력이 모델에 도달하기 '전'에 가려지는 유일한 Bash 경로다(PostToolUse 는 이미 전달된 출력을 못 바꾼다).
|
|
7
|
+
|
|
8
|
+
사용: <cmd> 2>&1 | python3 scrub_stream.py [secret_file ...]
|
|
9
|
+
"""
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main():
|
|
17
|
+
try:
|
|
18
|
+
import secret_filter as sf
|
|
19
|
+
values = sf.scrub_values_for(sys.argv[1:])
|
|
20
|
+
policy = sf.load_policy()
|
|
21
|
+
token = sf.MASK_TOKEN
|
|
22
|
+
except Exception:
|
|
23
|
+
sf = None
|
|
24
|
+
values, policy, token = [], None, '***MASKED***'
|
|
25
|
+
out = sys.stdout
|
|
26
|
+
for line in sys.stdin:
|
|
27
|
+
for v in values:
|
|
28
|
+
if v in line:
|
|
29
|
+
line = line.replace(v, token)
|
|
30
|
+
if sf is not None:
|
|
31
|
+
try:
|
|
32
|
+
line, _ = sf.redact(line, policy)
|
|
33
|
+
except Exception:
|
|
34
|
+
pass
|
|
35
|
+
out.write(line)
|
|
36
|
+
out.flush()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == '__main__':
|
|
40
|
+
try:
|
|
41
|
+
main()
|
|
42
|
+
except (BrokenPipeError, KeyboardInterrupt):
|
|
43
|
+
pass
|
|
@@ -113,7 +113,7 @@ REDACT_PATTERNS: List[Tuple[re.Pattern, str, str]] = [
|
|
|
113
113
|
# 값 separator `:` 또는 `=` 모두. 값은 4자 이상.
|
|
114
114
|
# 값에서 `*` 제외 + 뒤에 `*` 없음 → 이미 마스킹된 토큰(예: ghp_***REDACTED***)을
|
|
115
115
|
# 다시 매칭하는 이중 카운트를 방지(특정 토큰 패턴이 먼저 실행되어 마스킹됨).
|
|
116
|
-
(re.compile(r'(?i)(?<![\w-])([a-z0-9_.-]*(?:passwords?|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|secret[_-]?key|private[_-]?key|client[_-]?secret|access[_-]?token|auth[_-]?token|passphrase|credentials?))\s*[:=]\s*["\']?(?!(?:ghp_|gho_|ghs_|ghu_|github_pat_|npm_|sk-|sk_live_|rk_live_|pk_live_|AKIA|ASIA|xox|SG\.|eyJ))([^\s"\'&;,}*]{4,})(?!\*)["\']?'),
|
|
116
|
+
(re.compile(r'(?i)(?<![\w-])([a-z0-9_.-]*(?:passwords?|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|secret[_-]?key|private[_-]?key|client[_-]?secret|access[_-]?token|auth[_-]?token|passphrase|credentials?))\s*[:=]\s*["\']?(?!(?:ghp_|gho_|ghs_|ghu_|github_pat_|npm_|sk-|sk_live_|rk_live_|pk_live_|AKIA|ASIA|xox|SG\.|eyJ))(?!(?:process\.env|import\.meta\.env|os\.environ|os\.getenv|getenv\(|env\(|ENV\[|z\.|Joi\.|new |await |\(|\$\{|\{\{|<|`))(?!(?:string|number|boolean|undefined|null|None|str|int|bool|Optional|required|function|Secret|SecretStr)\b)(?![A-Za-z_$][\w$]*(?:\.[\w$]+)+(?:[\s,;)\]}]|$)|[A-Za-z_$][\w$]*(?:\.[\w$]+)*\()([^\s"\'&;,}*]{4,})(?!\*)["\']?'),
|
|
117
117
|
r'\1=***REDACTED***', 'kv_secret'),
|
|
118
118
|
# --token / --password CLI flags
|
|
119
119
|
(re.compile(r'(--(?:token|password|pass|secret|api-key)[= ])[^\s"\']+'), r'\1***REDACTED***', 'cli_flag'),
|
|
@@ -220,6 +220,9 @@ CORE_PROTECTED_PATH_GLOBS = [
|
|
|
220
220
|
# 사용자 홈 내부 config — .routinecode/ 하위 모든 json (런타임 apiKey·정책 등 모든 설정)
|
|
221
221
|
'**/.routinecode/*.json',
|
|
222
222
|
'**/.routinecode/**/*.json',
|
|
223
|
+
'**/.routinecode/*.json.*',
|
|
224
|
+
# Sealed Core 세션 임시 복호본(메인 프롬프트 평문) — 세션 동안만 존재, 모델 경유 읽기 차단
|
|
225
|
+
'**/.routinecode/.rt/**',
|
|
223
226
|
# RoutineCode 설치물 hooks — 방어 로직 전체 (routinecode/ 로 스코프).
|
|
224
227
|
# prefix 열거 대신 hooks/ 하위 모든 로직·설정 파일을 포괄 → 신규 훅 추가 시 자동 보호.
|
|
225
228
|
'**/routinecode/hooks/*.sh',
|
|
@@ -227,6 +230,9 @@ CORE_PROTECTED_PATH_GLOBS = [
|
|
|
227
230
|
'**/routinecode/hooks/*.js',
|
|
228
231
|
'**/routinecode/hooks/*.json',
|
|
229
232
|
'**/routinecode/hooks/lib/*',
|
|
233
|
+
# Claude Code 플러그인 캐시 — setup 이 마켓플레이스로 등록하면 CC 가 plugin/ 을 여기로 복사한다
|
|
234
|
+
# (프롬프트·에이전트 정의 평문 사본). 설치본과 같은 자산이므로 같은 수준으로 보호.
|
|
235
|
+
'**/plugins/cache/routinecode-marketplace/**',
|
|
230
236
|
]
|
|
231
237
|
|
|
232
238
|
# 명시적 허용 (공개 키는 민감 아님)
|
|
@@ -1019,6 +1025,50 @@ def _is_runtime_config_rule(rule):
|
|
|
1019
1025
|
return '.routinecode/' in _normalize_rule(rule)
|
|
1020
1026
|
|
|
1021
1027
|
|
|
1028
|
+
_RC_PKG_NAME = '@routinecrew/' + 'routinecode'
|
|
1029
|
+
_RC_SEG_RE = re.compile(r'(?:^|[/\\])routinecode(?=[/\\])')
|
|
1030
|
+
_pkg_root_cache: dict = {}
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
def _is_rc_package_dir(d: str) -> bool:
|
|
1034
|
+
"""d 가 실제 RoutineCode 패키지(설치본·dev 체크아웃) 루트인가 — package.json name 으로 판정."""
|
|
1035
|
+
if d in _pkg_root_cache:
|
|
1036
|
+
return _pkg_root_cache[d]
|
|
1037
|
+
ok = False
|
|
1038
|
+
try:
|
|
1039
|
+
with open(os.path.join(d, 'package.json'), encoding='utf-8') as fh:
|
|
1040
|
+
ok = json.load(fh).get('name') == _RC_PKG_NAME
|
|
1041
|
+
except Exception:
|
|
1042
|
+
ok = False
|
|
1043
|
+
_pkg_root_cache[d] = ok
|
|
1044
|
+
return ok
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
def _rc_scoped_rule(rule: str) -> bool:
|
|
1048
|
+
"""`routinecode/` 세그먼트나 plugin/routinecode-prompt.md 로 스코프된 '설치물' 규칙인가.
|
|
1049
|
+
(홈 런타임 config·플러그인 캐시 규칙은 패키지 판정 대상이 아님)"""
|
|
1050
|
+
r = _normalize_rule(rule)
|
|
1051
|
+
return ('/routinecode/' in r or r.endswith('/plugin/routinecode-prompt.md')) and \
|
|
1052
|
+
'.routinecode/' not in r and 'plugins/cache/' not in r
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
def _path_in_rc_package(p: str) -> bool:
|
|
1056
|
+
"""경로가 실제 RoutineCode 패키지 안인가. 이름만 같은 사용자 레포(예: ~/work/routinecode)는 False.
|
|
1057
|
+
존재하지 않는 경로도 False — 보호할 실물이 없다."""
|
|
1058
|
+
if not p:
|
|
1059
|
+
return False
|
|
1060
|
+
# npm 설치 위치(node_modules/@routinecrew/routinecode)는 존재 여부와 무관하게 설치물로 본다
|
|
1061
|
+
if '/node_modules/' + _RC_PKG_NAME + '/' in p.replace('\\', '/') + '/':
|
|
1062
|
+
return True
|
|
1063
|
+
cands = []
|
|
1064
|
+
for m in _RC_SEG_RE.finditer(p):
|
|
1065
|
+
cands.append(p[:m.end()])
|
|
1066
|
+
i = p.rfind('/plugin/')
|
|
1067
|
+
if i > 0:
|
|
1068
|
+
cands.append(p[:i])
|
|
1069
|
+
return any(_is_rc_package_dir(c) for c in cands)
|
|
1070
|
+
|
|
1071
|
+
|
|
1022
1072
|
def _core_path_verdict(path: str, policy: Policy) -> Tuple[bool, Optional[str]]:
|
|
1023
1073
|
"""CORE 소스보호 판정만 수행. (banned, rule).
|
|
1024
1074
|
|
|
@@ -1047,17 +1097,56 @@ def _core_path_verdict(path: str, policy: Policy) -> Tuple[bool, Optional[str]]:
|
|
|
1047
1097
|
continue
|
|
1048
1098
|
elif _dev_mode() or _is_dev_source_path(real):
|
|
1049
1099
|
continue
|
|
1100
|
+
# 이름만 'routinecode' 인 사용자 레포/가상 경로는 보호 대상 아님(거짓 차단 방지)
|
|
1101
|
+
if _rc_scoped_rule(rule) and not any(_path_in_rc_package(t) for t in targets):
|
|
1102
|
+
continue
|
|
1050
1103
|
return True, rule
|
|
1051
1104
|
return False, None
|
|
1052
1105
|
|
|
1053
1106
|
|
|
1107
|
+
def _rc_mentions_all_benign(cmd: str) -> bool:
|
|
1108
|
+
"""명령 속 `routinecode/<자산>` 언급이 전부 '실물 RoutineCode 패키지가 아닌' 리터럴 경로인가.
|
|
1109
|
+
변수·명령치환·글롭이 섞인 단어는 해석 불가 → 실물로 간주(False). 상대경로는 선두 cd·cwd 기준.
|
|
1110
|
+
True 면 사용자 레포 이름이 routinecode 이거나 테스트 문자열일 뿐이므로 CORE 차단하지 않는다."""
|
|
1111
|
+
words = re.findall(r'\S*routinecode[/\\]\S*', cmd)
|
|
1112
|
+
if not words:
|
|
1113
|
+
return False
|
|
1114
|
+
m_cd = re.match(r'\s*cd\s+([^\s;&|]+)\s*(?:&&|;|\|)', cmd)
|
|
1115
|
+
base = os.path.abspath(os.path.expanduser(m_cd.group(1))) if m_cd else os.getcwd()
|
|
1116
|
+
for w in words:
|
|
1117
|
+
if any(ch in w for ch in '$`*?[{()'):
|
|
1118
|
+
return False
|
|
1119
|
+
w = w.strip('\'"`;&|<>)')
|
|
1120
|
+
if '=' in w:
|
|
1121
|
+
w = w.split('=', 1)[1]
|
|
1122
|
+
p = os.path.expanduser(w)
|
|
1123
|
+
if not os.path.isabs(p):
|
|
1124
|
+
p = os.path.join(base, p)
|
|
1125
|
+
p = os.path.normpath(p)
|
|
1126
|
+
try:
|
|
1127
|
+
rp = os.path.realpath(p)
|
|
1128
|
+
except Exception:
|
|
1129
|
+
rp = p
|
|
1130
|
+
if _path_in_rc_package(p) or _path_in_rc_package(rp):
|
|
1131
|
+
return False
|
|
1132
|
+
return True
|
|
1133
|
+
|
|
1134
|
+
|
|
1054
1135
|
def _core_command_verdict(cmd: str, policy: Policy) -> Tuple[bool, Optional[str]]:
|
|
1055
1136
|
"""CORE 명령 패턴 판정만 수행. (banned, rule). dev 소스 대상 명령은 완화(config 리터럴 제외)."""
|
|
1056
1137
|
_dev = _dev_mode() or _cmd_targets_dev_source(cmd)
|
|
1057
1138
|
_touches_cfg = bool(re.search(r'\.routinecode[/\\]', cmd))
|
|
1139
|
+
_benign = None
|
|
1058
1140
|
for raw_pat in policy.core_commands:
|
|
1059
1141
|
try:
|
|
1060
1142
|
if re.search(raw_pat, cmd, re.IGNORECASE):
|
|
1143
|
+
# 설치물 패턴(routinecode/hooks·plugin·mcp-·engine)인데 언급된 경로가 전부 실물 패키지가
|
|
1144
|
+
# 아니면(이름만 같은 사용자 레포·테스트 문자열) 차단하지 않는다.
|
|
1145
|
+
if 'routinecode[' in raw_pat and not _touches_cfg:
|
|
1146
|
+
if _benign is None:
|
|
1147
|
+
_benign = _rc_mentions_all_benign(cmd)
|
|
1148
|
+
if _benign:
|
|
1149
|
+
continue
|
|
1061
1150
|
# .routinecode/ 리터럴을 건드리는 bash 명령은 dev 모드여도 계속 차단한다.
|
|
1062
1151
|
# 이유: 값-스크럽(collect_protected_values)이 **-glob(.routinecode/*.json)을
|
|
1063
1152
|
# 성능상 건너뛰어 bash stdout 에는 apiKey 백스톱이 없다. Read 는
|
|
@@ -1298,6 +1387,214 @@ def check_bash_command(cmd: str, policy: Optional[Policy] = None) -> Tuple[bool,
|
|
|
1298
1387
|
return False, None, []
|
|
1299
1388
|
|
|
1300
1389
|
|
|
1390
|
+
# ─── 비밀 파일 사전 마스킹 (2026-10-16) ─────────────────────────────────
|
|
1391
|
+
# PostToolUse 는 이미 모델에 전달된 도구 출력을 바꾸지 못한다(실측: 원본과 사본이 둘 다 전달됨).
|
|
1392
|
+
# 그래서 비밀 '값'은 도구가 실행되기 전에 막는다:
|
|
1393
|
+
# - Read/Grep 이 비밀 파일을 가리키면 → 값이 마스킹된 사본 경로로 바꿔 읽힌다(키 이름은 그대로).
|
|
1394
|
+
# - Bash 명령이 비밀 파일·환경변수 덤프를 건드리면 → 출력이 scrub_stream.py 를 거쳐 나오게 감싼다.
|
|
1395
|
+
# 접근 자체는 막지 않는다(개발자는 자기 설정을 참조할 수 있어야 한다) — 값만 모델에 가지 않는다.
|
|
1396
|
+
|
|
1397
|
+
_TEMPLATE_SUFFIXES = ('.example', '.sample', '.template', '.tmpl', '.dist', '.defaults')
|
|
1398
|
+
MASK_TOKEN = '***MASKED***'
|
|
1399
|
+
MASK_HEADER = '# [RoutineCode] 값이 마스킹된 사본입니다(키 이름만 표시). 값 변경은 사용자에게 요청하세요.\n'
|
|
1400
|
+
_MASK_MAX_BYTES = 1024 * 1024
|
|
1401
|
+
_KV_LINE_RE = re.compile(r'^(\s*(?:export\s+)?[A-Za-z_][\w.\-]*\s*[=:]\s*)(.*?)(\s*)$')
|
|
1402
|
+
_JSON_STR_KV_RE = re.compile(r'("(?:[^"\\]|\\.)*"\s*:\s*)"((?:[^"\\]|\\.)*)"')
|
|
1403
|
+
_PEM_RE = re.compile(r'(-----BEGIN [^-]+-----)(.*?)(-----END [^-]+-----)', re.S)
|
|
1404
|
+
_URL_CRED_RE = re.compile(r'^([a-z][a-z0-9+.\-]*://)([^/@\s]+)@', re.I)
|
|
1405
|
+
_PUBLIC_VALUE_RE = re.compile(r'^(?:-?\d+(?:\.\d+)?|true|false|yes|no|on|off|null|none|development|production|test|staging|local|localhost|127\.0\.0\.1|0\.0\.0\.0)$', re.I)
|
|
1406
|
+
_SECRET_ENV_NAME_RE = re.compile(r'(SECRET|TOKEN|PASSWORD|PASSWD|PASS|PWD|API_?KEY|PRIVATE|CREDENTIAL|AUTH|SESSION|COOKIE|DSN|DATABASE_URL|_KEY$)', re.I)
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
def is_secret_file(path: str, policy: Optional[Policy] = None) -> bool:
|
|
1410
|
+
"""generic 비밀 파일(.env·키·자격증명 등)인가. 템플릿(.env.example 등)과 allowlist 는 제외."""
|
|
1411
|
+
if not isinstance(path, str) or not path:
|
|
1412
|
+
return False
|
|
1413
|
+
if policy is None:
|
|
1414
|
+
policy = load_policy()
|
|
1415
|
+
real = _normalize_path(path)
|
|
1416
|
+
lexical = _lexical_path(path)
|
|
1417
|
+
targets = {real, lexical}
|
|
1418
|
+
basenames = {os.path.basename(t) for t in targets}
|
|
1419
|
+
if any(b.lower().endswith(_TEMPLATE_SUFFIXES) for b in basenames):
|
|
1420
|
+
return False
|
|
1421
|
+
|
|
1422
|
+
def _m(rule):
|
|
1423
|
+
nr = _normalize_rule(rule)
|
|
1424
|
+
return any(fnmatch.fnmatch(t, nr) for t in targets) or any(fnmatch.fnmatch(b, nr) for b in basenames)
|
|
1425
|
+
|
|
1426
|
+
if any(_m(r) for r in policy.path_allowlist):
|
|
1427
|
+
return False
|
|
1428
|
+
return any(_m(r) for r in list(policy.secret_paths) + list(policy.redact_only_paths))
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
def core_dir_scope(path: str) -> bool:
|
|
1432
|
+
"""Grep 등 '디렉터리 단위' 검색이 RoutineCode 설치물(또는 그것을 담은 상위 디렉터리)을 훑는가.
|
|
1433
|
+
dev 소스 체크아웃은 제외(개발자 무마찰). 파일 경로 판정은 _core_path_verdict 가 담당."""
|
|
1434
|
+
if not isinstance(path, str) or not path:
|
|
1435
|
+
return False
|
|
1436
|
+
try:
|
|
1437
|
+
real = os.path.realpath(os.path.expanduser(path))
|
|
1438
|
+
except Exception:
|
|
1439
|
+
return False
|
|
1440
|
+
if not os.path.isdir(real) or _is_dev_source_path(real):
|
|
1441
|
+
return False
|
|
1442
|
+
if _is_rc_package_dir(real) or _path_in_rc_package(real + '/'):
|
|
1443
|
+
return True
|
|
1444
|
+
if '/plugins/cache/routinecode-marketplace' in real + '/':
|
|
1445
|
+
return True
|
|
1446
|
+
for sub in ('routinecode', os.path.join('@routinecrew', 'routinecode'),
|
|
1447
|
+
os.path.join('node_modules', '@routinecrew', 'routinecode'),
|
|
1448
|
+
'routinecode-marketplace'):
|
|
1449
|
+
c = os.path.join(real, sub)
|
|
1450
|
+
if os.path.isdir(c) and (_is_rc_package_dir(c) or sub == 'routinecode-marketplace'):
|
|
1451
|
+
return True
|
|
1452
|
+
return False
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
def _mask_value(v: str) -> str:
|
|
1456
|
+
raw = v.strip()
|
|
1457
|
+
q = ''
|
|
1458
|
+
if len(raw) >= 2 and raw[0] == raw[-1] and raw[0] in '"\'':
|
|
1459
|
+
q, raw = raw[0], raw[1:-1]
|
|
1460
|
+
if not raw or _PUBLIC_VALUE_RE.match(raw):
|
|
1461
|
+
return v
|
|
1462
|
+
m = _URL_CRED_RE.match(raw)
|
|
1463
|
+
if m: # 접속 URL — 자격(user:pass)만 가리고 호스트·DB 명은 남김(개발 참조용)
|
|
1464
|
+
return q + m.group(1) + MASK_TOKEN + '@' + raw[m.end():] + q
|
|
1465
|
+
return q + MASK_TOKEN + q
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
def mask_secret_text(content: str) -> Tuple[str, int]:
|
|
1469
|
+
"""비밀 파일 내용에서 값만 마스킹. (masked, count). 키 이름·주석·구조는 유지."""
|
|
1470
|
+
n = 0
|
|
1471
|
+
|
|
1472
|
+
def _pem(m):
|
|
1473
|
+
nonlocal n
|
|
1474
|
+
n += 1
|
|
1475
|
+
return m.group(1) + '\n' + MASK_TOKEN + '\n' + m.group(3)
|
|
1476
|
+
|
|
1477
|
+
content = _PEM_RE.sub(_pem, content)
|
|
1478
|
+
stripped = content.lstrip()
|
|
1479
|
+
if stripped.startswith('{') or stripped.startswith('['): # JSON 자격증명 파일
|
|
1480
|
+
def _js(m):
|
|
1481
|
+
nonlocal n
|
|
1482
|
+
mv = _mask_value(m.group(2))
|
|
1483
|
+
if mv != m.group(2):
|
|
1484
|
+
n += 1
|
|
1485
|
+
return m.group(1) + '"' + mv + '"'
|
|
1486
|
+
return _JSON_STR_KV_RE.sub(_js, content), n
|
|
1487
|
+
out = []
|
|
1488
|
+
for line in content.splitlines(keepends=True):
|
|
1489
|
+
body = line.rstrip('\r\n')
|
|
1490
|
+
nl = line[len(body):]
|
|
1491
|
+
st = body.strip()
|
|
1492
|
+
if not st or st.startswith(('#', ';', '//')) or st == MASK_TOKEN or st.startswith('-----'):
|
|
1493
|
+
out.append(line)
|
|
1494
|
+
continue
|
|
1495
|
+
m = _KV_LINE_RE.match(body)
|
|
1496
|
+
if m:
|
|
1497
|
+
mv = _mask_value(m.group(2))
|
|
1498
|
+
if mv != m.group(2):
|
|
1499
|
+
n += 1
|
|
1500
|
+
out.append(m.group(1) + mv + m.group(3) + nl)
|
|
1501
|
+
continue
|
|
1502
|
+
# 구조 없는 줄(키 파일 본문·토큰 한 줄 등) — 값 토큰만 가린다
|
|
1503
|
+
toks = [t for t in _VALUE_SPLIT_RE.split(body) if _is_value_token(t.strip('"\'`'))]
|
|
1504
|
+
for t in sorted(set(toks), key=len, reverse=True):
|
|
1505
|
+
body = body.replace(t, MASK_TOKEN)
|
|
1506
|
+
n += 1
|
|
1507
|
+
out.append(body + nl)
|
|
1508
|
+
return ''.join(out), n
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
def masked_copy_path(path: str) -> Optional[str]:
|
|
1512
|
+
"""비밀 파일의 값-마스킹 사본을 만들어 경로 반환. 원본이 없거나 너무 크면 None."""
|
|
1513
|
+
import hashlib
|
|
1514
|
+
import tempfile
|
|
1515
|
+
try:
|
|
1516
|
+
real = os.path.realpath(os.path.expanduser(path))
|
|
1517
|
+
if not os.path.isfile(real) or os.path.getsize(real) > _MASK_MAX_BYTES:
|
|
1518
|
+
return None
|
|
1519
|
+
with open(real, 'rb') as fh:
|
|
1520
|
+
raw = fh.read()
|
|
1521
|
+
if b'\x00' in raw[:8192]: # 바이너리 키스토어(.p12/.jks) — 내용 대신 안내만
|
|
1522
|
+
masked = MASK_HEADER + '# (binary secret file — content not shown)\n'
|
|
1523
|
+
else:
|
|
1524
|
+
masked = MASK_HEADER + mask_secret_text(raw.decode('utf-8', errors='replace'))[0]
|
|
1525
|
+
d = os.path.join(tempfile.gettempdir(), 'rc-masked-%d' % os.getuid(),
|
|
1526
|
+
hashlib.sha256(real.encode('utf-8')).hexdigest()[:16])
|
|
1527
|
+
os.makedirs(d, mode=0o700, exist_ok=True)
|
|
1528
|
+
out = os.path.join(d, os.path.basename(real) or 'secret')
|
|
1529
|
+
fd = os.open(out + '.tmp', os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
|
|
1530
|
+
with os.fdopen(fd, 'w', encoding='utf-8') as fh:
|
|
1531
|
+
fh.write(masked)
|
|
1532
|
+
os.replace(out + '.tmp', out)
|
|
1533
|
+
return out
|
|
1534
|
+
except Exception:
|
|
1535
|
+
return None
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
_ENV_DUMP_RE = re.compile(
|
|
1539
|
+
r'(?:^|[\s;|&(])(?:printenv|export\s+-p|declare\s+-x|set)\s*(?:$|[;|&)>])'
|
|
1540
|
+
r'|(?:^|[\s;|&(])env\s*(?:$|[;|&)>])'
|
|
1541
|
+
r'|/proc/[^\s]*/environ'
|
|
1542
|
+
r'|docker\s+(?:inspect|compose\s+config)|kubectl\s+get\s+secrets?'
|
|
1543
|
+
r'|\$\{?[A-Z_]*(?:SECRET|TOKEN|PASSWORD|PASS|API_?KEY|PRIVATE|CREDENTIAL)[A-Z_]*')
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
def bash_secret_targets(cmd: str, policy: Optional[Policy] = None) -> Tuple[List[str], bool]:
|
|
1547
|
+
"""명령이 읽을 수 있는 비밀 파일 목록(실존) + 환경변수 덤프 여부. 변수 경로는 해석하지 않는다."""
|
|
1548
|
+
if not isinstance(cmd, str) or not cmd:
|
|
1549
|
+
return [], False
|
|
1550
|
+
if policy is None:
|
|
1551
|
+
policy = load_policy()
|
|
1552
|
+
files = []
|
|
1553
|
+
seen = set()
|
|
1554
|
+
m_cd = re.match(r'\s*cd\s+([^\s;&|]+)\s*(?:&&|;|\|)', cmd)
|
|
1555
|
+
base = os.path.abspath(os.path.expanduser(m_cd.group(1))) if m_cd else os.getcwd()
|
|
1556
|
+
cands = list(_iter_command_path_tokens(cmd))
|
|
1557
|
+
cands += [t for t in re.findall(r'(?<![\w$/~.\-])(\.?[\w.\-]+(?:/[\w.\-]+)*)', cmd)
|
|
1558
|
+
if not t.startswith(('/', '~', '-'))]
|
|
1559
|
+
for tok in cands:
|
|
1560
|
+
tok = tok.strip('\'"`')
|
|
1561
|
+
p = os.path.expanduser(tok)
|
|
1562
|
+
if not os.path.isabs(p):
|
|
1563
|
+
p = os.path.join(base, p)
|
|
1564
|
+
p = os.path.normpath(p)
|
|
1565
|
+
if p in seen:
|
|
1566
|
+
continue
|
|
1567
|
+
seen.add(p)
|
|
1568
|
+
try:
|
|
1569
|
+
if os.path.isfile(p) and is_secret_file(p, policy):
|
|
1570
|
+
files.append(p)
|
|
1571
|
+
except Exception:
|
|
1572
|
+
continue
|
|
1573
|
+
return files, bool(_ENV_DUMP_RE.search(cmd))
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
def wrap_bash_for_scrub(cmd: str, files: List[str], lib_dir: str) -> str:
|
|
1577
|
+
"""명령 출력을 scrub_stream.py 로 통과시키도록 감싼다. 종료코드는 pipefail 로 보존(bash·zsh 공통).
|
|
1578
|
+
원 명령은 base64 로 실어 따옴표 문제를 없앤다. 파이프 안이라 cd 등 셸 상태는 유지되지 않는다."""
|
|
1579
|
+
import shlex
|
|
1580
|
+
b64 = base64.b64encode(cmd.encode('utf-8')).decode('ascii')
|
|
1581
|
+
scrub = 'python3 ' + shlex.quote(os.path.join(lib_dir, 'scrub_stream.py')) + \
|
|
1582
|
+
''.join(' ' + shlex.quote(f) for f in files)
|
|
1583
|
+
return ("( set -o pipefail; { eval \"$(printf '%s' '" + b64 + "' | base64 --decode)\"; } 2>&1 | " + scrub + " )")
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
def scrub_values_for(files: List[str]) -> List[str]:
|
|
1587
|
+
"""scrub_stream 이 가릴 값: 비밀 파일에서 뽑은 값 + 이름이 비밀스러운 환경변수 값."""
|
|
1588
|
+
vals = set()
|
|
1589
|
+
for f in files:
|
|
1590
|
+
plain, _enc = _extract_values_from_file(f)
|
|
1591
|
+
vals |= set(plain)
|
|
1592
|
+
for k, v in os.environ.items():
|
|
1593
|
+
if v and len(v) >= 6 and _SECRET_ENV_NAME_RE.search(k) and not _PUBLIC_VALUE_RE.match(v):
|
|
1594
|
+
vals.add(v)
|
|
1595
|
+
return sorted(vals, key=len, reverse=True)
|
|
1596
|
+
|
|
1597
|
+
|
|
1301
1598
|
def summarize_matches(matches: List[SecretMatch]) -> str:
|
|
1302
1599
|
"""Build a user-facing summary of detected secrets."""
|
|
1303
1600
|
if not matches:
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""prompt-supplements 무결성 서명.
|
|
3
|
+
|
|
4
|
+
~/.routinecode/prompt-supplements.md 는 매 세션 시스템 프롬프트에 덧붙는다(bin/cli.sh).
|
|
5
|
+
정상 작성자는 session-start(지식 서버 → 로컬 캐시) 하나뿐이므로, 작성 직후 로컬 HMAC 키로 서명하고
|
|
6
|
+
cli.sh 는 서명이 맞을 때만 덧붙인다. 레포 속 문서 등에 유도된 모델이 이 파일을 고쳐 지시를 영속
|
|
7
|
+
주입하는 경로를 막는다(서명 불일치 → 덧붙이지 않고 사용자에게 알림, 다음 session-start 가 서버본으로 복구).
|
|
8
|
+
|
|
9
|
+
사용: supplements_sig.py sign <file> | supplements_sig.py verify <file> (exit 0=유효)
|
|
10
|
+
"""
|
|
11
|
+
import hashlib
|
|
12
|
+
import hmac
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _key():
|
|
18
|
+
d = os.path.join(os.environ.get('ROUTINECODE_KNOWLEDGE_DIR') or
|
|
19
|
+
os.path.join(os.path.expanduser('~'), '.routinecode', 'knowledge'), 'attest')
|
|
20
|
+
p = os.path.join(d, '.key')
|
|
21
|
+
try:
|
|
22
|
+
return open(p, 'rb').read()
|
|
23
|
+
except Exception:
|
|
24
|
+
pass
|
|
25
|
+
try:
|
|
26
|
+
os.makedirs(d, mode=0o700, exist_ok=True)
|
|
27
|
+
fd = os.open(p, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
|
28
|
+
with os.fdopen(fd, 'wb') as f:
|
|
29
|
+
f.write(os.urandom(32))
|
|
30
|
+
except Exception:
|
|
31
|
+
pass
|
|
32
|
+
try:
|
|
33
|
+
return open(p, 'rb').read()
|
|
34
|
+
except Exception:
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _mac(path):
|
|
39
|
+
key = _key()
|
|
40
|
+
if not key:
|
|
41
|
+
return None
|
|
42
|
+
with open(path, 'rb') as f:
|
|
43
|
+
return hmac.new(key, b'prompt-supplements|' + f.read(), hashlib.sha256).hexdigest()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def sign(path):
|
|
47
|
+
m = _mac(path)
|
|
48
|
+
if m:
|
|
49
|
+
tmp = path + '.sig.tmp'
|
|
50
|
+
with open(tmp, 'w') as f:
|
|
51
|
+
f.write(m)
|
|
52
|
+
os.replace(tmp, path + '.sig')
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def verify(path):
|
|
56
|
+
try:
|
|
57
|
+
m = _mac(path)
|
|
58
|
+
sig = open(path + '.sig').read().strip()
|
|
59
|
+
return bool(m) and hmac.compare_digest(m, sig)
|
|
60
|
+
except Exception:
|
|
61
|
+
return False
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == '__main__':
|
|
65
|
+
if len(sys.argv) != 3 or sys.argv[1] not in ('sign', 'verify'):
|
|
66
|
+
sys.exit(2)
|
|
67
|
+
if sys.argv[1] == 'sign':
|
|
68
|
+
sign(sys.argv[2])
|
|
69
|
+
sys.exit(0)
|
|
70
|
+
sys.exit(0 if verify(sys.argv[2]) else 1)
|
|
@@ -19,6 +19,20 @@ session_id = inp.get('session_id') or 'unknown'
|
|
|
19
19
|
tool_name = inp.get('tool_name', '')
|
|
20
20
|
tool_output = inp.get('tool_output', '') or inp.get('tool_response', '')
|
|
21
21
|
|
|
22
|
+
# MCP 도구 결과는 str/dict 가 아니라 content 블록 리스트([{type:'text', text:'{json}'}])
|
|
23
|
+
# 또는 {content:[...]} 로 온다. 과거엔 str/dict 만 처리해 parsed={} → community-usage
|
|
24
|
+
# 미기록 → 검증 피드백 루프 전체가 입력 0 이었다. 블록을 풀어 JSON 문자열로 정규화.
|
|
25
|
+
def _unwrap(o):
|
|
26
|
+
if isinstance(o, dict) and isinstance(o.get('content'), list) and not any(
|
|
27
|
+
k in o for k in ('community', 'local', 'results', 'patterns', 'quirks', 'errors')):
|
|
28
|
+
o = o['content']
|
|
29
|
+
if isinstance(o, list):
|
|
30
|
+
texts = [b.get('text', '') for b in o if isinstance(b, dict) and b.get('type') == 'text']
|
|
31
|
+
joined = ''.join(texts).strip()
|
|
32
|
+
return joined if joined else o
|
|
33
|
+
return o
|
|
34
|
+
tool_output = _unwrap(tool_output)
|
|
35
|
+
|
|
22
36
|
GATE_PATH = os.path.expanduser("~/.routinecode/knowledge/pre-query-gate.json")
|
|
23
37
|
COMMUNITY_PATH = os.path.expanduser("~/.routinecode/knowledge/community-usage.json")
|
|
24
38
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# PostToolUse hook —
|
|
2
|
+
# PostToolUse hook — 도구 출력에 비밀값이 섞였는지 사후 감지·경고(백스톱).
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# -
|
|
8
|
-
#
|
|
9
|
-
# → 결과적으로 Anthropic API는 redacted 본문만 수신
|
|
4
|
+
# 주의(2026-10-16 실측): PostToolUse 는 이미 모델에 전달된 tool_response 를 바꾸지 못한다.
|
|
5
|
+
# decision:block 의 reason 은 '추가로' 전달될 뿐 원본을 대체하지 않는다 → 여기서 가린 사본을
|
|
6
|
+
# 다시 보내면 토큰만 두 배가 되고 보호 효과는 없다. 그래서 본문을 되풀이하지 않고 짧은 경고만 낸다.
|
|
7
|
+
# 실제 차단은 PreToolUse 에서 한다: pre-read-guard/pre-grep-guard(비밀 파일 → 마스킹 사본),
|
|
8
|
+
# pre-bash-guard(비밀 파일·환경변수 덤프 명령 → scrub_stream 출력 필터).
|
|
10
9
|
#
|
|
11
10
|
# 동작 mode:
|
|
12
11
|
# hardBlock (기본): secret 발견 시 전체 tool_response를 redact된 버전으로 치환
|
|
@@ -155,6 +154,9 @@ try:
|
|
|
155
154
|
if _rp in _seen or len(_seen) >= 12: # 병리적 명령 방어 캡
|
|
156
155
|
continue
|
|
157
156
|
_seen.add(_rp)
|
|
157
|
+
# 비밀 파일(.env·키·자격증명)만 값 대조 — 일반 코드 파일의 식별자를 '값'으로 오인해 가리던 문제 제거
|
|
158
|
+
if not sf.is_secret_file(_rp, policy):
|
|
159
|
+
continue
|
|
158
160
|
try:
|
|
159
161
|
if not os.path.isfile(_rp):
|
|
160
162
|
continue
|
|
@@ -215,28 +217,11 @@ if posttool_mode == 'warn':
|
|
|
215
217
|
)
|
|
216
218
|
emit({'continue': True, 'systemMessage': msg})
|
|
217
219
|
|
|
218
|
-
#
|
|
219
|
-
redacted_text, _ = sf.redact(value_scrubbed, policy)
|
|
220
|
-
|
|
221
|
-
truncated_notice = ''
|
|
222
|
-
if len(response_text) > SCAN_LIMIT:
|
|
223
|
-
tail_len = len(response_text) - SCAN_LIMIT
|
|
224
|
-
truncated_notice = '\n\n' + t('secret.truncated', size=tail_len)
|
|
225
|
-
redacted_text += truncated_notice
|
|
226
|
-
|
|
220
|
+
# 본문은 되풀이하지 않는다(위 주의 참고). 모델이 값을 응답·커밋·파일로 옮기지 않도록 짧게 경고.
|
|
227
221
|
severity_key = 'secret.severity_critical' if hard else 'secret.severity_warning'
|
|
228
222
|
severity = t(severity_key)
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
+ '\n' + '─' * 60 + '\n'
|
|
232
|
-
)
|
|
233
|
-
footer = (
|
|
234
|
-
'\n' + '─' * 60 + '\n'
|
|
235
|
-
+ t('secret.redact_footer')
|
|
236
|
-
+ (f' HARD_LEAK pattern matched: {hard}' if hard else '')
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
final_reason = header + redacted_text + footer
|
|
223
|
+
final_reason = t('secret.detect_notice', severity=severity, tool_name=tool_name, count=count, summary=summary) \
|
|
224
|
+
+ (f' HARD_LEAK pattern: {hard}' if hard else '')
|
|
240
225
|
|
|
241
226
|
emit({'decision': 'block', 'reason': final_reason})
|
|
242
227
|
PYEOF
|
|
@@ -47,7 +47,11 @@ if echo "$BASE_TOOL" | grep -qE "^($FREE_TOOLS)$"; then
|
|
|
47
47
|
exit 0
|
|
48
48
|
fi
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
_RC_PKG="$(cd "$(dirname "$0")/.." 2>/dev/null && pwd)"
|
|
51
|
+
_rc_dev_bypass() { # 우회 변수는 개발용 소스 체크아웃에서만 유효(설치본 고객은 무시) — 2026-10-16 결정
|
|
52
|
+
[ "${ROUTINECODE_CREDIT_BYPASS:-}" = "true" ] && [ -d "$_RC_PKG/engine/src" ] && { [ -d "$_RC_PKG/.sources" ] || [ -d "$_RC_PKG/mcp-intelligence/src" ]; }
|
|
53
|
+
}
|
|
54
|
+
_rc_dev_bypass && exit 0
|
|
51
55
|
|
|
52
56
|
GATE=$(python3 -c "
|
|
53
57
|
import json, os
|