Skip to content

Add download_file function to sessions_python_plugin - #13411

Open
Rmaram07 wants to merge 2 commits into
microsoft:mainfrom
Rmaram07:download_file_method_fix
Open

Rmaram07 wants to merge 2 commits into
microsoft:mainfrom
Rmaram07:download_file_method_fix

Conversation

@Rmaram07

@Rmaram07 Rmaram07 commented Dec 6, 2025 •

Copy link
Copy Markdown

Motivation and Context

Description

Contribution Checklist

@Rmaram07
Rmaram07 requested a review from a team as a code owner December 6, 2025 00:19
@Rmaram07

Rmaram07 commented Dec 6, 2025

Copy link
Copy Markdown
Author

Julio Carlos Menendez (@juliomenendez) Atif Aziz (@atifaziz) Dan Dascalescu (@dandv) Matt Kotsenas (@MattKotsenas) , can you approve this pull request and do a release ASAP? we are blocked from using download_file method from semantic kernel.

@Rmaram07

Rmaram07 commented Dec 6, 2025

Copy link
Copy Markdown
Author

Mark Wallace, can you help me with this?

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Add a regression test covering kernel discovery of download_file.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Adds kernel-function metadata to make download_file discoverable and resolve lookup failures.

Changes:

  • Registers download_file with @kernel_function.
  • Provides its public name and description.
File Description
python/​semantic_kernel/​core_plugins/​sessions_python_tool/​sessions_python_plugin.py Exposes download_file to kernel plugin discovery.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

f"List files failed with status code {e.response.status_code} and error: {error_message}"
) from e

@kernel_function(name="download_file", description="Downloads a file from the current Session ID")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review finding (blocking): Do not expose unrestricted local file writes as a kernel function

Adding @kernel_function makes download_file model-callable, including its local_file_path argument. _validate_local_path_for_download currently allows every destination when allowed_download_directories is None, which is the default, so an auto-invoked tool call can overwrite any local file writable by the process. Please make local downloads deny-by-default when a path is supplied, or expose only a safe buffer-returning function.

This branch had an error being deployed

1 failed deployment
github-app-auth — b3b6e3af Deployed Sep 28, 2026 by eavanvalkenburg via add_label #29080
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