T06 · System Persistence
- Location
scripts/init.sh:42- Finding
Persistent execution of code outside the audited Skill package
- Content
View full analysis
/dev/null && python3 -c "import supervisor" 2>/dev/null; then SUPERVISOR_CONF="${HOME}/supervisord.conf" if [ -f "${SUPERVISOR_CONF}" ]; then if ! grep -q "token-broker" "${SUPERVISOR_CONF}" 2>/dev/null; then warn "未在 Supervisor 中找到 token-broker,尝试注册..." # 尝试通过 supervisord 提供的 rpc 接口添加 echo " [program:token-broker] command=npx ts-node ${BROKER_DIR}/src/server.ts directory=${BROKER_DIR} autostart=true autorestart=true startsecs=5 startretries=10 stopwaitsecs=5 killasgroup=true stopsignal=TERM stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 environment=BROKER_PORT=${BROKER_PORT},NODE_ENV=production" >> "${SUPERVISOR_CONF}" info "已追加到 Supervisor 配置" python3 -m supervisor.supervisorctl -c "${SUPERVISOR_CONF}" reread 2>/dev/null || true python3 -m supervisor.supervisorctl -c "${SUPERVISOR_CONF}" update 2>/dev/null || true sleep 2 else info "Supervisor 中已配置 TokenBroker" python3 -m supervisor.supervisorctl -c "${SUPERVISOR_CONF}" start token-broker 2>/dev/null || true sleep 2 fi fi fi ``` ### Technical Analysis The initialization script appends a new program definition to the user's persistent Supervisor configuration. The definition enables both `autostart` and `autorestart`, causing `${BROKER_DIR}/src/server.ts` to execute beyond the lifetime of the installer and to restart automatically after failure or a Supervisor restart. The executed broker source is located in the sibling directory `../../production-system/token-broker` rather than inside the audited Skill. That source code is not included in the project under review, so its behavior and integrity cannot be verified as par ...[truncated 1425 chars]- Remediation
View remediation
