<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:webfeeds="http://webfeeds.org/rss/1.0"><channel><title>scripting on 林協霆醫師</title><link>/tags/scripting/</link><description>林協霆醫師 (scripting)</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><image><url>https://htl.physician.tw/favicon-32x32.png</url><title>林協霆醫師</title><link>https://htl.physician.tw/</link><width>32</width><height>32</height></image><webfeeds:icon>https://htl.physician.tw/favicon-32x32.png</webfeeds:icon><webfeeds:logo>https://htl.physician.tw/android-chrome-512x512.png</webfeeds:logo><webfeeds:accentColor>5bbad5</webfeeds:accentColor><lastBuildDate>Tue, 24 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="/tags/scripting/index.xml" rel="self" type="application/rss+xml"/><item><title>green-box：以 Shell 腳本維護綠色／可信任二進位執行環境的私有專案</title><link>/blog/green-box-2026-03-24/</link><pubDate>Tue, 24 Mar 2026 00:00:00 +0000</pubDate><guid>/blog/green-box-2026-03-24/</guid><description>&lt;h2 id="introduction引言" >
&lt;div>
&lt;a href="#introduction%e5%bc%95%e8%a8%80">
#
&lt;/a>
Introduction（引言）
&lt;/div>
&lt;/h2>
&lt;p>軟體開發者長期以「執行不信任程式碼」為日常工作的一部分：無論是新工具、來路不明的腳本、或經 LLM 生成尚未審視的指令，都帶有潛在風險。&lt;code>green-box&lt;/code> 專案以「綠色執行盒」為核心隱喻：使用者只在進入此環境後才執行可疑指令，環境內預設無寫入權限至個人重要目錄，並以快照與快照恢復維護乾淨基線。&lt;/p>
&lt;h2 id="methods方法" >
&lt;div>
&lt;a href="#methods%e6%96%b9%e6%b3%95">
#
&lt;/a>
Methods（方法）
&lt;/div>
&lt;/h2>
&lt;p>實作以 Shell 腳本為主：建立隔離工作目錄、限制檔案系統可見範圍、提供「重置」指令快速回到基線。具體手段包含 chroot、namespace、container 等視作業系統而異；對於 macOS 則採用 dotfiles 風格的 sandbox profile 限制。設計上避免引入額外服務，使腳本可在最小依賴下被部署。&lt;/p>
&lt;p>整體理念是「降低使用者犯錯的後果」：當執行環境本身限制嚴格，使用者執行陌生指令的心理門檻降低，可更安全地進行探索與實驗。配合 Git 版本控制，每次重置可保證乾淨初始狀態，避免實驗副作用累積。&lt;/p>
&lt;h2 id="results結果" >
&lt;div>
&lt;a href="#results%e7%b5%90%e6%9e%9c">
#
&lt;/a>
Results（結果）
&lt;/div>
&lt;/h2>
&lt;p>該環境已成為作者執行 LLM 生成指令、嘗試新 CLI 工具的預設場域。即便指令中暗藏破壞性命令（如誤刪檔案、洩漏環境變數），其影響也被侷限於 green-box 內，不波及主系統。對於頻繁與 AI 協作開發者，此一隔離模式顯著降低意外風險。&lt;/p>
&lt;h2 id="discussion討論" >
&lt;div>
&lt;a href="#discussion%e8%a8%8e%e8%ab%96">
#
&lt;/a>
Discussion（討論）
&lt;/div>
&lt;/h2>
&lt;p>本專案實踐了「為個人工作流加入信任邊界」的設計：當不信任無法消除時，便應以技術手段限縮其影響。限制方面，Shell 隔離並非完整 sandbox，仍可能被刻意設計的惡意指令繞過；某些工具（需要全系統存取）無法在隔離環境內運作。未來可結合更完整的 sandbox 機制（如 macOS App Sandbox、Linux user namespaces）並提供易用包裝。&lt;/p>
&lt;h2 id="連結" >
&lt;div>
&lt;a href="#%e9%80%a3%e7%b5%90">
#
&lt;/a>
連結
&lt;/div>
&lt;/h2>
&lt;ul>
&lt;li>GitHub：&lt;a href="https://github.com/htlin222/green-box">htlin222/green-box&lt;/a>&lt;/li>
&lt;li>主要語言：Shell&lt;/li>
&lt;li>最後更新：2026-03-24&lt;/li>
&lt;/ul></description></item></channel></rss>