|
18 | 18 | test: |
19 | 19 | go test -v ./... |
20 | 20 |
|
| 21 | +# Run the TOTP test (requires TEST_TOTP_SECRET environment variable) |
| 22 | +test-totp: |
| 23 | + @if [ -z "$$TEST_TOTP_SECRET" ]; then \ |
| 24 | + echo "Error: TEST_TOTP_SECRET environment variable is required"; \ |
| 25 | + echo "Set it with: export TEST_TOTP_SECRET=your_secret_here"; \ |
| 26 | + echo "Or run: ./run_test_secret.sh"; \ |
| 27 | + exit 1; \ |
| 28 | + fi |
| 29 | + go run test_specific_secret.go |
| 30 | + |
21 | 31 | # Clean build artifacts and temporary files |
22 | 32 | clean: |
23 | 33 | rm -rf bin/ |
|
41 | 51 | lint: |
42 | 52 | golangci-lint run |
43 | 53 |
|
| 54 | +# Install security scanning tools |
| 55 | +install-security-tools: |
| 56 | + go install github.com/securego/gosec/v2/cmd/gosec@latest |
| 57 | + go install github.com/sonatype-nexus-community/nancy@latest |
| 58 | + |
| 59 | +# Run security scan with gosec |
| 60 | +security-scan: |
| 61 | + gosec -conf .gosec.json ./... |
| 62 | + |
| 63 | +# Run vulnerability scan with nancy |
| 64 | +vulnerability-scan: |
| 65 | + go list -json -deps ./... | nancy sleuth |
| 66 | + |
| 67 | +# Run all security checks |
| 68 | +security: security-scan vulnerability-scan |
| 69 | + |
44 | 70 | # Build for production |
45 | 71 | build-prod: |
46 | 72 | CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/api ./cmd/api |
@@ -82,11 +108,16 @@ help: |
82 | 108 | @echo " run - Run the application" |
83 | 109 | @echo " dev - Run with hot reload (Air)" |
84 | 110 | @echo " test - Run tests" |
| 111 | + @echo " test-totp - Run TOTP test (requires TEST_TOTP_SECRET env var)" |
85 | 112 | @echo " clean - Clean build artifacts" |
86 | 113 | @echo " install-air - Install Air for hot reloading" |
87 | 114 | @echo " setup - Setup development environment" |
88 | 115 | @echo " fmt - Format code" |
89 | 116 | @echo " lint - Run linter" |
| 117 | + @echo " install-security-tools - Install gosec and nancy security scanners" |
| 118 | + @echo " security-scan - Run gosec security scanner" |
| 119 | + @echo " vulnerability-scan - Run nancy vulnerability scanner" |
| 120 | + @echo " security - Run all security checks" |
90 | 121 | @echo " build-prod - Build for production" |
91 | 122 | @echo " docker-dev - Run development environment with Docker" |
92 | 123 | @echo " docker-compose-build - Build Docker images using docker-compose" |
|
0 commit comments