Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.

🔧 Config added for fees, makefile added to run dev mode (hot reloadin…#113

Merged
garry-sharp merged 4 commits into
mainfrom
fee-local-config-changes
Jul 4, 2025
Merged

🔧 Config added for fees, makefile added to run dev mode (hot reloadin…#113
garry-sharp merged 4 commits into
mainfrom
fee-local-config-changes

Conversation

@garry-sharp

@garry-sharp garry-sharp commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced new fee worker and fee server services with dedicated Dockerfiles for both production and development environments.
    • Added development Docker Compose configuration enabling live code updates for fee-related services.
    • Added configuration files for fee server and fee worker, including YAML and JSON examples.
    • Expanded database initialization to support multiple plugin databases.
  • Improvements

    • Updated Makefile with new targets for development and build workflows.
    • Enhanced error handling in the fee worker application startup.
  • Bug Fixes

    • Updated configuration and service names for clarity and consistency in Docker Compose files.
  • Chores

    • Removed obsolete fee configuration example file.

…g or plugins). Fee worker has been added here to enable hot reloading.
Copilot AI review requested due to automatic review settings July 3, 2025 13:00
@coderabbitai

coderabbitai Bot commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This change introduces new Dockerfiles, Docker Compose configurations, and supporting files to add "fee-worker" and "fee-server" services alongside development and production workflows. It updates configuration files, refines database and Redis service naming, and enhances error handling in the worker's main Go entrypoint.

Changes

Files/Group Change Summary
Dockerfile.Fee.worker, Dockerfile.Fee.worker.dev Added Dockerfiles for building and developing the fee worker service with Go, native libs, and config files.
Dockerfile.Fee.server, Dockerfile.Fee.server.dev Added Dockerfiles for building and developing the fee server service with Go, native libs, and config files.
docker-compose.yaml, docker-compose.dev.yaml Added/updated Compose files to define fee-worker, fee-server, and supporting services for prod and dev.
Makefile Added new targets for dev/prod builds and Compose up/down; updated .PHONY and environment variables.
etc/vultisig/fee.yml Added YAML config for fee service specifying type, version, and RPC endpoint.
fee.server.example.json Added example JSON config for fee server (server, DB, Redis, storage, Datadog).
payroll.server.example.json Updated DSN in payroll server config to use new DB host/port.
payroll.worker.example.json Reformatted and expanded config; updated DSN and nested vault_service keys.
fee_config.example.json Deleted obsolete fee config example JSON.
init-scripts/01_create_vultisig_plugin.sql Added creation of "vultisig-fee" and "vultisig-dca" databases.
cmd/fees/worker/main.go Added error handling for Postgres backend initialization.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Docker as Docker Engine
    participant FeeWorker as Fee Worker Container
    participant FeeServer as Fee Server Container
    participant DB as plugin-db
    participant Redis as redis-fees

    Dev->>Docker: docker-compose -f docker-compose.yaml up
    Docker->>FeeWorker: Build and start container
    Docker->>FeeServer: Build and start container
    FeeWorker->>DB: Connect to vultisig-fee database
    FeeWorker->>Redis: Connect to redis-fees
    FeeServer->>DB: Connect to vultisig-fee database
    FeeServer->>Redis: Connect to redis-fees
Loading

Possibly related PRs

Suggested reviewers

  • johnnyluo

Poem

A warren of workers, a server or two,
Compose files and configs, all shiny and new!
With Docker they gather, with Go they compile,
The fee bunnies hop in robust, modern style.
🐇💻
On networks and volumes, their services run—
Hooray for new features, the build is all done!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces configuration and service setup for the fees plugin alongside updating existing payroll services to share a single plugin-db instance, and adds Makefile targets for dev mode (hot reloading).

  • Updated all payroll DSNs to point at a shared plugin-db instead of payroll-db
  • Added fee plugin example configs (.json and .yml), Docker Compose services, and Dockerfiles (dev+prod)
  • Introduced docker-compose.dev.yaml and new Makefile targets (up-dev, build-dev, etc.)

Reviewed Changes

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

Show a summary per file
File Description
payroll.worker.example.json Changed DSN to use plugin-db and correct database name
payroll.server.example.json Updated DSN to use plugin-db
fee.worker.example.json Added example JSON config for the fees worker plugin
fee.server.example.json Added example JSON config for the fees server plugin
etc/vultisig/fee.yml New fee plugin YAML config for gas and RPC settings
docker-compose.yaml Renamed payroll-db to plugin-db, added redis-fees and fee-worker service
docker-compose.dev.yaml New dev compose file for hot-reloading the fee worker
Makefile Added up-dev, down-dev, build, and build-dev targets
Dockerfile.Fee.worker.dev New Dockerfile for fee worker with hot reload via Air
Dockerfile.Fee.worker New multi-stage Dockerfile for fee worker (production)
Comments suppressed due to low confidence (1)

docker-compose.dev.yaml:13

  • [nitpick] This volume mount may create a directory rather than mounting the intended host file. Verify that you’re specifying <host_path>:<container_path> and that the host path exists.
      - /app/build-errors.log

Comment thread fee.worker.example.json Outdated
Comment thread fee.server.example.json Outdated
"encryption_secret": "test123"
},
"database": {
"dsn": "postgres://myuser:mypassword@localhost:5431/vultisig-fee?sslmode=disable"

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] This server example still points at localhost; to mirror the worker and other services, consider using the plugin-db host here as well.

Suggested change
"dsn": "postgres://myuser:mypassword@localhost:5431/vultisig-fee?sslmode=disable"
"dsn": "postgres://myuser:mypassword@plugin-db:5431/vultisig-fee?sslmode=disable"

Copilot uses AI. Check for mistakes.
Comment thread Makefile
Comment thread Dockerfile.Fee.worker

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🔭 Outside diff range comments (1)
Makefile (1)

1-3: DYLD_LIBRARY variable is misspelled; should be DYLD_LIBRARY_PATH

DYLD_LIBRARY is ignored by the macOS loader. Export DYLD_LIBRARY_PATH (or drop entirely) so the dynamic linker can locate DKLS libs.

-DYLD_LIBRARY=../go-wrappers/includes/darwin/:$LD_LIBRARY_PATH
+DYLD_LIBRARY_PATH=../go-wrappers/includes/darwin/:${DYLD_LIBRARY_PATH:-}
🧹 Nitpick comments (11)
payroll.worker.example.json (1)

6-8: Replace placeholder encryption_secret before shipping
"encryption_secret": "test123" is fine for a template, but make sure CI / production artefacts never ship with this value.

fee.server.example.json (1)

5-5: Template secret must be rotated
Don’t forget to override "encryption_secret": "test123" in any non-local deployment.

fee.worker.example.json (1)

11-11: Remember to rotate the placeholder encryption_secret
Same caveat as other example configs.

payroll.server.example.json (1)

5-5: Rotate encryption_secret before production rollout
Same note as other example configs.

Makefile (2)

4-6: Mark targets as phony to avoid name clashes

Add a .PHONY block so make doesn’t treat existing files named build, up-dev, etc. as up-to-date targets.

+.PHONY: up up-dev down down-dev build build-dev dump-schema

Also applies to: 13-21


7-9: DRY: extract compose file list into a variable

Four targets repeat the same -f docker-compose.yaml -f docker-compose.dev.yaml. Use a variable to avoid drift:

COMPOSE_DEV = -f docker-compose.yaml -f docker-compose.dev.yaml

up-dev:
	@docker compose $(COMPOSE_DEV) up -d --remove-orphans
...

Also applies to: 16-21

docker-compose.yaml (1)

82-82: Remove trailing whitespace (YAMLlint error)
Line 82 contains a stray space after the port mapping.

-      - "8081:8080" 
+      - "8081:8080"
Dockerfile.Fee.worker.dev (1)

14-20: Clean up downloaded tarball to shrink image

The DKLS archive and extracted folder remain, adding ~40 MB. Compress the RUN chain and delete artifacts:

-RUN wget https://github.com/vultisig/go-wrappers/archive/refs/heads/master.tar.gz
-RUN tar -xzf master.tar.gz && \
-    cd go-wrappers-master && \
-    mkdir -p /usr/local/lib/dkls && \
-    cp --recursive includes /usr/local/lib/dkls
+RUN wget -q https://github.com/vultisig/go-wrappers/archive/refs/heads/master.tar.gz && \
+    tar -xzf master.tar.gz && \
+    cd go-wrappers-master && \
+    mkdir -p /usr/local/lib/dkls && \
+    cp -r includes /usr/local/lib/dkls && \
+    cd .. && rm -rf master.tar.gz go-wrappers-master
docker-compose.dev.yaml (1)

36-39: Fix YAML lint errors (trailing spaces & EOF newline)
Remove trailing spaces on line 36 and add a newline at EOF to satisfy linters.

Dockerfile.Fee.worker (2)

14-19: Clean up DKLS download in builder stage

Delete the archive and extracted dir to keep the builder layer smaller:

-RUN wget https://github.com/vultisig/go-wrappers/archive/refs/heads/master.tar.gz
-RUN tar -xzf master.tar.gz && \
+RUN wget -q https://github.com/vultisig/go-wrappers/archive/refs/heads/master.tar.gz && \
+    tar -xzf master.tar.gz && \
     cd go-wrappers-master && \
     mkdir -p /usr/local/lib/dkls && \
-    cp --recursive includes /usr/local/lib/dkls
+    cp -r includes /usr/local/lib/dkls && \
+    cd .. && rm -rf master.tar.gz go-wrappers-master

26-32: Runtime optimisation: use a slimmer base image

Consider ubuntu:24.04-minimal or a distroless image to cut size and CVE surface area; you only need glibc and the native libs.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6387cf5 and 27627fa.

📒 Files selected for processing (10)
  • Dockerfile.Fee.worker (1 hunks)
  • Dockerfile.Fee.worker.dev (1 hunks)
  • Makefile (1 hunks)
  • docker-compose.dev.yaml (1 hunks)
  • docker-compose.yaml (4 hunks)
  • etc/vultisig/fee.yml (1 hunks)
  • fee.server.example.json (1 hunks)
  • fee.worker.example.json (1 hunks)
  • payroll.server.example.json (1 hunks)
  • payroll.worker.example.json (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
payroll.server.example.json (2)
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
fee.worker.example.json (3)
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config from the external package "github.com/vultisig/verifier/vault_config" in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). The vault_config.Config struct contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). It contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
payroll.worker.example.json (4)
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config from the external package "github.com/vultisig/verifier/vault_config" in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). The vault_config.Config struct contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). It contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
Learnt from: webpiratt
PR: vultisig/plugin#96
File: plugin/payroll/transaction.go:178-183
Timestamp: 2025-06-18T18:28:19.759Z
Learning: In the payroll plugin, the Hash field in PluginKeysignRequest is intentionally set to the unsigned transaction hex (same as Message field) because computing a hash with empty V,R,S signature fields doesn't make sense, and it's documented as "not on-chain hash without signature". This is a deliberate placeholder approach.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
etc/vultisig/fee.yml (1)
Learnt from: webpiratt
PR: vultisig/plugin#96
File: plugin/payroll/transaction.go:43-44
Timestamp: 2025-06-18T18:22:06.358Z
Learning: In the vultisig/plugin codebase, the hardcoded ethereumEvmChainID = big.NewInt(1) in plugin/payroll/transaction.go is intentional for the current implementation phase. The team is implementing ETH first, with plans to add other EVM chains later. The functions/methods are already designed to work with all EVM chains.
fee.server.example.json (2)
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
docker-compose.yaml (1)
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
🪛 Checkov (3.2.334)
payroll.server.example.json

[MEDIUM] 8-9: Basic Auth Credentials

(CKV_SECRET_4)

fee.worker.example.json

[MEDIUM] 31-32: Basic Auth Credentials

(CKV_SECRET_4)

payroll.worker.example.json

[MEDIUM] 28-29: Basic Auth Credentials

(CKV_SECRET_4)

fee.server.example.json

[MEDIUM] 8-9: Basic Auth Credentials

(CKV_SECRET_4)

docker-compose.dev.yaml

[MEDIUM] 10-11: Basic Auth Credentials

(CKV_SECRET_4)

docker-compose.yaml

[MEDIUM] 80-81: Basic Auth Credentials

(CKV_SECRET_4)

🪛 YAMLlint (1.37.1)
docker-compose.dev.yaml

[error] 36-36: trailing spaces

(trailing-spaces)


[error] 39-39: no new line character at the end of file

(new-line-at-end-of-file)

docker-compose.yaml

[error] 82-82: trailing spaces

(trailing-spaces)

🔇 Additional comments (9)
payroll.worker.example.json (2)

10-14: Redis port (6378) is non-standard – verify it matches the Compose service
Every other service uses the default 6379. Using 6378 will break the connection unless a custom-port Redis container is started.


28-28: Confirm the plugin-db:5432 endpoint exists in the target network
The DSN was updated, but the Compose file must expose the DB on 5432 and under the plugin-db hostname for this to work.

fee.server.example.json (1)

12-14: Redis port (6377) deviates from the default
Ensure the dev Compose stack exposes Redis on 6377; otherwise, align the port to 6379.

fee.worker.example.json (2)

14-17: Validate Redis host/port availability
Container must be named redis-fees and listen on 6379; double-check docker-compose.*.yaml.


31-32: DSN relies on plugin-db:5432; confirm network alias exists
Mismatch here will prevent the worker from starting.

payroll.server.example.json (1)

8-9: DSN update LGTM – consistent with new plugin-db service
No action needed if Compose exposes the DB on 5432.

docker-compose.yaml (1)

131-138: External Docker network must exist

shared_network is external: true; docker compose up fails if the network hasn’t been created. Add a Make target or note in README:

docker network create shared_network
Dockerfile.Fee.worker.dev (1)

2-2: Verify availability of golang:1.24

As of today, Docker Hub only lists Go 1.23. Pinning to a non-existent tag will break CI/CD.

Dockerfile.Fee.worker (1)

2-2: Confirm golang:1.24 tag exists

Same concern as dev Dockerfile—pin to a valid tag or build will fail.

Comment thread etc/vultisig/fee.yml Outdated
Comment on lines +5 to +7
gas:
limit_multiplier: 300 # 300% of estimated gas
price_multiplier: 3 # 300% of suggested gas price

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Inconsistent multipliers – 300 vs 3 both claim “300 %”
limit_multiplier is set to 300 (3 ×), while price_multiplier is 3 (also 3 ×). Choose a single scale (either 3 or 300) to avoid mis-reading at runtime.

-limit_multiplier: 300 # 300% of estimated gas
-price_multiplier: 3   # 300% of suggested gas price
+limit_multiplier: 3   # 300% of estimated gas
+price_multiplier: 3   # 300% of suggested gas price
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
gas:
limit_multiplier: 300 # 300% of estimated gas
price_multiplier: 3 # 300% of suggested gas price
gas:
limit_multiplier: 3 # 300% of estimated gas
price_multiplier: 3 # 300% of suggested gas price
🤖 Prompt for AI Agents
In etc/vultisig/fee.yml around lines 5 to 7, the gas multipliers are
inconsistent: limit_multiplier is set to 300 (300%) while price_multiplier is
set to 3 (3×), both commented as 300%. Choose one scale for both multipliers,
either 3 or 300, and update the values and comments accordingly to ensure
consistent interpretation at runtime.

Comment thread fee.server.example.json Outdated
Comment thread fee.worker.example.json Outdated
Comment thread docker-compose.yaml
Comment thread docker-compose.dev.yaml Outdated
Comment thread docker-compose.dev.yaml Outdated
Comment on lines +10 to +11
DATABASE_DSN: postgres://myuser:mypassword@plugin-db:5432/vultisig-fee?sslmode=disable
volumes:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Credentials in DSN leak secrets

Same issue as production compose—move myuser:mypassword into secrets or an env-file.

🧰 Tools
🪛 Checkov (3.2.334)

[MEDIUM] 10-11: Basic Auth Credentials

(CKV_SECRET_4)

🤖 Prompt for AI Agents
In docker-compose.dev.yaml around lines 10 to 11, the DATABASE_DSN environment
variable contains hardcoded credentials which leak secrets. To fix this, remove
the username and password from the DSN string and instead reference them
securely via Docker secrets or an environment file. Update the compose file to
load these credentials from the secrets or env-file and construct the DSN
dynamically or via environment variables without exposing sensitive information
directly in the compose file.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
Dockerfile.Fee.server (1)

14-18: Same supply-chain & reproducibility concern as the dev Dockerfile

Pin the go-wrappers archive to a commit/tag and verify its checksum (see earlier suggestion).

🧹 Nitpick comments (6)
fee.server.example.json (1)

17-23: Block storage host inconsistency with worker configuration.

The block storage host uses localhost:9100 while the worker configuration uses minio-plugin:9000. For consistency and proper containerized networking, consider using the same service name and port.

-        "host": "http://localhost:9100",
+        "host": "http://minio-plugin:9000",
Dockerfile.Fee.server.dev (1)

26-34: Use a static .air.toml instead of a long echo chain

Committing the file (or templating it) improves readability and avoids brittle multilines in the Dockerfile.

docker-compose.yaml (2)

82-82: Remove trailing whitespace to satisfy linters

-      - "8081:8080" 
+      - "8081:8080"-      - "8082:8080" 
+      - "8082:8080"

Also applies to: 125-125


113-146: Reduce duplication with YAML anchors

REDIS_*, BLOCK_STORAGE_HOST, and DATABASE_DSN are repeated four times.
Consider anchors & aliases (or an env-file) to keep the file DRY and ease future edits.

docker-compose.dev.yaml (1)

34-34: Lint errors: trailing space & missing newline

-  minio_data: 
+  minio_data:
+

Also applies to: 37-37

Dockerfile.Fee.server (1)

25-32: Large runtime image & runs as root

Moving to a slim base (e.g. gcr.io/distroless/cc) and adding a non-root user will cut image size and harden security:

-FROM ubuntu:24.04
+FROM gcr.io/distroless/cc-# Run the application
-CMD ["./server"]
+USER 10001:10001  # non-privileged
+ENTRYPOINT ["/app/server"]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27627fa and ac59b12.

📒 Files selected for processing (11)
  • Dockerfile.Fee.server (1 hunks)
  • Dockerfile.Fee.server.dev (1 hunks)
  • Makefile (1 hunks)
  • cmd/fees/worker/main.go (1 hunks)
  • docker-compose.dev.yaml (1 hunks)
  • docker-compose.yaml (4 hunks)
  • etc/vultisig/fee.yml (1 hunks)
  • fee.server.example.json (1 hunks)
  • fee.worker.example.json (1 hunks)
  • fee_config.example.json (0 hunks)
  • init-scripts/01_create_vultisig_plugin.sql (1 hunks)
💤 Files with no reviewable changes (1)
  • fee_config.example.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • etc/vultisig/fee.yml
🧰 Additional context used
🧠 Learnings (6)
cmd/fees/worker/main.go (1)
Learnt from: RaghavSood
PR: vultisig/plugin#75
File: storage/postgres/db_plugin.go:25-40
Timestamp: 2025-05-30T02:44:31.711Z
Learning: The embed.FS directive `//go:embed migrations/plugin/*.sql` in storage/postgres/db_plugin.go correctly embeds plugin migration files that exist in the storage/postgres/migrations/plugin/ directory. The path "migrations/plugin" passed to goose.Up() references the embedded filesystem structure, not the physical file system path.
docker-compose.dev.yaml (2)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
docker-compose.yaml (3)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
Makefile (1)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
fee.server.example.json (4)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config from the external package "github.com/vultisig/verifier/vault_config" in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). The vault_config.Config struct contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
fee.worker.example.json (5)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: fee.worker.example.json:9-9
Timestamp: 2025-07-03T15:54:18.752Z
Learning: In configuration files, local_party_prefix values can contain hexadecimal digit patterns like "feee" which are intentional, not typos.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config from the external package "github.com/vultisig/verifier/vault_config" in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). The vault_config.Config struct contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: cmd/payroll/worker/main.go:84-84
Timestamp: 2025-07-02T04:58:30.139Z
Learning: VaultServiceConfig is defined as a field of type vault_config.Config in worker configuration structs across the vultisig/plugin codebase (cmd/payroll/worker/config.go, cmd/fees/worker/config.go, cmd/dca/worker/config.go). It contains an EncryptionSecret field that can be accessed via cfg.VaultServiceConfig.EncryptionSecret.
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
🪛 YAMLlint (1.37.1)
docker-compose.dev.yaml

[error] 34-34: trailing spaces

(trailing-spaces)


[error] 37-37: no new line character at the end of file

(new-line-at-end-of-file)

docker-compose.yaml

[error] 82-82: trailing spaces

(trailing-spaces)


[error] 125-125: trailing spaces

(trailing-spaces)

🪛 Checkov (3.2.334)
docker-compose.yaml

[MEDIUM] 80-81: Basic Auth Credentials

(CKV_SECRET_4)

fee.server.example.json

[MEDIUM] 9-10: Basic Auth Credentials

(CKV_SECRET_4)

fee.worker.example.json

[MEDIUM] 31-32: Basic Auth Credentials

(CKV_SECRET_4)

🪛 checkmake (0.2.2)
Makefile

[warning] 6-6: Missing required phony target "all"

(minphony)


[warning] 6-6: Missing required phony target "clean"

(minphony)


[warning] 6-6: Missing required phony target "test"

(minphony)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (7)
init-scripts/01_create_vultisig_plugin.sql (1)

1-3: LGTM! Database creation script is well-structured.

The SQL script correctly creates the required databases for the fee plugin infrastructure. The naming convention is consistent and aligns with the service architecture introduced in this PR.

cmd/fees/worker/main.go (1)

59-61: Excellent error handling improvement!

Adding proper error handling for the postgres.NewPostgresBackend call prevents potential nil pointer dereferences and provides clear error messages for debugging. The error wrapping follows Go best practices.

fee.worker.example.json (1)

1-33: Configuration file is well-structured and complete.

The JSON configuration covers all necessary components for the fee worker service including server endpoints, vault service parameters, Redis connection, block storage, monitoring, and database configuration. The structure aligns well with the Docker Compose setup introduced in this PR.

Makefile (3)

3-3: Good addition of DYLD_LIBRARY_PATH for native library support.

The new environment variable properly supports the native library requirements for the fee services, complementing the existing DYLD_LIBRARY variable.


6-6: Well-maintained .PHONY declaration.

The .PHONY declaration properly includes all targets, preventing conflicts with files of the same name and ensuring targets always execute.


11-25: Excellent development workflow support.

The new targets (up-dev, down-dev, build, build-dev) provide clean separation between production and development environments using Docker Compose override files. The implementation follows consistent patterns with existing targets.

Dockerfile.Fee.server.dev (1)

14-21: Un-pinned GitHub archive → unreproducible & potentially unsafe image

master.tar.gz changes on every commit; no checksum is verified.
Pin to a commit SHA/tag and verify its digest, then delete the archive to keep the layer slim:

-RUN wget https://github.com/vultisig/go-wrappers/archive/refs/heads/master.tar.gz
-RUN tar -xzf master.tar.gz && \
+ARG WRAPPER_SHA=06d7c3d            # example pinned commit
+RUN wget -q https://github.com/vultisig/go-wrappers/archive/${WRAPPER_SHA}.tar.gz -O wrappers.tar.gz && \
+    echo "2e6f…  wrappers.tar.gz" | sha256sum -c - && \
+    tar -xzf wrappers.tar.gz && \
     cd go-wrappers-${WRAPPER_SHA} && \
     mkdir -p /usr/local/lib/dkls && \
     cp --recursive includes /usr/local/lib/dkls && \
-    cd .. && rm -rf go-wrappers-* master.tar.gz
+    cd .. && rm -rf go-wrappers-* wrappers.tar.gz
⛔ Skipped due to learnings
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: Dockerfile.Payroll.server:14-19
Timestamp: 2025-07-02T04:55:36.331Z
Learning: In the vultisig/plugin repository, the team maintains both the main repository and the go-wrappers dependency repository, so they are comfortable downloading from the master branch rather than pinning to specific commits.

Comment thread Dockerfile.Fee.server.dev
Comment on lines +1 to +2
# Use the official Go image as the base image
FROM golang:1.24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Pin to an existing Go release – 1.24 does not yet exist

The official images only go up to 1.22.x at the moment. Referencing a non-existent tag will break the build once the cache is bust.
Update to the latest stable (e.g. golang:1.22-alpine) or pin a specific patch version.

🤖 Prompt for AI Agents
In Dockerfile.Fee.server.dev at lines 1 to 2, the base image is set to
golang:1.24, which does not exist yet and will cause build failures. Update the
FROM line to use an existing stable Go version tag such as golang:1.22-alpine or
a specific patch version like golang:1.22.9-alpine to ensure the image is
available and the build succeeds.

Comment thread Dockerfile.Fee.server
Comment on lines +1 to +2
# Use the official Go image as the base image
FROM golang:1.24 as builder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Invalid base tag – Go 1.24 image not yet published

Switch to an existing tag (golang:1.22, etc.) or your private registry mirror.

🤖 Prompt for AI Agents
In Dockerfile.Fee.server at lines 1 to 2, the base image tag 'golang:1.24' is
invalid because it is not yet published. Change the base image tag to a valid
existing version such as 'golang:1.22' or use a tag from your private registry
mirror to ensure the image can be pulled successfully.

johnnyluo
johnnyluo previously approved these changes Jul 4, 2025

@johnnyluo johnnyluo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
docker-compose.yaml (1)

84-85: Plain-text DB credentials — already discussed

This exact point was covered in the previous review and accepted for local-dev context, so nothing to change here.

Also applies to: 106-107, 127-128, 149-150

🧹 Nitpick comments (2)
docker-compose.yaml (2)

86-86: Remove trailing whitespace to satisfy YAMLlint

yaml-lint is failing on these lines due to a single blank after the last token. No functional impact, but it blocks clean CI runs and clutters git history.

-      - "8081:8080"␠
+      - "8081:8080"

-      - "8082:8080"␠
+      - "8082:8080"

-  minio_data: ␠
+  minio_data:

Also applies to: 129-129, 162-162


117-158: Reduce copy-pasted blocks with YAML anchors / env_file

fee-server and fee-worker repeat the same build, environment, depends_on, and networks sections. This duplication increases maintenance surface (four DSN edits instead of one, etc.).

Minimal example using anchors:

  &fee-template
  fee-common: &fee-common
    build:
      context: .
      platforms: [linux/amd64]
    environment:
      REDIS_HOST: redis-fees
      REDIS_PORT: 6379
      BLOCK_STORAGE_HOST: http://minio-plugin:9000
      DATABASE_DSN: postgres://myuser:mypassword@plugin-db:5432/vultisig-fee?sslmode=disable
    depends_on:
      plugin-db: { condition: service_healthy }
      redis-fees: { condition: service_healthy }
      minio-plugin: { condition: service_started }
    networks: [shared_network]

  fee-server:
    <<: *fee-common
    build:
      dockerfile: Dockerfile.Fee.server
    ports: ["8082:8080"]

  fee-worker:
    <<: *fee-common
    build:
      dockerfile: Dockerfile.Fee.worker

Alternatives: move the variables to an env_file, or use x- extension fields (Compose v3.9+).
Not urgent, but worthwhile for long-term maintainability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac59b12 and 076b88d.

📒 Files selected for processing (1)
  • docker-compose.yaml (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
docker-compose.yaml (3)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
🪛 Checkov (3.2.334)
docker-compose.yaml

[MEDIUM] 84-85: Basic Auth Credentials

(CKV_SECRET_4)

🪛 YAMLlint (1.37.1)
docker-compose.yaml

[error] 86-86: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)


[error] 162-162: trailing spaces

(trailing-spaces)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
docker-compose.yaml (1)

84-85: Plain-text DSNs acknowledged – previous discussion applies
These lines still embed myuser:mypassword. Per the prior conversation we had in this PR, this is acceptable for local-dev only and no further action is needed.

Also applies to: 106-107, 127-128, 149-150

🧹 Nitpick comments (2)
docker-compose.yaml (2)

21-47: Factor out the two Redis service blocks to cut duplication
redis-payroll and redis-fees are byte-for-byte identical apart from the host-port mapping and volume name. Collapsing the common parts into an anchor/alias (or a Compose extension field) keeps the file shorter and lowers the chance of future drift.

Example sketch:

x-redis-common: &redis-common
  image: redis:latest
  networks: [shared_network]
  healthcheck:
    test: ["CMD", "redis-cli", "ping"]
    interval: 1s
    timeout: 5s
    retries: 3

services:
  redis-payroll:
    <<: *redis-common
    ports: ["6378:6379"]
    volumes: [redis_payroll:/data]

  redis-fees:
    <<: *redis-common
    ports: ["6377:6379"]
    volumes: [redis_fees:/data]

This keeps the intent clear while avoiding copy-paste maintenance.


86-86: Strip trailing whitespace to satisfy YAML lint
yamllint flags trailing spaces on these lines. Removing them keeps CI tools quiet and avoids noisy diffs later.

-      - "8081:8080"␠
+      - "8081:8080"

(similarly for lines 129 and 162)

Also applies to: 129-129, 162-162

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 076b88d and daa9ac8.

📒 Files selected for processing (1)
  • docker-compose.yaml (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
docker-compose.yaml (3)
Learnt from: garry-sharp
PR: vultisig/plugin#113
File: docker-compose.yaml:80-81
Timestamp: 2025-07-03T15:55:04.565Z
Learning: For docker-compose.yaml files used for local development builds, hardcoded database credentials like "myuser:mypassword" in DATABASE_DSN environment variables are acceptable since they're only used locally and not exposed to external networks.
Learnt from: RaghavSood
PR: vultisig/plugin#70
File: .github/workflows/migration-test.yml:14-17
Timestamp: 2025-05-27T04:28:20.414Z
Learning: In GitHub Actions workflows for testing, hardcoded database credentials are acceptable when using ephemeral test services (like PostgreSQL containers) that only exist during the CI run, as there's no security risk with temporary test environments.
Learnt from: johnnyluo
PR: vultisig/plugin#108
File: payroll.worker.example.json:8-8
Timestamp: 2025-07-02T04:57:55.842Z
Learning: Example configuration files (files with ".example." in the name) for local testing purposes are allowed to have weak or placeholder encryption secrets like "test123" since they are templates meant to be replaced with secure values in production deployments.
🪛 Checkov (3.2.334)
docker-compose.yaml

[MEDIUM] 84-85: Basic Auth Credentials

(CKV_SECRET_4)

🪛 YAMLlint (1.37.1)
docker-compose.yaml

[error] 86-86: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)


[error] 162-162: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
docker-compose.yaml (1)

165-167: Verify that the external network exists before docker compose up
Because shared_network is marked external: true, developers need to create it once (docker network create shared_network) or Compose will fail. Confirm this is documented in the README/Makefile so first-time contributors don’t hit a dead end.

@johnnyluo johnnyluo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@garry-sharp
garry-sharp merged commit fe06fa4 into main Jul 4, 2025
3 checks passed
@garry-sharp
garry-sharp deleted the fee-local-config-changes branch July 4, 2025 10:13
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.

3 participants