SAFE on a python script blocks when the body mentions subprocess or base64

オープン
#252 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, typescript

調査の方向性

Start by tracing hasInterpreterCodeRisk, the decision order branches 5 and 6, and the SAFE post-filter; the issue identifies these as the relevant paths but gives no file names. Compare both proposed policy changes and run the adversarial and gitflow corpora, as the issue requires a measured evaluation. Done means the selected behavior lets a reviewer allow this file-body flag while critical-pattern, lookalike, and moderate-risk-token flags remain hard blocks.

索引モデルが issue の本文から書いたものです。

説明

A SAFE verdict on python3 <script>.py still blocks whenever the script body contains subprocess, base64, or a \x.. escape anywhere. In the last two days that refused 4 commands Jev had already cleared, in 4 different repos. None of them has a path to the reviewer.

Command What tripped hasInterpreterCodeRisk
python -I scripts/preflight.py <hex> \x00, \x14 (byte literals in a hash test)
python3 scripts/site-structure.py validate base64 x2
python3 scripts/testflight.py import subprocess, subprocess. x5
python3 -I ops/memory/test_sync.py import subprocess, subprocess. x1
python3 x.py ─► script body read ─► INTERPRETER_CODE_RISK matches ─► flag "python3 runs x.py"
                                                                         │
Jev: SAFE ─► decision order branch 6 (overlaid SAFE, never reviewed) ─► "flagged" block

Root cause: #67 put the inline -c markers on script bodies read from disk. For a one-line -c, subprocess or b64decode is a strong signal that the real work is hidden somewhere else. In a 300-line test script or release tool it's ordinary code, and the classifier has already read every line of it. The marker can't tell a subprocess.run(["git", "status"]) the judge saw from a decoded payload it didn't.

Two ways to fix it, each with a cost:

  1. Narrow the markers for file bodies to actual second execution: exec(, eval(, compile( in code mode, __import__, marshal, and a b64decode whose result reaches one of those. Keeps the hard block. Costs a regex that has to track data flow, which is what got #67's markers this broad in the first place.
  2. Send this one flag class (interpreter risk in a file body) to branch 5 instead of branch 6, so the stage 2 reviewer sees the body and the user's words. The gate's SAFE post-filter then has to accept a reviewer allow for this flag only. Critical-pattern, lookalike and moderate-risk-token flags stay hard.

I lean toward 2. It's a policy change to the overlay, so it needs a measured run over the adversarial and gitflow corpora before it ships.

主要言語
TypeScript
スター
1
フォーク
1
平均マージ
49分
マージ済み PR(30日)
82

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

STRML/omp-classifier のほかの issue

STRML/omp-classifier の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。