Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(sast): fixed SAST tool warnings #62

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Exceptions are acceptable depending on the circumstances (critical bug fixes tha

### Fixed

- fixed SAST tool warnings
- fixed a typo in authentication method selection

## [2.14.0] - 2024-03-01
Expand Down
24 changes: 21 additions & 3 deletions cmd/autobump/git_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package main

import (
"crypto/rand"
"fmt"
"math/rand"
"math/big"
"testing"

"github.com/go-faker/faker/v4"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/go-git/go-git/v5/storage/memory"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -147,6 +149,10 @@ func TestGetLatestTag_Success(t *testing.T) {

// Commit the changes
_, err = wt.Commit(faker.Sentence(), &git.CommitOptions{
Author: &object.Signature{
Name: faker.Name(),
Email: faker.Email(),
},
All: true,
})
require.NoError(t, err)
Expand All @@ -155,8 +161,16 @@ func TestGetLatestTag_Success(t *testing.T) {
head, err := repo.Head()
require.NoError(t, err)

// Create a tag on the commit
testTag := fmt.Sprintf("%d.%d.%d", rand.Intn(10), rand.Intn(10), rand.Intn(10))
// Create a random tag on the commit
randMax := big.NewInt(10)
major, err := rand.Int(rand.Reader, randMax)
require.NoError(t, err)
minor, err := rand.Int(rand.Reader, randMax)
require.NoError(t, err)
patch, err := rand.Int(rand.Reader, randMax)
require.NoError(t, err)

testTag := fmt.Sprintf("%d.%d.%d", major, minor, patch)
_, err = repo.CreateTag(testTag, head.Hash(), nil)
require.NoError(t, err)

Expand Down Expand Up @@ -195,6 +209,10 @@ func TestGetLatestTag_NoTagsFound(t *testing.T) {

// Commit the changes
_, err = wt.Commit("initial commit", &git.CommitOptions{
Author: &object.Signature{
Name: faker.Name(),
Email: faker.Email(),
},
All: true,
})
require.NoError(t, err)
Expand Down
14 changes: 12 additions & 2 deletions horusec.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"horusecCliFalsePositiveHashes": [],
"horusecCliRiskAcceptHashes": []
"horusecCliFalsePositiveHashes": [
"e56f980ae1b2ef6b01c86f493be3cc5c374bdc550acdc5d1eb9d152419578b9d"
],
"horusecCliRiskAcceptHashes": [
"560ba363f658af6c83e47bb0109356868c073a9c0fed0e4f7c6b633bf7ce77b5",
"dfb23abce8d2f48ffecebf436cf7cee39387c5d90882f2788830d7dd4d6054cd",
"7b5c7b22ecf9ab317402793b0705e0a82f669bf7bc640e1d6fcbbcdef0f3102f",
"ddc0ef41bbeeb7556c55f7a0c64ee20d919ca2e380f7e85fa5374c58dc877e73",
"282e477e1f992ca495bf244a7eff533d539e6bbb2e93c1874cfb79c4ef9e8682",
"db01586a8bf00075b621deb2123ca082fc576afb5c0528fddf774a13cd6a42ca",
"391bfdf65c05a160475a7665846c3ae9f3068cadfddcf2a44bde034bb2038ee0"
]
}
Loading