verytis 0.1.1 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verytis",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "packages"
@@ -200,7 +200,47 @@ function extractSharedSignals(
200
200
 
201
201
  // --- Safe text helpers ---
202
202
 
203
- import { sanitizePublicText } from "@/lib/fixgraph/redact-secrets"
203
+ const secretPatterns: Array<[RegExp, string]> = [
204
+ [/https?:\/\/[^/\s:@]+:[^/\s@]+@/gi, "https://[REDACTED]@"],
205
+ [/\bOPENAI_API_KEY\s*=\s*[^\s]+/gi, "OPENAI_API_KEY=[REDACTED]"],
206
+ [/\b(?:NEXT_PUBLIC_)?SUPABASE(?:_[A-Z]+)*_KEY\s*=\s*[^\s]+/gi, "SUPABASE_KEY=[REDACTED]"],
207
+ [/\bDATABASE_URL\s*=\s*[^\s]+/gi, "DATABASE_URL=[REDACTED]"],
208
+ [/\bJWT_SECRET\s*=\s*[^\s]+/gi, "JWT_SECRET=[REDACTED]"],
209
+ [/\b[A-Z0-9_]*(?:API_)?(?:KEY|TOKEN|SECRET|PASSWORD|PWD)\s*=\s*[^\s]+/gi, "[SECRET]=[REDACTED]"],
210
+ [/"[^"]*(?:key|token|secret|password|pwd)[^"]*"\s*:\s*"[^"]*"/gi, '"[SECRET]":"[REDACTED]"'],
211
+ [/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, "PRIVATE_KEY=[REDACTED]"],
212
+ [/\bPRIVATE_KEY\s*=\s*[^\n]+/gi, "PRIVATE_KEY=[REDACTED]"],
213
+ [/\bsk-[A-Za-z0-9_-]{16,}\b/g, "sk-[REDACTED]"],
214
+ [/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{16,}\b/g, "github_[REDACTED]"],
215
+ [/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g, "github_pat_[REDACTED]"],
216
+ [/\bBearer\s+[A-Za-z0-9._~+/=-]{16,}/gi, "Bearer [REDACTED]"],
217
+ [/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi, "[EMAIL_REDACTED]"],
218
+ ];
219
+
220
+ function redactPrivatePaths(input: string): string {
221
+ return input
222
+ .replace(/\b[A-Za-z]:\\Users\\[^\\\s:)'"`]+(?:\\[^\\\s:)'"`]+)*/g, "[path]")
223
+ .replace(/\b[A-Za-z]:\\[^\\\s:)'"`]+(?:\\[^\\\s:)'"`]+)*/g, "[path]")
224
+ .replace(/\/Users\/[^\s:)'"`]+/g, "[path]")
225
+ .replace(/\/home\/[^\s:)'"`]+/g, "[path]")
226
+ .replace(/\/private\/var\/[^\s:)'"`]+/g, "[path]")
227
+ .replace(/\/Users\/\S+/g, "<local-path>")
228
+ .replace(/\/home\/\S+/g, "<local-path>")
229
+ .replace(/[A-Za-z]:\\Users\\\S+/g, "<local-path>");
230
+ }
231
+
232
+ function redactSecrets(input: string): string {
233
+ const redacted = secretPatterns.reduce(
234
+ (acc, [pattern, replacement]) => acc.replace(pattern, replacement),
235
+ input
236
+ );
237
+ return redactPrivatePaths(redacted);
238
+ }
239
+
240
+ function sanitizePublicText(value: string | null | undefined, maxLength = 500): string {
241
+ if (!value) return "";
242
+ return redactSecrets(value).slice(0, maxLength).trim();
243
+ }
204
244
 
205
245
  function safeText(text: string | null | undefined, maxLength = 500): string {
206
246
  if (!text) return ""