Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2d4445b
Reliability improvements to PostgreSQL plugin and performance improve…
tristanpoland Mar 27, 2026
7207887
Add slog shim and shared S3 utilities
wayneeseguin Mar 27, 2026
f13d2e4
Replace sqlx with database/sql
wayneeseguin Mar 27, 2026
4b29bb7
Inline go-querytron into client package
wayneeseguin Mar 27, 2026
7e439f0
Migrate go-log to slog shim across 27 files
wayneeseguin Mar 27, 2026
d4a916c
Rewrite S3 plugin with AWS SDK v2
wayneeseguin Mar 27, 2026
9dfdbd8
Rewrite Backblaze plugin with AWS SDK v2
wayneeseguin Mar 27, 2026
1de7eb0
Upgrade go-github to v66 and modernize OAuth2
wayneeseguin Mar 27, 2026
a254e35
Migrate plugin framework to Cobra
wayneeseguin Mar 27, 2026
17d4cd2
Migrate five CLI binaries to Cobra
wayneeseguin Mar 27, 2026
e5093a1
Decompose shield CLI into Cobra command files
wayneeseguin Mar 27, 2026
2bdfd3a
Update go.mod and vendor for v10.0.0 deps
wayneeseguin Mar 27, 2026
9fdf1a9
Bump Go version to 1.26
wayneeseguin Mar 27, 2026
a8e140a
Update golang.org/x/* dependencies
wayneeseguin Mar 27, 2026
eb73ea2
Update google.golang.org/api, drop opencensus
wayneeseguin Mar 27, 2026
e898340
Update hashicorp/consul/api to v1.33.7
wayneeseguin Mar 27, 2026
038cafe
Update remaining direct dependencies
wayneeseguin Mar 27, 2026
768b9ed
Remove stale go-restful replace directive
wayneeseguin Mar 27, 2026
87b1427
Migrate from yaml.v2 to yaml.v3
wayneeseguin Mar 27, 2026
899172b
Bootstrap Ginkgo test suites for untested packages
wayneeseguin Mar 27, 2026
cca1f80
Add HttpOnly, Secure, SameSite to session cookies
wayneeseguin Mar 27, 2026
424106c
Fix retry loop infinite loop when rc=0
wayneeseguin Mar 27, 2026
8c878e9
Validate tenant and plugin on alternate-target restore
wayneeseguin Mar 27, 2026
3e078e6
Fix Worker race condition with atomic.Bool
wayneeseguin Mar 27, 2026
9ce8bb5
Add bus backlog overflow behavior tests
wayneeseguin Mar 27, 2026
b002815
Add edge case tests for target deletion and agents
wayneeseguin Mar 27, 2026
d5a45b4
Upgrade Ginkgo v1 to v2
wayneeseguin Mar 27, 2026
ef53a31
Add multi-database dialect adapter
wayneeseguin Mar 28, 2026
31977e2
Restore cross-database placeholder rebind
wayneeseguin Mar 28, 2026
1d92a68
Add PostgreSQL and MySQL driver support
wayneeseguin Mar 28, 2026
73bd91d
Fix format string vet errors in core
wayneeseguin Mar 30, 2026
b459a3e
Add YAML serialization tests for core and CLI
wayneeseguin Mar 30, 2026
ce51544
Migrate from yaml.v3 to goccy/go-yaml
wayneeseguin Mar 30, 2026
71cb659
Restore env var support lost in cobra migration
wayneeseguin Mar 31, 2026
472c850
Modernize local dev Docker stack
wayneeseguin Apr 2, 2026
e9940bb
Fix init form on uninitialized SHIELD cores
wayneeseguin Apr 2, 2026
fb56557
Fix query string reflect on string fields
wayneeseguin Apr 2, 2026
c2e53e3
Clear consul KV tree before restore
wayneeseguin Apr 2, 2026
19ee2e5
Fix S3 uploads for AWS SDK v2 compatibility
wayneeseguin Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"Bash(node:*)",
"Bash(python3:*)"
]
}
}
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION=9.0.0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ demo/shield-agent/in
demo/shield-core/in
demo/shared
demo/cached
/.vscode
1 change: 1 addition & 0 deletions .vscode/dryrun.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
make.exe --dry-run --always-make --keep-going --print-directory
'make.exe' is not recognized as an internal or external command,
operable program or batch file.

64 changes: 50 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,69 @@
FROM golang:1.21-bookworm as build
ARG UBUNTU_RELEASE=noble
ARG GO_VERSION=1.26.1

FROM ubuntu:${UBUNTU_RELEASE} AS build
ARG GO_VERSION
ARG TARGETARCH
ARG VERSION=local

RUN apt-get update \
&& apt-get install -y bzip2 gzip unzip curl openssh-client
&& apt-get install -y bzip2 gzip unzip curl git make gcc libc6-dev openssh-client ca-certificates \
&& curl -sL https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz | tar -C /usr/local -xzf - \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sLo /bin/jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64 \
&& chmod 0755 /bin/jq
ENV PATH="/usr/local/go/bin:/go/bin:${PATH}" \
GOPATH="/go"

ARG VERSION
COPY / /go/src/github.com/shieldproject/shield/
RUN cd /go/src/github.com/shieldproject/shield \
&& go mod tidy \
&& go mod vendor \
&& make build BUILD_TYPE="build -ldflags='-X main.Version=$VERSION'"
RUN mkdir -p /dist/bin /dist/plugins \

RUN mkdir -p /dist/bin /dist/plugins /dist/ui \
&& mv /go/src/github.com/shieldproject/shield/shieldd \
/go/src/github.com/shieldproject/shield/shield-agent \
/go/src/github.com/shieldproject/shield/shield-crypt \
/go/src/github.com/shieldproject/shield/shield-report \
/go/src/github.com/shieldproject/shield/shield-schema \
/go/src/github.com/shieldproject/shield/bin/shield-pipe \
/dist/bin \
/dist/bin/ \
&& for plugin in $(cat /go/src/github.com/shieldproject/shield/plugins); do \
cp /go/src/github.com/shieldproject/shield/$plugin /dist/plugins; \
cp /go/src/github.com/shieldproject/shield/$plugin /dist/plugins/; \
done \
&& cp -R /go/src/github.com/shieldproject/shield/web/htdocs /dist/ui

ADD init /dist/init
RUN chmod 0755 /dist/init/*
# Build shield CLI
RUN cd /go/src/github.com/shieldproject/shield \
&& go build -mod vendor -o /dist/bin/shield ./cmd/shield

# Download Vault
ARG VAULT_VERSION=1.21.4
RUN curl -sLo /tmp/vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_${TARGETARCH}.zip \
&& unzip /tmp/vault.zip -d /dist/bin/ \
&& rm /tmp/vault.zip

FROM ubuntu:${UBUNTU_RELEASE}

FROM ubuntu:jammy
RUN apt-get update \
&& apt-get install -y bzip2 gzip curl openssh-client \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /dist /shield
&& apt-get install -y curl netcat-openbsd openssh-client \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -r -m -s /bin/bash vcap

COPY --from=build /dist/bin/ /shield/bin/
COPY --from=build /dist/plugins/ /shield/plugins/
COPY --from=build /dist/ui/ /shield/ui/

# Copy init scripts and config
COPY init/core /shield/init/core
COPY init/agent /shield/init/agent
COPY init/shieldd.conf /shield/config/shieldd.conf
COPY init/vault.conf /shield/config/vault.conf

RUN chmod 0755 /shield/init/core /shield/init/agent \
&& mkdir -p /shield/data /shield/vault-data /etc/shield \
&& chown -R vcap:vcap /shield/data /shield/vault-data

ENV PATH="/shield/bin:${PATH}"

EXPOSE 8080 5444
47 changes: 31 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ api-tests: shieldd shield-schema shield-crypt shield-agent shield-report

# Running Tests for race conditions
race:
ginkgo -race *
go run github.com/onsi/ginkgo/v2/ginkgo run -race ./...

# Building Shield
shield: shieldd shield-agent shield-schema shield-crypt shield-report
shield: shieldd shield-cli shield-agent shield-schema shield-crypt shield-report

shield-crypt:
go $(BUILD_TYPE) -mod vendor ./cmd/shield-crypt
Expand All @@ -44,24 +44,37 @@ shield-schema:
shield-report:
go $(BUILD_TYPE) -mod vendor ./cmd/shield-report

shield: cmd/shield/help.go
go $(BUILD_TYPE) -mod vendor ./cmd/shield
help.all: cmd/shield/main.go
grep case $< | grep '{''{{' | cut -d\" -f 2 | sort | xargs -n1 -I@ ./shield @ -h > $@
shield-cli:
go $(BUILD_TYPE) -mod vendor -ldflags "$(LDFLAGS)" ./cmd/shield

# Building Plugins
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)

plugin: plugins
plugins:
go $(BUILD_TYPE) -mod vendor ./plugin/dummy
@echo "Building dummy plugin..."
@go $(BUILD_TYPE) -mod vendor ./plugin/dummy || go $(BUILD_TYPE) ./plugin/dummy
@for plugin in $$(cat plugins); do \
echo building plugin $$plugin...; \
go $(BUILD_TYPE) -mod vendor ./plugin/$$plugin; \
echo "building plugin $$plugin..."; \
if ! go $(BUILD_TYPE) -mod vendor ./plugin/$$plugin; then \
GOFLAGS=-mod=mod go $(BUILD_TYPE) ./plugin/$$plugin; \
fi; \
done


demo: clean shield plugins
./demo/build
(cd demo && docker-compose up)
@if [ -x ./demo/build ]; then \
./demo/build; \
else \
echo "(warning) ./demo/build not found; skipping demo build"; \
fi
(cd docker/demo && docker compose up)

# Local build stack (core/agent/demo/webdav from local source build)
demo-local:
docker compose -f docker-compose.local.yml up --build

dev-local: demo-local

docs: docs/dev/API.md
./bin/mkdocs --version latest --docroot /docs --output tmp/docs --style basic
Expand All @@ -76,16 +89,18 @@ clean:
rm -f $$(cat plugins) dummy


# Assemble the CLI help with some assistance from our friend, Perl
HELP := $(shell ls -1 cmd/shield/help/*)
cmd/shield/help.go: $(HELP) cmd/shield/help.pl
./cmd/shield/help.pl $(HELP) > $@

fixmes: fixme
fixme:
@grep -rn FIXME * | grep -v vendor/ | grep -v README.md | grep --color FIXME || echo "No FIXMES! YAY!"

dev:
# Quick local development mode (UI + API) using docker-compose
# Usage: make dev
# then open http://localhost:9009
dev: demo

# Keep legacy testdev flow for deeper local test sandbox
dev-test:
./bin/testdev

# Deferred: Naming plugins individually, e.g. make plugin dummy
Expand Down
2 changes: 1 addition & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"syscall"

"github.com/jhunt/go-log"
"github.com/shieldproject/shield/internal/log"
"golang.org/x/crypto/ssh"
)

Expand Down
5 changes: 2 additions & 3 deletions agent/agent_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"bufio"
"fmt"
"io"
"io/ioutil"
"os"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"golang.org/x/crypto/ssh"
)
Expand Down Expand Up @@ -100,7 +99,7 @@ func (c *Client) Run(out chan string, command string) error {
}

func ConfigureSSHClient(privateKeyPath string) (*ssh.ClientConfig, error) {
raw, err := ioutil.ReadFile(privateKeyPath)
raw, err := os.ReadFile(privateKeyPath)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

. "github.com/shieldproject/shield/agent"
Expand Down
5 changes: 2 additions & 3 deletions agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import (
"encoding/json"
"fmt"
"io"
"log/syslog"
"os"
"os/exec"
"regexp"
"strings"
"sync"

"github.com/jhunt/go-log"
"github.com/shieldproject/shield/internal/log"
"golang.org/x/crypto/ssh"
)

Expand Down Expand Up @@ -178,7 +177,7 @@ func (agent *Agent) Execute(c *Command, out chan string) error {
cmd.Env = appendEndpointVariables(cmd.Env, "SHIELD_TARGET_PARAM_", c.TargetEndpoint)
cmd.Env = appendEndpointVariables(cmd.Env, "SHIELD_STORE_PARAM_", c.StoreEndpoint)

if log.LogLevel() == syslog.LOG_DEBUG {
if log.IsDebug() {
cmd.Env = append(cmd.Env, "DEBUG=true")
}

Expand Down
4 changes: 2 additions & 2 deletions agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"strings"

env "github.com/jhunt/go-envirotron"
"github.com/jhunt/go-log"
"github.com/shieldproject/shield/internal/log"
"golang.org/x/crypto/ssh"
"gopkg.in/yaml.v2"
"github.com/goccy/go-yaml"
)

type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion agent/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"time"

"github.com/jhunt/go-log"
"github.com/shieldproject/shield/internal/log"
)

func (agent *Agent) Ping() {
Expand Down
5 changes: 2 additions & 3 deletions client/v2/shield/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package shield
import (
"fmt"

qs "github.com/jhunt/go-querytron"
"github.com/pborman/uuid"
"github.com/pborman/uuid"
)

type Agent struct {
Expand All @@ -30,7 +29,7 @@ type AgentFilter struct {
}

func (c *Client) ListAgents(filter *AgentFilter) ([]*Agent, error) {
u := qs.Generate(filter).Encode()
u := generateQueryString(filter).Encode()
var out struct {
Agents []*Agent `json:"agents"`
Problems map[string][]string `json:"problems"`
Expand Down
5 changes: 2 additions & 3 deletions client/v2/shield/archives.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package shield
import (
"fmt"

qs "github.com/jhunt/go-querytron"
"github.com/pborman/uuid"
"github.com/pborman/uuid"
)

type Archive struct {
Expand Down Expand Up @@ -39,7 +38,7 @@ func fixupArchiveRequest(p *Archive) {
}

func (c *Client) ListArchives(parent *Tenant, filter *ArchiveFilter) ([]*Archive, error) {
u := qs.Generate(filter).Encode()
u := generateQueryString(filter).Encode()
var out []*Archive
if err := c.get(fmt.Sprintf("/v2/tenants/%s/archives?%s", parent.UUID, u), &out); err != nil {
return nil, err
Expand Down
4 changes: 1 addition & 3 deletions client/v2/shield/fixups.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package shield

import (
"fmt"

qs "github.com/jhunt/go-querytron"
)

type Fixup struct {
Expand All @@ -18,7 +16,7 @@ type FixupFilter struct {
}

func (c *Client) ListFixups(filter *FixupFilter) ([]*Fixup, error) {
u := qs.Generate(filter).Encode()
u := generateQueryString(filter).Encode()
var out []*Fixup
return out, c.get(fmt.Sprintf("/v2/fixups?%s", u), &out)
}
Expand Down
5 changes: 2 additions & 3 deletions client/v2/shield/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package shield
import (
"fmt"

qs "github.com/jhunt/go-querytron"
"github.com/pborman/uuid"
"github.com/pborman/uuid"
)

type Job struct {
Expand Down Expand Up @@ -62,7 +61,7 @@ func fixupJobResponse(p *Job) {
}

func (c *Client) ListJobs(parent *Tenant, filter *JobFilter) ([]*Job, error) {
u := qs.Generate(filter).Encode()
u := generateQueryString(filter).Encode()
var out []*Job
if err := c.get(fmt.Sprintf("/v2/tenants/%s/jobs?%s", parent.UUID, u), &out); err != nil {
return nil, err
Expand Down
Loading