feat(delete): add --dry-run flag and safety guardrails#442
Open
ishaanxgupta wants to merge 1 commit intourunc-dev:mainfrom
Open
feat(delete): add --dry-run flag and safety guardrails#442ishaanxgupta wants to merge 1 commit intourunc-dev:mainfrom
ishaanxgupta wants to merge 1 commit intourunc-dev:mainfrom
Conversation
- Add --dry-run (-n) flag to preview deletions without executing - Implement containerID validation to prevent path traversal attacks - Add path safety validation before all delete operations - Create validateDeletionPath() to ensure paths stay within rootDir - Add critical system path denylist (/, /usr, /etc, etc.) - Implement DryRunDelete() method for safe preview - Validate bundleDir, rootfsDir, and BaseDir before deletion Security improvements: - Block path traversal sequences (..) in containerID - Prevent deletion of absolute paths outside expected roots - Refuse to delete critical system directories - Defense-in-depth with multiple validation layers Fixes: urunc-dev#423 Signed-off-by: hemang1404 <[email protected]> Co-authored-by: ishaanxgupta <[email protected]> Signed-off-by: hemang1404 <[email protected]>
✅ Deploy Preview for urunc canceled.
|
Contributor
|
Please do not open PRs for issues that have not be identified as such yet. |
Contributor
|
Duplicate with #436 |
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.
Description
This PR adds security hardening to the urunc delete command to prevent accidental deletion of host system paths and provides a dry-run mode for safe preview of operations.
1. Dry-Run Functionality
2. Path Traversal Protection
3. Path Safety Validation
Related issues
Fixes #423
How was this tested?
LLM usage
GitHub Copilot assisted with code implementation
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).collaborated with @hemang1404