Repository navigation
Verify PR#1 feedback content in main, add sandbox security tests, and add Windows usage to README - #3
Conversation
Co-authored-by: suchi <74622+suchi@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
PR#1(FBコミット 0f4f974 由来)の「sandbox 環境で危険なプリミティブを無効化する」挙動が main に残っていることをテストで検証し、回帰を防ぐための追加テストを入れる変更です。
Changes:
make_sandbox_envにおいて通常の算術が動作することをテスト追加- sandbox でファイルI/O・load・exit 系プリミティブが
EvalErrorでブロックされることをテスト追加
| describe 'make_sandbox_env' do | ||
| let(:sandbox) { described_class.make_sandbox_env } | ||
|
|
||
| it 'allows normal arithmetic in sandbox' do | ||
| expect(described_class.eval_source('(+ 1 2)', sandbox)).to eq(3) | ||
| end | ||
|
|
||
| it 'blocks open-input-file in sandbox' do | ||
| expect { described_class.eval_source('(open-input-file "test.txt")', sandbox) } | ||
| .to raise_error(Sucheme::EvalError, /open-input-file.*not available in sandbox/) | ||
| end | ||
|
|
||
| it 'blocks open-output-file in sandbox' do | ||
| expect { described_class.eval_source('(open-output-file "test.txt")', sandbox) } | ||
| .to raise_error(Sucheme::EvalError, /open-output-file.*not available in sandbox/) | ||
| end | ||
|
|
||
| it 'blocks load in sandbox' do | ||
| expect { described_class.eval_source('(load "file.scm")', sandbox) } | ||
| .to raise_error(Sucheme::EvalError, /load.*not available in sandbox/) | ||
| end | ||
|
|
||
| it 'blocks exit in sandbox' do | ||
| expect { described_class.eval_source('(exit)', sandbox) } | ||
| .to raise_error(Sucheme::EvalError, /exit.*not available in sandbox/) | ||
| end | ||
|
|
||
| it 'blocks call-with-input-file in sandbox' do | ||
| expect { described_class.eval_source('(call-with-input-file "f" (lambda (p) #f))', sandbox) } | ||
| .to raise_error(Sucheme::EvalError, /call-with-input-file.*not available in sandbox/) | ||
| end | ||
|
|
||
| it 'blocks call-with-output-file in sandbox' do | ||
| expect { described_class.eval_source('(call-with-output-file "f" (lambda (p) #f))', sandbox) } | ||
| .to raise_error(Sucheme::EvalError, /call-with-output-file.*not available in sandbox/) | ||
| end |
There was a problem hiding this comment.
make_sandbox_env blocks with-input-from-file / with-output-to-file as well (see SANDBOX_BLOCKED in lib/sucheme/evaluator.rb), but this spec only asserts blocking for open-*-file, load, exit, and call-with-*-file. Add examples for the remaining two to ensure sandbox restrictions are fully covered and avoid regressions.
There was a problem hiding this comment.
コミット 0c47e2b で with-input-from-file と with-output-to-file のブロックテストを追加しました。これで SANDBOX_BLOCKED の全8プリミティブ(open-input-file, open-output-file, with-input-from-file, with-output-to-file, call-with-input-file, call-with-output-file, load, exit)がテストでカバーされています。
|
@copilot でも下のWindowsで実行する方法がREADMEに書かれていないんだけど。UNIXの実行方法だけだよね。これでWindowsに対応したと言えるのでしょうか。 |
…o README Co-authored-by: suchi <74622+suchi@users.noreply.github.com>
コミット |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Issue claimed that changes from commit
0f4f974(PR#1 review feedback response) were missing from main. All changes are confirmed present.Findings
All
0f4f974/d603190/eebfcdecontent verified in main:parser.rbparse_allnil-on-datum-comment-EOF fixprimitives.rbfoldlarg order +string->numberradix supportevaluator.rbeval_let_syntaxdouble-eval + TCO (SchemeTailCall) forlet-values/let*-values/let-syntaxweb/app.rbrequire 'timeout'/'stringio'/'thread',STDOUT_MUTEX, sandbox envREADME.mdR5RS_COMPLIANCE.mdcall/ccescape-only noteci.yml$GITHUB_STEP_SUMMARYbenchmark outputONBOARDING.mdbundle config set --local path, Windows/PowerShell stepsTUTORIAL.mdAdded
Sandbox security tests
make_sandbox_envhad zero test coverage despite being a security boundary. Added 9 specs toevaluator_spec.rbcovering all 8 primitives inSANDBOX_BLOCKED:Windows usage in README
Added a
### Windows (PowerShell)section toREADME.mdwith instructions for running the REPL, executing files, evaluating expressions (using double quotes instead of single quotes), using thebin\sucheme.batbatch wrapper, and starting the Web UI.265 → 274 tests, all passing.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.