Skip to content

Conversation

@ausbru87
Copy link
Contributor

Closes #123

Adds automated security scanning to improve supply chain security for air-gapped deployments:

Changes

  • CodeQL: Daily Go code vulnerability scanning
  • Trivy: Filesystem and Docker image scanning for dependencies
  • OpenSSF Scorecard: Weekly security best practices assessment
  • Enhanced Dependabot: Commit prefixes and patch update filtering

All scan results are uploaded to GitHub Security tab for centralized monitoring.

Testing

  • Workflows will run on this PR to validate configuration
  • Docker image scan will run once images are published

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

- Scan LOW,MEDIUM,HIGH,CRITICAL instead of only HIGH,CRITICAL
- Remove Docker image scan (no :latest tag exists)
Enable vuln, secret, and misconfig scanners explicitly
- Build Go binary for linux/amd64
- Build Docker image with buildx
- Scan the built image (not filesystem)
- Matches coder/coder scanning approach
- Add table format scan to show results in workflow logs
- Upload SARIF as artifact for manual inspection
- Matches coder/coder artifact upload pattern
@ausbru87 ausbru87 requested a review from Copilot October 12, 2025 05:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive automated security scanning workflows to improve supply chain security for air-gapped deployments. The changes include CodeQL vulnerability scanning, Trivy image scanning, OpenSSF Scorecard security assessment, and enhanced Dependabot configuration.

  • Automated daily security scanning with CodeQL and Trivy
  • Weekly OpenSSF Scorecard security best practices assessment
  • Enhanced Dependabot with commit prefixes and patch update filtering

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
CHANGELOG.md Documents the addition of security scanning workflows and Dependabot enhancements
.github/workflows/security.yaml Main security workflow with CodeQL and Trivy scanning jobs
.github/workflows/scorecard.yml OpenSSF Scorecard workflow for security best practices assessment
.github/dependabot.yaml Enhanced configuration with commit prefixes and patch update filtering

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ausbru87 ausbru87 self-assigned this Oct 12, 2025
@ausbru87 ausbru87 marked this pull request as ready for review October 12, 2025 05:13
@ausbru87 ausbru87 removed the request for review from jdomeracki-coder October 14, 2025 03:27
Makefile Outdated

TAG=$(shell git describe --always)

build/linux/amd64:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build/linux/amd64:
bin/coder-marketplace-linux-amd64:

You can keep the PHONY (after editing the target name) for simplicity's sake though, otherwise you'll need to specify every Go-related file as a dependency

Copy link
Contributor Author

@ausbru87 ausbru87 Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to leave PHONY or to use a pattern like one of the following to ensure Make can still optimize by not building if no Go files change?

bin/code-marketplace-linux-amd64: $(wildcard **/*.go) go.mod go.sum

If you think leaving PHONY is simpler and cleaner then I am open just like using Make to optimize builds even in small repos like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to do it you'll probably have to use shell find cuz I don't think make's wildcard is very good. But it's probably fine to just leave it as PHONY for this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use shell find

@deansheather
Copy link
Member

@code-asher could you give this a review and flag anything that's weird for you? I haven't contributed to this repo before so maybe I'm missing something in my reviews

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thank you!

scorecard.yml:24: actions/checkout → v5.0.0
scorecard.yml:29: ossf/scorecard-action → v2.4.3
security.yaml:32: actions/checkout → v5.0.0 (CodeQL job)
security.yaml:57: actions/checkout → v5.0.0 (Trivy job)
security.yaml:81: aquasecurity/trivy-action → v0.33.1
security.yaml:88: aquasecurity/trivy-action → v0.33.1
removed PHONY alias
added wildcard for .go files
updated security workflow to use explicit build target vs old alias
removed patch ignore and instead we are grouping all-dependencies updates weekly
Makefile Outdated

build/linux/amd64:
# Individual build targets for each OS/arch combination
bin/code-marketplace-mac-amd64: $(wildcard **/*.go) go.mod go.sum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does wildcard **/*.go work? I can't find any example of this online, seems like people do a lot of workarounds for this.

In coder/coder we define a variable with the result of a $(shell find ...) command

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use shell find

Makefile Outdated
build/linux/amd64:
# Individual build targets for each OS/arch combination
bin/code-marketplace-mac-amd64: $(wildcard **/*.go) go.mod go.sum
mkdir -p bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could maybe just put a $(shell mkdir -p bin) at the top of the file (not in a target) to avoid having to duplicate it in every target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this out of the build targets. good idea to reduce duplication.

Makefile Outdated
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-linux-arm64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-amd64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-arm64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o $@ ./cmd/marketplace/main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible would be nice to make the recurring flags here a make variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added LDFLAGS variable.

README.md Outdated
Comment on lines 16 to 44
## Development

### Requirements

- Go 1.21 or later
- GNU Make 4.3 or later (for recursive glob support in build targets)

### Building from source

Build all platform binaries:

```console
make build
```

Build a specific platform:

```console
make bin/code-marketplace-linux-amd64
```

Available targets:
- `bin/code-marketplace-mac-amd64`
- `bin/code-marketplace-mac-arm64`
- `bin/code-marketplace-linux-amd64`
- `bin/code-marketplace-linux-arm64`
- `bin/code-marketplace-windows-amd64`
- `bin/code-marketplace-windows-arm64`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new build targets 👌

This should probably go in CONTRIBUTING.md instead since we put all development docs in there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new targets and other info identified under ##Development has been moved to CONTRIBUTING.md

…IBUTING.md

- Use $(shell find) instead of wildcard for Go files (deansheather)
- Extract mkdir -p bin to top-level (deansheather)
- Create LDFLAGS variable for build flags (deansheather)
- Move Development section from README.md to CONTRIBUTING.md (code-asher)
Makefile Outdated
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-amd64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-arm64 ./cmd/marketplace/main.go
# Individual build targets for each OS/arch combination
bin/code-marketplace-mac-amd64: $(GO_SRC) go.mod go.sum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mac targets should be called darwin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you update your contributing.md section too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swapped all mentions of mac -> darwin

Makefile Outdated
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-arm64 ./cmd/marketplace/main.go
# Individual build targets for each OS/arch combination
bin/code-marketplace-mac-amd64: $(GO_SRC) go.mod go.sum
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o $@ ./cmd/marketplace/main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o $@ ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o "$@" ./cmd/marketplace/main.go

On all of them :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added "" to all build commands

@ausbru87 ausbru87 merged commit 01e9fc7 into main Dec 10, 2025
5 checks passed
@ausbru87 ausbru87 deleted the 123-add-security-scanning branch December 10, 2025 01:19
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automated security scanning (CodeQL, Trivy, OpenSSF Scorecard)

3 participants