Skip to content

Commit 58cbdd8

Browse files
committed
fix(ci): enable CGO for all builds, fix diagram and approval channels docs
1 parent 790a856 commit 58cbdd8

4 files changed

Lines changed: 65 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88
contents: write
99

1010
jobs:
11-
goreleaser:
11+
release-linux:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
@@ -19,9 +19,39 @@ jobs:
1919
with:
2020
go-version-file: go.mod
2121

22+
- name: Install arm64 cross-compiler
23+
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
24+
2225
- uses: goreleaser/goreleaser-action@v6
2326
with:
2427
version: latest
2528
args: release --clean
2629
env:
2730
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
release-darwin:
33+
runs-on: macos-latest
34+
needs: release-linux
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- uses: actions/setup-go@v5
41+
with:
42+
go-version-file: go.mod
43+
44+
- name: Build darwin binaries
45+
run: |
46+
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags='-s -w' -o sluice_darwin_arm64 ./cmd/sluice/
47+
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -ldflags='-s -w' -o sluice_darwin_amd64 ./cmd/sluice/
48+
49+
- name: Upload darwin binaries to release
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
tag="${GITHUB_REF#refs/tags/}"
54+
version="${tag#v}"
55+
mv sluice_darwin_arm64 "sluice_${version}_darwin_arm64"
56+
mv sluice_darwin_amd64 "sluice_${version}_darwin_amd64"
57+
gh release upload "$tag" "sluice_${version}_darwin_arm64" "sluice_${version}_darwin_amd64"

.goreleaser.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@ builds:
44
- id: sluice
55
main: ./cmd/sluice
66
binary: sluice
7+
env:
8+
- CGO_ENABLED=1
79
goos:
8-
- darwin
910
- linux
1011
goarch:
1112
- amd64
1213
- arm64
14+
overrides:
15+
- goos: linux
16+
goarch: arm64
17+
env:
18+
- CGO_ENABLED=1
19+
- CC=aarch64-linux-gnu-gcc
20+
ldflags:
21+
- -s -w -linkmode external -extldflags "-static"
1322

1423
archives:
1524
- id: sluice

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
FROM golang:1.26-alpine AS builder
2+
RUN apk add --no-cache gcc musl-dev
23
WORKDIR /build
34
COPY go.mod go.sum ./
45
RUN go mod download
56
COPY . .
6-
RUN CGO_ENABLED=0 go build -o /sluice ./cmd/sluice/
7+
RUN go build -ldflags='-s -w -linkmode external -extldflags "-static"' -o /sluice ./cmd/sluice/
78

89
FROM alpine:3.21
910
RUN apk add --no-cache ca-certificates wget && \

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,27 @@ flowchart LR
2626
PX[SOCKS5 Proxy<br/>network policy + MITM]
2727
end
2828
29-
TG[Telegram Bot<br/>approve / deny]
29+
subgraph Approval["Approval Channels"]
30+
TG[Telegram<br/>primary]
31+
WH[HTTP Webhooks]
32+
end
33+
3034
HM[Human]
3135
UP[Upstream<br/>MCP Servers]
3236
IN[Internet]
3337
3438
OC -- "MCP tool calls" --> GW
3539
OC -- "all TCP/UDP<br/>(via tun2proxy)" --> PX
36-
GW --> UP
40+
GW -- "allowed" --> UP
41+
GW -. "ask verdict" .-> Approval
3742
PX -- "phantom -> real<br/>credential swap" --> IN
38-
PX -. "ask verdict" .-> TG
39-
TG -. "allow / deny" .-> HM
40-
HM -. "respond" .-> TG
41-
TG -. "resolve" .-> PX
43+
PX -. "ask verdict" .-> Approval
44+
Approval -. "allow / deny" .-> HM
45+
HM -. "respond" .-> Approval
46+
Approval -. "resolve" .-> Sluice
4247
```
4348

44-
**OpenClaw** uses phantom tokens for all API calls. **tun2proxy** routes all traffic to sluice's SOCKS5 proxy (runs as a container in Docker, on the host for Apple Container/macOS VM). **Sluice** evaluates every connection against policy rules (allow / deny / ask). "Ask" verdicts send a Telegram notification with inline buttons. The MITM proxy swaps phantom tokens for real credentials in-flight. Credentials are managed via Telegram or CLI, stored encrypted with age, and hot-reloaded into OpenClaw without restarts.
49+
**OpenClaw** uses phantom tokens for all API calls. **tun2proxy** routes all traffic to sluice's SOCKS5 proxy (runs as a container in Docker, on the host for Apple Container/macOS VM). Both the MCP gateway and SOCKS5 proxy evaluate requests against policy rules (allow / deny / ask). "Ask" verdicts are broadcast to all configured approval channels (Telegram, HTTP webhooks). The first channel to respond wins. The MITM proxy swaps phantom tokens for real credentials in-flight. Credentials are managed via approval channels or CLI, stored encrypted with age, and hot-reloaded into OpenClaw without restarts.
4550

4651
## Quick Start
4752

@@ -200,9 +205,13 @@ Sluice supports multiple credential backends. Set `provider` in `[vault]` config
200205

201206
Chain multiple providers with `providers = ["1password", "age"]`. First provider with the credential wins.
202207

203-
## Telegram Bot
208+
## Approval Channels
209+
210+
Sluice broadcasts "ask" verdicts to all configured approval channels. The first channel to respond wins. Other channels get a cancellation notice.
204211

205-
Manage sluice from your phone. Approve connections, add credentials, update policy.
212+
### Telegram (primary)
213+
214+
Manage sluice from your phone. Approve connections and tool calls, add credentials, update policy.
206215

207216
| Command | Description |
208217
|---------|-------------|
@@ -214,6 +223,10 @@ Manage sluice from your phone. Approve connections, add credentials, update poli
214223
| `/status` | Proxy stats and pending approvals |
215224
| `/audit recent [N]` | Last N audit entries |
216225

226+
### HTTP Webhooks
227+
228+
REST API on port 3000 for programmatic approval integration. `GET /api/approvals` lists pending requests, `POST /api/approvals/{id}/resolve` resolves them. Use this to build custom approval UIs or integrate with existing workflows.
229+
217230
## Audit Log
218231

219232
Tamper-evident JSON Lines log with blake3 hash chaining. Every connection, tool call, approval, and denial is recorded.

0 commit comments

Comments
 (0)