pipechecker 0.2.3 → 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 +549 -28
- 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/README.md
CHANGED
|
@@ -1,49 +1,570 @@
|
|
|
1
1
|
# PipeChecker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Catch CI/CD pipeline errors before you push — not after CI fails.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://github.com/Ayyankhan101/PipeChecker/actions/workflows/ci.yml)
|
|
6
|
+
[](https://crates.io/crates/pipechecker)
|
|
7
|
+
[](LICENSE-MIT)
|
|
8
|
+
[]()
|
|
9
|
+
[](Cargo.toml)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What Problem Does This Solve?
|
|
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
|
|
6
94
|
```bash
|
|
7
|
-
|
|
95
|
+
git clone https://github.com/Ayyankhan101/PipeChecker.git
|
|
96
|
+
cd PipeChecker
|
|
8
97
|
cargo install --path .
|
|
98
|
+
```
|
|
9
99
|
|
|
10
|
-
|
|
100
|
+
### Via npm (once published)
|
|
101
|
+
```bash
|
|
102
|
+
npm install -g pipechecker
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Quick Start
|
|
108
|
+
|
|
109
|
+
### 1. Check a single file
|
|
110
|
+
```bash
|
|
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
|
|
11
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
|
|
12
140
|
```
|
|
13
141
|
|
|
14
|
-
|
|
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
|
+
|
|
15
178
|
| Flag | Description |
|
|
16
179
|
|------|-------------|
|
|
17
|
-
|
|
|
18
|
-
| `--
|
|
19
|
-
| `--fix` | Attempt automatic fixes (e.g., pin unpinned actions) |
|
|
180
|
+
| `FILE` | Path to a specific workflow file |
|
|
181
|
+
| `--all`, `-a` | Audit **all** discovered workflow files |
|
|
20
182
|
| `--tui` | Launch the interactive terminal UI |
|
|
21
|
-
| `--
|
|
22
|
-
| `--
|
|
23
|
-
| `--
|
|
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
|
|
220
|
+
```
|
|
221
|
+
|
|
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)
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## JSON Output
|
|
230
|
+
|
|
231
|
+
Perfect for CI/CD integration or programmatic consumption:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
pipechecker --format json
|
|
235
|
+
```
|
|
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
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
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
|
|
261
|
+
```
|
|
262
|
+
|
|
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
|
|
270
|
+
|
|
271
|
+
💡 Review the changes and commit them!
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 👀 Watch Mode
|
|
275
|
+
Monitors workflow files and re-runs on every save — perfect for development:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
pipechecker --watch
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
👀 Watching for workflow changes...
|
|
283
|
+
Press Ctrl+C to stop
|
|
284
|
+
|
|
285
|
+
🔄 File changed: .github/workflows/ci.yml
|
|
286
|
+
Provider: GitHubActions
|
|
287
|
+
0 errors, 0 warnings
|
|
288
|
+
✅ All checks passed
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 🤫 Quiet Mode (CI-Friendly)
|
|
292
|
+
Only output errors — suppress warnings and info. Perfect for CI pipelines where you want clean output:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
pipechecker --quiet
|
|
296
|
+
# or
|
|
297
|
+
pipechecker -q
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
❌ Circular dependency detected (job: deploy) (in .github/workflows/deploy.yml)
|
|
302
|
+
```
|
|
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
|
|
311
|
+
```
|
|
312
|
+
|
|
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:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
pipechecker .github/workflows/ci.yml
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
Provider: GitHubActions
|
|
329
|
+
0 errors, 0 warnings
|
|
330
|
+
✅ All checks passed
|
|
331
|
+
⏱️ Checked in 2.1ms
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### 🔒 Pre-commit Hook
|
|
335
|
+
Never commit a broken workflow again:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
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
|
+
```
|
|
346
|
+
|
|
347
|
+
The hook automatically validates any workflow files you stage:
|
|
348
|
+
|
|
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
|
|
354
|
+
|
|
355
|
+
❌ Workflow validation failed!
|
|
356
|
+
Fix errors above or use 'git commit --no-verify' to skip
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Configuration File
|
|
362
|
+
|
|
363
|
+
Create a `.pipecheckerrc.yml` in your project root to customize behavior:
|
|
364
|
+
|
|
365
|
+
```yaml
|
|
366
|
+
# Files to skip (glob patterns supported)
|
|
367
|
+
ignore:
|
|
368
|
+
- .github/workflows/experimental-*.yml
|
|
369
|
+
- .github/workflows/draft-*.yml
|
|
370
|
+
- old-pipeline.yml
|
|
371
|
+
|
|
372
|
+
# Toggle individual audit rules
|
|
373
|
+
rules:
|
|
374
|
+
circular_dependencies: true # Detect dependency cycles
|
|
375
|
+
missing_secrets: true # Flag hardcoded secrets
|
|
376
|
+
docker_latest_tag: true # Warn about :latest tags
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
PipeChecker searches for config in this order:
|
|
380
|
+
1. `.pipecheckerrc.yml`
|
|
381
|
+
2. `.pipecheckerrc.yaml`
|
|
382
|
+
3. `.pipechecker.yml`
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## How the Auditors Work
|
|
387
|
+
|
|
388
|
+
### 📋 Syntax Auditor
|
|
389
|
+
Validates the structural integrity of your pipeline:
|
|
390
|
+
|
|
391
|
+
- ✅ Jobs are defined
|
|
392
|
+
- ✅ Steps exist within jobs
|
|
393
|
+
- ✅ No duplicate job IDs
|
|
394
|
+
- ✅ `needs` / `depends_on` targets exist
|
|
395
|
+
|
|
396
|
+
### 🔗 DAG Auditor (Cycle Detection)
|
|
397
|
+
Builds a **dependency graph** of your jobs and runs **Tarjan's Strongly Connected Components** algorithm:
|
|
398
|
+
|
|
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)
|
|
24
423
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- `⚠️` – **Warning** (non‑critical issue)
|
|
28
|
-
- `❌` – **Error** (must be addressed)
|
|
29
|
-
- `🔧` – Auto‑fix mode
|
|
424
|
+
### 🐳 Docker & 📌 Pinning Auditor
|
|
425
|
+
Ensures reproducible builds:
|
|
30
426
|
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## Real-World Examples
|
|
437
|
+
|
|
438
|
+
### Example 1: Valid workflow
|
|
439
|
+
```bash
|
|
440
|
+
$ pipechecker .github/workflows/ci.yml
|
|
441
|
+
Provider: GitHubActions
|
|
442
|
+
0 errors, 0 warnings
|
|
443
|
+
```
|
|
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
|
|
458
|
+
1 errors, 0 warnings
|
|
459
|
+
|
|
460
|
+
❌ ERROR: Circular dependency detected (job: deploy)
|
|
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
|
+
---
|
|
482
|
+
|
|
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
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## CI/CD Integration
|
|
515
|
+
|
|
516
|
+
Add PipeChecker to your own CI pipeline:
|
|
517
|
+
|
|
518
|
+
```yaml
|
|
519
|
+
- name: Validate workflows
|
|
520
|
+
run: |
|
|
521
|
+
cargo install pipechecker
|
|
522
|
+
pipechecker --all --strict --format json
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
Or use it as a pre-commit hook (recommended):
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
pipechecker --install-hook
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
## Development
|
|
534
|
+
|
|
535
|
+
### Run tests
|
|
33
536
|
```bash
|
|
34
537
|
cargo test
|
|
538
|
+
# 103 tests — all passing
|
|
35
539
|
```
|
|
36
|
-
The repository includes unit tests for the auditors (syntax, DAG, secrets) to ensure future changes don’t re‑introduce bugs.
|
|
37
540
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- **Coverage** with `cargo tarpaulin`
|
|
44
|
-
- **Matrix builds** across Linux, macOS, and Windows, including cross‑compilation for `aarch64`.
|
|
541
|
+
### Lint & format
|
|
542
|
+
```bash
|
|
543
|
+
cargo clippy -- -D warnings
|
|
544
|
+
cargo fmt -- --check
|
|
545
|
+
```
|
|
45
546
|
|
|
46
|
-
|
|
547
|
+
### Coverage
|
|
548
|
+
```bash
|
|
549
|
+
cargo tarpaulin --fail-under 55
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
47
553
|
|
|
48
554
|
## License
|
|
49
|
-
|
|
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
|
+
```
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
<div align="center">
|
|
565
|
+
|
|
566
|
+
**PipeChecker** — *because waiting 10 minutes for CI to tell you about a typo is nobody's idea of fun.*
|
|
567
|
+
|
|
568
|
+
[Report a bug](https://github.com/Ayyankhan101/PipeCheck/issues) · [Request a feature](https://github.com/Ayyankhan101/PipeCheck/issues) · [Contributing](CONTRIBUTING.md)
|
|
569
|
+
|
|
570
|
+
</div>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|