Skip to content

fix: escape path in maven when user inputs a space #5346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

phgermanov
Copy link
Contributor

@phgermanov phgermanov commented May 7, 2025

Description

User reported issues when a maven path contains a space. This PR wraps such paths in single quotes.

Checklist

  • Tests
  • Documentation
  • Inner source library needs updating

@phgermanov phgermanov requested a review from a team as a code owner May 7, 2025 12:35
@@ -546,7 +546,7 @@ func addDetectArgs(args []string, config detectExecuteScanOptions, utils detectU
args = append(args, fmt.Sprintf("\"--detect.code.location.name=%v\"", codelocation))

if len(mavenArgs) > 0 && !checkIfArgumentIsInScanProperties(config, "detect.maven.build.command") {
args = append(args, fmt.Sprintf("\"--detect.maven.build.command=%v\"", strings.Join(mavenArgs, " ")))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant users escape the space in path?


func quoteMavenArgs(args []string) string {
// Quote any argument containing spaces to handle paths properly
quotedArgs := make([]string, len(args))
Copy link
Member

@manjunathSurendrakumar manjunathSurendrakumar May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work in all platforms and cases?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't own this step :)

Copy link

@phgermanov
Copy link
Contributor Author

/it

}

for _, test := range tt {
test := test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use of this directive?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants