Skip to content

Commit

Permalink
chore: switch from satori/go.uuid to google/uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
tankbusta committed Dec 14, 2021
1 parent f477337 commit fae293d
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ require (
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/uuid v1.3.0
github.com/gorilla/csrf v1.7.0
github.com/json-iterator/go v1.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/nightlyone/lockfile v0.0.0-20170804114028-6a197d5ea611
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/client_model v0.2.0
github.com/rs/zerolog v1.20.0
github.com/satori/go.uuid v0.0.0-20160713180306-0aa62d5ddceb
github.com/shirou/gopsutil v0.0.0-20170510024726-b6da2bd76e7d
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
github.com/stretchr/testify v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/csrf v1.7.0 h1:mMPjV5/3Zd460xCavIkppUdvnl5fPXMpv2uz2Zyg7/Y=
Expand Down Expand Up @@ -309,8 +311,6 @@ github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJ
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/satori/go.uuid v0.0.0-20160713180306-0aa62d5ddceb h1:1r/p6yT1FfHR1+qBm7UYBPgfqCmzz/8mpNvfc+iKlfU=
github.com/satori/go.uuid v0.0.0-20160713180306-0aa62d5ddceb/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil v0.0.0-20170510024726-b6da2bd76e7d h1:LeaIII7aaihsHubuUO2FQyEzU4q/1hrBo3AT+E5YBZk=
github.com/shirou/gopsutil v0.0.0-20170510024726-b6da2bd76e7d/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
Expand Down
4 changes: 2 additions & 2 deletions server/authentication/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/fireeye/gocrack/server/authentication"
"github.com/fireeye/gocrack/server/storage"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
ldap "gopkg.in/ldap.v2"
)

Expand Down Expand Up @@ -233,7 +233,7 @@ func (s *Backend) Login(username, password string) (*storage.User, error) {
Username: username,
IsSuperUser: isUserFirstAndShouldBeAdmin,
EmailAddress: props["mail"],
UserUUID: uuid.NewV4().String(),
UserUUID: uuid.NewString(),
Password: "user_is_ldap",
}

Expand Down
4 changes: 2 additions & 2 deletions server/filemanager/filemanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
fakestor "github.com/fireeye/gocrack/server/filemanager/test"
"github.com/fireeye/gocrack/server/storage"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -69,7 +69,7 @@ func TestSaveEngineFile(t *testing.T) {
assert.FailNow(t, "failed to create test file", err.Error())
}

uuidToCreate := uuid.NewV4().String()
uuidToCreate := uuid.NewString()
fresp, err := fm.SaveFile(testfile, "testing", uuidToCreate, storage.EngineFileDictionary)
if err != nil {
assert.FailNow(t, "failed to save test file", err.Error())
Expand Down
4 changes: 2 additions & 2 deletions server/filemanager/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/fireeye/gocrack/server/storage"

"github.com/google/uuid"
"github.com/rs/zerolog/log"
uuid "github.com/satori/go.uuid"
)

type extlookup map[string]storage.EngineFileType
Expand Down Expand Up @@ -48,7 +48,7 @@ func (s *Context) importDirectory() error {
Str("extension", extension).
Msg("Importing file")

fileUUID := uuid.NewV4().String()
fileUUID := uuid.NewString()
fd, err := os.Open(path)
if err != nil {
nonFatalError = err
Expand Down
4 changes: 2 additions & 2 deletions server/storage/bdb/audit_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

"github.com/fireeye/gocrack/server/storage"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)

func generateRandomAuditEntry(entID string, userID string) storage.ActivityLogEntry {
if userID == "" {
userID = uuid.NewV4().String()
userID = uuid.NewString()
}

return storage.ActivityLogEntry{
Expand Down
8 changes: 4 additions & 4 deletions server/storage/bdb/entitlement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import (

"github.com/fireeye/gocrack/server/storage"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)

func TestEntitlement(t *testing.T) {
db := initTest(t)
defer db.DestroyTest()

dummyUUID := uuid.NewV4().String()
dummyUUID := uuid.NewString()
taskFile := storage.TaskFile{
FileID: dummyUUID,
SavedAt: "/tmp/foobaz",
UploadedAt: time.Now(),
UploadedBy: "testing",
UploadedByUUID: uuid.NewV4().String(),
UploadedByUUID: uuid.NewString(),
}

txn, err := db.NewTaskFileTransaction()
Expand All @@ -36,7 +36,7 @@ func TestEntitlement(t *testing.T) {

// We don't actually need to save this record
dummyUserRec := storage.User{
UserUUID: uuid.NewV4().String(),
UserUUID: uuid.NewString(),
}

// User shouldnt be entitled to this document...yet
Expand Down
72 changes: 36 additions & 36 deletions server/storage/bdb/task_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/fireeye/gocrack/server/storage"
"github.com/fireeye/gocrack/shared"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)

Expand All @@ -21,9 +21,9 @@ var testUnexpectedValInGetNextTestCmp = "expected next task differs from what wa

func createTestJobDoc(t *testing.T, txn storage.CreateTaskTxn, userDoc *storage.User) (*storage.Task, error) {
doc := &storage.Task{
TaskID: uuid.NewV4().String(),
TaskID: uuid.NewString(),
TaskName: "My Awesome Task!",
FileID: uuid.NewV4().String(),
FileID: uuid.NewString(),
CreatedByUUID: userDoc.UserUUID,
}
return doc, txn.CreateTask(doc)
Expand Down Expand Up @@ -117,12 +117,12 @@ func TestTaskManagementGetNextTaskForHost(t *testing.T) {
{
Tasks: []storage.Task{
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
AssignedToHost: "my-hostname",
AssignedToDevices: &storage.CLDevices{4, 5},
Expand All @@ -139,12 +139,12 @@ func TestTaskManagementGetNextTaskForHost(t *testing.T) {
{
Tasks: []storage.Task{
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
AssignedToHost: "my-hostname",
AssignedToDevices: &storage.CLDevices{4, 5},
Expand All @@ -160,12 +160,12 @@ func TestTaskManagementGetNextTaskForHost(t *testing.T) {
{
Tasks: []storage.Task{
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
AssignedToDevices: &storage.CLDevices{4, 5},
},
Expand All @@ -180,21 +180,21 @@ func TestTaskManagementGetNextTaskForHost(t *testing.T) {
{
Tasks: []storage.Task{
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC().Add(-time.Duration(time.Hour * 4)),
},
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing2",
CaseCode: shared.GetStrPtr("CC-1338"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
},
},
Expand All @@ -208,12 +208,12 @@ func TestTaskManagementGetNextTaskForHost(t *testing.T) {
{
Tasks: []storage.Task{
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC().Add(-time.Duration(time.Hour * 4)),
Status: storage.TaskStatusFinished,
},
Expand All @@ -225,22 +225,22 @@ func TestTaskManagementGetNextTaskForHost(t *testing.T) {
{
Tasks: []storage.Task{
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedBy: "testing",
CreatedAt: time.Now().UTC().Add(-time.Duration(time.Hour * 4)),
Priority: storage.WorkerPriorityNormal,
},
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing2",
CaseCode: shared.GetStrPtr("CC-1338"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
Priority: storage.WorkerPriorityHigh,
},
Expand Down Expand Up @@ -304,26 +304,26 @@ func TestTaskManagementProperlyQueueingTasks(t *testing.T) {
db := initTest(t)
defer db.DestroyTest()

firstTaskID := uuid.NewV4().String()
firstTaskID := uuid.NewString()
tasks := []storage.Task{
{
FileID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: firstTaskID,
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
AssignedToHost: "my-hostname",
AssignedToDevices: &storage.CLDevices{4, 5},
},
{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing 2",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC().Add(1 * time.Minute),
AssignedToDevices: &storage.CLDevices{5},
},
Expand Down Expand Up @@ -367,12 +367,12 @@ func TestDeleteTask(t *testing.T) {
defer db.DestroyTest()

doc := storage.Task{
FileID: uuid.NewV4().String(),
TaskID: uuid.NewV4().String(),
FileID: uuid.NewString(),
TaskID: uuid.NewString(),
TaskName: "Testing",
CaseCode: shared.GetStrPtr("CC-1337"),
CreatedBy: "testing",
CreatedByUUID: uuid.NewV4().String(),
CreatedByUUID: uuid.NewString(),
CreatedAt: time.Now().UTC(),
AssignedToHost: "my-hostname",
AssignedToDevices: &storage.CLDevices{4, 5},
Expand Down
4 changes: 2 additions & 2 deletions server/storage/bdb/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/fireeye/gocrack/server/storage"

"github.com/asdine/storm"
"github.com/satori/go.uuid"
"github.com/google/uuid"
)

// SearchForUserByPassword locates the user record by username. If a record is found, the checker function will be called to validate the password.
Expand All @@ -27,7 +27,7 @@ func (s *BoltBackend) SearchForUserByPassword(username string, checker storage.P
func (s *BoltBackend) CreateUser(user *storage.User) (err error) {
user.CreatedAt = time.Now().UTC()
if user.UserUUID == "" {
user.UserUUID = uuid.NewV4().String()
user.UserUUID = uuid.NewString()
}

if err = s.db.From("users").Save(&boltUser{User: *user, DocVersion: curUserVer}); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions server/web/file_management_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/fireeye/gocrack/server/storage"

"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
)

type FileType storage.EngineFileType
Expand Down Expand Up @@ -86,7 +86,7 @@ func (s *Server) webUploadEngineFile(c *gin.Context) *WebAPIError {
sf := storage.EngineFile{
FileName: c.Param("filename"),
UploadedByUUID: claim.UserUUID,
FileID: uuid.NewV4().String(),
FileID: uuid.NewString(),
IsShared: isShared,
}

Expand Down
4 changes: 2 additions & 2 deletions server/web/file_management_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/fireeye/gocrack/server/storage"

"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
"github.com/tankbusta/hashvalidate"
)

Expand Down Expand Up @@ -111,7 +111,7 @@ func (s *Server) webUploadTaskFile(c *gin.Context) *WebAPIError {
FileName: c.Param("filename"),
UploadedAt: time.Now().UTC(),
UploadedByUUID: claim.UserUUID,
FileID: uuid.NewV4().String(),
FileID: uuid.NewString(),
}

engineTypeStr, _ := c.GetQuery("engine")
Expand Down
2 changes: 1 addition & 1 deletion server/web/middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/fireeye/gocrack/server/storage"

"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/gorilla/csrf"
"github.com/rs/zerolog/log"
uuid "github.com/satori/go.uuid"
)

// logAction records potentially sensitive actions to the database for auditing purposes
Expand Down
Loading

0 comments on commit fae293d

Please sign in to comment.