Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4e8ca21
harden public HTTP handler
the-code-learner Aug 18, 2026
6c35053
test public HTTP hardening
the-code-learner Aug 18, 2026
f56f006
sign internal peer snapshot requests
the-code-learner Aug 18, 2026
68a5e1a
disable development endpoints by default
the-code-learner Aug 18, 2026
b3fcc35
add encrypted wallet backup types
the-code-learner Aug 18, 2026
c30be6e
encrypt wallet private keys at rest
the-code-learner Aug 18, 2026
914dd11
add encrypted wallet unlock flow
the-code-learner Aug 18, 2026
8771054
add backend and wallet CI
the-code-learner Aug 18, 2026
13c863d
protect node state file permissions
the-code-learner Aug 18, 2026
4ff32a6
document security posture
the-code-learner Aug 18, 2026
8bcdfc2
enable dependency update monitoring
the-code-learner Aug 18, 2026
8f3ebe2
fix WebCrypto buffer typing and key validation
the-code-learner Aug 18, 2026
17d6ec1
scope formatting check to changed Go files
the-code-learner Aug 18, 2026
6538120
gate wallet dependencies on high severity audit
the-code-learner Aug 18, 2026
1cada59
add one-shot wallet dependency refresh
the-code-learner Aug 18, 2026
b56e9ae
run dependency refresh once from pull request
the-code-learner Aug 18, 2026
23b2105
refresh vite toolchain and audited transitive dependencies
the-code-learner Aug 18, 2026
e719eab
update wallet dependencies
github-actions[bot] Aug 18, 2026
16878cf
remove one-shot dependency refresh workflow
the-code-learner Aug 18, 2026
e67de12
modernize GitHub Actions runtimes
the-code-learner Aug 18, 2026
902b333
add atomic ledger state persistence helper
the-code-learner Aug 18, 2026
ab58d7b
test atomic ledger state persistence
the-code-learner Aug 18, 2026
2416c24
add one-shot ledger persistence patch
the-code-learner Aug 18, 2026
88f3a83
scope persistence patch verification to ledger
the-code-learner Aug 18, 2026
4bfe6f7
make ledger state persistence atomic
github-actions[bot] Aug 18, 2026
fce0d5f
remove one-shot ledger persistence workflow
the-code-learner Aug 18, 2026
cab92ae
make atomic state persistence cross-platform
the-code-learner Aug 18, 2026
ad51ccf
harden node HTTP server lifecycle
the-code-learner Aug 18, 2026
a51b0f9
test node HTTP server hardening
the-code-learner Aug 18, 2026
51184cf
add one-shot process and docs hardening patch
the-code-learner Aug 18, 2026
6a27697
harden node HTTP defaults and update quick start
github-actions[bot] Aug 18, 2026
3049d0a
remove one-shot process hardening workflow
the-code-learner Aug 18, 2026
7188776
bound public HTTP request bodies
the-code-learner Aug 18, 2026
54c8b66
test public request body limits
the-code-learner Aug 18, 2026
8128457
proxy wallet dev API through same origin
the-code-learner Aug 18, 2026
b92831f
add one-shot wallet same-origin patch
the-code-learner Aug 18, 2026
0503f76
use same-origin wallet API by default
github-actions[bot] Aug 18, 2026
1c05b8a
reject DPoS stake overflows
the-code-learner Aug 18, 2026
7ec1319
test DPoS stake overflow rejection
the-code-learner Aug 18, 2026
1ffa9d3
remove one-shot wallet origin workflow
the-code-learner Aug 18, 2026
42531b7
add one-shot consensus test stability patch
the-code-learner Aug 18, 2026
f6d9fb4
stabilize asynchronous consensus tests
github-actions[bot] Aug 18, 2026
befe63f
add checked ledger arithmetic helpers
the-code-learner Aug 18, 2026
4abe59e
fix validator voting power arithmetic helper
the-code-learner Aug 18, 2026
029732d
test checked ledger arithmetic
the-code-learner Aug 18, 2026
4124a48
add saturating helper for defensive state reconstruction
the-code-learner Aug 18, 2026
9b5c0e4
test ledger overflow protections
the-code-learner Aug 18, 2026
73db935
add one-shot ledger arithmetic hardening patch
the-code-learner Aug 18, 2026
e1bac28
harden ledger arithmetic against overflow
github-actions[bot] Aug 18, 2026
fb8670b
remove one-shot consensus test workflow
the-code-learner Aug 18, 2026
2532513
remove one-shot ledger arithmetic workflow
the-code-learner Aug 18, 2026
340c1c8
reject aggregate DPoS voting power overflow
the-code-learner Aug 18, 2026
0fea0e1
test aggregate DPoS voting power overflow
the-code-learner Aug 18, 2026
3745571
test consensus timing ignores unsigned remote timestamps
the-code-learner Aug 18, 2026
805867e
add one-shot consensus timing hardening patch
the-code-learner Aug 18, 2026
1b62afd
keep consensus round timing local
github-actions[bot] Aug 18, 2026
16b7ca0
remove one-shot consensus timing workflow
the-code-learner Aug 18, 2026
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
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5

- package-ecosystem: npm
directory: /apps/wallet
schedule:
interval: weekly
open-pull-requests-limit: 5
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
go:
name: Go checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: false

- name: Check formatting of changed Go files
shell: bash
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"
else
base="${{ github.event.before }}"
fi

if [ -z "$base" ] || [[ "$base" =~ ^0+$ ]]; then
base="$(git rev-list --max-parents=0 HEAD)"
fi

mapfile -t files < <(git diff --name-only --diff-filter=ACMRT "$base" HEAD -- '*.go')
if [ "${#files[@]}" -eq 0 ]; then
echo "No changed Go files to format-check."
exit 0
fi

unformatted="$(gofmt -l "${files[@]}")"
if [ -n "$unformatted" ]; then
echo "The following changed Go files need gofmt:"
echo "$unformatted"
exit 1
fi

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

- name: Test
run: go test ./...

wallet:
name: Wallet build
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/wallet
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
cache-dependency-path: apps/wallet/package-lock.json

- name: Install dependencies
run: npm ci

- name: Audit production and build dependencies
run: npm audit --audit-level=high

- name: Type-check and build
run: npm run build
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Implemented today:
- Go HTTP node entrypoint in `cmd/node`
- DPoS election primitives and tests in `internal/dpos`
- transaction envelope validation in `internal/tx`
- durable accounts, mempool, committed blocks, restart-safe state, and snapshot restore in `internal/ledger`
- durable accounts, mempool, committed blocks, atomic restart-safe state persistence, and snapshot restore in `internal/ledger`
- durable validator-set snapshots with versioning, proposer scheduling, and quorum summaries in `internal/ledger`
- durable consensus round state with restart-safe height, round, and round-start tracking in `internal/ledger`
- durable signed consensus proposals, validator votes, and quorum certificates in `internal/ledger`
Expand All @@ -28,7 +28,7 @@ Implemented today:
- consensus visibility endpoints for status, validator snapshots, active round inspection, proposer schedule inspection, latest consensus artifacts, and next-block template preview
- operator-facing observability endpoints for readiness, alerts, SLO summaries, alert-rule exports, recording-rule exports, dashboard bundles, Grafana dashboard export, JSON metrics, Prometheus metrics, and structured logs
- Vue wallet in `apps/wallet`
- wallet account generation, import/export, local signing, account inspection, faucet funding, and transaction broadcast
- wallet account generation, encrypted import/export, passphrase-protected local key storage, local signing, account inspection, faucet funding, and transaction broadcast

Implemented in this iteration:

Expand Down Expand Up @@ -97,21 +97,23 @@ PowerShell note: if your shell blocks `npm`, use `npm.cmd` instead.

### 1. Run one node

From the repository root:
From the repository root, enable development-only endpoints only when you need the local faucet or manual block tools:

```powershell
$env:ZEPHYR_ENABLE_DEV_ENDPOINTS="true"
go run ./cmd/node
```

By default the node:
For a normal node process, leave `ZEPHYR_ENABLE_DEV_ENDPOINTS` unset or set it to `false`. The node process:

- listens on `:8080`
- listens on `127.0.0.1:8080` by default; set `ZEPHYR_HTTP_ADDR` explicitly to bind another interface
- stores durable state in `var/node`
- produces blocks every `15s` when transactions are queued
- runs the consensus automation ticker every `1s`, but automation stays off until `ZEPHYR_ENABLE_CONSENSUS_AUTOMATION=true`
- uses a `5s` consensus round timeout once automation is enabled
- runs peer sync only if `ZEPHYR_PEERS` is configured
- exposes consensus status even before a validator set has been elected
- keeps `/v1/dev/*` unavailable unless `ZEPHYR_ENABLE_DEV_ENDPOINTS=true` is explicitly configured

Useful probes:

Expand Down Expand Up @@ -148,7 +150,7 @@ npm.cmd install
npm.cmd run dev
```

Vite serves the wallet on `http://localhost:5173` by default.
Vite serves the wallet on `http://localhost:5173` by default and proxies `/health`, `/v1`, and `/metrics` to `http://127.0.0.1:8080`, so local development stays same-origin in the browser. Set `ZEPHYR_WALLET_DEV_NODE` to change the dev proxy target, or `VITE_ZEPHYR_API_BASE` when intentionally targeting a different API origin.

### 3. Run a two-node local devnet

Expand Down
31 changes: 31 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Security Policy

Zephyr Chain is pre-production software. Do not use the current node, wallet, dev faucet, or consensus implementation to custody assets of real-world value.

## Current security posture

- The process-facing node handler disables `/v1/dev/*` endpoints by default. Local development that needs the faucet, block-template, or manual block-production endpoints must opt in with `ZEPHYR_ENABLE_DEV_ENDPOINTS=true`.
- Internal snapshot requests require a peer source header and follow the configured peer-identity policy. Validator deployments should configure `ZEPHYR_VALIDATOR_PRIVATE_KEY`, enable `ZEPHYR_REQUIRE_PEER_IDENTITY=true`, and pin peers with `ZEPHYR_PEER_VALIDATORS` where practical.
- The node entrypoint restricts its data directory to owner access and keeps `state.json` owner-readable/writable only on operating systems that implement POSIX-style permission bits.
- The browser wallet encrypts private-key material at rest with a passphrase-derived AES-256-GCM key. The passphrase is processed locally and is not sent to the node.
- A browser wallet remains exposed to browser-origin threats while unlocked. XSS, malicious extensions, compromised dependencies, or a compromised browser profile can still access in-memory key material. Hardware-backed signing and stronger key isolation remain future production work.

## Development endpoints

The following routes are development-only and should stay disabled on public deployments:

- `POST /v1/dev/faucet`
- `GET /v1/dev/block-template`
- `POST /v1/dev/produce-block`

Enable them only for an isolated development environment:

```text
ZEPHYR_ENABLE_DEV_ENDPOINTS=true
```

## Reporting a vulnerability

Please avoid publishing exploitable details in a public issue. Use the repository's private vulnerability-reporting or security-advisory flow when available. If no private reporting channel is enabled, open a minimal issue asking the maintainer for a private contact channel without including exploit details.

When reporting, include the affected commit, reproduction conditions, expected impact, and whether the issue affects consensus safety, key custody, peer authentication, state integrity, or denial-of-service resistance.
Loading