diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml index a2272fb8..d073a722 100644 --- a/.github/workflows/api-test.yml +++ b/.github/workflows/api-test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84cf2103..88182e2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -61,7 +61,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -101,7 +101,7 @@ jobs: os: [windows-2019, windows-2022, ubuntu-22.04, ubuntu-20.04] steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e224ad77..9f4f4da8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 27541062..13307d35 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/projectsSync.yaml b/.github/workflows/projectsSync.yaml index 2785444c..e8c261e5 100644 --- a/.github/workflows/projectsSync.yaml +++ b/.github/workflows/projectsSync.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b6569be..85b28c6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 6c7b26d8..fe83d053 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml index 30b95d93..79f10870 100644 --- a/.github/workflows/semantic.yml +++ b/.github/workflows/semantic.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index f36f6fa1..387827d1 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -15,7 +15,7 @@ jobs: security-events: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/go.mod b/go.mod index 84f67eb2..725a19a6 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/golang-migrate/migrate/v4 v4.18.1 github.com/gorilla/websocket v1.5.3 github.com/ilyakaznacheev/cleanenv v1.5.0 - github.com/jackc/pgx/v5 v5.7.0 + github.com/jackc/pgx/v5 v5.7.1 github.com/prometheus/client_golang v1.20.3 github.com/rs/zerolog v1.33.0 github.com/stretchr/testify v1.9.0 @@ -29,6 +29,7 @@ require ( require ( github.com/klauspost/compress v1.17.9 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + golang.org/x/mod v0.21.0 // indirect ) require ( @@ -54,7 +55,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/joho/godotenv v1.5.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -69,7 +70,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect - github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.14.0 + github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.15.0 github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -86,7 +87,7 @@ require ( golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.25.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect diff --git a/go.sum b/go.sum index fc6da928..b3cfdaae 100644 --- a/go.sum +++ b/go.sum @@ -106,10 +106,10 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.7.0 h1:FG6VLIdzvAPhnYqP14sQ2xhFLkiUQHCs6ySqO91kF4g= -github.com/jackc/pgx/v5 v5.7.0/go.mod h1:awP1KNnjylvpxHuHP63gzjhnGkI1iw+PMoIwvoleN/8= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs= +github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -167,8 +167,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.14.0 h1:jmQTwkHWocY4PMemtpxh4hnB87GNMXyESYmX83JqtFw= -github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.14.0/go.mod h1:LyY8fOvYBt5gawHYuivROR7EBySRuSR0u/k8QosnCeU= +github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.15.0 h1:ySOGxNA252aNikQvTr213aCgWQ3bouJhCLGjF+CNQt4= +github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.15.0/go.mod h1:LyY8fOvYBt5gawHYuivROR7EBySRuSR0u/k8QosnCeU= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= @@ -278,8 +278,8 @@ golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/internal/controller/http/v1/domains_test.go b/internal/controller/http/v1/domains_test.go index 951cd727..91d935c3 100644 --- a/internal/controller/http/v1/domains_test.go +++ b/internal/controller/http/v1/domains_test.go @@ -141,9 +141,9 @@ func TestDomainRoutes(t *testing.T) { expectedCode: http.StatusBadRequest, }, { - name: "insert domain validation - failed", + name: "insert domain validation - failed", method: http.MethodPost, - url: "/api/v1/admin/domains", + url: "/api/v1/admin/domains", mock: func(domain *MockDomainsFeature) { domain400Test := &dtov1.Domain{ProfileName: "p1", TenantID: "t1", DomainSuffix: "domain1.com", ProvisioningCert: "cert1", ProvisioningCertStorageFormat: "string1"} domain.EXPECT().Insert(context.Background(), domain400Test).Return(nil, domains.ErrDatabase) diff --git a/internal/entity/dto/v1/auditlog.go b/internal/entity/dto/v1/auditlog.go index b6e6a978..01716050 100644 --- a/internal/entity/dto/v1/auditlog.go +++ b/internal/entity/dto/v1/auditlog.go @@ -6,17 +6,3 @@ type AuditLog struct { TotalCount int `json:"totalCnt" binding:"required" example:"0"` Records []auditlog.AuditLogRecord `json:"records" binding:"required"` } - -// type AuditLogRecord struct { -// AuditAppID int `json:"AuditAppId" binding:"required" example:"0"` -// EventID int `json:"EventId" binding:"required" example:"0"` -// InitiatorType int `json:"InitiatorType" binding:"required" example:"0"` -// AuditApp string `json:"AuditApp" binding:"required" example:"MikeIsAmazing"` -// Event string `json:"Event" binding:"required" example:"MikeIsAmazing"` -// Initiator string `json:"Initiator" binding:"required" example:"MikeIsAmazing"` -// Time time.Time `json:"Time" binding:"required" example:"MikeIsAmazing"` -// MCLocationType int `json:"MCLocationType" binding:"required" example:"0"` -// NetAddress string `json:"NetAddress" binding:"required" example:"MikeIsAmazing"` -// Ex string `json:"Ex" binding:"required" example:"MikeIsAmazing"` -// ExStr string `json:"ExStr" binding:"required" example:"MikeIsAmazing"` -// } diff --git a/internal/entity/dto/v1/device.go b/internal/entity/dto/v1/device.go index 14348a1a..06f3dab2 100644 --- a/internal/entity/dto/v1/device.go +++ b/internal/entity/dto/v1/device.go @@ -18,7 +18,7 @@ type Device struct { LastSeen *time.Time `json:"lastSeen,omitempty"` LastDisconnected *time.Time `json:"lastDisconnected,omitempty"` DeviceInfo *DeviceInfo `json:"deviceInfo,omitempty"` - Username string `json:"username"` + Username string `json:"username" binding:"max=16"` Password string `json:"password"` UseTLS bool `json:"useTLS"` AllowSelfSigned bool `json:"allowSelfSigned"` diff --git a/internal/usecase/devices/connections_test.go b/internal/usecase/devices/connections_test.go index 5218f14d..2d53af1b 100644 --- a/internal/usecase/devices/connections_test.go +++ b/internal/usecase/devices/connections_test.go @@ -9,7 +9,7 @@ import ( gomock "go.uber.org/mock/gomock" "github.com/open-amt-cloud-toolkit/console/internal/entity" - "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1" + dtov1 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1" devices "github.com/open-amt-cloud-toolkit/console/internal/usecase/devices" "github.com/open-amt-cloud-toolkit/console/pkg/logger" ) diff --git a/internal/usecase/devices/info.go b/internal/usecase/devices/info.go index fd5b2012..75fa25fb 100644 --- a/internal/usecase/devices/info.go +++ b/internal/usecase/devices/info.go @@ -11,7 +11,7 @@ import ( dtov2 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v2" ) -func (uc *UseCase) GetVersion(c context.Context, guid string) (dtov1.Version, dtov2.Version, error) { +func (uc *UseCase) GetVersion(c context.Context, guid string) (v1 dtov1.Version, v2 dtov2.Version, err error) { item, err := uc.GetByID(c, guid, "") if err != nil { return dtov1.Version{}, dtov2.Version{}, err diff --git a/internal/usecase/devices/network.go b/internal/usecase/devices/network.go index e536767e..ebe3f273 100644 --- a/internal/usecase/devices/network.go +++ b/internal/usecase/devices/network.go @@ -3,7 +3,7 @@ package devices import ( "context" - "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1" + dtov1 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1" "github.com/open-amt-cloud-toolkit/console/internal/usecase/devices/wsman" ) diff --git a/internal/usecase/devices/network_test.go b/internal/usecase/devices/network_test.go index 38ae2eaf..24137cf0 100644 --- a/internal/usecase/devices/network_test.go +++ b/internal/usecase/devices/network_test.go @@ -12,7 +12,7 @@ import ( gomock "go.uber.org/mock/gomock" "github.com/open-amt-cloud-toolkit/console/internal/entity" - "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1" + dtov1 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1" devices "github.com/open-amt-cloud-toolkit/console/internal/usecase/devices" "github.com/open-amt-cloud-toolkit/console/internal/usecase/devices/wsman" "github.com/open-amt-cloud-toolkit/console/pkg/logger"