Repository navigation
DXE-7228 commands: validate package command names before deriving output paths - #227
Merged
mgwoj merged 1 commit intoOct 9, 2026
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Address the ASCII validation issue and add coverage for pre-existing output symlink cleanup.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR validates package command names before deriving executable paths and removes pre-existing Go build outputs to mitigate path-control and symlink risks.
Changes:
- Adds centralized command-name validation.
- Applies validation during metadata loading, Go builds, and binary downloads.
- Adds malformed-metadata and output-path regressions.
- Removes existing Go build outputs before compilation.
Review findings:
pkg/tools/util.go:19(moderate, 1 vote): validate raw values against ASCII ranges before lowercasing.pkg/packages/golang.go:84(nit, 3 votes): add a regression covering removal of a pre-existing output symlink.
File summaries
| File | Summary |
|---|---|
pkg/tools/util.go |
Defines command-name normalization and validation. |
pkg/packages/golang.go |
Validates Go commands and removes existing outputs. |
pkg/packages/golang_test.go |
Tests malformed Go command names. |
pkg/commands/subcommands.go |
Validates metadata and binary output paths. |
pkg/commands/subcommands_test.go |
Tests malformed local, remote, and binary metadata. |
Review details
Suppressed comments (1)
pkg/tools/util.go:20
- The validation runs after Unicode lowercasing, so non-ASCII characters with an ASCII lowercase mapping (for example U+212A, the Kelvin sign) pass this supposedly ASCII identifier grammar and can collide with a distinct normalized name. Match the raw value against the ASCII ranges first, then lowercase it.
normalized := strings.ToLower(name)
if !commandNamePattern.MatchString(normalized) {
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+84
to
+88
| // A package repository controls its own contents. Remove a pre-existing | ||
| // output entry so go build cannot follow a symlink planted in that repo. | ||
| if err := os.Remove(outputPath); err != nil && !os.IsNotExist(err) { | ||
| return fmt.Errorf("remove existing Go build output %q: %w", outputPath, err) | ||
| } |
mgwoj
changed the base branch from
master
to
feature/DXE-7228-gh-pr-validate-package-command-names-before-writing-binaries
October 9, 2026 12:10
mgwoj
approved these changes
Oct 9, 2026
mgwoj
merged commit Oct 9, 2026
9145e31
into
akamai:feature/DXE-7228-gh-pr-validate-package-command-names-before-writing-binaries
1 check passed
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.
cli.jsoncommand names are normalized during package discovery, but werenot constrained to command identifiers before being incorporated into binary
output names.
Validate command names while reading package metadata, before installer
selection or dependency processing. Keep the same validation at the Go build
and binary download sinks so direct callers cannot reintroduce filesystem path
control.
Remove a pre-existing Go build output entry before invoking
go build. Thisprevents package contents from supplying a symlink at the expected output
location.
Add regressions for malformed local and remote metadata, the binary download
path, and the Go installation path.
Tests:
go test ./...