Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
176e818
use pkg.go.dev for documentation
willnorris Jan 26, 2020
c2dd079
update github actions config
willnorris Jan 26, 2020
3bdd0fe
actions: always test with latest go version
willnorris Jan 26, 2020
ef09c1b
add support for multiple signature keys (#209)
maurociancio Feb 2, 2020
403735c
no need to export signatureKeyList type
willnorris Feb 2, 2020
dec2089
docker: use latest go1.13.x
willnorris Feb 2, 2020
edd9dba
allow space-separated list of signature keys
willnorris Feb 2, 2020
8c28dca
include referer header in remote requests
willnorris Feb 21, 2020
2eb6dfc
remove my personal config from example systemd file
willnorris Feb 24, 2020
8484518
add basic prometheus support
benhaan Nov 10, 2017
4e97a7e
make 'cached' a bool
willnorris Feb 24, 2020
7f91379
rename prometheus metrics and vars
willnorris Feb 24, 2020
00652fd
Added signed options example into the documentation.
skunkworker Jan 13, 2020
3589510
use gorilla/mux for routing requests
willnorris Apr 2, 2020
72ba50b
docs: update changelog in preparation for v0.10.0
willnorris Apr 3, 2020
65aeb78
actions: publish docker images on new git tags
willnorris Apr 4, 2020
8d8c59a
bump go version
willnorris Apr 4, 2020
7de7100
actions: set timeout for uploading to codecov
willnorris Apr 4, 2020
3c7d08f
Fix dockerhub link
ThomWright May 5, 2020
f91e9cb
Allow allowing/blocks hosts by IP range (#236)
blakestoddard Jun 20, 2020
0da684b
Switch to Hostname() for checking whether a host is allowed or not (#…
blakestoddard Jun 21, 2020
bfb3289
update default branch to master
willnorris Jun 21, 2020
5600290
simplify shields.io URL
willnorris Jun 23, 2020
fc79b85
fix go lint warnings
willnorris Jun 20, 2020
0008657
dockerfile: change deprecated maintainer syntax
willnorris Sep 9, 2020
d6e0ad0
update go dependencies
willnorris Sep 9, 2020
9f2d0f0
add github action for golangci
willnorris Sep 10, 2020
7e21abe
remove ineffective break statement
willnorris Sep 10, 2020
84ae42b
golangci: enable additional checks
willnorris Sep 10, 2020
80c7cb2
remove unecessary gitignore
willnorris Sep 10, 2020
067500c
add more golangci-lint checks
willnorris Sep 10, 2020
6126c92
cleanup unused module entries
willnorris Sep 10, 2020
32a8bea
switch to supported version of redigo package
willnorris Sep 10, 2020
52f4360
Add option to disable following redirects (#237)
blakestoddard Sep 10, 2020
fd43ff2
Support proxying images with no provided intermediate cert (#241)
blakestoddard Sep 10, 2020
66c549e
Setup GitHub Action for code scanning (#247)
willnorris Sep 16, 2020
c6206ea
Set a strict Content-Security-Policy
blakestoddard Oct 16, 2020
c08b3c5
Disable browser MIME confusion attacks via content-type sniffing
blakestoddard Oct 16, 2020
31e8faa
codecov token not required for public repos
willnorris Jan 13, 2021
7c98d50
Create Dependabot config file
dependabot-preview[bot] Jan 13, 2021
2afbc71
Bump cloud.google.com/go/storage from 1.11.0 to 1.12.0
dependabot[bot] Jan 13, 2021
c2e0ac1
Bump github.com/aws/aws-sdk-go from 1.34.20 to 1.36.26
dependabot[bot] Jan 13, 2021
2d53435
Bump github.com/prometheus/client_golang from 1.7.1 to 1.9.0
dependabot[bot] Jan 14, 2021
dd798db
dependabot: move to weekly updates
willnorris Jan 20, 2021
2203979
Add X-XSS-Protection HTTP response header to block potential XSS
yassineaboukir Jan 22, 2021
5bb3254
updated heroku instructons / added eb instructions
atestu Jan 22, 2021
3999c5b
run goimports
willnorris Jan 24, 2021
e72ae6f
go get -u ./...
willnorris Feb 11, 2021
f41a60b
actions: update which go versions we test with
willnorris Feb 11, 2021
bb65766
actions: only update test coverage on recent go version
willnorris Feb 11, 2021
87f0c62
actions: bump to actions/cache@v2
willnorris Feb 11, 2021
c34c3dd
readme: add statement about supported go versions
willnorris Feb 11, 2021
e307e61
bump go version in Dockerfile and tests for go1.16
willnorris Feb 18, 2021
762e5cf
actions: print go version being used
willnorris Feb 18, 2021
b328d1a
dependabot: back off to monthly
willnorris Feb 18, 2021
3a30ba7
Bump github.com/aws/aws-sdk-go from 1.37.8 to 1.37.10
dependabot[bot] Feb 15, 2021
7ba3f12
cleanup license headers and contributing docs
willnorris Mar 10, 2021
2d76bb1
Bump github.com/fcjr/aia-transport-go from 1.2.1 to 1.2.2
dependabot[bot] Feb 18, 2021
4bee838
Bump cloud.google.com/go/storage from 1.13.0 to 1.15.0
dependabot[bot] May 1, 2021
7cfc99c
Bump github.com/aws/aws-sdk-go from 1.37.10 to 1.38.51
dependabot[bot] Jun 1, 2021
85f1fd1
Bump github.com/aws/aws-sdk-go from 1.38.51 to 1.38.64
dependabot[bot] Jun 20, 2021
95bcf70
modules: update prometheus and tidy (#294)
willnorris Jun 20, 2021
09d247c
go.mod: update indirect dependencies
willnorris Jun 23, 2021
bbb026e
Bump cloud.google.com/go/storage from 1.15.0 to 1.16.1
dependabot[bot] Sep 1, 2021
5f85069
Bump github.com/aws/aws-sdk-go from 1.38.64 to 1.40.42 (#306)
dependabot[bot] Sep 14, 2021
66818a7
change envy package to avoid replace directive
willnorris Oct 13, 2021
e5da3b9
bump docker build to go1.17, and actions to latest
willnorris Oct 13, 2021
7aacb8b
actions: update docker workflow
willnorris Oct 13, 2021
d9b179c
docker: remove envy go.mod file
willnorris Oct 13, 2021
3dd327f
actions: combine docker workflows
willnorris Oct 13, 2021
851396b
actions: switch to publish docker image to github packages
willnorris Oct 13, 2021
3f2e270
docs: update install instructions for both go and docker
willnorris Oct 13, 2021
2174b95
docs: point out env var config option for docker
willnorris Oct 13, 2021
77e26e4
ci: add explicit permissions to codeql config
willnorris Oct 13, 2021
49c4bb8
build(deps): bump github.com/aws/aws-sdk-go from 1.40.42 to 1.41.12
dependabot[bot] Oct 27, 2021
006b99f
build(deps): bump cloud.google.com/go/storage from 1.16.1 to 1.18.2
dependabot[bot] Oct 27, 2021
d94e561
Add support for passing headers to remote server
Nov 4, 2021
0f2deb1
remove behavior of copyHeaders to copy all headers
willnorris Nov 5, 2021
a4d659d
style: remove unnecessary type declaration
willnorris Nov 5, 2021
7c14835
ci: update docker image workflow
willnorris Dec 7, 2021
e155a71
ci: fix default branch name for workflow
willnorris Dec 7, 2021
8fd838a
ci: try signing docker image with cosign
willnorris Dec 7, 2021
13bafdb
Add MaxRedirects option
intrip Nov 15, 2021
ef8aec7
lint: explain hash alg exclusion better
willnorris Jan 22, 2022
a81add5
lint: improve error handling
willnorris Jan 22, 2022
a1741ac
update dependencies
willnorris Feb 16, 2022
7584ca6
bump golangci-lint version
willnorris Feb 16, 2022
6022f6a
bump minimum go version to 1.15
willnorris Feb 16, 2022
e35f829
workflow: bump actions for building docker image
willnorris Nov 9, 2022
a1ea6d8
.github: bump all github action versions
willnorris Nov 9, 2022
e4a5896
godoc: fix godoc formatting
willnorris Nov 9, 2022
59aad26
cmd/imageproxy: add proper server timeouts
willnorris Nov 9, 2022
0e35e58
.github: clarify docker build steps
willnorris Nov 14, 2022
43b75b0
docker: add multi-platform support
willnorris Nov 14, 2022
b6e5e70
Revert "docker: add multi-platform support"
willnorris Nov 14, 2022
a6f541d
docker: add multi-platform support
willnorris Nov 14, 2022
635cc9e
go.mod: bump all deps
willnorris Nov 14, 2022
26b7060
.github: bump minimum go version to 1.16
willnorris Nov 14, 2022
eba736d
.github: bump minimum go version to 1.17
willnorris Nov 14, 2022
4121c06
readme: update minimum working go version
willnorris Nov 15, 2022
631d363
docker: cosign sign tags rather than digest
willnorris Dec 6, 2022
93dcedd
docker: go back to signing digests
willnorris Dec 6, 2022
8c1d05f
fly: add action and config for fly deployment
willnorris Dec 13, 2022
a0eb26e
.github: run deploy workflow after successful docker push
willnorris Dec 13, 2022
99c0bba
Update imageproxy.service
xiyou1223 Dec 30, 2022
d95da8f
README: update URL for test images
willnorris Jan 15, 2023
3b7abaf
go.mod: bump dependencies
willnorris Feb 1, 2023
12d8f92
go.mod: set go version to 1.17
willnorris Feb 1, 2023
5ffd8db
all: remove deprecated use of io/ioutil
willnorris Feb 1, 2023
431c70a
.github/workflow: switch to local-build fly deploy
willnorris Feb 1, 2023
f314cbf
.github/workfow: try to fix fly deploy
willnorris Feb 1, 2023
3815eb8
build(deps): bump golang.org/x/image from 0.3.0 to 0.5.0
dependabot[bot] Feb 17, 2023
b84da53
go.mod: update dependencies
willnorris Apr 3, 2023
3e9a5dd
cmd/imageproxy-sign: remove broken test
willnorris Apr 4, 2023
b37663f
.github/workflows: update to actions/setup-go@v4
willnorris Apr 4, 2023
5bef5a8
.github/workflows: switch flag syntax back
willnorris Apr 4, 2023
f9fd6c9
.github/workflows: update golangci-lint action
willnorris Apr 4, 2023
7295bec
added clients section to README
azolf Feb 18, 2023
eb9dd53
first pass at basic caddy module
willnorris May 9, 2023
5afd908
README: update URL of my personal imageproxy instance
willnorris May 9, 2023
4229b98
remove deploy script for my personal instance
willnorris May 9, 2023
2008a17
don't require redirect URLs to match AllowHosts
willnorris May 12, 2023
67f506b
caddy/go.mod: bump imageproxy version and try replace
willnorris May 13, 2023
1ba0bd0
caddy: follow redirects
willnorris May 13, 2023
a9b6594
return early if remote URL returns a 404
willnorris May 13, 2023
84960fc
bump go version to 1.18 and update deps
willnorris Aug 2, 2023
9708b43
README.md: format file
willnorris Aug 2, 2023
da55ece
Dockerfile: use wolfi-base as build image
willnorris Aug 2, 2023
ef50c1f
cmd/imageproxy: remove gorilla mux router
willnorris Nov 13, 2023
2451f30
.github: run prettier over all yml files
willnorris May 9, 2024
3aec0fc
.github: update action versions
willnorris May 9, 2024
4653948
go.mod: update modules
willnorris May 9, 2024
9a0fc21
caddy/go.mod: bump dependencies
willnorris May 9, 2024
572ad2d
caddy: bump to caddy 2.8.1 and set directive order
willnorris Jun 1, 2024
c361000
add trim option to remove solid color borders
vetler Mar 28, 2025
b4c03c2
.github/workflows: upgrade actions
willnorris Apr 18, 2025
5b619de
.github/workflows: drop linux/arm/v7 from docker
willnorris Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
commit-message:
prefix: "go.mod:"
assignees:
- willnorris
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: ".github:"
assignees:
- willnorris
38 changes: 38 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "CodeQL"

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 1 * * 6" # run weekly on Saturdays

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: ["go"]

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@4c3e5362829f0b0bb62ff5f6c938d7f95574c306 #v2.21.1
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@4c3e5362829f0b0bb62ff5f6c938d7f95574c306 #v2.21.1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@4c3e5362829f0b0bb62ff5f6c938d7f95574c306 #v2.21.1
67 changes: 67 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Docker

on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
# Run the workflow on pull_request events to ensure we can still build the image.
# We only publish the image on push events (see if statements in steps below).
branches: ["main"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Docker buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
if: github.event_name == 'push'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

# Sign the Docker image
- name: Install cosign
if: github.event_name == 'push'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
- name: Sign the published Docker image
if: github.event_name == 'push'
env:
COSIGN_YES: "true"
run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
23 changes: 23 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- main
pull_request:
branches:
- "**"
name: linter

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: stable

- name: golangci-lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd #v7.0.0
with:
version: v2.1.2
83 changes: 36 additions & 47 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- "**"
name: tests
env:
GO111MODULE: on
Expand All @@ -7,56 +13,39 @@ jobs:
test:
strategy:
matrix:
go-version: [1.12.x, 1.13.x]
go-version:
# support the two most recent major go versions
- stable
- oldstable
platform: [ubuntu-latest]
include:
# minimum go version that works. This is not necessarily supported in
# any way, and will be bumped up without notice as needed. But it at
# least lets us know what go version should work.
- go-version: 1.21
platform: ubuntu-latest

# include windows, but only with the latest Go version, since there
# is very little in the library that is platform specific
- go-version: stable
platform: windows-latest

# only update test coverage stats with most recent go version on linux
- go-version: stable
platform: ubuntu-latest
update-coverage: true
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: ${{ matrix.go-version }}

- name: Run go fmt
run: diff -u <(echo -n) <(gofmt -d -s .)
- name: Run go test
run: go test -v -race -coverprofile coverage.txt -covermode atomic ./...

- name: Run go vet
run: go vet ./...

- name: Run go test
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Upload coverage to Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)

# On Windows, just run the local tests. Don't bother with checking gofmt, go
# vet, or uploading results to Codecov
test-windows:
strategy:
matrix:
go-version: [1.12.x, 1.13.x]
platform: [windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v1
- name: Cache go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**\go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test ./...
- name: Upload coverage to Codecov
if: ${{ matrix.update-coverage }}
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
12 changes: 0 additions & 12 deletions .gitignore

This file was deleted.

31 changes: 31 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "2"
linters:
enable:
- dogsled
- dupl
- errorlint
- gosec
- misspell
- nakedret
- unconvert
- unparam
- whitespace

# TODO: fix issues and reenable these checks
disable:
- errcheck
- gosec
- staticcheck

exclusions:
rules:
# Some cache implementations use md5 hashes for cached filenames. There is
# a slight risk of cache poisoning if an attacker could construct a URL
# with the same hash, but the URL would also need to be allowed by the
# proxy's security settings (host allowlist, URL signature, etc). Changing
# these to a more secure hash algorithm would result in 100% cache misses
# when users upgrade. For now, just leave these alone.
- path: internal/.*cache
linters:
- gosec
text: G(401|501)
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
FROM golang:1.12 as build
MAINTAINER Will Norris <will@willnorris.com>
# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM cgr.dev/chainguard/wolfi-base as build
LABEL maintainer="Will Norris <will@willnorris.com>"

RUN useradd -u 1001 go
RUN apk update && apk add build-base git openssh go-1.21

WORKDIR /app

COPY go.mod go.sum ./
COPY third_party/envy/go.mod ./third_party/envy/
RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -v ./cmd/imageproxy
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -v ./cmd/imageproxy

FROM scratch
FROM cgr.dev/chainguard/static:latest

COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /app/imageproxy /app/imageproxy

USER go

CMD ["-addr", "0.0.0.0:8080"]
ENTRYPOINT ["/app/imageproxy"]

Expand Down
Loading