Plan 32 — wsvalidate extract + config validate + snapshot hardening#80
Merged
Conversation
Move NormaliseWorkspace + invalidWorkspaceReason from internal/tui/addflow/ground.go into a new internal/wsvalidate package so addflow + initflow + cmd share a single source of truth for the trim/Clean/trailing-slash + IsAbs + ".." segment scan rules. Update absolute-path error to "absolute paths not allowed (no leading / or drive letter)" so Windows users (C:\foo) aren't misled by the prior "(no leading /)" wording. Plan 32 Phase A — closes Plan-29-cosmetic 3 + Plan-29-security-hardening 1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add two defence-in-depth rules to InvalidReason: 1. Reject backslash anywhere in the path. POSIX treats `\` as a legal literal in file names so "foo\bar" sneaks past IsAbs but is almost certainly a Windows-style separator the user typed by mistake — better to flag than silently accept. 2. Reject pure root. Inputs that Clean to "." (e.g. "", ".", "foo/..") would install at the project root, which is almost never intended. Add 4 negative tests (absolute, backslash, pure root, parent escape) + 2 positive (nested relative accepted, Normalise canonicalises) in new internal/wsvalidate/wsvalidate_test.go. Plan 32 Phase B — closes Plan-29-security-hardening 2 + 3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- conflicts_test.go: rename shortName→conflictsShortName, add Keep-vs-Backup tone assertion - ground_test.go: TestGround_AcceptsNestedRelative (positive companion) - vessel_test.go: TestVessel_AcceptsCleanRelative (positive companion)
LastStep
added a commit
that referenced
this pull request
Apr 25, 2026
PR #80 squash 99e9948 — wsvalidate extract, defence-in-depth, test strengthening, generate.go consolidations, snapshot test gaps, ProjectConfig.Validate + symlink-resistant write. 13 of 17 review items closed across Plan-29-cosmetic / Plan-29-test-gap / Plan-29-sec-hardening / Plan-31-cosmetic / Plan-31-test-gap / Plan-31-sec-hardening. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
LastStep
added a commit
that referenced
this pull request
May 4, 2026
) Windows lacks syscall.O_NOFOLLOW. Cross-compile to GOOS=windows fails since Plan 32 (#80). Split openSnapshotFile into platform files: unix variant keeps O_NOFOLLOW symlink defense; windows variant uses plain OpenFile. Unblocks v0.4.0 GoReleaser cross-compile (release run 25313754104 failed at undefined: syscall.O_NOFOLLOW).
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.
Summary
Plan 32 follow-up bundle from Plan 29 + Plan 31 review backlog — 6 commits, file-disjoint refactors and hardening.
20a8f76) — extractinternal/wsvalidate/package; migrateaddflow/ground.go+initflow/vessel.goto shared validator7c792c1) — reject backslash + pure-root inwsvalidate.InvalidReason(closes Plan-29-sec-hardening 2 + 3)053c6bc) — strengthenTestConflicts_ColorTonesDifferPerAction(Keep-vs-Backup), positive companions for vessel + ground (AcceptsCleanRelative,AcceptsNestedRelative), renameshortName→conflictsShortNamed7b6fde) — collapsehasAbility→slices.Contains; collapseagentsToSlice+requiredToSlice→compatToSlice12707d0) —TestWriteCatalogSnapshot_TrailingNewline+TestSerializeCatalog_VersionPassThrough42252b4) —ProjectConfig.Validate()chokepoint (wired intoLoad());O_NOFOLLOWsymlink-resistant write atWriteCatalogSnapshotTest plan
go vet ./...cleango test ./...all green (cached)TestWriteCatalogSnapshot_RefusesSymlinkexercises O_NOFOLLOWTestValidate_*covers required field, bad workspace, bad docs_path, all 9 forbidden shell metacharsorigin/main🤖 Generated with Claude Code