Skip to content

Commit

Permalink
scs: bugfix - att outdated chsharp sdk on horusec-engine-csharp (#1022)
Browse files Browse the repository at this point in the history
fixes #1021

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>
(cherry picked from commit 940debf)
  • Loading branch information
iancardosozup authored and nathanmartinszup committed Mar 10, 2022
1 parent 96fbcc8 commit ac6405a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/enums/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "github.com/ZupIT/horusec-devkit/pkg/enums/languages"
const (
DefaultRegistry = "docker.io"
C = "horuszup/horusec-c:v1.0.1"
Csharp = "horuszup/horusec-csharp:v1.1.0"
Csharp = "horuszup/horusec-csharp:v1.2.0"
Elixir = "horuszup/horusec-elixir:v1.1.0"
Generic = "horuszup/horusec-generic:v1.1.0"
Go = "horuszup/horusec-go:v1.2.1"
Expand Down
10 changes: 10 additions & 0 deletions internal/services/formatters/csharp/scs/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ var (

// ErrBuildProject occurs when SCS fail to build the dotnet project.
ErrBuildProject = errors.New("project failed to build. Fix the project issues and try again")

// ErrInvalidSDKOutput occurs when SCS try to use an old version of csharp SDK to analyze a project with the new One
ErrInvalidSDKOutput = errors.New("horusec-engine-csharp SDK is outdated, " +
"you can build your own and add to horusecCliCustomImages config" +
" or create a new issue on https://github.com/ZupIT/horusec/issues to maintainers update the image")
)

const (
BuildFailedOutput = "Msbuild failed when processing the file"
SolutionFileNotFound = "solution file not found"
solutionExt = ".sln"
invalidSDKOutput = "Could not execute because the application was not found or a " +
"compatible .NET SDK is not installed."
)

type Formatter struct {
Expand Down Expand Up @@ -209,6 +216,9 @@ func (f *Formatter) checkOutputErrors(output string) (string, error) {
if strings.Contains(output, SolutionFileNotFound) {
return output, ErrSolutionNotFound
}
if strings.Contains(output, invalidSDKOutput) {
return output, ErrInvalidSDKOutput
}

return output, nil
}

0 comments on commit ac6405a

Please # to comment.