fix: persist task permissions in HistoryItem and add ReDoS mitigation#12338
Closed
roomote-v0[bot] wants to merge 1 commit into
Closed
fix: persist task permissions in HistoryItem and add ReDoS mitigation#12338roomote-v0[bot] wants to merge 1 commit into
roomote-v0[bot] wants to merge 1 commit into
Conversation
- Add taskPermissions field to historyItemSchema so permissions survive VS Code restarts - Pass taskPermissions through taskMetadata when saving task history - Restore permissions via toTaskPermissions() in createTaskWithHistoryItem - Add isSafeRegex() heuristic that detects nested quantifiers and excessive pattern length (ReDoS vectors) - Apply safety check in both Zod schema validation (parse time) and matchesAnyPattern() (runtime belt-and-suspenders) - Add 32 new tests covering isSafeRegex, schema rejection of unsafe patterns, runtime skipping, HistoryItem round-trip, and edge cases Addresses remaining considerations from PR #12337 review before merge.
2 tasks
Contributor
Author
|
Closing this PR as requested -- the persistence and ReDoS fixes are already included in #12337. |
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.
Related GitHub Issue
Addresses remaining considerations from PR #12337 (Phase 3b), linked to Issue #12330.
Description
This PR attempts to address the two remaining considerations raised in the PR #12337 review before merging:
taskPermissionsare now saved to disk as part of the task history, so they survive VS Code restarts.isSafeRegex()heuristic rejects patterns with nested quantifiers and excessive length at both parse time (Zod schema) and runtime (matchesAnyPattern).Feedback and guidance are welcome.
Changes
packages/types/src/task-permissions.tsisSafeRegex()heuristic, apply as Zod refinement and runtime guard inmatchesAnyPatternpackages/types/src/history.tstaskPermissionsfield tohistoryItemSchemasrc/core/task-persistence/taskMetadata.tstaskPermissionsin metadatasrc/core/task/Task.tstaskMetadata()on savesrc/core/webview/ClineProvider.tstoTaskPermissions()increateTaskWithHistoryItempackages/types/src/__tests__/task-permissions.spec.tsRecommendation
Both fixes should be included before merging PR #12337:
Test Procedure
packages/types(32 new + 21 existing)Pre-Submission Checklist
Interactively review PR in Roo Code Cloud