Skip to content

Commit 024df58

Browse files
authored
release: Feature Freeze for Audit (#223)
feat: Major release with security hardening, fee policy enhancements, and infrastructure improvements ## Breaking Changes - Migrated to Solana SDK v3.0.x and updated all dependencies - Replaced custom Kora Signer with solana-signers crate - Removed `sign_transaction_if_paid` - all signing now validates pricing (FREE config maintains old behavior) - Removed `get_all_signers` function for security - Changed response types: removed signatures from `signAndSendTransaction` and `signTransaction` ## Security & Audit Fixes - Implemented constant-time HMAC verification - Added request body size limits to prevent server overload - Sanitized debug macros and loggers to prevent sensitive data exposure - Removed dangerous `.unwrap()` calls with proper error handling - Added overflow protection across all math operations - Enhanced ConfigValidator with security warnings for risky configurations - Fixed precision issues using fixed-point decimals for price calculations - Updated fee payer policies to secure defaults ## Fee System Enhancements - Extended fee payer policy support for SPL/Token2022 instructions (revoke, set authority, mint to, freeze/thaw account, etc.) - Enhanced fee payer outflow calculation to include SPL token transfers - Improved fee estimation efficiency (Free→instant, Fixed→simple calc, Margin→full calc) - Added support for multi-token payment transfers in single transaction - Refactored payment analysis to return transfer fees - Added "strict" mode for fixed fees (errors if total exceeds fixed amount) - Enhanced mint validation for PermanentDelegate and TransferHook extensions ## Developer Experience - Implemented Rust test runner replacing complex Makefiles - Added TypeScript test support with improved CI workflow - Added debug command targets for various test scenarios - Cleaned up test fixtures and removed duplicated code - Improved test performance with non-hardcoded ports and file reuse - Added exponential backoff for health checks ## Bug Fixes - Fixed inner instruction parsing for Parsed/PartiallyDecoded instructions - Fixed double fee counting in ATA + fee payer outflow calculation - Fixed index out of bounds in `uncompile_instructions` - Made price source non-optional throughout codebase - Updated transaction validation for safer account key retrieval ## Infrastructure & Tooling - Updated error handling in TurnkeySigner and PrivySigner - Added method validation middleware (separate from auth) - Enhanced logging for API failures and overflow scenarios - Migrated from gill to @solana/kit - Added git-cliff configuration for changelog generation - Improved Rust and SDK publish workflows ## Documentation - Updated security guidance for FREE/fixed fees and fee payer policies - Added warnings for permanent delegate risks - Clarified margin adjustment behavior - Updated usage_limit documentation - Enhanced ADDING_SIGNERS.md for solana-signers crate - Updated x402 demo and configuration guides ## Tests - Added comprehensive adversarial tests for fee payer policy violations - Added tests for SPL token transfer scenarios - Added tests for multi-payment analysis - Enhanced validation tests for new fee payer policies - Improved error assertion patterns
1 parent ece4b9b commit 024df58

File tree

198 files changed

+32785
-9500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+32785
-9500
lines changed
Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,15 @@
11
name: 'Cleanup Test Environment'
2-
description: 'Stop all test processes (Kora RPC, Solana validator, etc.)'
2+
description: 'Kill any remaining test processes (safety net for test runner failures)'
33

44
runs:
55
using: 'composite'
66
steps:
7-
- name: Stop test processes
7+
- name: Kill remaining processes
88
shell: bash
99
if: always()
1010
run: |
11-
echo "🧹 Cleaning up test environment..."
12-
13-
# Stop Kora RPC server using saved PID
14-
if [ -f /tmp/kora_pid ]; then
15-
KORA_PID=$(cat /tmp/kora_pid)
16-
if [ ! -z "$KORA_PID" ]; then
17-
echo "Stopping Kora RPC server (PID: $KORA_PID)"
18-
kill $KORA_PID 2>/dev/null || true
19-
fi
20-
rm -f /tmp/kora_pid
21-
fi
22-
23-
# Stop using environment variable as fallback
24-
if [ ! -z "$KORA_PID" ]; then
25-
echo "Stopping Kora RPC server (ENV PID: $KORA_PID)"
26-
kill $KORA_PID 2>/dev/null || true
27-
fi
28-
29-
# Stop Solana validator using saved PID
30-
if [ -f /tmp/validator_pid ]; then
31-
VALIDATOR_PID=$(cat /tmp/validator_pid)
32-
if [ ! -z "$VALIDATOR_PID" ]; then
33-
echo "Stopping Solana validator (PID: $VALIDATOR_PID)"
34-
kill $VALIDATOR_PID 2>/dev/null || true
35-
fi
36-
rm -f /tmp/validator_pid
37-
fi
38-
39-
# Stop using environment variable as fallback
40-
if [ ! -z "$VALIDATOR_PID" ]; then
41-
echo "Stopping Solana validator (ENV PID: $VALIDATOR_PID)"
42-
kill $VALIDATOR_PID 2>/dev/null || true
43-
fi
44-
45-
# Kill any remaining processes by name (nuclear option)
46-
echo "Killing any remaining test processes..."
11+
echo "🧹 Safety cleanup of any remaining processes..."
4712
pkill -f "solana-test-validator" 2>/dev/null || true
4813
pkill -f "kora" 2>/dev/null || true
49-
50-
# Wait a moment for processes to stop
51-
sleep 2
52-
14+
sleep 1
5315
echo "✅ Cleanup completed"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Run Test Runner"
2+
description: "Execute Kora integration tests using the test runner with specified filters"
3+
4+
inputs:
5+
filters:
6+
description: "Test filters to apply (e.g., '--filter regular --filter auth')"
7+
required: true
8+
verbose:
9+
description: "Enable verbose output"
10+
required: false
11+
default: "true"
12+
rpc-url:
13+
description: "Solana RPC URL to use"
14+
required: false
15+
default: "http://127.0.0.1:8899"
16+
force-refresh:
17+
description: "Force refresh of test accounts"
18+
required: false
19+
default: "false"
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: Run integration tests with test runner
25+
shell: bash
26+
run: |
27+
echo "🧪 Running integration tests with filters: ${{ inputs.filters }}"
28+
29+
# Build command arguments
30+
ARGS=""
31+
if [ "${{ inputs.verbose }}" = "true" ]; then
32+
ARGS="$ARGS --verbose"
33+
fi
34+
if [ "${{ inputs.force-refresh }}" = "true" ]; then
35+
ARGS="$ARGS --force-refresh"
36+
fi
37+
if [ "${{ inputs.rpc-url }}" != "http://127.0.0.1:8899" ]; then
38+
ARGS="$ARGS --rpc-url ${{ inputs.rpc-url }}"
39+
fi
40+
41+
# Add filters
42+
ARGS="$ARGS ${{ inputs.filters }}"
43+
44+
# Run the test runner
45+
cargo run -p tests --bin test_runner -- $ARGS

.github/actions/setup-kora-rpc/action.yml

Lines changed: 0 additions & 112 deletions
This file was deleted.

.github/actions/setup-solana-validator/action.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/badges/coverage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"schemaVersion": 1, "label": "coverage", "message": "85.5%", "color": "green"}
1+
{"schemaVersion": 1, "label": "coverage", "message": "85.7%", "color": "green"}

.github/cliff.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# git-cliff configuration for changelog generation
2+
# See: https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
header = ""
6+
body = """
7+
{% for group, commits in commits | group_by(attribute="group") %}
8+
### {{ group | upper_first }}
9+
{% for commit in commits %}
10+
- {{ commit.message | split(pat="\n") | first | trim }}
11+
{% endfor %}
12+
{% endfor %}
13+
"""
14+
trim = true
15+
16+
[git]
17+
conventional_commits = true
18+
filter_unconventional = true
19+
commit_parsers = [
20+
{ message = "^feat", group = "Features" },
21+
{ message = "^fix", group = "Bug Fixes" },
22+
{ message = "^perf", group = "Performance" },
23+
{ message = "^refactor", group = "Refactoring" },
24+
{ message = "^doc", group = "Documentation" },
25+
{ message = "^test", group = "Testing" },
26+
{ message = "^chore", skip = true },
27+
{ message = "^ci", skip = true },
28+
{ message = "^build", skip = true },
29+
]
30+
sort_commits = "newest"

.github/workflows/build-rust.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build Rust Artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cache-key:
7+
description: "Cache key suffix for rust cache"
8+
required: true
9+
type: string
10+
artifact-name:
11+
description: "Base name for the uploaded artifact"
12+
required: true
13+
type: string
14+
outputs:
15+
artifact-name:
16+
description: "The actual artifact name with hash suffix"
17+
value: ${{ jobs.build.outputs.artifact-name }}
18+
19+
jobs:
20+
build:
21+
name: Build Rust Artifacts
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 15
24+
outputs:
25+
artifact-name: ${{ inputs.artifact-name }}-${{ steps.source-hash.outputs.hash }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: dtolnay/rust-toolchain@stable
30+
31+
- uses: Swatinem/rust-cache@v2
32+
with:
33+
shared-key: ${{ inputs.cache-key }}
34+
35+
- name: Calculate source files hash
36+
id: source-hash
37+
run: |
38+
SOURCE_HASH=$(find crates tests Cargo.toml Cargo.lock Makefile makefiles -type f \( -name "*.rs" -o -name "*.toml" -o -name "Makefile" \) -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1 | head -c 8)
39+
echo "hash=$SOURCE_HASH" >> $GITHUB_OUTPUT
40+
echo "Source files hash: $SOURCE_HASH"
41+
42+
- name: Build workspace
43+
run: make build
44+
45+
- name: Upload build artifacts
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: ${{ inputs.artifact-name }}-${{ steps.source-hash.outputs.hash }}
49+
path: |
50+
target/debug/kora
51+
target/debug/test_runner
52+
retention-days: 1

0 commit comments

Comments
 (0)