-
Notifications
You must be signed in to change notification settings - Fork 69
Extract standalone arkd-signer + shared txsigner lib (BREAKING: ARKD_SIGNER_ADDR required) #1118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 10 commits
88dadb3
723cdfe
53c1193
3c83f02
6eb62e8
757b5d6
56d51c4
42361b2
c0b8c08
91f0c7b
a91b876
c75709c
e3bcbb3
1f54bc7
53856a2
3b5c908
059f353
14e27c1
524e3b6
d56b8fa
644e309
c572c47
7e1d60f
0513a9a
2d3754d
691cb5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # First stage: build the arkd-signer binary | ||
| FROM golang:1.26.4 AS builder | ||
|
|
||
| ARG VERSION | ||
| ARG TARGETOS | ||
| ARG TARGETARCH | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${VERSION}'" -o /app/bin/arkd-signer ./cmd/arkd-signer/main.go | ||
|
|
||
| # Second stage: minimal runtime image | ||
| FROM alpine:3.20 | ||
|
|
||
| RUN apk update && apk upgrade | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=builder /app/bin/arkd-signer /app/ | ||
|
|
||
| ENV PATH="/app:${PATH}" | ||
|
|
||
| ENTRYPOINT [ "arkd-signer" ] | ||
|
Comment on lines
+15
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Run the runtime container as a non-root user. The signer holds sensitive key material; running as root increases blast radius if compromised. Suggested hardening FROM alpine:3.20
RUN apk update && apk upgrade
WORKDIR /app
-COPY --from=builder /app/bin/arkd-signer /app/
+RUN addgroup -S signer && adduser -S -G signer signer
+COPY --from=builder --chown=signer:signer /app/bin/arkd-signer /app/
ENV PATH="/app:${PATH}"
+USER signer
ENTRYPOINT [ "arkd-signer" ]🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "os" | ||
| "os/signal" | ||
| "syscall" | ||
|
|
||
| "github.com/arkade-os/arkd/pkg/arkd-signer/config" | ||
| grpcservice "github.com/arkade-os/arkd/pkg/arkd-signer/interface/grpc" | ||
| log "github.com/sirupsen/logrus" | ||
| ) | ||
|
|
||
| func main() { | ||
| cfg, err := config.LoadConfig() | ||
| if err != nil { | ||
| log.Fatalf("invalid config: %s", err) | ||
| } | ||
|
|
||
| log.SetLevel(log.Level(cfg.LogLevel)) | ||
|
|
||
| svc, err := grpcservice.NewService(cfg) | ||
| if err != nil { | ||
| log.Fatalf("failed to create service: %s", err) | ||
| } | ||
|
|
||
| log.Infof("arkd signer config: %s", cfg) | ||
|
|
||
| log.Info("starting service...") | ||
| if err := svc.Start(); err != nil { | ||
| log.Fatalf("failed to start service: %s", err) | ||
| } | ||
| log.Infof("arkd signer listens on: %v", cfg.Port) | ||
|
|
||
| log.RegisterExitHandler(svc.Stop) | ||
|
|
||
| sigChan := make(chan os.Signal, 1) | ||
| signal.Notify( | ||
| sigChan, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGHUP, os.Interrupt, | ||
| ) | ||
| <-sigChan | ||
|
|
||
| log.Info("shutting down service...") | ||
| log.Exit(0) | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,3 @@ | ||||||
| ARKD_WALLET_LOG_LEVEL=5 | ||||||
| ARKD_WALLET_NBXPLORER_URL=http://localhost:32838 | ||||||
| ARKD_WALLET_DATADIR=./data/signer | ||||||
| ARKD_WALLET_NETWORK=regtest | ||||||
| ARKD_WALLET_SIGNER_KEY=19422b10efd05403820ff6a3365422be2fc5f07f34a6d1603f7298328f0f80f6 | ||||||
| ARKD_WALLET_PORT=6161 | ||||||
| ARKD_SIGNER_LOG_LEVEL=5 | ||||||
| ARKD_SIGNER_SECRET_KEY=19422b10efd05403820ff6a3365422be2fc5f07f34a6d1603f7298328f0f80f6 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Do not commit a real signer private key in a tracked env file. Line 2 embeds live key material. Replace this with a placeholder and inject the actual key from an untracked local env/secret store. Suggested fix-ARKD_SIGNER_SECRET_KEY=19422b10efd05403820ff6a3365422be2fc5f07f34a6d1603f7298328f0f80f6
+ARKD_SIGNER_SECRET_KEY=__SET_IN_LOCAL_UNTRACKED_ENV__📝 Committable suggestion
Suggested change
🧰 Tools🪛 Betterleaks (1.5.0)[high] 2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||
| ARKD_SIGNER_PORT=6061 | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Avoid documenting a concrete signer private key value.
Publishing a realistic fixed secret encourages unsafe copy-paste and creates recurring secret-scan noise; prefer a placeholder and a generation command.
Suggested doc tweak
🧰 Tools
🪛 Betterleaks (1.5.0)
[high] 169-169: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🤖 Prompt for AI Agents
Source: Linters/SAST tools