Skip to content

fix: add directory traversal restriction for local_path in save_prese… - #2765

Open
whisper88-lgtm wants to merge 7 commits into
google:mainfrom
whisper88-lgtm:feat/fix-local-path
Open

whisper88-lgtm wants to merge 7 commits into
google:mainfrom
whisper88-lgtm:feat/fix-local-path

Conversation

@whisper88-lgtm

Copy link
Copy Markdown
Collaborator

The PR/commit is resolving the unconstrained local_path.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Hygiene review — 1 finding(s).


Round 1 · 0 of this PR's 25 automated comments used · this round is capped at 20 across all reviewers.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Maintainability review — 2 finding(s).


Round 1 · 0 of this PR's 25 automated comments used · this round is capped at 20 across all reviewers.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Security review — 2 finding(s).


Round 1 · 0 of this PR's 25 automated comments used · this round is capped at 20 across all reviewers.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Correctness review — 1 finding(s).


Round 1 · 0 of this PR's 25 automated comments used · this round is capped at 20 across all reviewers.

@github-actions github-actions Bot added the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review. All checks pass and the review comments are resolved.

Re-requested review from happyhuman.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated House Rules review — 1 finding(s).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Security review — 1 finding(s).


Round 2 · 6 of this PR's 25 automated comments used · this round is capped at 3 across all reviewers · after this round only Security and Correctness run.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Security review — 1 finding(s).


Round 3 · 7 of this PR's 25 automated comments used · this round is capped at 1 across all reviewers · only Security and Correctness still run.

@whisper88-lgtm

Copy link
Copy Markdown
Collaborator Author

@happyhuman fixed https://buganizer.corp.google.com/issues/565095907, please review. Thanks so much!

@whisper88-lgtm whisper88-lgtm removed the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 5, 2026
@github-actions github-actions Bot added the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 5, 2026
@whisper88-lgtm whisper88-lgtm removed the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 5, 2026
@github-actions github-actions Bot added the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 5, 2026
@whisper88-lgtm whisper88-lgtm removed the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 6, 2026

@happyhuman happyhuman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewed the PR and left a few comments. PTAL

if not local_path:
return "Error: No local file path provided."

base_dir = Path.cwd().resolve()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_artifact_as_local_path and get_gcs_file_as_local_path above both hand back tempfile.NamedTemporaryFile paths. Do those ever land under Path.cwd()?

# Subdirectory inside current directory (exists, but is not a file)
test_subdir = tmp_path / "subdir"
test_subdir.mkdir(parents=True, exist_ok=True)
from unittest.mock import patch

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move patch into the unittest.mock import at the top?


"""Attach A2A (Agent2Agent) endpoints to the FastAPI app.

func:`attach_a2a_routes` registers the dynamic

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func: is missing its leading colon


COPY ./pyproject.toml ./README.md ./uv.lock* ./

COPY ./app ./app

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyproject.toml lists packages = ["eval", "app"] under [tool.hatch.build.targets.wheel], but only ./app is copied here. Should pyproject.toml only package app, or does ./eval need to be copied before uv sync --frozen?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants