-
Notifications
You must be signed in to change notification settings - Fork 1
feat(safe-outputs): add upload-artifact safe output #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot right now this will do nothing, in the end. We need to save the agent's provided file to the output_directory, and then retrieve it in the executor phase. This is a similar idea to create-pull-request tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restructured in fb479e5 to mirror the
create-pull-requeststaging pattern:Stage 1 (MCP,
mcp.rs) now:UploadArtifactParams.file_pathagainstbounding_directory(workspace root) and canonicalizes to guard against symlink escape.self.output_directoryunder a generated unique nameupload-artifact-<artifact_name>-<short-id>.<ext>(extension preserved for the Stage 3 allow-list check).UploadArtifactResult::new(artifact_name, file_path, staged_file, file_size)and writes the NDJSON record.Stage 3 (
upload_artifact.rs::execute_impl) now reads fromctx.working_directory.join(&self.staged_file)and re-canonicalizes (defense in depth), then runs the existing size / extension / name-allow-list /name-prefix/##vso[-injection / abs-path-charset checks before emitting##vso[artifact.upload artifactname=...]<staged-abs-path>.The result struct gained
staged_fileandfile_sizefields and an explicit::new()constructor (an internalUploadArtifactResultFieldsmirror keeps thetool_result!macro happy). Added 3 new executor tests (success, missing-file,##vso[-rejection) on top of the existing 16 — all 1034 tests + clippy pass.