@axiomatic-labs/claudeflow 2.0.24 → 2.0.25

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/lib/auth.js +21 -2
  2. package/package.json +1 -1
package/lib/auth.js CHANGED
@@ -1,15 +1,34 @@
1
1
  const { execSync } = require('child_process');
2
2
 
3
+ const VALID_TOKEN_PATTERNS = [
4
+ /^ghp_[A-Za-z0-9_]+$/, // Personal access token
5
+ /^gho_[A-Za-z0-9_]+$/, // OAuth token
6
+ /^ghu_[A-Za-z0-9_]+$/, // User-to-server token
7
+ /^ghs_[A-Za-z0-9_]+$/, // Server-to-server token
8
+ /^github_pat_[A-Za-z0-9_]+$/,// Fine-grained PAT
9
+ /^[0-9a-f]{40}$/, // Classic 40-char hex token
10
+ ];
11
+
12
+ function sanitizeToken(raw) {
13
+ if (!raw || typeof raw !== 'string') return null;
14
+ const clean = raw.replace(/[\x00-\x1F\x7F]/g, '').trim();
15
+ if (!clean) return null;
16
+ if (!VALID_TOKEN_PATTERNS.some((re) => re.test(clean))) return null;
17
+ return clean;
18
+ }
19
+
3
20
  function getGitHubToken() {
4
21
  // Try gh CLI first
5
22
  try {
6
- const token = execSync('gh auth token', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
23
+ const raw = execSync('gh auth token', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
24
+ const token = sanitizeToken(raw);
7
25
  if (token) return token;
8
26
  } catch {}
9
27
 
10
28
  // Fall back to GITHUB_TOKEN env var
11
29
  if (process.env.GITHUB_TOKEN) {
12
- return process.env.GITHUB_TOKEN;
30
+ const token = sanitizeToken(process.env.GITHUB_TOKEN);
31
+ if (token) return token;
13
32
  }
14
33
 
15
34
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiomatic-labs/claudeflow",
3
- "version": "2.0.24",
3
+ "version": "2.0.25",
4
4
  "description": "Claudeflow — AI-powered development toolkit for Claude Code. Skills, agents, hooks, and quality gates that ship production apps.",
5
5
  "bin": {
6
6
  "claudeflow": "./bin/cli.js"