forked from Stellar-Uzima/Uzima-Contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypto_audit.sh
More file actions
executable file
·48 lines (38 loc) · 1.41 KB
/
Copy pathcrypto_audit.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# crypto_audit.sh - Targeted cryptographic/security checks for Uzima contracts
#
# This script is intended for developer workstations/CI (it runs cargo commands).
set -euo pipefail
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
print_header() { echo -e "\n${BLUE}>>> $1${NC}"; }
print_ok() { echo -e "${GREEN}✓ $1${NC}"; }
print_warn() { echo -e "${YELLOW}⚠ $1${NC}"; }
print_err() { echo -e "${RED}✗ $1${NC}" >&2; }
trap 'print_err "crypto audit failed"' ERR
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$PROJECT_ROOT"
print_header "Format"
cargo fmt -- --check
print_ok "cargo fmt --check"
print_header "Clippy (crypto-related crates)"
cargo clippy -p medical_records -p crypto_registry -p homomorphic_registry -p mpc_manager --all-targets --all-features -- -D warnings
print_ok "cargo clippy"
print_header "Tests (crypto-related crates)"
cargo test -p medical_records -p crypto_registry -p homomorphic_registry -p mpc_manager
print_ok "cargo test"
print_header "Cargo audit (optional)"
if command -v cargo-audit >/dev/null 2>&1; then
# Advisory DB fetch may require network; tolerate failure in restricted environments.
if cargo audit; then
print_ok "cargo audit"
else
print_warn "cargo audit failed (network/DB unavailable?)"
fi
else
print_warn "cargo-audit not installed"
print_warn "Install with: cargo install cargo-audit"
fi