pipechecker 0.2.2 โ 0.2.5
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 +483 -119
- package/npm/pipechecker-darwin-arm64/pipechecker +0 -0
- package/npm/pipechecker-darwin-x64/pipechecker +0 -0
- package/npm/pipechecker-linux-arm64/pipechecker +0 -0
- package/npm/pipechecker-linux-x64/pipechecker +0 -0
- package/npm/pipechecker-x64.exe/pipechecker.exe +0 -0
- package/package.json +1 -1
- package/scripts/install.js +3 -3
package/README.md
CHANGED
|
@@ -1,206 +1,570 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PipeChecker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://crates.io/crates/pipecheck)
|
|
5
|
-
[](https://www.npmjs.com/package/pipecheck)
|
|
6
|
-
[](LICENSE-MIT)
|
|
3
|
+
> **Catch CI/CD pipeline errors before you push โ not after CI fails.**
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
[](https://github.com/Ayyankhan101/PipeChecker/actions/workflows/ci.yml)
|
|
6
|
+
[](https://crates.io/crates/pipechecker)
|
|
7
|
+
[](LICENSE-MIT)
|
|
8
|
+
[]()
|
|
9
|
+
[](Cargo.toml)
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
---
|
|
11
12
|
|
|
12
|
-
##
|
|
13
|
+
## What Problem Does This Solve?
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
Every developer has been here:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
๐ You push a small change โ CI fails 10 minutes later โ
|
|
19
|
+
you fix it โ push again โ CI fails again โ repeat 3 more times
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**PipeChecker runs locally** and validates your CI/CD workflows **before** you commit, so you catch:
|
|
23
|
+
|
|
24
|
+
| Catches | Example |
|
|
25
|
+
|---------|---------|
|
|
26
|
+
| โ **Circular dependencies** | Job A โ Job B โ Job A |
|
|
27
|
+
| โ **Missing job references** | `needs: [build]` but no `build` job exists |
|
|
28
|
+
| โ **Empty pipelines** | No jobs or steps defined |
|
|
29
|
+
| โ ๏ธ **Hardcoded secrets** | `API_KEY=sk_live_abc123` in env vars |
|
|
30
|
+
| โ ๏ธ **Undeclared env vars** | `${{ env.UNKNOWN }}` never defined |
|
|
31
|
+
| โ ๏ธ **Unpinned actions** | `uses: actions/checkout` without `@v4` |
|
|
32
|
+
| โ ๏ธ **Docker `:latest` tags** | `image: nginx:latest` (unreproducible builds) |
|
|
33
|
+
| โ ๏ธ **Missing job timeouts** | No `timeout-minutes` set โ jobs can run forever |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Visual Overview
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
41
|
+
โ YOUR WORKFLOW FILE โ
|
|
42
|
+
โ (.github/workflows/ci.yml) โ
|
|
43
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
44
|
+
โ
|
|
45
|
+
โผ
|
|
46
|
+
โโโโโโโโโโโโโโโโโโโโโโโโ
|
|
47
|
+
โ PIPECHECKER โ
|
|
48
|
+
โ โ
|
|
49
|
+
โ โโโโโโโโโโโโโโโโโโ โ
|
|
50
|
+
โ โ YAML Parser โ โ
|
|
51
|
+
โ โ GitHub/GitLab โ โ
|
|
52
|
+
โ โ CircleCI โ โ
|
|
53
|
+
โ โโโโโโโโโฌโโโโโโโโโ โ
|
|
54
|
+
โ โ โ
|
|
55
|
+
โ โโโโโโโโโผโโโโโโโโโ โ
|
|
56
|
+
โ โ Auditors โ โ
|
|
57
|
+
โ โ โ โ
|
|
58
|
+
โ โ ๐ Syntax โ โ
|
|
59
|
+
โ โ ๐ DAG/Cycle โ โ
|
|
60
|
+
โ โ ๐ Secrets โ โ
|
|
61
|
+
โ โ ๐ณ Docker โ โ
|
|
62
|
+
โ โ ๐ Pinning โ โ
|
|
63
|
+
โ โโโโโโโโโฌโโโโโโโโโ โ
|
|
64
|
+
โ โ โ
|
|
65
|
+
โโโโโโโโโโโโผโโโโโโโโโโโโ
|
|
66
|
+
โ
|
|
67
|
+
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
|
|
68
|
+
โผ โผ โผ
|
|
69
|
+
โ
PASS โ ๏ธ WARNINGS โ ERRORS
|
|
70
|
+
No issues Fix before Must fix
|
|
71
|
+
found! production before push
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Supported Platforms
|
|
77
|
+
|
|
78
|
+
| Platform | File Pattern | Status |
|
|
79
|
+
|----------|-------------|--------|
|
|
80
|
+
| **GitHub Actions** | `.github/workflows/*.yml` | โ
Full support |
|
|
81
|
+
| **GitLab CI** | `.gitlab-ci.yml` | โ
Full support |
|
|
82
|
+
| **CircleCI** | `.circleci/config.yml` | โ
Full support |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Installation
|
|
87
|
+
|
|
88
|
+
### From crates.io
|
|
89
|
+
```bash
|
|
90
|
+
cargo install pipechecker
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### From source
|
|
15
94
|
```bash
|
|
16
|
-
|
|
95
|
+
git clone https://github.com/Ayyankhan101/PipeChecker.git
|
|
96
|
+
cd PipeChecker
|
|
97
|
+
cargo install --path .
|
|
17
98
|
```
|
|
18
99
|
|
|
19
|
-
###
|
|
100
|
+
### Via npm (once published)
|
|
20
101
|
```bash
|
|
21
|
-
|
|
102
|
+
npm install -g pipechecker
|
|
22
103
|
```
|
|
23
104
|
|
|
24
|
-
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Quick Start
|
|
108
|
+
|
|
109
|
+
### 1. Check a single file
|
|
25
110
|
```bash
|
|
26
|
-
|
|
111
|
+
pipechecker .github/workflows/ci.yml
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2. Auto-detect your workflow
|
|
115
|
+
```bash
|
|
116
|
+
pipechecker
|
|
117
|
+
# โ Auto-detected: .github/workflows/ci.yml
|
|
118
|
+
# Provider: GitHubActions
|
|
119
|
+
# 0 errors, 0 warnings
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 3. Audit everything
|
|
123
|
+
```bash
|
|
124
|
+
pipechecker --all
|
|
125
|
+
# Checking 3 workflow file(s)...
|
|
126
|
+
#
|
|
127
|
+
# ๐ .github/workflows/ci.yml
|
|
128
|
+
# Provider: GitHubActions
|
|
129
|
+
# โ
No issues found
|
|
130
|
+
#
|
|
131
|
+
# ๐ .github/workflows/deploy.yml
|
|
132
|
+
# Provider: GitHubActions
|
|
133
|
+
# 1 errors, 2 warnings
|
|
134
|
+
# โ ERROR: Circular dependency detected (job: deploy)
|
|
135
|
+
# ๐ก Remove one of the dependencies to break the cycle
|
|
136
|
+
# โ ๏ธ WARNING: Job 'deploy' has no steps
|
|
137
|
+
#
|
|
138
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
139
|
+
# Total: 1 errors, 2 warnings across 3 files
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Interactive TUI
|
|
145
|
+
|
|
146
|
+
PipeChecker includes a **terminal UI** for browsing results across multiple files:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pipechecker --tui
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
154
|
+
โ ๐ Pipecheck - Interactive Mode โ
|
|
155
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
156
|
+
โ Workflows โ
|
|
157
|
+
โโถ โ deploy.yml โ 2 errors โ 1 warnings โ
|
|
158
|
+
โ โ
ci.yml โ 0 errors โ 0 warnings โ
|
|
159
|
+
โ โ ๏ธ lint.yml โ 0 errors โ 3 warnings โ
|
|
160
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
161
|
+
โ [โ/โ] Navigate [Enter] Details [Q] Quitโ
|
|
162
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Keyboard shortcuts:**
|
|
166
|
+
|
|
167
|
+
| Key | Action |
|
|
168
|
+
|-----|--------|
|
|
169
|
+
| `โ` / `k` | Move up |
|
|
170
|
+
| `โ` / `j` | Move down |
|
|
171
|
+
| `Enter` / `Space` | Toggle detail view |
|
|
172
|
+
| `q` / `Esc` | Quit |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## All CLI Flags
|
|
177
|
+
|
|
178
|
+
| Flag | Description |
|
|
179
|
+
|------|-------------|
|
|
180
|
+
| `FILE` | Path to a specific workflow file |
|
|
181
|
+
| `--all`, `-a` | Audit **all** discovered workflow files |
|
|
182
|
+
| `--tui` | Launch the interactive terminal UI |
|
|
183
|
+
| `--watch`, `-w` | Watch for file changes and re-run audits |
|
|
184
|
+
| `--fix` | Auto-fix issues (pin unpinned actions + Docker `:latest` tags) |
|
|
185
|
+
| `--install-hook` | Install a git pre-commit hook |
|
|
186
|
+
| `--format`, `-f` `<text\|json>` | Output format (default: `text`) |
|
|
187
|
+
| `--strict`, `-s` | Treat warnings as errors (exit code 1) |
|
|
188
|
+
| `--quiet`, `-q` | Only output errors โ suppress warnings and info. Perfect for CI |
|
|
189
|
+
| `--verbose` | Show diagnostic info (auditors ran, per-severity counts, discovered files) |
|
|
190
|
+
| `--no-pinning` | Skip Docker image and action-pinning checks |
|
|
191
|
+
| `--version` | Show version |
|
|
192
|
+
| `--help` | Show help |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Output Explained
|
|
197
|
+
|
|
198
|
+
### Severity Levels
|
|
199
|
+
|
|
200
|
+
| Symbol | Level | Meaning |
|
|
201
|
+
|--------|-------|---------|
|
|
202
|
+
| โ | **Error** | Must fix โ will break your pipeline |
|
|
203
|
+
| โ ๏ธ | **Warning** | Should fix โ may cause issues later |
|
|
204
|
+
| โน๏ธ | **Info** | Informational โ nothing to worry about |
|
|
205
|
+
|
|
206
|
+
### Example output with details
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
Provider: GitHubActions
|
|
210
|
+
2 errors, 1 warnings
|
|
211
|
+
|
|
212
|
+
โ ERROR: Circular dependency detected (job: deploy) [line 42]
|
|
213
|
+
๐ก Remove one of the dependencies to break the cycle
|
|
214
|
+
|
|
215
|
+
โ ERROR: Job 'deploy' depends on non-existent job 'build' (job: deploy) [line 45]
|
|
216
|
+
๐ก Add a job with id 'build' or remove the dependency
|
|
217
|
+
|
|
218
|
+
โ ๏ธ WARNING: Job 'lint' has no steps (job: lint) [line 12]
|
|
219
|
+
๐ก Add steps to perform work in this job
|
|
27
220
|
```
|
|
28
221
|
|
|
29
|
-
|
|
222
|
+
Each issue includes:
|
|
223
|
+
- **What** went wrong (clear message)
|
|
224
|
+
- **Where** it happened (job name + line number)
|
|
225
|
+
- **How** to fix it (actionable suggestion)
|
|
30
226
|
|
|
31
|
-
|
|
32
|
-
- ๐ **Dependency Analysis** - Detect circular dependencies in job workflows
|
|
33
|
-
- ๐ **Secrets Auditing** - Identify hardcoded secrets and environment variable issues
|
|
34
|
-
- ๐ณ **Docker Validation** - Check Docker image references and tags
|
|
35
|
-
- ๐ **Multiple Output Formats** - Text and JSON output for CI integration
|
|
36
|
-
- โก **Fast** - Written in Rust for maximum performance
|
|
37
|
-
- ๐ฏ **Zero Config** - Works out of the box
|
|
227
|
+
---
|
|
38
228
|
|
|
39
|
-
##
|
|
229
|
+
## JSON Output
|
|
40
230
|
|
|
41
|
-
|
|
231
|
+
Perfect for CI/CD integration or programmatic consumption:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
pipechecker --format json
|
|
42
235
|
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"provider": "GitHubActions",
|
|
240
|
+
"issues": [
|
|
241
|
+
{
|
|
242
|
+
"severity": "Error",
|
|
243
|
+
"message": "Circular dependency detected: job-a -> job-b -> job-a",
|
|
244
|
+
"location": { "line": 42, "column": 3, "job": "deploy" },
|
|
245
|
+
"suggestion": "Remove one of the dependencies to break the cycle"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"summary": "1 errors, 0 warnings"
|
|
249
|
+
}
|
|
49
250
|
```
|
|
50
251
|
|
|
51
|
-
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Modes of Operation
|
|
255
|
+
|
|
256
|
+
### ๐ง Auto-Fix Mode
|
|
257
|
+
Automatically pins unpinned GitHub Actions to known versions:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
pipechecker --fix
|
|
52
261
|
```
|
|
53
|
-
|
|
54
|
-
โ โ ERROR: Circular dependency detected: job-a -> job-c -> job-b
|
|
55
|
-
โ Fix immediately
|
|
56
|
-
โ git push with confidence โ
|
|
262
|
+
|
|
57
263
|
```
|
|
264
|
+
๐ง Auto-fix mode
|
|
265
|
+
|
|
266
|
+
โจ Fixed 2 issue(s) in .github/workflows/ci.yml:
|
|
267
|
+
|
|
268
|
+
actions/checkout โ actions/checkout@v4
|
|
269
|
+
actions/setup-node โ actions/setup-node@v4
|
|
58
270
|
|
|
59
|
-
|
|
271
|
+
๐ก Review the changes and commit them!
|
|
272
|
+
```
|
|
60
273
|
|
|
61
|
-
###
|
|
274
|
+
### ๐ Watch Mode
|
|
275
|
+
Monitors workflow files and re-runs on every save โ perfect for development:
|
|
62
276
|
|
|
63
277
|
```bash
|
|
64
|
-
|
|
65
|
-
|
|
278
|
+
pipechecker --watch
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
๐ Watching for workflow changes...
|
|
283
|
+
Press Ctrl+C to stop
|
|
66
284
|
|
|
67
|
-
|
|
68
|
-
|
|
285
|
+
๐ File changed: .github/workflows/ci.yml
|
|
286
|
+
Provider: GitHubActions
|
|
287
|
+
0 errors, 0 warnings
|
|
288
|
+
โ
All checks passed
|
|
289
|
+
```
|
|
69
290
|
|
|
70
|
-
|
|
71
|
-
|
|
291
|
+
### ๐คซ Quiet Mode (CI-Friendly)
|
|
292
|
+
Only output errors โ suppress warnings and info. Perfect for CI pipelines where you want clean output:
|
|
72
293
|
|
|
73
|
-
|
|
74
|
-
|
|
294
|
+
```bash
|
|
295
|
+
pipechecker --quiet
|
|
296
|
+
# or
|
|
297
|
+
pipechecker -q
|
|
75
298
|
```
|
|
76
299
|
|
|
77
|
-
|
|
300
|
+
```
|
|
301
|
+
โ Circular dependency detected (job: deploy) (in .github/workflows/deploy.yml)
|
|
302
|
+
```
|
|
78
303
|
|
|
304
|
+
Exit code is still `1` if there are errors โ works perfectly with `--strict` for failing CI on any issue.
|
|
305
|
+
|
|
306
|
+
### ๐ข Verbose Mode
|
|
307
|
+
See exactly what PipeChecker is doing โ which files it found, which auditors ran, and per-severity breakdowns:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
pipechecker --verbose
|
|
79
311
|
```
|
|
80
|
-
CI/CD Pipeline Auditor - Catch errors before you push
|
|
81
312
|
|
|
82
|
-
|
|
313
|
+
```
|
|
314
|
+
๐ Auditing: .github/workflows/ci.yml
|
|
315
|
+
๐ Auditors ran: syntax, dag, secrets, pinning
|
|
316
|
+
๐ Found: 0 errors, 1 warnings, 0 info
|
|
317
|
+
โฑ๏ธ Checked in 3.2ms
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### โฑ๏ธ Timing Metrics
|
|
321
|
+
Every audit now shows how long it took โ because speed matters:
|
|
83
322
|
|
|
84
|
-
|
|
85
|
-
|
|
323
|
+
```bash
|
|
324
|
+
pipechecker .github/workflows/ci.yml
|
|
325
|
+
```
|
|
86
326
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
--tui Interactive terminal UI mode
|
|
93
|
-
-f, --format <FORMAT> Output format (text, json) [default: text]
|
|
94
|
-
--no-docker Skip Docker image checks
|
|
95
|
-
-s, --strict Enable strict mode (warnings as errors)
|
|
96
|
-
-h, --help Print help
|
|
97
|
-
-V, --version Print version
|
|
327
|
+
```
|
|
328
|
+
Provider: GitHubActions
|
|
329
|
+
0 errors, 0 warnings
|
|
330
|
+
โ
All checks passed
|
|
331
|
+
โฑ๏ธ Checked in 2.1ms
|
|
98
332
|
```
|
|
99
333
|
|
|
100
|
-
###
|
|
334
|
+
### ๐ Pre-commit Hook
|
|
335
|
+
Never commit a broken workflow again:
|
|
101
336
|
|
|
102
337
|
```bash
|
|
103
|
-
|
|
104
|
-
|
|
338
|
+
pipechecker --install-hook
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
```
|
|
342
|
+
โ
Pre-commit hook installed!
|
|
343
|
+
Pipecheck will run before every commit
|
|
344
|
+
Use 'git commit --no-verify' to skip
|
|
345
|
+
```
|
|
105
346
|
|
|
106
|
-
|
|
107
|
-
pipecheck --watch
|
|
347
|
+
The hook automatically validates any workflow files you stage:
|
|
108
348
|
|
|
109
|
-
|
|
110
|
-
|
|
349
|
+
```bash
|
|
350
|
+
$ git commit -m "Update CI pipeline"
|
|
351
|
+
๐ Checking workflows with pipechecker...
|
|
352
|
+
โ ERROR: Circular dependency detected (job: deploy) [line 42]
|
|
353
|
+
๐ก Remove one of the dependencies to break the cycle
|
|
111
354
|
|
|
112
|
-
|
|
113
|
-
|
|
355
|
+
โ Workflow validation failed!
|
|
356
|
+
Fix errors above or use 'git commit --no-verify' to skip
|
|
114
357
|
```
|
|
115
358
|
|
|
116
|
-
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Configuration File
|
|
117
362
|
|
|
118
|
-
Create `.
|
|
363
|
+
Create a `.pipecheckerrc.yml` in your project root to customize behavior:
|
|
119
364
|
|
|
120
365
|
```yaml
|
|
366
|
+
# Files to skip (glob patterns supported)
|
|
121
367
|
ignore:
|
|
122
|
-
- .github/workflows/
|
|
123
|
-
|
|
368
|
+
- .github/workflows/experimental-*.yml
|
|
369
|
+
- .github/workflows/draft-*.yml
|
|
370
|
+
- old-pipeline.yml
|
|
371
|
+
|
|
372
|
+
# Toggle individual audit rules
|
|
124
373
|
rules:
|
|
125
|
-
circular_dependencies: true
|
|
126
|
-
missing_secrets: true
|
|
127
|
-
docker_latest_tag: true
|
|
374
|
+
circular_dependencies: true # Detect dependency cycles
|
|
375
|
+
missing_secrets: true # Flag hardcoded secrets
|
|
376
|
+
docker_latest_tag: true # Warn about :latest tags
|
|
128
377
|
```
|
|
129
378
|
|
|
130
|
-
|
|
379
|
+
PipeChecker searches for config in this order:
|
|
380
|
+
1. `.pipecheckerrc.yml`
|
|
381
|
+
2. `.pipecheckerrc.yaml`
|
|
382
|
+
3. `.pipechecker.yml`
|
|
131
383
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## How the Auditors Work
|
|
387
|
+
|
|
388
|
+
### ๐ Syntax Auditor
|
|
389
|
+
Validates the structural integrity of your pipeline:
|
|
135
390
|
|
|
136
|
-
|
|
137
|
-
|
|
391
|
+
- โ
Jobs are defined
|
|
392
|
+
- โ
Steps exist within jobs
|
|
393
|
+
- โ
No duplicate job IDs
|
|
394
|
+
- โ
`needs` / `depends_on` targets exist
|
|
138
395
|
|
|
139
|
-
|
|
140
|
-
|
|
396
|
+
### ๐ DAG Auditor (Cycle Detection)
|
|
397
|
+
Builds a **dependency graph** of your jobs and runs **Tarjan's Strongly Connected Components** algorithm:
|
|
141
398
|
|
|
142
|
-
# Skip Docker checks
|
|
143
|
-
pipecheck .github/workflows/ci.yml --no-docker
|
|
144
399
|
```
|
|
400
|
+
job-a โโdependsโโโถ job-b
|
|
401
|
+
โฒ โ
|
|
402
|
+
โ โผ
|
|
403
|
+
โโโโโdependsโโโโ job-c
|
|
404
|
+
```
|
|
405
|
+
โ โ **Circular dependency detected:** job-a โ job-b โ job-c โ job-a
|
|
406
|
+
|
|
407
|
+
### ๐ Secrets Auditor
|
|
408
|
+
Scans for security issues in environment variables and run blocks:
|
|
409
|
+
|
|
410
|
+
```yaml
|
|
411
|
+
env:
|
|
412
|
+
API_KEY: sk_live_abc123 # โ ๏ธ Hardcoded secret
|
|
413
|
+
TOKEN: ${{ secrets.TOKEN }} # โ
Correct way
|
|
414
|
+
RUN: echo ${{ secrets.API_KEY }} # โน๏ธ Info โ ensure it's configured
|
|
415
|
+
RUN: echo ${{ env.UNDEFINED }} # โ ๏ธ Undeclared env var
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Detects:
|
|
419
|
+
- Hardcoded API keys, passwords, tokens
|
|
420
|
+
- Secret references in `with:` blocks
|
|
421
|
+
- Undeclared `${{ env.X }}` references
|
|
422
|
+
- Suspicious values (long alphanumeric strings, base64)
|
|
145
423
|
|
|
146
|
-
|
|
424
|
+
### ๐ณ Docker & ๐ Pinning Auditor
|
|
425
|
+
Ensures reproducible builds:
|
|
147
426
|
|
|
427
|
+
```yaml
|
|
428
|
+
uses: actions/checkout # โ ๏ธ No version pin
|
|
429
|
+
uses: actions/checkout@v4 # โ
Pinned
|
|
430
|
+
image: nginx:latest # โ ๏ธ Unpredictable
|
|
431
|
+
image: nginx:1.25-alpine # โ
Specific
|
|
148
432
|
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## Real-World Examples
|
|
437
|
+
|
|
438
|
+
### Example 1: Valid workflow
|
|
439
|
+
```bash
|
|
440
|
+
$ pipechecker .github/workflows/ci.yml
|
|
149
441
|
Provider: GitHubActions
|
|
442
|
+
0 errors, 0 warnings
|
|
443
|
+
```
|
|
150
444
|
|
|
445
|
+
### Example 2: Circular dependency
|
|
446
|
+
```yaml
|
|
447
|
+
jobs:
|
|
448
|
+
deploy:
|
|
449
|
+
needs: [test]
|
|
450
|
+
steps: [{ run: echo deploy }]
|
|
451
|
+
test:
|
|
452
|
+
needs: [deploy]
|
|
453
|
+
steps: [{ run: echo test }]
|
|
454
|
+
```
|
|
455
|
+
```bash
|
|
456
|
+
$ pipechecker broken.yml
|
|
457
|
+
Provider: GitHubActions
|
|
151
458
|
1 errors, 0 warnings
|
|
152
459
|
|
|
153
|
-
โ ERROR: Circular dependency detected
|
|
460
|
+
โ ERROR: Circular dependency detected (job: deploy)
|
|
154
461
|
๐ก Remove one of the dependencies to break the cycle
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### Example 3: Hardcoded secrets
|
|
465
|
+
```yaml
|
|
466
|
+
jobs:
|
|
467
|
+
build:
|
|
468
|
+
env:
|
|
469
|
+
API_SECRET: sk_live_hardcoded_value
|
|
470
|
+
steps: [{ run: echo building }]
|
|
471
|
+
```
|
|
472
|
+
```bash
|
|
473
|
+
$ pipechecker secrets.yml
|
|
474
|
+
Provider: GitHubActions
|
|
475
|
+
0 errors, 1 warnings
|
|
476
|
+
|
|
477
|
+
โ ๏ธ WARNING: Job 'build' env 'API_SECRET' may contain a hardcoded secret
|
|
478
|
+
๐ก Use secrets.API_SECRET instead of hardcoding
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
---
|
|
155
482
|
|
|
156
|
-
|
|
157
|
-
|
|
483
|
+
## Architecture
|
|
484
|
+
|
|
485
|
+
```
|
|
486
|
+
pipechecker/
|
|
487
|
+
โโโ src/
|
|
488
|
+
โ โโโ main.rs # CLI entry point (clap)
|
|
489
|
+
โ โโโ lib.rs # Public API โ audit_file, audit_content, discover_workflows
|
|
490
|
+
โ โโโ models.rs # Core types โ Pipeline, Job, Step, Issue, Severity
|
|
491
|
+
โ โโโ error.rs # Error enum (thiserror)
|
|
492
|
+
โ โโโ config.rs # .pipecheckerrc.yml loading
|
|
493
|
+
โ โโโ fix.rs # Auto-fix for action pinning
|
|
494
|
+
โ โโโ tui.rs # Interactive terminal UI (ratatui + crossterm)
|
|
495
|
+
โ โโโ parsers/
|
|
496
|
+
โ โ โโโ mod.rs # Provider detection + dispatch
|
|
497
|
+
โ โ โโโ github.rs # GitHub Actions YAML parser
|
|
498
|
+
โ โ โโโ gitlab.rs # GitLab CI YAML parser
|
|
499
|
+
โ โ โโโ circleci.rs # CircleCI YAML parser
|
|
500
|
+
โ โโโ auditors/
|
|
501
|
+
โ โโโ mod.rs # Module gate
|
|
502
|
+
โ โโโ syntax.rs # Structural validation
|
|
503
|
+
โ โโโ dag.rs # Dependency graph + cycle detection (petgraph)
|
|
504
|
+
โ โโโ secrets.rs # Secret/env var scanning (regex)
|
|
505
|
+
โ โโโ pinning.rs # Action/Docker image pinning
|
|
506
|
+
โโโ tests/
|
|
507
|
+
โ โโโ parser_test.rs # Parser integration tests
|
|
508
|
+
โ โโโ auditors_test.rs # Auditor + fixture tests
|
|
509
|
+
โโโ tests/fixtures/ # Sample workflow files for testing
|
|
158
510
|
```
|
|
159
511
|
|
|
160
|
-
|
|
512
|
+
---
|
|
161
513
|
|
|
162
|
-
|
|
163
|
-
|----------|--------|--------------|
|
|
164
|
-
| **GitHub Actions** | โ
Full Support | `.github/workflows/*.yml` |
|
|
165
|
-
| **GitLab CI** | โ
Full Support | `.gitlab-ci.yml` |
|
|
166
|
-
| **CircleCI** | โ
Full Support | `.circleci/config.yml` |
|
|
514
|
+
## CI/CD Integration
|
|
167
515
|
|
|
168
|
-
|
|
516
|
+
Add PipeChecker to your own CI pipeline:
|
|
169
517
|
|
|
170
|
-
### GitHub Actions
|
|
171
518
|
```yaml
|
|
172
519
|
- name: Validate workflows
|
|
173
520
|
run: |
|
|
174
|
-
|
|
175
|
-
|
|
521
|
+
cargo install pipechecker
|
|
522
|
+
pipechecker --all --strict --format json
|
|
176
523
|
```
|
|
177
524
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
- cargo install pipecheck
|
|
183
|
-
- pipecheck .gitlab-ci.yml --strict
|
|
525
|
+
Or use it as a pre-commit hook (recommended):
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
pipechecker --install-hook
|
|
184
529
|
```
|
|
185
530
|
|
|
186
|
-
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
## Development
|
|
534
|
+
|
|
535
|
+
### Run tests
|
|
187
536
|
```bash
|
|
188
|
-
|
|
189
|
-
|
|
537
|
+
cargo test
|
|
538
|
+
# 103 tests โ all passing
|
|
190
539
|
```
|
|
191
540
|
|
|
192
|
-
|
|
541
|
+
### Lint & format
|
|
542
|
+
```bash
|
|
543
|
+
cargo clippy -- -D warnings
|
|
544
|
+
cargo fmt -- --check
|
|
545
|
+
```
|
|
193
546
|
|
|
194
|
-
|
|
547
|
+
### Coverage
|
|
548
|
+
```bash
|
|
549
|
+
cargo tarpaulin --fail-under 55
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## License
|
|
555
|
+
|
|
556
|
+
This project is licensed under either **MIT** or **Apache-2.0** at your option.
|
|
557
|
+
|
|
558
|
+
```
|
|
559
|
+
SPDX: MIT OR Apache-2.0
|
|
560
|
+
```
|
|
195
561
|
|
|
196
|
-
|
|
562
|
+
---
|
|
197
563
|
|
|
198
|
-
|
|
199
|
-
- MIT License ([LICENSE-MIT](LICENSE-MIT))
|
|
200
|
-
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
|
|
564
|
+
<div align="center">
|
|
201
565
|
|
|
202
|
-
|
|
566
|
+
**PipeChecker** โ *because waiting 10 minutes for CI to tell you about a typo is nobody's idea of fun.*
|
|
203
567
|
|
|
204
|
-
|
|
568
|
+
[Report a bug](https://github.com/Ayyankhan101/PipeCheck/issues) ยท [Request a feature](https://github.com/Ayyankhan101/PipeCheck/issues) ยท [Contributing](CONTRIBUTING.md)
|
|
205
569
|
|
|
206
|
-
|
|
570
|
+
</div>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -62,7 +62,7 @@ async function install() {
|
|
|
62
62
|
|
|
63
63
|
// Check if binary already exists
|
|
64
64
|
if (fs.existsSync(binaryPath)) {
|
|
65
|
-
console.log('โ
|
|
65
|
+
console.log('โ Pipechecker binary already installed');
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -78,7 +78,7 @@ async function install() {
|
|
|
78
78
|
try {
|
|
79
79
|
await download(url, binaryPath);
|
|
80
80
|
fs.chmodSync(binaryPath, 0o755);
|
|
81
|
-
console.log('โ
|
|
81
|
+
console.log('โ Pipechecker installed successfully');
|
|
82
82
|
} catch (error) {
|
|
83
83
|
console.error(`Failed to download binary from ${url}`);
|
|
84
84
|
console.error('Falling back to building from source...');
|
|
@@ -89,7 +89,7 @@ async function install() {
|
|
|
89
89
|
process.platform === 'win32' ? 'pipechecker.exe' : 'pipechecker');
|
|
90
90
|
fs.copyFileSync(sourceBinary, binaryPath);
|
|
91
91
|
fs.chmodSync(binaryPath, 0o755);
|
|
92
|
-
console.log('โ
|
|
92
|
+
console.log('โ Pipechecker installed from source');
|
|
93
93
|
} catch (buildError) {
|
|
94
94
|
console.error('Failed to build from source. Please ensure Rust is installed.');
|
|
95
95
|
console.error('Visit https://rustup.rs to install Rust');
|