Skip to content

Commit 4422862

Browse files
Jake Claytonjakec-dev
authored andcommitted
chore: enhance security configurations
1 parent b109900 commit 4422862

File tree

9 files changed

+187
-22
lines changed

9 files changed

+187
-22
lines changed

.github/workflows/codeql.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
schedule:
9+
- cron: '31 7 * * 3'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'go' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
31+
with:
32+
languages: ${{ matrix.language }}
33+
34+
- name: Setup Go
35+
uses: actions/setup-go@6d5114b80faf1e90e980a273e2c95e1642c7dc55 # v5.2.0
36+
with:
37+
go-version-file: 'go.mod'
38+
39+
- name: Build
40+
run: make build
41+
42+
- name: Perform CodeQL Analysis
43+
uses: github/codeql-action/analyze@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
44+
with:
45+
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ jobs:
7373
# Upload the results to GitHub's code scanning dashboard (optional).
7474
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
7575
- name: "Upload to code-scanning"
76-
uses: github/codeql-action/upload-sarif@v3
76+
uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
7777
with:
7878
sarif_file: results.sarif

.github/workflows/workflow.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ on:
66
- develop
77
- master
88

9+
permissions: read-all
10+
911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
1214
strategy:
1315
matrix:
1416
go-version: ['1.24.3']
1517
steps:
16-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1719

1820
- name: Set up Go
19-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@6d5114b80faf1e90e980a273e2c95e1642c7dc55 # v5.2.0
2022
with:
2123
go-version: ${{ matrix.go-version }}
2224
cache: true
@@ -25,7 +27,7 @@ jobs:
2527
run: go version
2628

2729
- name: Set up golangci-lint
28-
uses: golangci/golangci-lint-action@v8
30+
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v8.0.0
2931
with:
3032
version: v2.1
3133

@@ -42,7 +44,7 @@ jobs:
4244
run: make build
4345

4446
- name: Upload coverage
45-
uses: actions/upload-artifact@v4
47+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
4648
with:
4749
name: coverage-${{ matrix.go-version }}
4850
path: coverage.html

.goreleaser.yaml renamed to .goreleaser.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ archives:
2929

3030
checksum:
3131
name_template: "{{ .ProjectName }}_checksums.txt"
32+
algorithm: sha256
33+
34+
sboms:
35+
- artifacts: archive
36+
id: sboms
3237

3338
changelog:
3439
sort: asc

.lefthook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ pre-commit:
77
stage_fixed: true
88
go-mod-tidy:
99
glob: "go.mod"
10-
run: go mod tidy && git add go.mod go.sum
10+
run: go mod tidy && git add go.mod go.sum
11+
gitleaks:
12+
run: gitleaks git --staged --no-banner --redact -v

CODEOWNERS

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This file defines code ownership for automatic review assignment
2+
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
3+
4+
# Global owners - these owners will be requested for review when someone opens a pull request
5+
* @jakec-dev
6+
7+
# Go source files
8+
*.go @jakec-dev
9+
10+
# GitHub Actions workflows
11+
.github/ @jakec-dev
12+
13+
# Documentation
14+
*.md @jakec-dev
15+
docs/ @jakec-dev
16+
17+
# Configuration files
18+
Makefile @jakec-dev
19+
go.mod @jakec-dev
20+
go.sum @jakec-dev
21+
.golangci.yml @jakec-dev
22+
.goreleaser.yml @jakec-dev

CONTRIBUTING.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ Thanks for your interest in contributing to **aws-local-sync**! This guide outli
44

55
## Prerequisites
66

7-
- Go 1.21 or later
7+
- Go 1.24.3 or later
88
- Make
9-
- [golangci-lint](https://golangci-lint.run/usage/install/) (for linting)
109

1110
## Development Setup
1211

@@ -17,12 +16,19 @@ Thanks for your interest in contributing to **aws-local-sync**! This guide outli
1716
cd aws-local-sync
1817
```
1918

20-
2. **Install Git hooks**
19+
2. **Install development tools**
2120

2221
```sh
23-
make hooks # Install pre-commit hooks via lefthook
22+
make install # Installs all required dev tools and dependencies
2423
```
2524

25+
This will install:
26+
- golangci-lint (code linting)
27+
- lefthook (git hooks)
28+
- gitleaks (secret scanning)
29+
- govulncheck (vulnerability scanning)
30+
- staticcheck (static analysis)
31+
2632
3. **Explore available commands**
2733

2834
```sh
@@ -66,7 +72,7 @@ This project uses [lefthook](https://github.com/evilmartians/lefthook) for Git h
6672

6773
### Useful Make Targets
6874

69-
- `make hooks` - Install Git hooks
75+
- `make install` - Install all dev tools and git hooks
7076
- `make hooks-run` - Manually run pre-commit checks
7177
- `make tidy` - Clean up dependencies and format code
7278
- `make clean` - Remove build artifacts

Makefile

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,31 @@ help: ## Show all available make targets with descriptions
3737
else if (/^## .*$$/) {printf "${CYAN}%s${RESET}\n", substr($$1,4)} \
3838
}' $(MAKEFILE_LIST)
3939

40+
# ==================================================================================== #
41+
# SETUP
42+
# ==================================================================================== #
43+
44+
.PHONY: install
45+
install: ## Install all development dependencies, tools, and git hooks
46+
@echo "Installing development tools..."
47+
@command -v golangci-lint >/dev/null 2>&1 || \
48+
(echo "→ Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
49+
@command -v lefthook >/dev/null 2>&1 || \
50+
(echo "→ Installing lefthook..." && go install github.com/evilmartians/lefthook@latest)
51+
@command -v gitleaks >/dev/null 2>&1 || \
52+
(echo "→ Installing gitleaks..." && go install github.com/zricethezav/gitleaks/v8@latest)
53+
@command -v govulncheck >/dev/null 2>&1 || \
54+
(echo "→ Installing govulncheck..." && go install golang.org/x/vuln/cmd/govulncheck@latest)
55+
@command -v staticcheck >/dev/null 2>&1 || \
56+
(echo "→ Installing staticcheck..." && go install honnef.co/go/tools/cmd/staticcheck@latest)
57+
@command -v go-licenses >/dev/null 2>&1 || \
58+
(echo "→ Installing go-licenses..." && go install github.com/google/go-licenses@latest)
59+
@echo "→ Installing git hooks..."
60+
@lefthook install
61+
@echo "→ Downloading Go dependencies..."
62+
@go mod download
63+
@echo "✓ All development tools and git hooks installed successfully!"
64+
4065
# ==================================================================================== #
4166
# QUALITY CONTROL
4267
# ==================================================================================== #
@@ -52,6 +77,8 @@ audit: test ## Run full audit: verify modules, scan for issues and vulnerabiliti
5277
go vet ./...
5378
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-U1000 ./...
5479
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
80+
@echo "→ Checking for unpinned dependencies..."
81+
@go list -m -json all | jq -r 'select(.Indirect != true) | select(.Main != true) | "\(.Path) \(.Version)"' || echo "No dependencies found"
5582

5683
.PHONY: test
5784
test: ## Run tests with race detection and generate coverage report (HTML + out)
@@ -62,6 +89,10 @@ test: ## Run tests with race detection and generate coverage report (HTML + out)
6289
upgradeable: ## Show all direct dependencies with available upgrades
6390
@go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all
6491

92+
.PHONY: licenses
93+
licenses: ## Check licenses of all dependencies
94+
@go-licenses report ./... 2>/dev/null || echo "No dependencies with licenses found"
95+
6596
# ==================================================================================== #
6697
# DEVELOPMENT
6798
# ==================================================================================== #
@@ -75,17 +106,6 @@ tidy: ## Clean up go.mod/go.sum and format all Go source files
75106
build: ## Build the Go binary with version, commit, and build time metadata
76107
go build -trimpath -ldflags $(LDFLAGS) -o ${BUILD_DIR}/${BINARY_NAME} ${MAIN_PACKAGE}
77108

78-
.PHONY: hooks
79-
hooks: ## Install git hooks via lefthook
80-
@command -v lefthook >/dev/null 2>&1 || \
81-
(echo "Installing lefthook..." && go install github.com/evilmartians/lefthook@latest)
82-
@lefthook install
83-
@echo "Git hooks installed successfully"
84-
85-
.PHONY: hooks-run
86-
hooks-run: ## Run pre-commit hooks manually on all files
87-
@lefthook run pre-commit
88-
89109
.PHONY: build-static
90110
build-static: ## Build a statically linked binary for release (CGO disabled)
91111
CGO_ENABLED=0 go build -trimpath -ldflags $(LDFLAGS) \
@@ -95,6 +115,10 @@ build-static: ## Build a statically linked binary for release (CGO disabled)
95115
run: build ## Build and run the compiled binary
96116
${BUILD_DIR}/${BINARY_NAME}
97117

118+
.PHONY: pre-commit
119+
pre-commit: ## Run pre-commit hooks manually on all files
120+
@lefthook run pre-commit
121+
98122
.PHONY: clean
99123
clean: ## Remove compiled binary, coverage reports, and other build artifacts
100124
go clean

SECURITY.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
We release patches for security vulnerabilities. Currently supported versions:
6+
7+
| Version | Supported |
8+
| ------- | ------------------ |
9+
| 0.x.x | :white_check_mark: |
10+
11+
## Reporting a Vulnerability
12+
13+
We take the security of aws-local-sync seriously. If you believe you have found a security vulnerability, please report it to us as described below.
14+
15+
### How to Report
16+
17+
Please report security vulnerabilities through GitHub's security advisory feature:
18+
19+
1. Go to the [Security tab](https://github.com/jakec-dev/aws-local-sync/security) of this repository
20+
2. Click on "Report a vulnerability"
21+
3. Fill out the form with details about the vulnerability
22+
23+
### What to Include
24+
25+
Please include the following information:
26+
27+
- Type of issue (e.g., buffer overflow, SQL injection, cross-site scripting, etc.)
28+
- Full paths of source file(s) related to the manifestation of the issue
29+
- The location of the affected source code (tag/branch/commit or direct URL)
30+
- Any special configuration required to reproduce the issue
31+
- Step-by-step instructions to reproduce the issue
32+
- Proof-of-concept or exploit code (if possible)
33+
- Impact of the issue, including how an attacker might exploit it
34+
35+
### Response Timeline
36+
37+
- We will acknowledge receipt of your vulnerability report within 48 hours
38+
- We will send a more detailed response within 5 business days indicating the next steps
39+
- We will keep you informed about the progress towards a fix and full announcement
40+
- We may ask for additional information or guidance during the process
41+
42+
## Security Best Practices
43+
44+
When using aws-local-sync:
45+
46+
1. **AWS Credentials**: Never commit AWS credentials to version control. Use environment variables or AWS credential files
47+
2. **IAM Permissions**: Follow the principle of least privilege when configuring IAM roles and policies
48+
3. **Dependencies**: Keep dependencies up to date using Dependabot alerts
49+
4. **Binary Verification**: Verify checksums of downloaded binaries when available
50+
51+
## Security Updates
52+
53+
Security updates will be released as patch versions and announced through:
54+
- GitHub Releases
55+
- Security Advisories on this repository
56+
57+
## Acknowledgments
58+
59+
We appreciate the security research community's efforts in helping keep aws-local-sync secure. Contributors who report valid security issues will be acknowledged in our release notes (unless they prefer to remain anonymous).

0 commit comments

Comments
 (0)