Skip to content

Commit fb3f977

Browse files
authored
Deleted skip auto install parameter, changed allow partial results default value (#961)
* deleted skip auto install, changed allow partial results default * removed NewSecretsEmailDetails
1 parent 6474b96 commit fb3f977

File tree

5 files changed

+2
-61
lines changed

5 files changed

+2
-61
lines changed

scanpullrequest/scanpullrequest.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,6 @@ func scanPullRequest(repo *utils.Repository, client vcsclient.VcsClient) (err er
104104
return
105105
}
106106

107-
// Output results
108-
shouldSendExposedSecretsEmail := issues.SecretsIssuesExists() && repo.SmtpServer != ""
109-
if shouldSendExposedSecretsEmail {
110-
secretsEmailDetails := utils.NewSecretsEmailDetails(client, repo, append(issues.SecretsVulnerabilities, issues.SecretsViolations...))
111-
if err = utils.AlertSecretsExposed(secretsEmailDetails); err != nil {
112-
return
113-
}
114-
}
115-
116107
// Handle PR comments for scan output
117108
if err = utils.HandlePullRequestCommentsAfterScan(issues, resultContext, repo, client, int(pullRequestDetails.ID)); err != nil {
118109
return
@@ -184,7 +175,6 @@ func createBaseScanDetails(repoConfig *utils.Repository, client vcsclient.VcsCli
184175
SetResultsContext(repositoryCloneUrl, repoConfig.Watches, repoConfig.JFrogProjectKey, repoConfig.IncludeVulnerabilities, len(repoConfig.AllowedLicenses) > 0).
185176
SetFixableOnly(repoConfig.FixableOnly).
186177
SetConfigProfile(repoConfig.ConfigProfile).
187-
SetSkipAutoInstall(repoConfig.SkipAutoInstall).
188178
SetDisableJas(repoConfig.DisableJas).
189179
SetXscPRGitInfoContext(repoConfig.Project, client, repoConfig.PullRequestDetails).
190180
SetDiffScan(!repoConfig.IncludeAllVulnerabilities).

scanrepository/scanrepository.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ func (cfp *ScanRepositoryCmd) setCommandPrerequisites(repository *utils.Reposito
135135
SetResultsContext(repositoryCloneUrl, repository.Watches, repository.JFrogProjectKey, repository.IncludeVulnerabilities, len(repository.AllowedLicenses) > 0).
136136
SetFixableOnly(repository.FixableOnly).
137137
SetConfigProfile(repository.ConfigProfile).
138-
SetSkipAutoInstall(repository.SkipAutoInstall).
139138
SetAllowPartialResults(repository.AllowPartialResults).
140139
SetDisableJas(repository.DisableJas)
141140

utils/consts.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,9 @@ const (
7777
DisableJasEnv = "JF_DISABLE_ADVANCED_SECURITY"
7878
DetectionOnlyEnv = "JF_SKIP_AUTOFIX"
7979
AllowedLicensesEnv = "JF_ALLOWED_LICENSES"
80-
SkipAutoInstallEnv = "JF_SKIP_AUTO_INSTALL"
8180
AllowPartialResultsEnv = "JF_ALLOW_PARTIAL_RESULTS"
8281
WatchesDelimiter = ","
8382

84-
// Email related environment variables
85-
//#nosec G101 -- False positive - no hardcoded credentials.
86-
SmtpPasswordEnv = "JF_SMTP_PASSWORD"
87-
SmtpUserEnv = "JF_SMTP_USER"
88-
SmtpServerEnv = "JF_SMTP_SERVER"
89-
EmailReceiversEnv = "JF_EMAIL_RECEIVERS"
90-
9183
//#nosec G101 -- False positive - no hardcoded credentials.
9284
GitTokenEnv = "JF_GIT_TOKEN"
9385
GitBaseBranchEnv = "JF_GIT_BASE_BRANCH"

utils/params.go

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ type Scan struct {
170170
Projects []Project `yaml:"projects,omitempty"`
171171
EmailDetails `yaml:",inline"`
172172
ConfigProfile *services.ConfigProfile
173-
SkipAutoInstall bool
174173
AllowPartialResults bool
175174
}
176175

@@ -182,33 +181,6 @@ type EmailDetails struct {
182181
EmailReceivers []string `yaml:"emailReceivers,omitempty"`
183182
}
184183

185-
func (s *Scan) SetEmailDetails() error {
186-
smtpServerAndPort := getTrimmedEnv(SmtpServerEnv)
187-
if smtpServerAndPort == "" {
188-
return nil
189-
}
190-
splittedServerAndPort := strings.Split(smtpServerAndPort, ":")
191-
if len(splittedServerAndPort) < 2 {
192-
return fmt.Errorf("failed while setting your email details. Could not extract the smtp server and its port from the %s environment variable. Expected format: `smtp.server.com:port`, received: %s", SmtpServerEnv, smtpServerAndPort)
193-
}
194-
s.SmtpServer = splittedServerAndPort[0]
195-
s.SmtpPort = splittedServerAndPort[1]
196-
s.SmtpUser = getTrimmedEnv(SmtpUserEnv)
197-
s.SmtpPassword = getTrimmedEnv(SmtpPasswordEnv)
198-
if s.SmtpUser == "" {
199-
return fmt.Errorf("failed while setting your email details. SMTP username is expected, but the %s environment variable is empty", SmtpUserEnv)
200-
}
201-
if s.SmtpPassword == "" {
202-
return fmt.Errorf("failed while setting your email details. SMTP password is expected, but the %s environment variable is empty", SmtpPasswordEnv)
203-
}
204-
if len(s.EmailReceivers) == 0 {
205-
if emailReceiversEnv := getTrimmedEnv(EmailReceiversEnv); emailReceiversEnv != "" {
206-
s.EmailReceivers = strings.Split(emailReceiversEnv, ",")
207-
}
208-
}
209-
return nil
210-
}
211-
212184
func (s *Scan) setDefaultsIfNeeded() (err error) {
213185
e := &ErrMissingEnv{}
214186
if !s.IncludeAllVulnerabilities {
@@ -260,11 +232,6 @@ func (s *Scan) setDefaultsIfNeeded() (err error) {
260232
}
261233
s.MinSeverity = severity.String()
262234
}
263-
if !s.SkipAutoInstall {
264-
if s.SkipAutoInstall, err = getBoolEnv(SkipAutoInstallEnv, false); err != nil {
265-
return
266-
}
267-
}
268235
if len(s.Projects) == 0 {
269236
s.Projects = append(s.Projects, Project{})
270237
}
@@ -274,7 +241,7 @@ func (s *Scan) setDefaultsIfNeeded() (err error) {
274241
}
275242
}
276243
if !s.AllowPartialResults {
277-
if s.AllowPartialResults, err = getBoolEnv(AllowPartialResultsEnv, false); err != nil {
244+
if s.AllowPartialResults, err = getBoolEnv(AllowPartialResultsEnv, true); err != nil {
278245
return
279246
}
280247
}
@@ -283,7 +250,6 @@ func (s *Scan) setDefaultsIfNeeded() (err error) {
283250
return
284251
}
285252
}
286-
err = s.SetEmailDetails()
287253
return
288254
}
289255

utils/scandetails.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type ScanDetails struct {
2929
client vcsclient.VcsClient
3030
fixableOnly bool
3131
disableJas bool
32-
skipAutoInstall bool
3332
minSeverityFilter severityutils.Severity
3433
baseBranch string
3534
configProfile *clientservices.ConfigProfile
@@ -91,11 +90,6 @@ func (sc *ScanDetails) SetFixableOnly(fixable bool) *ScanDetails {
9190
return sc
9291
}
9392

94-
func (sc *ScanDetails) SetSkipAutoInstall(skipAutoInstall bool) *ScanDetails {
95-
sc.skipAutoInstall = skipAutoInstall
96-
return sc
97-
}
98-
9993
func (sc *ScanDetails) SetMinSeverity(minSeverity string) (*ScanDetails, error) {
10094
if minSeverity == "" {
10195
return sc, nil
@@ -170,7 +164,7 @@ func (sc *ScanDetails) RunInstallAndAudit(workDirs ...string) (auditResults *res
170164
SetInstallCommandName(sc.InstallCommandName).
171165
SetInstallCommandArgs(sc.InstallCommandArgs).
172166
SetTechnologies(sc.GetTechFromInstallCmdIfExists()).
173-
SetSkipAutoInstall(sc.skipAutoInstall).
167+
SetSkipAutoInstall(true).
174168
SetAllowPartialResults(sc.allowPartialResults).
175169
SetExclusions(sc.PathExclusions).
176170
SetUseJas(!sc.DisableJas()).

0 commit comments

Comments
 (0)