@solana-epic/github-action 0.1.0-beta.1 → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # EPIC
2
+
3
+ <p align="center">
4
+ <b>Upgrade Intelligence for Solana Programs</b>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@solana-epic/cli"><img src="https://img.shields.io/npm/v/@solana-epic/cli.svg?style=flat-square&color=blue" alt="npm version" /></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/solana-epic/epic.svg?style=flat-square" alt="license" /></a>
10
+ <a href="https://github.com/solana-epic/epic/releases"><img src="https://img.shields.io/github/v/release/solana-epic/epic.svg?style=flat-square&color=orange" alt="GitHub release" /></a>
11
+ <a href="https://github.com/solana-epic/epic/actions"><img src="https://img.shields.io/github/actions/workflow/status/solana-epic/epic/test.yml?branch=main&style=flat-square" alt="GitHub Actions status" /></a>
12
+ </p>
13
+
14
+ ---
15
+
16
+ EPIC is the deployment readiness and upgrade intelligence infrastructure for Solana programs. Positioned between git push and mainnet, EPIC evaluates state layout evolution, ABI compatibility, and security regressions to answer a simple question before you deploy:
17
+
18
+ **"Can this upgrade safely reach mainnet?"**
19
+
20
+ ---
21
+
22
+ ## Why EPIC Exists
23
+
24
+ Standard developer tooling tells you if your code compiles. Security scanners tell you if a codebase has known vulnerabilities. **Neither tells you if the transition between your old deployment and your new code will break state on mainnet.**
25
+
26
+ Every Solana program upgrade is a high-risk migration. A minor type shift, field reordering, or missing state reload can corrupt deserialization layouts, lock user accounts, or introduce severe security regressions.
27
+
28
+ EPIC catches these upgrade compatibility issues and regressions in local development and on every pull request.
29
+
30
+ ---
31
+
32
+ ## What EPIC Does
33
+
34
+ ### 1. Upgrade Compatibility (`epic check`)
35
+ Compare two program versions to verify layout compatibility and prevent state corruption.
36
+ ```
37
+ $ epic check ./old-program ./new-program
38
+
39
+ 🔍 Comparing Program Layouts...
40
+ [CRITICAL] Layout size decrease detected on struct Position: 56 bytes -> 48 bytes.
41
+ Account shrinkage can lead to mainnet deserialization failures.
42
+ Consider using realloc or adding padding fields to preserve layout sizing.
43
+ ```
44
+
45
+ ### 2. State Layout Analysis (`epic analyze`)
46
+ Track account layout evolution, serialized sizes, and memory offsets to manage state scaling.
47
+ ```
48
+ $ epic analyze .
49
+
50
+ 🔍 Analyzing State Account Layouts...
51
+ STATE ACCOUNTS:
52
+ ├── Vault (49 bytes) [program::lib] [Static]
53
+ └── Position (56 bytes) [program::lib] [Static]
54
+ ```
55
+
56
+ ### 3. Upgrade Safety Verification (`epic audit`)
57
+ Verify that modifications to instruction state rules and safety invariants do not introduce security regressions.
58
+ ```
59
+ $ epic audit .
60
+
61
+ 🔍 Verifying Invariant Safety...
62
+ [CRITICAL] EPIC-SEC-003: Missing Post-CPI Account Reload
63
+ Affected File: programs/vault/src/lib.rs:42
64
+ Context: State mutation of Vault account following CPI invocation
65
+ Recommendation: Reload local state cache (e.g. run vault.reload()?) after CPI.
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Installation
71
+
72
+ Install the CLI wrapper:
73
+ ```bash
74
+ npm install -g @solana-epic/cli
75
+ ```
76
+
77
+ Verify your installation:
78
+ ```bash
79
+ epic rules
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Quick Start
85
+
86
+ ### 1. Check Upgrade Compatibility
87
+ Compare your current working directory against a previous release or program folder:
88
+ ```bash
89
+ epic check ./old_release_dir ./new_release_dir
90
+ ```
91
+
92
+ ### 2. Run Layout Invariant Verification
93
+ Audit your codebase for security regressions before committing:
94
+ ```bash
95
+ epic audit .
96
+ ```
97
+
98
+ ### 3. Integrate with CI/CD
99
+ Incorporate upgrade checks directly into your pull requests. EPIC supports standard SARIF outputs for GitHub Actions integration:
100
+ ```yaml
101
+ - name: Run EPIC Upgrade Checks
102
+ run: npx @solana-epic/cli audit . -f sarif
103
+
104
+ - name: Upload Safety Report
105
+ uses: github/code-scanning-upload-aurora@v2
106
+ with:
107
+ sarif_file: sarif.json
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Safety Invariant Rules
113
+
114
+ EPIC parses Rust source code directly to ensure upgrade changes do not break safety invariants:
115
+
116
+ | Rule ID | Name | Severity | Description |
117
+ | :--- | :--- | :--- | :--- |
118
+ | **EPIC-SEC-001** | Owner Validation | Critical | Ensures mutable account write paths are guarded by ownership checks (`account.owner == program_id`). |
119
+ | **EPIC-SEC-002** | Signer Validation | Critical | Verifies privileged mutations check signer authority. |
120
+ | **EPIC-SEC-003** | Missing Post-CPI Reload | Critical | Flags reads/writes on stale deserialized state cached before a mutating CPI. |
121
+ | **EPIC-SEC-004** | PDA Seed Collision Risk | High | Identifies adjacent variable-length seeds lacking delimiters that could cause derivation collision. |
122
+ | **EPIC-SEC-005** | Arbitrary CPI Targets | Critical | Flags CPIs targeting dynamic program IDs without validations. |
123
+
124
+ To inspect a rule's criteria in detail, run:
125
+ ```bash
126
+ epic explain EPIC-SEC-001
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Architecture Overview
132
+
133
+ EPIC constructs control-flow representations of program ASTs and diffs state schemas across the following unified pipeline:
134
+ ```
135
+ Source Code ➔ Rust AST Parser ➔ Type Registry ➔ CFG Builder ➔ SSA Engine ➔ Dominance Tree ➔ GuardFacts IR ➔ Rules Analyzer
136
+ ```
137
+ For a deep dive into the compiler and engine architecture, see [docs/architecture.md](docs/architecture.md).
138
+
139
+ ---
140
+
141
+ ## Roadmap
142
+
143
+ * **IDL-based layout drift verification**: Track compatibility profiles directly via published IDLs.
144
+ * **Editor LSP integration**: Real-time IDE diagnostics for layout drift and offset alignment.
145
+ * **Migration assistance**: Automatically generate Anchor state migration wrappers.
146
+
147
+ ---
148
+
149
+ ## Contributing
150
+
151
+ We welcome contributions to EPIC! See [CONTRIBUTING.md](CONTRIBUTING.md) for local development setup, package structure, and submission guidelines.
152
+
153
+ ---
154
+
155
+ ## License
156
+
157
+ EPIC is open-source developer tooling licensed under the **MIT License**. See [LICENSE](LICENSE) for details.
package/action.yml CHANGED
@@ -15,9 +15,17 @@ inputs:
15
15
  description: 'Minimum severity level to trigger a non-zero exit code (Safe, Minor, Major, Critical)'
16
16
  required: false
17
17
  default: 'Critical'
18
+ config_path:
19
+ description: 'Path to epic.toml configuration file'
20
+ required: false
21
+
22
+ sarif_output:
23
+ description: 'Path where the SARIF report will be written'
24
+ required: false
25
+ default: 'epic-report.sarif'
18
26
  outputs:
19
27
  severity:
20
- description: 'Overall upgrade severity (Safe, Minor, Major, Critical)'
28
+ description: 'Overall upgrade severity (Compatible, Migration-Required, Blocked)'
21
29
  findings_count:
22
30
  description: 'Number of detected upgrade findings'
23
31
  runs: