Skip to content

Commit d1076c5

Browse files
varunursekarclaude
andcommitted
address Greptile review on PR #45
- optimizer.run: validate self.max_proposals >= 0 before the proposal_limit guard, so the specific 'must be non-negative' error is reachable (was a dead branch that always tripped the generic message first). - compiler._safe_extract_tar: extractall(filter='data') to strip device files / setuid bits and neutralize unsafe links, matching extract_harbor_session_archive (also silences the py3.14 deprecation). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b069cb1 commit d1076c5

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

vero/src/vero/harbor/build/compiler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ def _safe_extract_tar(payload: bytes, destination: Path) -> None:
9090
link = PurePosixPath(member.linkname)
9191
if link.is_absolute() or ".." in link.parts:
9292
raise ValueError(f"unsafe link in Git archive: {member.linkname!r}")
93-
archive.extractall(destination)
93+
# filter="data" strips device files / setuid bits and neutralizes unsafe
94+
# links, matching extract_harbor_session_archive's defensive posture.
95+
archive.extractall(destination, filter="data")
9496

9597

9698
def _prepare_baseline_repo(

vero/src/vero/optimization/optimizer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,15 @@ async def run(
415415
max_proposals: int | None = None,
416416
) -> OptimizationResult:
417417
proposal_limit = self.max_proposals if max_proposals is None else max_proposals
418+
# Check the session-level limit first: otherwise a negative
419+
# self.max_proposals always trips the proposal_limit guard below and its
420+
# specific message is unreachable.
421+
if self.max_proposals < 0:
422+
raise ValueError("max_proposals must be non-negative")
418423
if proposal_limit < 0 or proposal_limit > self.max_proposals:
419424
raise ValueError(
420425
"run max_proposals must be between zero and the session protocol limit"
421426
)
422-
if self.max_proposals < 0:
423-
raise ValueError("max_proposals must be non-negative")
424427
if self.max_rounds < 1:
425428
raise ValueError("max_rounds must be positive")
426429
if self.max_concurrency < 1:

0 commit comments

Comments
 (0)