preflyt 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/bin/cli.js +30 -17
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -3,14 +3,14 @@
3
3
  const fs = require('fs')
4
4
  const path = require('path')
5
5
 
6
- // Simple patterns for common API keys
7
- const API_KEY_PATTERNS = [
8
- { name: 'OpenAI', pattern: /sk-[a-zA-Z0-9-_]{20,}/ },
9
- { name: 'Stripe Secret', pattern: /sk_live_[a-zA-Z0-9]{20,}/ },
10
- { name: 'Stripe Test', pattern: /sk_test_[a-zA-Z0-9]{20,}/ },
11
- { name: 'AWS Access Key', pattern: /AKIA[0-9A-Z]{16}/ },
12
- { name: 'GitHub Token', pattern: /ghp_[a-zA-Z0-9]{36}/ },
13
- { name: 'Hugging Face', pattern: /hf_[a-zA-Z0-9]{20,}/ },
6
+ // Security patterns to check
7
+ const SECURITY_PATTERNS = [
8
+ { name: 'Exposed secret', pattern: /sk-[a-zA-Z0-9-_]{20,}/ },
9
+ { name: 'Exposed secret', pattern: /sk_live_[a-zA-Z0-9]{20,}/ },
10
+ { name: 'Exposed secret', pattern: /sk_test_[a-zA-Z0-9]{20,}/ },
11
+ { name: 'Exposed secret', pattern: /AKIA[0-9A-Z]{16}/ },
12
+ { name: 'Exposed secret', pattern: /ghp_[a-zA-Z0-9]{36}/ },
13
+ { name: 'Exposed secret', pattern: /hf_[a-zA-Z0-9]{20,}/ },
14
14
  ]
15
15
 
16
16
  // File extensions to scan
@@ -21,14 +21,16 @@ const SKIP_FOLDERS = ['node_modules', '.git', '.next', 'dist', 'build']
21
21
 
22
22
  // Store found issues
23
23
  const issues = []
24
+ let filesScanned = 0
24
25
 
25
26
  // Scan a single file
26
27
  function scanFile(filePath) {
28
+ filesScanned++
27
29
  const content = fs.readFileSync(filePath, 'utf-8')
28
30
  const lines = content.split('\n')
29
31
 
30
32
  lines.forEach((line, index) => {
31
- API_KEY_PATTERNS.forEach(({ name, pattern }) => {
33
+ SECURITY_PATTERNS.forEach(({ name, pattern }) => {
32
34
  if (pattern.test(line)) {
33
35
  issues.push({
34
36
  file: filePath,
@@ -62,25 +64,36 @@ function scanDirectory(dir) {
62
64
  })
63
65
  }
64
66
 
67
+ // Security categories (for display)
68
+ const SECURITY_CATEGORIES = [
69
+ 'šŸ”‘ Exposed secrets & API keys'
70
+ ]
71
+
65
72
  // Main
66
- console.log('\nāœˆļø Preflyt - Preflight security check...\n')
73
+ console.log('\nāœˆļø Preflyt - Preflight security check\n')
67
74
 
68
75
  const targetDir = process.argv[2] || '.'
69
76
  scanDirectory(targetDir)
70
77
 
78
+ console.log(`šŸ“Š Scanned ${filesScanned} files for:`)
79
+ SECURITY_CATEGORIES.forEach(cat => console.log(` ${cat}`))
80
+ console.log()
81
+
71
82
  if (issues.length === 0) {
72
- console.log('āœ… All clear! Ready for takeoff.\n')
83
+ console.log('āœ… All clear — ready for takeoff!\n')
73
84
  } else {
74
- console.log(`āš ļø Found ${issues.length} issue(s) to fix before shipping:\n`)
85
+ console.log(`──────────────────────────────────────────`)
86
+ console.log(`āš ļø Found ${issues.length} issue(s) to review:\n`)
75
87
 
76
- issues.forEach(issue => {
77
- console.log(` šŸ“ ${issue.file}:${issue.line}`)
78
- console.log(` Type: ${issue.type}`)
79
- console.log(` Code: ${issue.content}`)
88
+ issues.forEach((issue, index) => {
89
+ console.log(` ${index + 1}. ${issue.type}`)
90
+ console.log(` šŸ“ ${issue.file}:${issue.line}`)
91
+ console.log(` └─ ${issue.content}`)
80
92
  console.log()
81
93
  })
82
94
 
83
- console.log('šŸ’” Tip: Move secrets to environment variables!\n')
95
+ console.log(`──────────────────────────────────────────`)
96
+ console.log(`šŸ’” Fix these issues before shipping to production\n`)
84
97
  process.exit(1) // Exit with error code
85
98
  }
86
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "preflyt",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Preflight security checks for flow coders",
5
5
  "bin": {
6
6
  "preflyt": "./bin/cli.js"