Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
refactor(defsec): Refactor defsec into components (#1460)
Browse files Browse the repository at this point in the history
* refactor(defsec): Remove trivy-policy components

* refactor(defsec): Remove trivy-aws components

* refactor(defsec): Remove trivy-iac components

* refactor: refactor defsec into components (#1461)

* refactor: remove defsec cmd

* fix linter issue

* refactor: restore tf context

* refactor: remove spec package

* refactor: remove rules pkg

* test: remove extrafs dep

* refactor: restore package for rego conversion

* refactor: remove formatters pkg

* chore: run go mod tidy

* chore: remove replacements of unused packages

* remove scripts

* remove setup-opa action

* remove adapter linter

* remove outdated-api-update workflow

* chore: cleanup Makefile and remove unnecessary workflows

* chore: run go mod tidy

* bump go version to 1.20

* bump golangci-lint version

* re-add pkg/scanners/options

* readd test/testutil

---------

Co-authored-by: Nikita Pivkin <nikita.pivkin@smartforce.io>
  • Loading branch information
simar7 and nikpivkin authored Oct 10, 2023
1 parent 78aed65 commit 82e20e4
Show file tree
Hide file tree
Showing 3,563 changed files with 12 additions and 199,112 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 0 additions & 13 deletions .github/actions/setup-opa/action.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/adapter-lint.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/outdated-api-update.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/release.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/test-bundle.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ jobs:
go-version-file: go.mod
cache: false

- name: Run non-localstack tests
if: matrix.os != 'ubuntu-latest'
run: make test-no-localstack
shell: bash
- name: Run full tests
if: matrix.os == 'ubuntu-latest'
run: make test
shell: bash
38 changes: 0 additions & 38 deletions .github/workflows/test-rego.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/verify-schema.yml

This file was deleted.

67 changes: 0 additions & 67 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
DYNAMIC_REGO_FOLDER=./rules/kubernetes/policies/dynamic

.PHONY: test
test:
go test -race ./...

.PHONY: test-no-localstack
test-no-localstack:
go test $$(go list ./... | grep -v internal/adapters/cloud/aws | awk -F'github.com/aquasecurity/defsec/' '{print "./"$$2}')

.PHONY: rego
rego: fmt-rego test-rego

.PHONY: schema
schema:
go run ./cmd/schema generate

.PHONY: fmt-rego
fmt-rego:
opa fmt -w rules/cloud/policies

.PHONY: test-rego
test-rego:
go test --run Test_AllRegoRules ./test

.PHONY: typos
typos:
which codespell || pip3 install codespell
Expand All @@ -37,49 +16,3 @@ fix-typos:
quality:
which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
golangci-lint run --timeout 3m --verbose

.PHONY: update-loader
update-loader:
python3 scripts/update_loader_rules.py
@goimports -w pkg/rules/rules.go

.PHONY: metadata_lint
metadata_lint:
go run ./cmd/lint

.PHONY: docs
docs:
go run ./cmd/avd_generator

.PHONY: docs-test
docs-test:
go test -v ./cmd/avd_generator/...

.PHONY: id
id:
@go run ./cmd/id

.PHONY: update-aws-deps
update-aws-deps:
@grep aws-sdk-go-v2 go.mod | grep -v '// indirect' | sed 's/^[\t\s]*//g' | sed 's/\s.*//g' | xargs go get
@go mod tidy

.PHONY: adapter-lint
adapter-lint:
go run ./cmd/adapter-lint/main.go ./internal/adapters/...
go run ./cmd/adapter-lint/main.go ./pkg/providers/...

.PHONY: outdated-api-updated
outdated-api-updated:
sed -i.bak "s|recommendedVersions :=.*|recommendedVersions := $(OUTDATE_API_DATA)|" $(DYNAMIC_REGO_FOLDER)/outdated_api.rego && rm $(DYNAMIC_REGO_FOLDER)/outdated_api.rego.bak

.PHONY: bundle
bundle:
./scripts/bundle.sh
cp bundle.tar.gz scripts/bundle.tar.gz
go run ./scripts/verify-bundle.go
rm scripts/bundle.tar.gz

.PHONY: build
build:
go build -o bin/defsec ./cmd/defsec

This file was deleted.

21 changes: 0 additions & 21 deletions avd_docs/aws/accessanalyzer/AVD-AWS-0175/docs.md

This file was deleted.

21 changes: 0 additions & 21 deletions avd_docs/aws/apigateway/AVD-AWS-0001/CloudFormation.md

This file was deleted.

30 changes: 0 additions & 30 deletions avd_docs/aws/apigateway/AVD-AWS-0001/Terraform.md

This file was deleted.

13 changes: 0 additions & 13 deletions avd_docs/aws/apigateway/AVD-AWS-0001/docs.md

This file was deleted.

30 changes: 0 additions & 30 deletions avd_docs/aws/apigateway/AVD-AWS-0002/Terraform.md

This file was deleted.

Loading

0 comments on commit 82e20e4

Please sign in to comment.