Skip to content

Commit

Permalink
e2e:hotfix - Fixing problems on e2e and github files (#1084)
Browse files Browse the repository at this point in the history
Signed-off-by: Wilian Gabriel <wilian.silva@zup.com.br>
  • Loading branch information
wiliansilvazup authored Jun 19, 2022
1 parent 68a999b commit 8fb0125
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# GitHub code owners
# See https://github.com/blog/2392-introducing-code-owners
* @wiliansilvazup @matheusalcantarazup @lucasbrunozup @nathanmartinszup @iancardosozup @oliveirafelipezup
* @ZupIT/project-horus-sec-rw @ZupIT/project-horus-sec-admin @ZupIT/appsec-admin
5 changes: 5 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.17

- name: Download Examples repository
run: |
git clone https://github.com/ZupIT/horusec-examples-vulnerabilities.git ../horusec-examples-vulnerabilities
- name: coverage
run: make coverage
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ jobs:
with:
docker_buildx: false

- name: Download Examples repository
run: |
git clone https://github.com/ZupIT/horusec-examples-vulnerabilities.git ../horusec-examples-vulnerabilities
- name: test
run: make test
2 changes: 1 addition & 1 deletion e2e/analysis/test_case.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ func NewTestCase() []*TestCase {
testutil.StartFlagEnableGitHistory: "true",
testutil.StartFlagEnableCommitAuthor: "true",
testutil.StartFlagAnalysisTimeout: "10000",
testutil.StartFlagIgnore: "**/ruby/**, **/javascript/**, **/python/**, **/go/**",
testutil.StartFlagIgnore: "**/ruby/**, **/javascript/**, **/python/**, **/go/example*/**",
},
},
Expected: Expected{
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/language_detect/language_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (ld *LanguageDetect) checkDefaultPathsToIgnore(path string) bool {
}
}
if !ld.config.EnableGitHistoryAnalysis {
return strings.Contains(path, ".git")
return strings.Contains(path, ".git"+string(os.PathSeparator)) || strings.HasSuffix(path, ".git")
}
return false
}
Expand Down
21 changes: 21 additions & 0 deletions internal/controllers/language_detect/language_detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ func TestLanguageDetectIgnoreFiles(t *testing.T) {
assertTestLanguageDetectIgnoreFiles(t, cfg)
}

func TestLanguageDetectIgnoreFilesGithubFolder(t *testing.T) {
logger.LogSetOutput(io.Discard)

cfg := config.New()
cfg.EnableGitHistoryAnalysis = true
cfg.EnableCommitAuthor = true
cfg.FilesOrPathsToIgnore = []string{"**/leaks/**", "**/yaml/**"}
cfg.ProjectPath = filepath.Join(testutil.RootPath, "..", "horusec-examples-vulnerabilities")

analysisID := uuid.New()

ld := NewLanguageDetect(cfg, analysisID)

langs, err := ld.Detect(cfg.ProjectPath)
assert.Contains(t, langs, languages.Yaml)
assert.NoError(t, err)
assert.DirExists(t, filepath.Join(cfg.ProjectPath, ".horusec", analysisID.String(), ".git"))
assert.DirExists(t, filepath.Join(cfg.ProjectPath, ".horusec", analysisID.String(), ".github"))
assert.FileExists(t, filepath.Join(cfg.ProjectPath, ".horusec", analysisID.String(), ".github", "workflows", "license.yaml"))
}

func assertTestLanguageDetectIgnoreFiles(t *testing.T, cfg *config.Config) {
analysisID := uuid.New()

Expand Down
2 changes: 2 additions & 0 deletions internal/services/formatters/generic/deployments/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ RUN "$JAVA_HOME/bin/jlink" --compress=2 \

FROM python:3.10.4-alpine3.14

RUN apk add build-base

RUN pip install semgrep==v0.85.0

COPY --from=jlink /jlinked /opt/jdk/
Expand Down

0 comments on commit 8fb0125

Please sign in to comment.