Skip to content

Commit 709def8

Browse files
committed
fix vulnerabilities
1 parent 400b9fe commit 709def8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

cli/docs/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var flagsMap = map[string]components.Flag{
223223
url: components.NewStringFlag(url, "JFrog URL."),
224224
xrayUrl: components.NewStringFlag(xrayUrl, "JFrog Xray URL."),
225225
user: components.NewStringFlag(user, "JFrog username."),
226-
// jfrog-ignore: not hardcoded credentials
226+
// jfrog-ignore: false positive, not hardcoded credentials
227227
password: components.NewStringFlag(password, "JFrog password."),
228228
accessToken: components.NewStringFlag(accessToken, "JFrog access token."),
229229
Threads: components.NewStringFlag(Threads, "The number of parallel threads used to scan the source code project.", components.WithIntDefaultValue(cliutils.Threads)),
@@ -312,7 +312,7 @@ var flagsMap = map[string]components.Flag{
312312
InputFile: components.NewStringFlag(InputFile, "Path to an input file in YAML format contains multiple git providers. With this option, all other scm flags will be ignored and only git servers mentioned in the file will be examined.."),
313313
ScmType: components.NewStringFlag(ScmType, fmt.Sprintf("SCM type. Possible values are: %s.", contributors.NewScmType().GetValidScmTypeString()), components.SetMandatory()),
314314
ScmApiUrl: components.NewStringFlag(ScmApiUrl, "SCM API URL. For example: 'https://api.github.com'.", components.SetMandatory()),
315-
// jfrog-ignore: not hardcoded credentials
315+
// jfrog-ignore: false positive, not hardcoded credentials
316316
Token: components.NewStringFlag(Token, fmt.Sprintf("SCM API token. In the absence of a flag, tokens should be passed in the %s environment variable, or in the corresponding environment variables '%s'.", contributors.GenericGitTokenEnvVar, contributors.NewScmType().GetOptionalScmTypeTokenEnvVars()), components.SetMandatory()),
317317
Owner: components.NewStringFlag(Owner, "The format of the owner key depends on the Git provider: On GitHub and GitLab, the owner is typically an individual or an organization, On Bitbucket, the owner can also be a project. In the case of a private instance on Bitbucket, the individual or organization name should be prefixed with '~'.", components.SetMandatory()),
318318
RepoName: components.NewStringFlag(RepoName, "List of semicolon-separated(;) repositories names to analyze, If not provided all repositories related to the provided owner will be analyzed."),

utils/results/conversion/sarifparser/sarifparser.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -981,12 +981,10 @@ func getDockerfileLocationIfExists(run *sarif.Run) string {
981981
return location
982982
}
983983
}
984-
if workspace := os.Getenv(utils.CurrentGithubWorkflowWorkspaceEnvVar); workspace != "" {
984+
// Validate file path to prevent directory traversal
985+
if workspace := os.Getenv(utils.CurrentGithubWorkflowWorkspaceEnvVar); workspace != "" && !strings.Contains(workspace, "..") {
985986
if exists, err := fileutils.IsFileExists(filepath.Join(workspace, "Dockerfile"), false); err == nil && exists {
986-
// Validate file path to prevent directory traversal
987-
if !strings.Contains(workspace, "..") {
988-
return filepath.Join(workspace, "Dockerfile")
989-
}
987+
return filepath.Join(workspace, "Dockerfile")
990988
}
991989
}
992990
return ""
@@ -996,7 +994,8 @@ func getGithubWorkflowsDirIfExists() string {
996994
if exists, err := fileutils.IsDirExists(GithubBaseWorkflowDir, false); err == nil && exists {
997995
return GithubBaseWorkflowDir
998996
}
999-
if workspace := os.Getenv(utils.CurrentGithubWorkflowWorkspaceEnvVar); workspace != "" {
997+
// Validate file path to prevent directory traversal
998+
if workspace := os.Getenv(utils.CurrentGithubWorkflowWorkspaceEnvVar); workspace != "" && !strings.Contains(workspace, "..") {
1000999
if exists, err := fileutils.IsDirExists(filepath.Join(workspace, GithubBaseWorkflowDir), false); err == nil && exists {
10011000
return filepath.Join(workspace, GithubBaseWorkflowDir)
10021001
}

0 commit comments

Comments
 (0)