Repository navigation
fix: harden workspace output-path validation - #8423
Draft
Treicy Sanchez (Treicysg) wants to merge 6 commits into
Draft
Treicy Sanchez (Treicysg) wants to merge 6 commits into
Treicy Sanchez (Treicysg) wants to merge 6 commits into
Conversation
Contributor
|
Thanks for opening this pull request! Please link it to an issue by adding the fixes syntax to the pull request description, for example: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Remaining containment bypasses can allow cleanup to delete external files or workspace-root contents.
2 open findings
What changed in this PR
Hardens Kiota workspace output-path validation to protect files during generation cleanup.
Changes:
- Adds symbolic-link and junction containment checks.
- Revalidates output paths immediately before cleanup.
- Adds link-validation and external-file preservation tests.
| File | Description |
|---|---|
| tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs | Tests link containment and cleanup protection. |
| src/Kiota.Builder/WorkspaceManagement/BaseApiConsumerConfiguration.cs | Adds filesystem-aware output-path validation. |
| src/Kiota.Builder/KiotaBuilder.cs | Validates workspace output paths before deletion. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
83
to
+89
| if (config.CleanOutput && Directory.Exists(config.OutputPath)) | ||
| { | ||
| if (useKiotaConfig && !config.NoWorkspace) | ||
| { | ||
| var relativeOutput = Path.GetRelativePath(workspaceDirectory, Path.GetFullPath(config.OutputPath)); | ||
| BaseApiConsumerConfiguration.ValidateOutputPath(relativeOutput, workspaceDirectory); | ||
| } |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


No description provided.