Skip to content

Commit 400b9fe

Browse files
committed
try to fix vulnerabilities
1 parent e2c7d4d commit 400b9fe

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

cli/docs/flags.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,11 @@ var commandFlags = map[string][]string{
219219
// Security Flag keys mapped to their corresponding components.Flag definition.
220220
var flagsMap = map[string]components.Flag{
221221
// Common commands flags
222-
ServerId: components.NewStringFlag(ServerId, "Server ID configured using the config command."),
223-
url: components.NewStringFlag(url, "JFrog URL."),
224-
xrayUrl: components.NewStringFlag(xrayUrl, "JFrog Xray URL."),
225-
user: components.NewStringFlag(user, "JFrog username."),
222+
ServerId: components.NewStringFlag(ServerId, "Server ID configured using the config command."),
223+
url: components.NewStringFlag(url, "JFrog URL."),
224+
xrayUrl: components.NewStringFlag(xrayUrl, "JFrog Xray URL."),
225+
user: components.NewStringFlag(user, "JFrog username."),
226+
// jfrog-ignore: not hardcoded credentials
226227
password: components.NewStringFlag(password, "JFrog password."),
227228
accessToken: components.NewStringFlag(accessToken, "JFrog access token."),
228229
Threads: components.NewStringFlag(Threads, "The number of parallel threads used to scan the source code project.", components.WithIntDefaultValue(cliutils.Threads)),
@@ -308,9 +309,10 @@ var flagsMap = map[string]components.Flag{
308309
SecretValidation: components.NewBoolFlag(SecretValidation, fmt.Sprintf("Selective scanners mode: Triggers token validation on found secrets. Relevant only with --%s flag.", Secrets)),
309310

310311
// Git flags
311-
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.."),
312-
ScmType: components.NewStringFlag(ScmType, fmt.Sprintf("SCM type. Possible values are: %s.", contributors.NewScmType().GetValidScmTypeString()), components.SetMandatory()),
313-
ScmApiUrl: components.NewStringFlag(ScmApiUrl, "SCM API URL. For example: 'https://api.github.com'.", components.SetMandatory()),
312+
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.."),
313+
ScmType: components.NewStringFlag(ScmType, fmt.Sprintf("SCM type. Possible values are: %s.", contributors.NewScmType().GetValidScmTypeString()), components.SetMandatory()),
314+
ScmApiUrl: components.NewStringFlag(ScmApiUrl, "SCM API URL. For example: 'https://api.github.com'.", components.SetMandatory()),
315+
// jfrog-ignore: not hardcoded credentials
314316
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()),
315317
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()),
316318
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,10 @@ func getDockerfileLocationIfExists(run *sarif.Run) string {
983983
}
984984
if workspace := os.Getenv(utils.CurrentGithubWorkflowWorkspaceEnvVar); workspace != "" {
985985
if exists, err := fileutils.IsFileExists(filepath.Join(workspace, "Dockerfile"), false); err == nil && exists {
986-
return filepath.Join(workspace, "Dockerfile")
986+
// Validate file path to prevent directory traversal
987+
if !strings.Contains(workspace, "..") {
988+
return filepath.Join(workspace, "Dockerfile")
989+
}
987990
}
988991
}
989992
return ""

0 commit comments

Comments
 (0)