@nodatachat/mcp 1.3.42 → 1.3.49
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/dist/gate.js +41 -41
- package/dist/index.js +295 -259
- package/dist/status.js +2 -2
- package/package.json +1 -1
package/dist/gate.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/*! @nodatachat/mcp 1.3.
|
|
2
|
-
import{appendFileSync as ei,copyFileSync as Cc,existsSync as $n,mkdirSync as ti,readdirSync as ni,readFileSync as ri,statSync as kt,writeFileSync as Pc}from"node:fs";import{homedir as fe}from"node:os";import{basename as xt,extname as Tn,isAbsolute as X,join as Fe,relative as si,resolve as C}from"node:path";import{TextDecoder as un}from"node:util";var L={text:[],header:[],secrets:[],table:null};function Ze(e){e.table&&(L.table=e.table);for(let t of e.text??[])L.text.some(r=>r.kind===t.kind)||L.text.push(t);e.header&&!L.header.includes(e.header)&&L.header.push(e.header);for(let t of e.secrets??[])L.secrets.some(r=>r.id===t.id)||L.secrets.push(t)}function Ke(){return L.text}function Et(){return L.header}function J(){return L.table}function At(){return L.secrets}var be=[{id:"aws-access-key",name:"AWS Access Key",pattern:/(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)/,severity:"critical"},{id:"aws-secret-key",name:"AWS Secret Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[=:]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/,severity:"critical"},{id:"gcp-api-key",name:"GCP API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"critical"},{id:"gcp-service-account",name:"GCP Service Account",pattern:/"type"\s*:\s*"service_account"/,severity:"critical"},{id:"github-token",name:"GitHub Token",pattern:/gh[pousr]_[0-9a-zA-Z]{36,}/,severity:"critical"},{id:"github-fine-grained",name:"GitHub Fine-Grained Token",pattern:/github_pat_[0-9a-zA-Z_]{22,}/,severity:"critical"},{id:"gitlab-token",name:"GitLab Token",pattern:/glpat-[0-9a-zA-Z_-]{20,}/,severity:"critical"},{id:"stripe-secret",name:"Stripe Secret Key",pattern:/sk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"stripe-restricted",name:"Stripe Restricted Key",pattern:/rk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"slack-token",name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z-]{10,}/,severity:"high"},{id:"slack-webhook",name:"Slack Webhook",pattern:/hooks\.slack\.com\/services\/T[0-9A-Z]{8,}\/B[0-9A-Z]{8,}\/[0-9a-zA-Z]{24}/,severity:"high"},{id:"twilio-api-key",name:"Twilio API Key",pattern:/SK[0-9a-fA-F]{32}/,severity:"high"},{id:"sendgrid-api-key",name:"SendGrid API Key",pattern:/SG\.[0-9a-zA-Z_-]{22}\.[0-9a-zA-Z_-]{43}/,severity:"critical"},{id:"postgres-uri",name:"PostgreSQL Connection String",pattern:/postgres(?:ql)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"mongodb-uri",name:"MongoDB Connection String",pattern:/mongodb(?:\+srv)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"redis-uri",name:"Redis Connection String",pattern:/redis(?:s)?:\/\/[^\s'"]{10,}/,severity:"high"},{id:"openai-key",name:"OpenAI API Key",pattern:/sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}/,severity:"critical"},{id:"openai-project-key",name:"OpenAI API Key",pattern:/sk-(?:proj|svcacct|admin)-[0-9A-Za-z_-]{40,}/,severity:"critical"},{id:"anthropic-key",name:"Anthropic API Key",pattern:/sk-ant-[0-9a-zA-Z_-]{40,}/,severity:"critical"},{id:"firebase-key",name:"Firebase API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"high"},{id:"supabase-key",name:"Supabase Service Key",pattern:/eyJ[0-9a-zA-Z_-]{100,}/,severity:"critical"},{id:"supabase-access-token",name:"Supabase Access Token",pattern:/\bsbp_[0-9a-f]{40}\b/,severity:"critical"},{id:"supabase-secret-key",name:"Supabase Secret Key",pattern:/\bsb_secret_[0-9A-Za-z_-]{20,}/,severity:"critical"},{id:"private-key",name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,severity:"critical"},{id:"jwt-secret",name:"JWT/Generic Secret",pattern:/(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"password-in-code",name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"bearer-token",name:"Bearer Token in Code",pattern:/['"]Bearer\s+[0-9a-zA-Z._-]{20,}['"]/,severity:"high"}];function q(){let e=At().filter(t=>!be.some(r=>r.id===t.id));return[...be,...e]}var Vn=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Salary / income"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication|prescription)$/i,type:"medical",label:"Medical"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Policy"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation"}],Zn=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם הלקוח|שם בן זוג|שם המבוטח|שם המוטב|שם הילד|שם הקטין)$/i,type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מס' זהות|teudat_zehut|tz|israeli_id|il_id)$/i,type:"id",label:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה)$/i,type:"id",label:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|אימייל|כתובת מייל)$/i,type:"email",label:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|טלפון נייד)$/i,type:"phone",label:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|רחוב|מס בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|מען)$/i,type:"address",label:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|ת לידה|תאריך הולדת|יום הולדת|גיל)$/i,type:"dob",label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|מספר חשבון|מס חשבון|סניף|iban|iban_il)$/i,type:"financial",label:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|מספר אשראי|cvv|אשראי)$/i,type:"financial",label:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|מצב רפואי|חיסון|רגישות|אלרגיה|סוג דם)$/i,type:"medical",label:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מס פוליסה|פוליסה|מספר חבר|מספר ביטוח)$/i,type:"id",label:"\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4/\u05D7\u05D1\u05E8\u05D5\u05EA"},{pattern:/^(?:שם הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|תעודת לידה)$/i,type:"minor_data",label:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|השקפה פוליטית|מצב משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מס רכב|לוחית רישוי|מספר רישוי)$/i,type:"tracking",label:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}],Kn=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|enabled|active|public|version|metadata|config|settings|data|content|note|comment|label|color|icon)$/i,Xn=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(file|product|item|company|org|organization|project|sheet|table|field|category|branch|bank|city|street|document|plan|course|department|site|domain|brand|vendor|service|role)[ _-]?name$/i;function Y(e){if(!e)return null;let t=e.trim();if(Kn.test(t)||/^name$/i.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...Zn,...Vn])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(Xn.test(t))return null;if(/^שם[ _][\u0590-\u05FF"'׳ ]{2,20}$/.test(t))return{type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"};if(/^(customer|client|employee|inspector|supervisor|contact|person|patient|user|owner|manager|agent|member|driver|tenant|student|parent|beneficiary|insured)_?(full_?)?name$/i.test(r))return{type:"name",label:"Person name"};for(let n of Et()){let s=n(t);if(s)return{type:s.type,label:s.label}}return null}function It(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let s=0;s<9;s++){let i=parseInt(r[s]??"0",10)*(s%2+1);i>9&&(i-=9),n+=i}return n%10===0&&parseInt(r,10)>0}function Jn(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let r=0,n=!1;for(let s=t.length-1;s>=0;s-=1){let i=parseInt(t[s]??"0",10);n&&(i*=2,i>9&&(i-=9)),r+=i,n=!n}return r%10===0}function qn(e){let t=String(e??"").replace(/\s/g,"").toUpperCase();if(!/^[A-Z]{2}\d{2}[A-Z0-9]{10,30}$/.test(t))return!1;let r=t.slice(4)+t.slice(0,4),n=0;for(let s of r){let i=s>="A"&&s<="Z"?String(s.charCodeAt(0)-55):s;for(let o of i)n=(n*10+Number(o))%97}return n===1}var Xe="(?<!\\d)(?<!\\d[.,])",Je="(?!\\d)(?![.,]\\d)",$t=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${Xe}\\d{9}${Je}`,"g"),validate:It,hint:"Israeli national ID (check digit verified) in plaintext. Encrypt the column or mask it at rest."},{subkind:"credit_card",severity:"critical",pattern:new RegExp(`${Xe}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${Je}`,"g"),validate:Jn,hint:"Payment card number (Luhn verified) in plaintext. This is PCI scope."},{subkind:"iban",severity:"high",pattern:/\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g,validate:qn,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${Xe}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${Je}`,"g"),validate:e=>{let t=e.replace(/\D/g,"").replace(/^972/,"0");return/^0[57]\d{8}$/.test(t)?!0:/^0[2-489]\d{7}$/.test(t)&&(/[- ]/.test(e)||e.startsWith("+972"))},hint:"Israeli phone number in plaintext."}];function _e(e,t){let r=[],n="",s=!1;for(let i=0;i<e.length;i++){let o=e[i];s?o==='"'&&e[i+1]==='"'?(n+='"',i++):o==='"'?s=!1:n+=o:o==='"'?s=!0:o===t?(r.push(n),n=""):n+=o}return r.push(n),r}import{inflateRawSync as Or}from"node:zlib";import{inflateSync as Yn}from"node:zlib";var ke=new Set([".pdf"]),Tt=8*1024*1024;function Lt(e){let t=e.toString("latin1"),r=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,s;for(;(s=n.exec(t))!==null;){let i=Number(s[1]),o=n.lastIndex,a=t.indexOf("endobj",o);if(a<0)continue;let l=t.indexOf("stream",o),c,u=null;if(l>=0&&l<a){c=t.slice(o,l);let d=l+6;t[d]==="\r"&&(d+=1),t[d]===`
|
|
3
|
-
`&&(d+=1);let p=t.indexOf("endstream",d);p>d&&(u=e.subarray(d,p))}else
|
|
4
|
-
`),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,p;for(;(p=d.exec(e))!==null;){let
|
|
5
|
-
`)}var
|
|
6
|
-
`);return
|
|
7
|
-
`).map(
|
|
8
|
-
`)),{text:[
|
|
9
|
-
`),truncated:a,streams:o})}function
|
|
1
|
+
/*! @nodatachat/mcp 1.3.49 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
|
|
2
|
+
import{appendFileSync as _s,copyFileSync as pl,existsSync as Vn,mkdirSync as ks,readdirSync as xs,readFileSync as vs,statSync as Lt,writeFileSync as fl}from"node:fs";import{homedir as re}from"node:os";import{basename as Dt,extname as Kn,isAbsolute as ie,join as Ve,relative as ws,resolve as C}from"node:path";import{TextDecoder as Sn}from"node:util";var P={text:[],header:[],secrets:[],table:null,amounts:null};function tt(e){e.table&&(P.table=e.table),e.amounts&&(P.amounts=e.amounts);for(let t of e.text??[])P.text.some(r=>r.kind===t.kind)||P.text.push(t);e.header&&!P.header.includes(e.header)&&P.header.push(e.header);for(let t of e.secrets??[])P.secrets.some(r=>r.id===t.id)||P.secrets.push(t)}function nt(){return P.amounts?.()===!0}function Se(){return P.text}function Mt(){return P.header}function ae(){return P.table}function Ht(){return P.secrets}var Ee=[{id:"aws-access-key",name:"AWS Access Key",pattern:/(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)/,severity:"critical"},{id:"aws-secret-key",name:"AWS Secret Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[=:]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/,severity:"critical"},{id:"gcp-api-key",name:"GCP API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"critical"},{id:"gcp-service-account",name:"GCP Service Account",pattern:/"type"\s*:\s*"service_account"/,severity:"critical"},{id:"github-token",name:"GitHub Token",pattern:/gh[pousr]_[0-9a-zA-Z]{36,}/,severity:"critical"},{id:"github-fine-grained",name:"GitHub Fine-Grained Token",pattern:/github_pat_[0-9a-zA-Z_]{22,}/,severity:"critical"},{id:"gitlab-token",name:"GitLab Token",pattern:/glpat-[0-9a-zA-Z_-]{20,}/,severity:"critical"},{id:"stripe-secret",name:"Stripe Secret Key",pattern:/sk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"stripe-restricted",name:"Stripe Restricted Key",pattern:/rk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"slack-token",name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z-]{10,}/,severity:"high"},{id:"slack-webhook",name:"Slack Webhook",pattern:/hooks\.slack\.com\/services\/T[0-9A-Z]{8,}\/B[0-9A-Z]{8,}\/[0-9a-zA-Z]{24}/,severity:"high"},{id:"twilio-api-key",name:"Twilio API Key",pattern:/SK[0-9a-fA-F]{32}/,severity:"high"},{id:"sendgrid-api-key",name:"SendGrid API Key",pattern:/SG\.[0-9a-zA-Z_-]{22}\.[0-9a-zA-Z_-]{43}/,severity:"critical"},{id:"postgres-uri",name:"PostgreSQL Connection String",pattern:/postgres(?:ql)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"mongodb-uri",name:"MongoDB Connection String",pattern:/mongodb(?:\+srv)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"redis-uri",name:"Redis Connection String",pattern:/redis(?:s)?:\/\/[^\s'"]{10,}/,severity:"high"},{id:"openai-key",name:"OpenAI API Key",pattern:/sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}/,severity:"critical"},{id:"openai-project-key",name:"OpenAI API Key",pattern:/sk-(?:proj|svcacct|admin)-[0-9A-Za-z_-]{40,}/,severity:"critical"},{id:"anthropic-key",name:"Anthropic API Key",pattern:/sk-ant-[0-9a-zA-Z_-]{40,}/,severity:"critical"},{id:"firebase-key",name:"Firebase API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"high"},{id:"supabase-key",name:"Supabase Service Key",pattern:/eyJ[0-9a-zA-Z_-]{100,}/,severity:"critical"},{id:"supabase-access-token",name:"Supabase Access Token",pattern:/\bsbp_[0-9a-f]{40}\b/,severity:"critical"},{id:"supabase-secret-key",name:"Supabase Secret Key",pattern:/\bsb_secret_[0-9A-Za-z_-]{20,}/,severity:"critical"},{id:"private-key",name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,severity:"critical"},{id:"jwt-secret",name:"JWT/Generic Secret",pattern:/(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"password-in-code",name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"bearer-token",name:"Bearer Token in Code",pattern:/['"]Bearer\s+[0-9a-zA-Z._-]{20,}['"]/,severity:"high"}];function ce(){let e=Ht().filter(t=>!Ee.some(r=>r.id===t.id));return[...Ee,...e]}var mr=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Salary / income"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication|prescription)$/i,type:"medical",label:"Medical"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Policy"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation"}],gr=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם הלקוח|שם בן זוג|שם המבוטח|שם המוטב|שם הילד|שם הקטין)$/i,type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מס' זהות|teudat_zehut|tz|israeli_id|il_id)$/i,type:"id",label:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה)$/i,type:"id",label:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|אימייל|כתובת מייל)$/i,type:"email",label:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|טלפון נייד)$/i,type:"phone",label:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|רחוב|מס בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|מען)$/i,type:"address",label:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|ת לידה|תאריך הולדת|יום הולדת|גיל)$/i,type:"dob",label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|מספר חשבון|מס חשבון|סניף|iban|iban_il)$/i,type:"financial",label:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|מספר אשראי|cvv|אשראי)$/i,type:"financial",label:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|מצב רפואי|חיסון|רגישות|אלרגיה|סוג דם)$/i,type:"medical",label:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מס פוליסה|פוליסה|מספר חבר|מספר ביטוח)$/i,type:"id",label:"\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4/\u05D7\u05D1\u05E8\u05D5\u05EA"},{pattern:/^(?:שם הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|תעודת לידה)$/i,type:"minor_data",label:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|השקפה פוליטית|מצב משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מס רכב|לוחית רישוי|מספר רישוי)$/i,type:"tracking",label:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}],yr=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|enabled|active|public|version|metadata|config|settings|data|content|note|comment|label|color|icon)$/i,br=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(file|product|item|company|org|organization|project|sheet|table|field|category|branch|bank|city|street|document|plan|course|department|site|domain|brand|vendor|service|role)[ _-]?name$/i;function le(e){if(!e)return null;let t=e.trim();if(yr.test(t)||/^name$/i.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...gr,...mr])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(br.test(t))return null;if(/^שם[ _][\u0590-\u05FF"'׳ ]{2,20}$/.test(t))return{type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"};if(/^(customer|client|employee|inspector|supervisor|contact|person|patient|user|owner|manager|agent|member|driver|tenant|student|parent|beneficiary|insured)_?(full_?)?name$/i.test(r))return{type:"name",label:"Person name"};for(let n of Mt()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function jt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}function _r(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i-=1){let s=parseInt(t[i]??"0",10);n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function kr(e){let t=String(e??"").replace(/\s/g,"").toUpperCase();if(!/^[A-Z]{2}\d{2}[A-Z0-9]{10,30}$/.test(t))return!1;let r=t.slice(4)+t.slice(0,4),n=0;for(let i of r){let s=i>="A"&&i<="Z"?String(i.charCodeAt(0)-55):i;for(let o of s)n=(n*10+Number(o))%97}return n===1}var rt="(?<!\\d)(?<!\\d[.,])",it="(?!\\d)(?![.,]\\d)",Ut=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${rt}\\d{9}${it}`,"g"),validate:jt,hint:"Israeli national ID (check digit verified) in plaintext. Encrypt the column or mask it at rest."},{subkind:"credit_card",severity:"critical",pattern:new RegExp(`${rt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${it}`,"g"),validate:_r,hint:"Payment card number (Luhn verified) in plaintext. This is PCI scope."},{subkind:"iban",severity:"high",pattern:/\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g,validate:kr,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${rt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${it}`,"g"),validate:e=>{let t=e.replace(/\D/g,"").replace(/^972/,"0");return/^0[57]\d{8}$/.test(t)?!0:/^0[2-489]\d{7}$/.test(t)&&(/[- ]/.test(e)||e.startsWith("+972"))},hint:"Israeli phone number in plaintext."}];function Ae(e,t){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s];i?o==='"'&&e[s+1]==='"'?(n+='"',s++):o==='"'?i=!1:n+=o:o==='"'?i=!0:o===t?(r.push(n),n=""):n+=o}return r.push(n),r}import{inflateRawSync as ii}from"node:zlib";import{inflateSync as xr}from"node:zlib";var Ie=new Set([".pdf"]),zt=8*1024*1024;function Vt(e){let t=e.toString("latin1"),r=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,i;for(;(i=n.exec(t))!==null;){let s=Number(i[1]),o=n.lastIndex,a=t.indexOf("endobj",o);if(a<0)continue;let c=t.indexOf("stream",o),l,u=null;if(c>=0&&c<a){l=t.slice(o,c);let d=c+6;t[d]==="\r"&&(d+=1),t[d]===`
|
|
3
|
+
`&&(d+=1);let p=t.indexOf("endstream",d);p>d&&(u=e.subarray(d,p))}else l=t.slice(o,a);r.set(s,{num:s,dict:l,stream:u})}for(let s of[...r.values()]){if(!s.stream||!/\/Type\s*\/ObjStm\b/.test(s.dict))continue;let o=$e(s),a=Number(/\/N\s+(\d+)/.exec(s.dict)?.[1]??0),c=Number(/\/First\s+(\d+)/.exec(s.dict)?.[1]??-1);if(o===null||!a||c<0)continue;let l=o.slice(0,c).trim().split(/\s+/).map(Number);for(let u=0;u<a;u+=1){let d=l[2*u],p=l[2*u+1];if(d===void 0||p===void 0||Number.isNaN(d)||Number.isNaN(p))break;let f=u+1<a?l[2*(u+1)+1]:void 0,m=o.slice(c+p,f!==void 0?c+f:void 0);r.has(d)||r.set(d,{num:d,dict:m,stream:null})}}return r}function st(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let r=0,n=0;for(let i of t){let s=i.codePointAt(0)??0;s<32||s>=127&&s<=191||s===65533||s>=57344&&s<=63743?r+=1:/[\p{L}\p{N}]/u.test(i)&&(n+=1)}return r/t.length>.2||n/t.length<.25}function vr(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let r=t.indexOf("~>");r>=0&&(t=t.slice(0,r));let n=[],i=0,s=0;for(let o of t){if(o==="z"&&s===0){n.push(0,0,0,0);continue}let a=o.charCodeAt(0)-33;if(a<0||a>84)return null;i=i*85+a,s+=1,s===5&&(n.push(i>>>24&255,i>>>16&255,i>>>8&255,i&255),i=0,s=0)}if(s>0){for(let a=s;a<5;a+=1)i=i*85+84;let o=[i>>>24&255,i>>>16&255,i>>>8&255,i&255];for(let a=0;a<s-1;a+=1)n.push(o[a]??0)}return Buffer.from(n)}function wr(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",r=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(r)?Buffer.from(r,"hex"):null}function Sr(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(r=>r[1]??"")}function $e(e){if(!e.stream)return null;let t=e.stream;for(let r of Sr(e.dict)){let n=null;if(r==="FlateDecode")try{n=xr(t)}catch{return null}else if(r==="ASCII85Decode")n=vr(t);else if(r==="ASCIIHexDecode")n=wr(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function Er(e){let t=new Map,r=1,n=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(n&&n[1]){let c=/<([0-9A-Fa-f]+)>/.exec(n[1]);c&&c[1]&&c[1].length>=4&&(r=2)}let i=c=>{let l="";for(let u=0;u+3<c.length+1;u+=4){let d=parseInt(c.slice(u,u+4),16);Number.isFinite(d)&&d>0&&(l+=String.fromCharCode(d))}return l},s=/beginbfchar([\s\S]*?)endbfchar/g,o;for(;(o=s.exec(e))!==null;){let c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,l;for(;(l=c.exec(o[1]??""))!==null;)t.set(parseInt(l[1]??"0",16),i(l[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(o=a.exec(e))!==null;){let c=o[1]??"",l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,u;for(;(u=l.exec(c))!==null;){let d=parseInt(u[1]??"0",16),p=parseInt(u[2]??"0",16),f=parseInt((u[3]??"0").slice(0,4)||"0",16);if(!(p-d>65535))for(let m=d;m<=p;m+=1)t.set(m,String.fromCharCode(f+(m-d)))}}return{map:t,bytes:r}}function Ar(e){let t=new Map,r=[],n=[];for(let s of e.values()){for(let o of s.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))o[1]&&n.push(o[1]);for(let o of s.dict.matchAll(/\/Font\s+(\d+)\s+\d+\s+R/g)){let a=e.get(Number(o[1]));a&&n.push(a.dict)}}let i=new Set;for(let s of n){let o=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=o.exec(s))!==null;){let c=`${a[1]}#${a[2]}`;i.has(c)||(i.add(c),r.push([a[1]??"",Number(a[2])]))}}for(let[s,o]of r){let a=e.get(o);if(!a)continue;let c=null,l=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(l){let d=e.get(Number(l[1])),p=d?$e(d):null;p&&(c=Er(p))}if(c||(c=Tr(a.dict,e)),!c)continue;let u=t.get(s)??[];u.push(c),t.set(s,u)}return t}var Ir=["alef","bet","gimel","dalet","he","vav","zayin","het","tet","yod","finalkaf","kaf","lamed","finalmem","mem","finalnun","nun","samekh","ayin","finalpe","pe","finaltsadi","tsadi","qof","resh","shin","tav"];function $r(e){let t=/^uni([0-9A-Fa-f]{4})$/.exec(e)??/^u([0-9A-Fa-f]{4,6})$/.exec(e);if(t)return String.fromCodePoint(parseInt(t[1],16));let r=/^afii(\d{5})$/.exec(e);if(r){let s=Number(r[1]);if(s>=57664&&s<=57690)return String.fromCharCode(1488+(s-57664))}let n=Ir.indexOf(e.replace(/hebrew$/,""));return n>=0?String.fromCharCode(1488+n):e==="space"?" ":/^[A-Za-z]$/.test(e)?e:{zero:"0",one:"1",two:"2",three:"3",four:"4",five:"5",six:"6",seven:"7",eight:"8",nine:"9",period:".",comma:",",hyphen:"-",colon:":",slash:"/",at:"@"}[e]??null}function Tr(e,t){let r=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(r=t.get(Number(n[1]))?.dict??"");let i=/\/Differences\s*\[([^\]]*)\]/.exec(r);if(!i?.[1])return null;let s=new Map,o=0;for(let a of i[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){o=Number(a);continue}let c=$r(a.slice(1));c!==null&&s.set(o,c),o+=1}return s.size?{map:s,bytes:1}:null}function Kt(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e[r];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let i=e[r+1];if(i===void 0)break;if(i>="0"&&i<="7"){let o="",a=r+1;for(;a<e.length&&o.length<3&&e[a]>="0"&&e[a]<="7";)o+=e[a],a+=1;t.push(parseInt(o,8)&255),r=a-1;continue}let s={n:10,r:13,t:9,b:8,f:12};t.push(s[i]??i.charCodeAt(0)&255),r+=1}return t}function Zt(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let r=2;r+1<e.length;r+=2)t+=String.fromCharCode((e[r]??0)<<8|(e[r+1]??0));return t}function Bt(e,t){let r=Zt(e);if(r!==null)return r;if(!t)return e.map(i=>String.fromCharCode(i)).join("");let n="";if(t.bytes===2)for(let i=0;i+1<e.length;i+=2){let s=(e[i]??0)<<8|(e[i+1]??0);n+=t.map.get(s)??""}else for(let i of e)n+=t.map.get(i)??String.fromCharCode(i);return n}function Rr(e){let t=0;for(let r of e){let n=r.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(r)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function Wt(e,t){if(!t||t.length<=1)return Bt(e,t?.[0]);let r="",n=-1/0;for(let i of t){let s=Bt(e,i),o=Rr(s);o>n&&(r=s,n=o)}return r}function Cr(e,t){let r="",n="",i,s=!1,o="",a=0,c=null,l=()=>{n.trim()&&(r+=n+`
|
|
4
|
+
`),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,p;for(;(p=d.exec(e))!==null;){let f=p[0];if(p[1]!==void 0&&f.endsWith("Tf")){i=t.get(p[1]);continue}if(p[2]!==void 0){Math.abs(Number(p[3]))>.01?l():Number(p[2])!==0&&u();continue}if(p[4]!==void 0){let m=Number(p[4]);c!==null&&Math.abs(m-c)>.01?l():c!==null&&u(),c=m;continue}if(f==="T*"){l();continue}if(f==="["){s=!0;continue}if(f==="]"){s=!1;continue}if(f==="TJ"||f==="Tj"||f==="'"||f==='"'){(f==="'"||f==='"')&&l(),o&&(n+=o,a=o.trim().length,o="");continue}if(f.startsWith("("))o+=Wt(Kt(f.slice(1,-1)),i);else if(f.startsWith("<")){let m=f.slice(1,-1).replace(/\s+/g,""),y=[];for(let S=0;S+1<m.length;S+=2)y.push(parseInt(m.slice(S,S+2),16));o+=Wt(y,i)}else s&&Number(f)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),l(),r}function Pr(e,t){let r=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(r),i=n?t.get(Number(n[1]))?.dict:void 0;if(!i)return"";let s=[],o=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=o.exec(i))!==null;){let c=a[2]??"";if(c.startsWith("(")){let l=Kt(c.slice(1,-1));s.push(Zt(l)??l.map(u=>String.fromCharCode(u)).join(""))}else{let l=c.slice(1,-1).replace(/\s+/g,""),u="";if(l.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<l.length+1;d+=4)u+=String.fromCharCode(parseInt(l.slice(d,d+4),16));else for(let d=0;d+1<l.length;d+=2)u+=String.fromCharCode(parseInt(l.slice(d,d+2),16));s.push(u)}}return s.join(`
|
|
5
|
+
`)}var Gt="\u05DD\u05DF\u05E5\u05E3\u05DA";function Te(e){let t=0,r=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])Gt.includes(n[0])&&(t+=1),Gt.includes(n[n.length-1])&&(r+=1);return t>=3&&t>r*2}var Lr={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function Re(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(r=>Lr[r]??r).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,r=>[...r].reverse().join("")):e}function Xt(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let r=Vt(e);if(r.size===0)return null;let n=Ar(r),i=[];i.push(Pr(e,r));let s=0,o=0,a=!1;for(let l of r.values()){if(!l.stream||!/\/Subtype\s*\/Form\b/.test(l.dict)&&/\/Subtype|\/Type\s*\/(XObject|Font|Metadata|ObjStm|XRef)|\/FontFile/.test(l.dict))continue;let d=$e(l);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let p=Cr(d,n);if(p.trim().length!==0){if(o+=1,s+p.length>zt){i.push(p.slice(0,Math.max(0,zt-s))),a=!0;break}i.push(p),s+=p.length}}if(o===0)return null;let c=i.slice(1).join(`
|
|
6
|
+
`);return st(c)?null:(Te(c)&&(c=c.split(`
|
|
7
|
+
`).map(Re).join(`
|
|
8
|
+
`)),{text:[i[0]??"",c].join(`
|
|
9
|
+
`),truncated:a,streams:o})}function Jt(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return"not a valid PDF";if(e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return"encrypted (password or copy protection)";let r=Vt(e),n=0,i=0,s=0;for(let o of r.values()){if(!o.stream)continue;if(/\/Subtype\s*\/Image\b/.test(o.dict)){i+=1;continue}let a=$e(o);if(a===null){/\/Type\s*\/(Font|Metadata|XRef)|\/FontFile|\/Length1/.test(o.dict)||(s+=1);continue}/(TJ|Tj)\b/.test(a)&&(n+=1)}return n===0&&i>0?"no text layer \u2014 a scanned image (needs OCR, which NoData does not do)":n===0&&s>0?"its pages are compressed in a way NoData cannot open":n===0?"no text in it":"its fonts have no usable letter map \u2014 the text decodes to symbols"}import{execFileSync as Dr}from"node:child_process";import{existsSync as Or,mkdtempSync as Nr,readFileSync as Yt,readdirSync as Le,rmSync as Fr,statSync as Mr,writeFileSync as Qt}from"node:fs";import{tmpdir as Hr}from"node:os";import{delimiter as jr,join as $}from"node:path";var de="install the free tools once (they run only on this computer): winget install oschwartz10612.Poppler and winget install UB-Mannheim.TesseractOCR (tick Hebrew in its installer)",Ce=null;function qt(e){try{return Mr(e).isFile()}catch{return!1}}function Ur(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),r=process.env.LOCALAPPDATA;for(let n of t)e.push($(n,"Tesseract-OCR"));if(r){e.push($(r,"Programs","Tesseract-OCR"),$(r,"Microsoft","WinGet","Links"));let n=$(r,"Microsoft","WinGet","Packages");try{for(let i of Le(n))if(/^oschwartz10612\.Poppler/i.test(i))for(let s of Le($(n,i)))e.push($(n,i,s,"Library","bin"))}catch{}}for(let n of t)try{for(let i of Le(n))/^poppler/i.test(i)&&e.push($(n,i,"Library","bin"),$(n,i,"bin"))}catch{}return e}function Pe(e,t){let r=process.env[t];if(r)return qt(r)?r:void 0;let n=process.platform==="win32",i=n?[`${e}.exe`,e]:[e],s=(process.env.PATH??"").split(jr).filter(Boolean);n&&s.push(...Ur());for(let o of s)for(let a of i)if(qt($(o,a)))return $(o,a)}function Z(e,t,r){try{return Dr(e,t,{encoding:"utf8",timeout:r,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function ue(){if(Ce)return Ce;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return Ce={ocrLangs:[],osd:!1};let e={pdftotext:Pe("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:Pe("pdftoppm","NODATA_PDFTOPPM"),tesseract:Pe("tesseract","NODATA_TESSERACT"),ocrmypdf:Pe("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((Z(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(r=>r.trim()));e.ocrLangs=["heb","eng"].filter(r=>t.has(r)),e.osd=t.has("osd")}return Ce=e}function en(e,t,r=".pdf"){let n=Nr($(Hr(),"nd-read-"));try{let i=$(n,`in${r}`);return Qt(i,e,{mode:384}),t(n,i)}finally{Fr(n,{recursive:!0,force:!0})}}function at(e){let t=e.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,"").replace(/\f/g,`
|
|
10
10
|
`).replace(/[ \t]+\n/g,`
|
|
11
|
-
`).trim();return t.replace(/\s/g,"").length<2||
|
|
12
|
-
`).map(
|
|
13
|
-
`):t}function
|
|
14
|
-
${a} ${
|
|
11
|
+
`).trim();return t.replace(/\s/g,"").length<2||st(t)?null:Te(t)?t.split(`
|
|
12
|
+
`).map(Re).join(`
|
|
13
|
+
`):t}function zr(e){let t=ue().pdftotext;if(!t)return null;let r=en(e,(n,i)=>Z(t,["-enc","UTF-8","-q",i,"-"],6e4));return r===null?null:at(r)}var Br=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function Wr(e){let t=e.toString("latin1",0,64).match(/^P5\s+(\d+)\s+(\d+)\s+255\s/);return t?{w:Number(t[1]),h:Number(t[2]),at:t[0].length}:null}function Gr(e,t){let r=Wr(e);if(!r)return null;let{w:n,h:i,at:s}=r,o=e.subarray(s),[a,c]=t===180?[n,i]:[i,n],l=Buffer.alloc(a*c);for(let u=0;u<i;u++)for(let d=0;d<n;d++){let p=o[u*n+d];t===180?l[(i-1-u)*n+(n-1-d)]=p:t===90?l[d*a+(i-1-u)]=p:l[(n-1-d)*a+u]=p}return Buffer.concat([Buffer.from(`P5
|
|
14
|
+
${a} ${c}
|
|
15
15
|
255
|
|
16
|
-
`,"latin1"),
|
|
17
|
-
`))??
|
|
18
|
-
`).filter(u=>[...
|
|
16
|
+
`,"latin1"),l])}function Vr(e,t){if(!e.osd)return;let r=Z(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(r.match(/Rotate:\s*(\d+)/)?.[1]??0),i=Number(r.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||i<2)return;let s=Gr(Yt(t),n);s&&Qt(t,s,{mode:384})}function Kr(e,t,r){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=$(t,"side.txt");return Z(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,r,$(t,"out.pdf")],3e5),Or(n)?at(Yt(n,"utf8")):null}function Zr(e){let t=ue();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let r=Br();return en(e,(n,i)=>{if(Z(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(r+1),i,$(n,"p")],12e4)===null)return null;let s=Le(n).filter(l=>/^p-\d+\.pgm$/.test(l)).sort((l,u)=>Number(l.match(/\d+/)[0])-Number(u.match(/\d+/)[0])),o=s.length>r,a=[];for(let l of s.slice(0,r)){Vr(t,$(n,l));let u=Z(t.tesseract,[$(n,l),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);u&&a.push(u)}let c=at(a.join(`
|
|
17
|
+
`))??Kr(t,n,i);return c===null?null:{text:c,truncated:o,pages:Math.min(s.length,r)}})}function ot(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function De(e,t={}){let r=Xt(e),n=zr(e);if(r){if(n===null)return{...r,engine:"builtin",uncertain:!1};let s=ot(r.text),o=n.split(`
|
|
18
|
+
`).filter(u=>[...ot(u)].some(d=>!s.has(d))),a=ot(n),c=[...a].filter(u=>!s.has(u)),l=c.length>Math.max(3,a.size*.1)||c.some(u=>/^\d{5,}$/.test(u));return o.length===0?{...r,engine:"builtin",uncertain:!1}:{...r,text:r.text+`
|
|
19
19
|
`+o.join(`
|
|
20
|
-
`),engine:"builtin",uncertain:
|
|
20
|
+
`),engine:"builtin",uncertain:l}}if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return null;if(n!==null)return{text:n,truncated:!1,streams:0,engine:"pdftotext",uncertain:!1};if(!t.ocr)return null;let i=Zr(e);return i?{text:i.text,truncated:i.truncated,streams:0,engine:"ocr",uncertain:!1}:null}function tn(e){let t=Jt(e),r=ue();return/scanned image/.test(t)?r.tesseract&&r.pdftoppm&&r.ocrLangs.length?"no text layer \u2014 a scanned image; the folder scan reads it with OCR on this computer, the read gate does not wait for OCR":`no text layer \u2014 a scanned image. To read it: ${de}`:/encrypted/.test(t)?t+(r.pdftotext?"":` \u2014 if it opens without a password, the second reader can read it: ${de}`):/letter map|compressed/.test(t)&&!r.pdftotext?`${t}. A second reader may read it: ${de}`:/letter map|compressed/.test(t)?`${t} (the second reader, pdftotext, could not read it either)`:t}var nn=[208,207,17,224,161,177,26,225],ct=4294967294,Oe=4294967295,Xr=64*1024*1024;function pe(e){if(e.length<512)return!1;for(let t=0;t<nn.length;t+=1)if(e[t]!==nn[t])return!1;return!0}function lt(e){if(!pe(e))return null;try{let t=e.readUInt16LE(30),r=e.readUInt16LE(32);if(t!==9&&t!==12)return null;let n=1<<t,i=1<<r,s=e.readUInt32LE(44),o=e.readUInt32LE(48),a=e.readUInt32LE(56),c=e.readUInt32LE(60),l=e.readUInt32LE(68),u=e.readUInt32LE(72),d=Math.floor((e.length-n)/n)+1,p=g=>{let b=(g+1)*n;return g>=d||b>=e.length?null:e.subarray(b,Math.min(b+n,e.length))},f=[];for(let g=0;g<109&&f.length<s;g+=1){let b=e.readUInt32LE(76+g*4);b!==Oe&&f.push(b)}let m=l;for(let g=0;g<u&&m!==ct&&m!==Oe;g+=1){let b=p(m);if(!b)return null;let v=n/4-1;for(let E=0;E<v&&f.length<s;E+=1){let x=b.readUInt32LE(E*4);x!==Oe&&f.push(x)}m=b.readUInt32LE(v*4)}let y=[];for(let g of f){let b=p(g);if(!b)return null;for(let v=0;v+4<=b.length;v+=4)y.push(b.readUInt32LE(v))}let S=(g,b,v)=>{let E=[],x=g;for(;x!==ct&&x!==Oe;){if(x>=b.length||E.length>v)return null;E.push(x),x=b[x]}return E},h=(g,b)=>{let v=S(g,y,d);if(!v)return null;let E=[];for(let z of v){let oe=p(z);if(!oe)return null;E.push(oe)}let x=Buffer.concat(E);return b>=0?x.subarray(0,Math.min(b,x.length)):x},_=h(o,-1);if(!_)return null;let k=[],I=new Map;for(let g=0,b=0;g+128<=_.length;g+=128,b+=1){let v=_.readUInt16LE(g+64),E=_[g+66];if(E===0||v<2||v>64)continue;let x=_.subarray(g,g+v-2).toString("utf16le"),z={id:b,name:x,type:E,left:_.readUInt32LE(g+68),right:_.readUInt32LE(g+72),child:_.readUInt32LE(g+76),start:_.readUInt32LE(g+116),size:_.readUInt32LE(g+120),path:x};k.push(z),I.set(b,z)}let L=new Set,F=(g,b)=>{let v=[g];for(;v.length;){let E=v.pop(),x=I.get(E);!x||L.has(E)||(L.add(E),x.path=b?`${b}/${x.name}`:x.name,v.push(x.left,x.right),x.type===1&&F(x.child,x.path))}},M=k.find(g=>g.type===5);M&&F(M.child,"");let O=k.find(g=>g.type===5);if(!O)return null;let V=null,R=[];if(k.some(g=>g.type===2&&g.size<a&&g.size>0)){V=h(O.start,O.size);let g=c!==ct?h(c,-1):null;if(g)for(let b=0;b+4<=g.length;b+=4)R.push(g.readUInt32LE(b));else R=[]}let U=new Map,K=new Map,H=(g,b)=>{U.has(g.name)||U.set(g.name,b),K.set(g.path,b)};for(let g of k)if(g.type===2&&!(g.size>Xr)){if(g.size===0){H(g,Buffer.alloc(0));continue}if(g.size<a){if(!V)continue;let b=S(g.start,R,Math.ceil(V.length/i)+1);if(!b)continue;let v=b.map(E=>V.subarray(E*i,E*i+i));H(g,Buffer.concat(v).subarray(0,g.size))}else{let b=h(g.start,g.size);b&&H(g,b)}}return{streams:U,paths:K}}catch{return null}}import{TextDecoder as rn}from"node:util";var fe="password-protected: open it with its password, or check it by hand";function Jr(e){let t=e.streams;return t.has("EncryptionInfo")&&t.has("EncryptedPackage")?"encrypted-ooxml":t.has("WordDocument")?"doc":t.has("Workbook")||t.has("Book")?"xls":t.has("PowerPoint Document")?"ppt":[...t.keys()].some(r=>r.startsWith("__substg1.0_"))?"msg":null}var cn=e=>{try{return new rn(e)}catch{return new rn("latin1")}},X=cn("windows-1252");function he(e){return e.replace(/[\r\x07\x0b\x0c]/g,`
|
|
21
21
|
`).replace(/[\x13\x14\x15]/g," ").replace(/[\x00-\x08\x0e-\x1f]/g,"").replace(/\n{3,}/g,`
|
|
22
22
|
|
|
23
|
-
`)}function
|
|
24
|
-
`))}function
|
|
25
|
-
`))}function
|
|
26
|
-
`))}function
|
|
27
|
-
`)):!o&&(
|
|
28
|
-
`){
|
|
23
|
+
`)}function qr(e,t){return e.length>t?{text:e.slice(0,t),truncated:!0}:{text:e,truncated:!1}}function Yr(e){let t=e.streams.get("WordDocument");if(t.length<512)return{kind:"doc",reason:"damaged Word file"};let r=t.readUInt16LE(10);if(r&256||r&32768)return{kind:"doc",reason:fe};if(t.readUInt16LE(2)<101){let m=t.readUInt32LE(24),y=t.readUInt32LE(28);return y<=m||y>t.length?{kind:"doc",reason:"damaged Word file"}:he(X.decode(t.subarray(m,y)))}let i=e.streams.get(r&512?"1Table":"0Table");if(!i)return{kind:"doc",reason:"damaged Word file (no table stream)"};let s=32;s+=2+t.readUInt16LE(s)*2,s+=2+t.readUInt16LE(s)*4;let o=s+2,a=t.readUInt32LE(o+264),c=t.readUInt32LE(o+264+4);if(!c||a+c>i.length)return{kind:"doc",reason:"damaged Word file (no piece table)"};let l=a,u=a+c,d=null;for(;l<u;){let m=i[l];if(m===1)l+=3+i.readInt16LE(l+1);else if(m===2){let y=i.readUInt32LE(l+1);d=i.subarray(l+5,Math.min(l+5+y,i.length));break}else break}if(!d||d.length<16)return{kind:"doc",reason:"damaged Word file (no piece table)"};let p=Math.floor((d.length-4)/12),f=[];for(let m=0;m<p;m+=1){let y=d.readUInt32LE(m*4),h=d.readUInt32LE((m+1)*4)-y;if(h<=0||h>t.length)continue;let _=d.readUInt32LE(4*(p+1)+m*8+2);if(_&1073741824){let k=(_&1073741823)/2;f.push(X.decode(t.subarray(k,Math.min(k+h,t.length))))}else f.push(t.subarray(_,Math.min(_+h*2,t.length)).toString("utf16le"))}return he(f.join(""))}var dt=class{segs;i=0;p=0;constructor(t){this.segs=t}here(){for(;this.i<this.segs.length&&this.p>=this.segs[this.i].length;)this.i+=1,this.p=0;return this.i<this.segs.length?this.segs[this.i]:null}get done(){return this.here()===null}atSeam(){return this.p===0&&this.i>0}u8(){let t=this.here();if(!t)throw new Error("eof");return t[this.p++]}u16(){return this.u8()|this.u8()<<8}u32(){return(this.u16()|this.u16()<<16)>>>0}skip(t){for(let r=0;r<t;r+=1)this.u8()}chars(t,r){let n="",i=t,s=r;for(;i>0&&this.here();){this.p===0&&n.length>0&&(s=(this.u8()&1)===1);let a=this.here();if(!a)break;let c=Math.floor((a.length-this.p)/(s?2:1)),l=Math.min(i,c);if(l<=0){this.p=a.length;continue}let u=a.subarray(this.p,this.p+l*(s?2:1));n+=s?u.toString("utf16le"):u.toString("latin1"),this.p+=u.length,i-=l}return n}};function Qr(e){let t=new dt(e),r=[];try{t.u32();let n=t.u32();for(let i=0;i<n&&!t.done;i+=1){let s=t.u16(),o=t.u8(),a=o&8?t.u16():0,c=o&4?t.u32():0;r.push(t.chars(s,(o&1)===1)),t.skip(a*4+c)}}catch{}return r}function sn(e,t,r,n){if(t+2>e.length)return"";let i=e.readUInt16LE(t);if(!r)return n.decode(e.subarray(t+2,t+2+i));let s=e[t+2],o=t+3;return s&8&&(o+=2),s&4&&(o+=4),s&1?e.subarray(o,o+i*2).toString("utf16le"):e.subarray(o,o+i).toString("latin1")}function on(e){let t;if(e&2)t=e>>2;else{let r=Buffer.alloc(8);r.writeUInt32LE(0,0),r.writeUInt32LE((e&4294967292)>>>0,4),t=r.readDoubleLE(0)}return e&1?t/100:t}var Ne=e=>Number.isFinite(e)?String(e):"";function ei(e){let t=e.streams.get("Workbook")??e.streams.get("Book"),r=!0,n=X,i=[],s=new Set,o=[],a=[],c=-1,l=null,u=0,d=(y,S,h)=>{if(c<0||!h)return;let _=a[c],k=_.get(y)??new Map;k.set(S,h),_.set(y,k)},p=0;for(;p+4<=t.length;){let y=t.readUInt16LE(p),S=t.readUInt16LE(p+2),h=t.subarray(p+4,Math.min(p+4+S,t.length)),_=p+4+S;switch(y){case 2057:u+=1,h.length>=4&&(r=h.readUInt16LE(0)===1536),u===1&&h.length>=4&&h.readUInt16LE(2)!==5&&(c=a.length,a.push(new Map));break;case 10:u=Math.max(0,u-1);break;case 47:return{kind:"xls",reason:fe};case 66:if(h.length>=2&&!r){let k=h.readUInt16LE(0);n=k===1200?X:cn(`windows-${k}`)}break;case 133:if(h.length>6){let k=h[6];if(r){let I=h[7]&1;o.push(I?h.subarray(8,8+k*2).toString("utf16le"):h.subarray(8,8+k).toString("latin1"))}else o.push(n.decode(h.subarray(7,7+k)))}break;case 252:{let k=[h];for(;_+4<=t.length&&t.readUInt16LE(_)===60;){let I=t.readUInt16LE(_+2);k.push(t.subarray(_+4,Math.min(_+4+I,t.length))),_+=4+I}i=Qr(k);break}case 253:if(h.length>=10){let k=h.readUInt32LE(6);s.add(k),d(h.readUInt16LE(0),h.readUInt16LE(2),i[k]??"")}break;case 516:case 214:h.length>=8&&d(h.readUInt16LE(0),h.readUInt16LE(2),sn(h,6,r,n));break;case 515:h.length>=14&&d(h.readUInt16LE(0),h.readUInt16LE(2),Ne(h.readDoubleLE(6)));break;case 638:h.length>=10&&d(h.readUInt16LE(0),h.readUInt16LE(2),Ne(on(h.readUInt32LE(6))));break;case 189:{if(h.length>=6){let k=h.readUInt16LE(0),I=h.readUInt16LE(2);for(let L=4;L+6<=h.length-2;L+=6)d(k,I++,Ne(on(h.readUInt32LE(L+2))))}break}case 6:if(h.length>=14){let k=h.readUInt16LE(0),I=h.readUInt16LE(2);h.readUInt16LE(12)===65535?l=h[6]===0?[k,I]:null:d(k,I,Ne(h.readDoubleLE(6)))}break;case 519:l&&d(l[0],l[1],sn(h,0,r,n)),l=null;break}p=_}let f=[];a.forEach((y,S)=>{f.push(o[S]??"");for(let h of[...y.keys()].sort((_,k)=>_-k)){let _=y.get(h);f.push([..._.keys()].sort((k,I)=>k-I).map(k=>_.get(k)).join(" "))}f.push("")});let m=i.filter((y,S)=>!s.has(S));return m.length&&f.push(...m),he(f.join(`
|
|
24
|
+
`))}function ti(e){if(e.streams.has("EncryptedSummary"))return{kind:"ppt",reason:fe};let t=e.streams.get("PowerPoint Document"),r=[],n=0;for(;n+8<=t.length;){let i=t.readUInt16LE(n)&15,s=t.readUInt16LE(n+2),o=t.readUInt32LE(n+4);if(s===12052)return{kind:"ppt",reason:fe};if(i===15){n+=8;continue}let a=t.subarray(n+8,Math.min(n+8+o,t.length));s===4e3||s===4026?r.push(a.toString("utf16le")):s===4008&&r.push(X.decode(a)),n+=8+o}return he(r.join(`
|
|
25
|
+
`))}function ni(e){let t=[];for(let[r,n]of e.paths){if(r.startsWith("__attach_"))continue;let i=/(?:^|\/)__substg1\.0_([0-9A-F]{4})(001F|001E)$/i.exec(r);i&&t.push(i[2].toUpperCase()==="001F"?n.toString("utf16le"):X.decode(n))}return he(t.join(`
|
|
26
|
+
`))}function an(e){let t=new Map;for(let[r,n]of e.paths){let i=/^(__attach_version1\.0_#[0-9A-F]{8})\/__substg1\.0_(3707|3704|3701)(001F|0102)$/i.exec(r);if(!i)continue;let s=t.get(i[1])??{};i[2]==="3701"&&i[3]==="0102"?s.data=n:i[2]==="3707"?s.name=n.toString("utf16le").replace(/\0+$/,""):i[2]==="3704"&&(s.short=n.toString("utf16le").replace(/\0+$/,"")),t.set(i[1],s)}return[...t.values()].filter(r=>r.data).map((r,n)=>({name:r.name||r.short||`attachment-${n+1}`,data:r.data}))}function ut(e,t){let r=lt(e);if(!r)return{kind:null,reason:"damaged Office 97-2003 file"};let n=Jr(r);if(!n)return{kind:null,reason:"a compound file that is not a Word, Excel, PowerPoint or Outlook file"};if(n==="encrypted-ooxml")return{kind:n,reason:fe};let i;try{i=n==="doc"?Yr(r):n==="xls"?ei(r):n==="ppt"?ti(r):ni(r)}catch{i={kind:n,reason:"damaged Office 97-2003 file"}}if(typeof i!="string")return i;if(!i.trim()&&!(n==="msg"&&an(r).length))return{kind:n,reason:"no text inside (an empty file, or only pictures)"};let s=qr(i,t),o=n==="msg"?an(r):[];return{kind:n,text:s.text,truncated:s.truncated,parts:[`cfb:${n}`],...o.length?{attachments:o}:{}}}import{TextDecoder as ln}from"node:util";var ri=new Set(["fonttbl","colortbl","stylesheet","listtable","listoverridetable","rsidtbl","generator","pict","object","objdata","themedata","colorschememapping","datastore","latentstyles","xmlnstbl","mmathpr","filetbl","revtbl","pgdsctbl","bkmkstart","bkmkend","fldinst","shppict","nonshppict","blipuid","panose","falt","wgrffmtfilter","defchp","defpap"]),dn=e=>{try{return new ln(e===65001?"utf-8":`windows-${e}`)}catch{return new ln("windows-1252")}};function Fe(e){return e.length>=5&&e.subarray(0,5).toString("latin1")==="{\\rtf"}function pt(e){let t=dn(1252),r=[],n=[],i=()=>{n.length&&(r.push(t.decode(Uint8Array.from(n))),n=[])},s=[],o=!1,a=1,c=0,l=0,u=e.length;for(;l<u;){let d=e[l];if(d==="{"){i(),s.push({skip:o,uc:a}),l+=1,e.startsWith("\\*",l)&&(o=!0);continue}if(d==="}"){i();let p=s.pop();p&&(o=p.skip,a=p.uc),l+=1;continue}if(d==="\\"){let p=e[l+1];if(p==="'"){let S=parseInt(e.substr(l+2,2),16);if(l+=4,c>0){c-=1;continue}!o&&Number.isFinite(S)&&n.push(S);continue}if(p==="\\"||p==="{"||p==="}"){o||(i(),r.push(p)),l+=2;continue}if(p==="~"){o||r.push(" "),l+=2;continue}let f=/^([a-zA-Z]+)(-?\d+)? ?/.exec(e.slice(l+1,l+40));if(!f){l+=2;continue}l+=1+f[0].length;let m=f[1].toLowerCase(),y=f[2]!==void 0?Number(f[2]):null;if(ri.has(m)){o=!0;continue}m==="ansicpg"&&y?t=dn(y):m==="uc"&&y!==null?a=y:m==="u"&&y!==null?(i(),o||r.push(String.fromCharCode(y<0?y+65536:y)),c=a):!o&&(m==="par"||m==="line"||m==="row"||m==="sect"||m==="page")?(i(),r.push(`
|
|
27
|
+
`)):!o&&(m==="tab"||m==="cell")&&(i(),r.push(" "));continue}if(d==="\r"||d===`
|
|
28
|
+
`){l+=1;continue}if(c>0){c-=1,l+=1;continue}o||(i(),r.push(d)),l+=1}return i(),r.join("").replace(/\n{3,}/g,`
|
|
29
29
|
|
|
30
|
-
`)}var
|
|
30
|
+
`)}var ft=new Set([".xlsx",".xlsm",".xltx",".xltm",".docx",".docm",".dotx",".dotm",".pptx",".pptm",".ppsx",".ppsm",".potx"]),Me=new Set([".odt",".ods",".odp",".ott",".ots",".otp"]),ht=new Set([".doc",".dot",".xls",".xlt",".ppt",".pps",".pot",".msg"]),un=new Set([".rtf"]);function si(e){return/^\.(xls[xm]|xlt[xm])$/.test(e)?".xlsx":/^\.(doc[xm]|dot[xm])$/.test(e)?".docx":/^\.(ppt[xm]|pps[xm]|potx)$/.test(e)?".pptx":e}var J=8*1024*1024,oi=101010256,ai=33639248,ci=67324752;function me(e){let t=Math.min(e.length,67584),r=-1;for(let o=e.length-22;o>=e.length-t&&o>=0;o-=1)if(e.readUInt32LE(o)===oi){r=o;break}if(r<0)return null;let n=e.readUInt16LE(r+10),i=e.readUInt32LE(r+16);if(i>=e.length)return null;let s=[];for(let o=0;o<n&&!(i+46>e.length||e.readUInt32LE(i)!==ai);o+=1){let a=e.readUInt16LE(i+8),c=e.readUInt16LE(i+10),l=e.readUInt32LE(i+20),u=e.readUInt32LE(i+24),d=e.readUInt16LE(i+28),p=e.readUInt16LE(i+30),f=e.readUInt16LE(i+32),m=e.readUInt32LE(i+42),y=e.subarray(i+46,i+46+d).toString("utf8");s.push({name:y,flags:a,method:c,compSize:l,uncompSize:u,localHeaderOffset:m}),i+=46+d+p+f}return s}function ge(e,t,r=256*1024*1024){let n=t.localHeaderOffset;if(n+30>e.length||e.readUInt32LE(n)!==ci)return null;let i=e.readUInt16LE(n+26),s=e.readUInt16LE(n+28),o=n+30+i+s,a=o+t.compSize;if(a>e.length)return null;let c=e.subarray(o,a);try{if(t.method===0)return c.length<=r?Buffer.from(c):null;if(t.method===8)return ii(c,{maxOutputLength:r})}catch{return null}return null}function li(e,t){return ge(e,t)?.toString("utf8")??null}var di={"&":"&","<":"<",">":">",""":'"',"'":"'"};function B(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>di[t]??t).replace(/&#(\d+);/g,(t,r)=>{let n=Number(r);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>{let n=parseInt(r,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function ui(e){return B(e.replace(/<[^>]*>/g,`
|
|
31
31
|
`)).replace(/\n{2,}/g,`
|
|
32
|
-
`)}function
|
|
33
|
-
`+
|
|
34
|
-
`))}a+p.length>
|
|
35
|
-
`),truncated:
|
|
36
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function
|
|
37
|
-
`),counts:o,columnsHidden:s.filter((h,y)=>i[y])}}var Jr=/^xl\/(pivotCache|charts|externalLinks)\//,on=10;function qr(e,t,r=1){e[t]=(e[t]??0)+r}function an(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function cn(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),r="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))r+=n[1];return M(r)}function Yr(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>cn(t[1]??"")):[]}var ln=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Pe(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function V(e,t){if(e.type==="s"){let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?t[Number(n[1])]??null:null}if(e.type==="inlineStr"){let n=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return n?cn(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?M(r[1]):null}function Qr(e){let t=[];for(let r of e.matchAll(ln)){let n=Pe(r[1],"r"),s=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!s)return null;t.push({full:r[0],attrs:r[1],inner:r[2]??"",col:s[1],row:Number(s[2]),type:Pe(r[1],"t")??"n"})}return t}function es(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,s)=>n-s).slice(0,on);for(let n of r){let s=new Map;for(let i of e.filter(o=>o.row===n)){let o=V(i,t),a=o?Y(o):null;a&&s.set(i.col,{type:a.type,header:o.trim()})}if(s.size>0)return{row:n,cols:s}}return{row:-1,cols:new Map}}var ts=/^xl\/worksheets\/sheet\d+\.xml$/,ns=200;function rs(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function ss(e,t){let r=[...new Set(e.map(i=>i.row))].sort((i,o)=>i-o).slice(0,on),n=-1,s=-1/0;for(let i of r){let o=e.filter(c=>c.row===i).map(c=>(V(c,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(c=>!rs(c)).length,l=a*2-(o.length-a);l>s&&(s=l,n=i)}return n}function is(e,t,r){let n=es(t,r),s=J();if(!s)return n;let i=n.row>=0?n.row:ss(t,r);if(i<0)return n;let o=t.filter(d=>d.row===i).map(d=>({col:d.col,text:(V(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,p)=>[d.col,p])),l=new Map;for(let d of t){if(d.row<=i)continue;let p=a.get(d.col);if(p!==void 0){if(!l.has(d.row)){if(l.size>=ns)continue;l.set(d.row,o.map(()=>""))}l.get(d.row)[p]=V(d,r)??""}}let c=new Map(i===n.row?n.cols:[]),u=o.map(d=>d.text);for(let d of s({name:e,headers:u,rows:[...l.values()]})){let p=u.indexOf(d.column);p<0||c.set(o[p].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:i,cols:c}}function rn(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${an(t)}</t></is></c>`}var os=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let n=0;n<8;n+=1)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function as(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=os[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var sn=33;function dn(e){let t=[],r=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),l=o.name.endsWith("/"),c=l?Buffer.alloc(0):Xr(o.data),u=l?0:8,d=l?0:as(o.data),p=Buffer.alloc(30);p.writeUInt32LE(67324752,0),p.writeUInt16LE(20,4),p.writeUInt16LE(2048,6),p.writeUInt16LE(u,8),p.writeUInt16LE(sn,12),p.writeUInt32LE(d,14),p.writeUInt32LE(c.length,18),p.writeUInt32LE(o.data.length,22),p.writeUInt16LE(a.length,26),t.push(p,a,c);let h=Buffer.alloc(46);h.writeUInt32LE(33639248,0),h.writeUInt16LE(20,4),h.writeUInt16LE(20,6),h.writeUInt16LE(2048,8),h.writeUInt16LE(u,10),h.writeUInt16LE(sn,14),h.writeUInt32LE(d,16),h.writeUInt32LE(c.length,20),h.writeUInt32LE(o.data.length,24),h.writeUInt16LE(a.length,28),h.writeUInt32LE(n,42),r.push(h,a),n+=p.length+a.length+c.length}let s=Buffer.concat(r),i=Buffer.alloc(22);return i.writeUInt32LE(101010256,0),i.writeUInt16LE(e.length,8),i.writeUInt16LE(e.length,10),i.writeUInt32LE(s.length,12),i.writeUInt32LE(n,16),Buffer.concat([...t,s,i])}function ft(e){let t=se(e);if(!t||t.length===0||t.some(f=>Jr.test(f.name)))return null;let r=new Map;for(let f of t){if(f.name.endsWith("/")){r.set(f.name,Buffer.alloc(0));continue}let k=ie(e,f);if(!k)return null;r.set(f.name,k)}let n=[...r.keys()].filter(f=>ts.test(f));if(n.length===0)return null;let s=r.get("xl/sharedStrings.xml")?.toString("utf8")??null,i=Yr(s),o=new Set,a={},l=new Set,c=lt();for(let f of n){let k=r.get(f).toString("utf8"),m=Qr(k);if(!m)return null;let x=is(f.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),m,i),_=x.row,A=new Map;for(let $ of m){if($.type!=="n"||$.row<=_)continue;let T=V($,i);T!==null&&A.set($.col,[...A.get($.col)??[],T])}let P=ut(A),N=new Map;for(let[$,{type:T,header:F,how:me}]of x.cols)me==="header"&&P.has($)||(N.set($,T),l.add(F));let he=k.replace(ln,($,T,F)=>{let me=Pe(T,"r"),[,H,ge]=/^([A-Z]+)(\d+)$/.exec(me),D={full:$,attrs:T,inner:F??"",col:H,row:Number(ge),type:Pe(T,"t")??"n"},g=V(D,i),b=()=>{if(D.type==="s"){let v=/<v>([^<]*)<\/v>/.exec(D.inner);v&&o.add(Number(v[1]))}return $};if(g===null||g.trim()==="")return b();let S=N.get(H);if(S&&D.row>_&&!dt(g))return qr(a,`column:${S}`),rn(T,c(S,g));if(D.type==="n"&&P.has(H))return b();let E=O(g,a);return E.text===g?b():rn(T,E.text)});r.set(f,Buffer.from(he,"utf8"))}if(s){let f=-1,k=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,m=>(f+=1,o.has(f)?m:"<si><t></t></si>"));r.set("xl/sharedStrings.xml",Buffer.from(k,"utf8"))}for(let f of[...r.keys()].filter(k=>/^xl\/comments\d*\.xml$/.test(k))){let m=r.get(f).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(x,_,A,P)=>{let N=O(M(A),a);return`${_}${an(N.text)}${P}`});r.set(f,Buffer.from(m,"utf8"))}let u=r.get("docProps/core.xml");if(u){let f=u.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");r.set("docProps/core.xml",Buffer.from(f,"utf8"))}let d=r.get("xl/workbook.xml");if(d){let f=d.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");r.set("xl/workbook.xml",Buffer.from(f,"utf8"))}let p=r.get("docProps/app.xml");if(p){let f=p.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");r.set("docProps/app.xml",Buffer.from(f,"utf8"))}let h=r.has("xl/calcChain.xml"),y=t.map(f=>f.name).filter(f=>!(h&&f==="xl/calcChain.xml"));if(h)for(let f of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let k=r.get(f);k&&r.set(f,Buffer.from(k.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:dn(y.map(f=>({name:f,data:r.get(f)}))),counts:a,columnsHidden:[...l]}}var Z=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,cs=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,ls=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function ht(e){let t=0;for(let r of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!n||!cs.test(n[1])||ls.test(n[1]))continue;let s=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");s.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(s)&&t++}return t}var la=64*1024*1024,da=4*1024*1024;var ua=512*1024*1024,pa=1024*1024*1024;var fa=256*1024*1024;var ha=new un("utf-8",{fatal:!0}),ma=new un("windows-1255");var ga=new Set([".cache",".cargo",".rustup",".npm",".pnpm-store",".yarn",".gradle",".m2",".nuget",".conda",".pyenv",".rbenv",".nvm",".volta",".bun",".deno",".docker",".android",".vscode-server",".agents",".agent",".codeium",".continue","antigravity",".antigravity","__pycache__",".venv","venv","site-packages",".next",".turbo",".expo",".nx",".parcel-cache",".svelte-kit","appdata",".trash","$recycle.bin"].map(e=>e.toLowerCase()));var xs=["Put the new key where the app reads it (for a developer machine: the NoData vault + nodata_run, not a .env file).","Check that the app still works with the new key.","Only then delete / revoke the OLD key \u2014 until you do, whoever copied it can still use it."],w=(e,t,r)=>({provider:e,url:t,steps:[...r,...xs]}),vs={"aws-access-key":w("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault)."]),"aws-secret-key":w("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault).","Mark the old key Inactive before deleting it."]),"gcp-api-key":w("Google Cloud","https://console.cloud.google.com/apis/credentials",["Open APIs & Services \u2192 Credentials.","Pick the key \u2192 Regenerate key (or create a new one and restrict it to the APIs you use)."]),"gcp-service-account":w("Google Cloud (service account)","https://console.cloud.google.com/iam-admin/serviceaccounts",["Open IAM & Admin \u2192 Service accounts \u2192 the account \u2192 Keys.","Add key \u2192 Create new key (JSON). Keep the file out of Git and out of shared folders."]),"firebase-key":w("Firebase / Google Cloud","https://console.cloud.google.com/apis/credentials",["A Firebase web key is meant to be public \u2014 restrict it instead: Credentials \u2192 the key \u2192 Application restrictions (your domains only).","If it is not a web key, regenerate it."]),"github-token":w("GitHub","https://github.com/settings/tokens",["Open Settings \u2192 Developer settings \u2192 Personal access tokens.","Generate a new token with only the scopes you need."]),"github-fine-grained":w("GitHub","https://github.com/settings/tokens?type=beta",["Open Fine-grained tokens.","Regenerate the token (or create a new one for only the repositories you need)."]),"gitlab-token":w("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":w("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys.","Roll the secret key (Stripe can keep the old one alive for a short overlap)."]),"stripe-restricted":w("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys \u2192 Restricted keys.","Roll the key, or create a new restricted key."]),"slack-token":w("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":w("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":w("Twilio","https://console.twilio.com/us1/account/keys-credentials/api-keys",["Open Account \u2192 API keys & tokens.","Create a new API key."]),"sendgrid-api-key":w("SendGrid","https://app.sendgrid.com/settings/api_keys",["Open Settings \u2192 API Keys.","Create a new key with only the permissions you need."]),"openai-key":w("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":w("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":w("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":w("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new SECRET key (a service_role / secret key bypasses every database rule \u2014 treat it like a root password).","Older projects with JWT keys: rotating the JWT secret replaces every key and signs everyone out \u2014 plan it."]),"supabase-access-token":w("Supabase (personal access token \u2014 reaches every project of the account)","https://supabase.com/dashboard/account/tokens",["Open Account \u2192 Access Tokens.","Revoke this token, then generate a new one only where it is needed (CLI, MCP) \u2014 prefer a read-only MCP."]),"supabase-secret-key":w("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new secret key, switch your servers to it, then delete this one."]),"postgres-uri":w("PostgreSQL (the password in the connection string)","https://supabase.com/dashboard/project/_/settings/database",["Change the database user's password: in Supabase \u2192 Project Settings \u2192 Database \u2192 Reset password; elsewhere, your host's console or ALTER USER \u2026 WITH PASSWORD.","Update the connection string with the new password."]),"mongodb-uri":w("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":w("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":w("Private key (SSH / TLS / signing)","",["Generate a new key pair.","Register the new PUBLIC key where the old one was trusted (server authorized_keys, certificate, service settings)."]),"jwt-secret":w("Your app's JWT secret","",["Set a new long random secret in the app's configuration.","Every signed-in user will be signed out \u2014 plan the moment."]),"password-in-code":w("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":w("An access token","",["Revoke the token in the service that issued it and issue a new one."])},ws=w("A credential","",["Find the service it belongs to and issue a new credential there."]);function mt(e){return vs[e]??ws}function hn(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||Ss(e)}function Ss(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as Es,mkdirSync as pc,readFileSync as As,statSync as mn,writeFileSync as fc}from"node:fs";import{homedir as Is}from"node:os";import{join as $s}from"node:path";var Ts=()=>$s(Is(),".nodata","flagged.json");function Rs(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var ce=null;function Cs(){let e=Ts();try{if(!Es(e))return{};let t=mn(e).mtimeMs;if(ce&&ce.path===e&&ce.mtimeMs===t)return ce.store;let r=JSON.parse(As(e,"utf8"));return ce={path:e,mtimeMs:t,store:r},r}catch{return{}}}function Le(e){let t=Cs()[Rs(e)];if(!t)return null;try{if(mn(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}return t.kinds}import{existsSync as Ps,mkdirSync as bc,readFileSync as Ls,writeFileSync as _c}from"node:fs";import{homedir as Ds}from"node:os";import{join as Os}from"node:path";var gn=()=>Os(Ds(),".nodata","prefs.json");function Ns(){try{let e=Ps(gn())?JSON.parse(Ls(gn(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function Fs(){let t=process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"";try{t||=Intl.DateTimeFormat().resolvedOptions().locale}catch{}return/^(he|iw)(?:[-_.@]|$)/i.test(t)?"he":"en"}function K(){return Ns()??Fs()}function R(e,t,r=K()){return r==="he"?e:t}import{createHmac as Ms,randomBytes as js}from"node:crypto";import{existsSync as Oe,mkdirSync as Us,readdirSync as zs,readFileSync as gt,writeFileSync as Bs}from"node:fs";import{homedir as de}from"node:os";import{basename as Ws,extname as Gs,isAbsolute as Vs,join as ue,relative as Zs,resolve as Ks}from"node:path";function j(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function Hs(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function yn(e,t,r){switch(t){case"eq":return e===r;case"ne":return e!==r;case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"prefix":return typeof e=="string"&&typeof r=="string"&&e.toLowerCase().startsWith(r.toLowerCase());case"gte":{let n=j(e),s=j(r);return n!==null&&s!==null&&n>=s}case"lte":{let n=j(e),s=j(r);return n!==null&&s!==null&&n<=s}case"between":{let n=j(e);return n!==null&&Array.isArray(r)&&r.length===2&&Hs(n,j(r[0]),j(r[1]))}default:return!1}}function bn(e,t,r){switch(t){case"in":return Array.isArray(r)&&e.some(n=>r.includes(n));case"not_in":return Array.isArray(r)&&!e.some(n=>r.includes(n));default:return!1}}var _n=()=>ue(de(),".nodata","rules.json"),De=()=>ue(de(),".nodata","rules-key"),kn={allow:0,ask:1,clean_copy:2,deny:3},Xs={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write"],label:"what the agent does (read, search, run, write)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>Gs(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Ws(e.path).toLowerCase()}};function Js(){try{if(Oe(De())){let t=gt(De(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=js(32);return Us(ue(de(),".nodata"),{recursive:!0}),Bs(De(),e.toString("hex")+`
|
|
38
|
-
`,{mode:384}),e}var qs=(e,t)=>Ms("sha256",t).update(JSON.stringify(e)).digest("hex");function xn(){if(!Oe(_n()))return{rules:[],tampered:!1};try{let e=JSON.parse(gt(_n(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=Oe(De())&&typeof e.mac=="string"&&e.mac===qs(t,Js());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var le=e=>{let t=Ks(e.replace(/^~(?=[\\/]|$)/,de())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function U(e,t){if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),s=le(t).toLowerCase();return s.endsWith("/"+n)||s.includes("/"+n+"/")}let r=Zs(le(e),le(t));return r===""||!r.startsWith("..")&&!Vs(r)}function vn(e,t){let r=Xs[e.field];if(!r)return!1;let n=r.extract(t);return e.op==="exists"?n!==void 0&&n!=="":n===void 0?!1:r.cardinality==="set"?bn(Array.isArray(n)?n:[],e.op,e.value):yn(n,e.op,e.value)}function yt(e,t){let r=e.map((n,s)=>({rule:n,n:s+1})).filter(n=>U(n.rule.path,t.path)).sort((n,s)=>le(s.rule.path).length-le(n.rule.path).length||n.n-s.n);for(let n of r)if((n.rule.when??[]).every(s=>vn(s,t)))return{...n,touched:t.path};return null}function bt(e,t,r,n){let s=null;for(let[i,o]of e.entries())U(o.path,t)||(o.path.startsWith("**/")?!Ys(t,o.path):!U(t,o.path))||(o.when??[]).every(a=>vn(a,{action:r,path:o.path,now:n}))&&(!s||kn[o.effect]>kn[s.rule.effect])&&(s={rule:o,n:i+1,touched:o.path});return s}function Ys(e,t){let r=0,n=(s,i)=>{if(i>5||r>4e3)return!1;let o;try{o=zs(s,{withFileTypes:!0})}catch{return!1}for(let a of o){if(++r>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let l=ue(s,a.name);if(U(t,l)||n(l,i+1))return!0}return!1};return n(e,0)}var Qs={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};var wn=(e,t=!1)=>Qs[e][t?1:0];function Sn(){try{let e=ue(de(),".nodata","org-mandate.json");if(!Oe(e))return[];let t=JSON.parse(gt(e,"utf8"));return Array.isArray(t.folder_rules)?t.folder_rules:[]}catch{return[]}}var ii=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...ct]),oi=50*1024*1024,ai=8,ci={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function vt(e){let t=xt(e).toLowerCase();return ii.has(Tn(t))||Z.test(t)}var li=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,di=/\.nodata[\\/]+(device-key\.json|secrets\.json|credentials\.json|issuer-ed25519\.json|capsule\.json|capsule-key|shares|approvals|fabric-key\.json|machine-salt|pending-link\.json|api-shares\.json|secret-shares\.json)\b/i;function pe(e){let t=Fe(fe(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!li.test(n)}function ui(e){return di.test(e)}var En=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,pi=/(>|\bsed\s+-i|\btee\b|\b(rm|del|erase|mv|move|cp|copy|ren|rename)\b|Set-Content|Add-Content|Out-File|Remove-Item|Move-Item|Copy-Item|Rename-Item|WriteAllText|writeFileSync|unlinkSync)/i;function fi(e,t,r){if(e==="Bash"||e==="PowerShell"){let s=typeof t.command=="string"?t.command:"";return En.test(s)&&pi.test(s)}let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?En.test((X(n)?n:C(r,n)).replace(/\\/g,"/")):!1}function hi(e){return vt(e)||Le(e)!==null}var He=class extends Error{};function mi(e){let t=Tn(e).toLowerCase(),r=ri(e),n,s;if(t===".csv"||t===".tsv")s=r.toString("utf8"),n=pt(s,t===".tsv"?" ":void 0).counts;else if(ct.has(t)){let o=t===".xlsx"||t===".xlsm"?ft(r):null,a=at(r,t);if(!a&&!o)throw new He;s=a?.text??"",n=o?o.counts:O(s).counts}else s=r.toString("utf8"),n=O(s).counts;let i=be.filter(o=>o.pattern.test(s)).length;return Z.test(xt(e).toLowerCase())&&(i=Math.max(i,ht(s))),i&&(n.secret=Math.max(n.secret??0,i)),n}var gi={israeli_id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",credit_card:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",iban:"IBAN",israeli_phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",email:'\u05D3\u05D5\u05D0"\u05DC',secret:"\u05E1\u05D5\u05D3",name:"\u05E9\u05DD",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",financial:"\u05DE\u05D9\u05D3\u05E2 \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",bank_account:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7",plate:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"};function Rn(e){let t=K()==="he",r=n=>(t?gi[n]:ci[n])??n;return Object.entries(e).sort((n,s)=>s[1]-n[1]).map(([n,s])=>`${s} ${n.startsWith("column:")?`${r(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:r(n)}`).join(", ")}function yi(e){return Rn(e)}function Cn(e,t,r){let n=i=>X(i)?i:C(r,i),s=i=>{try{return kt(i).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&s(n(t.path)))return[n(t.path)];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let i=t.command,o=[...[...i.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...i.matchAll(/'([^']*)'/g)].map(l=>l[1]),...i.split(/[\s|;&<>(),=`]+/)],a=[];for(let l of o){let c=l.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,fe()).replace(/^\/([a-zA-Z])\//,(d,p)=>process.platform==="win32"?`${p}:/`:d);if(!c)continue;let u=n(c);if(!(!vt(c)&&!pe(u)&&Le(u)===null)&&(s(u)&&!a.includes(u)&&a.push(u),a.length>=ai))break}return a}return[]}function z(e){return e.replace(/\\+/g,"/")}function bi(e){let t=e.trim();return/[;|&\n]|`|\$\(/.test(t.replace(/^cmd(?:\.exe)?\s+\/c\s+/i,""))?!1:/^(?:cmd(?:\.exe)?\s+\/c\s+)?(?:explorer(?:\.exe)?|start|invoke-item|ii|start-process|open|xdg-open)\b/i.test(t)}function Pn(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&bi(t.command))return n;for(let s of Cn(e,t,r)){if(!hi(s)||hn(s)||!$n(s))continue;let i,o=vt(s)?null:Le(s);if(o){i=`${z(s)}: ${R("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${yi(o)}`,n.push(i);continue}try{if(kt(s).size>oi)i=`${z(s)}: too large to check here (over 50 MB)`;else{let a=mi(s);if(Object.keys(a).length===0)continue;i=`${z(s)}: ${Rn(a)}`}}catch(a){i=a instanceof He?`${z(s)}: ${R("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`:`${z(s)}: could not be checked`}n.push(i)}return n}var _t=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,Me=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,_i=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^(?:npx\s+(?:-y\s+)?@nodatachat\/mcp(?:@\S+)?|nodata-mcp)\s+(?:secrets-run|secrets-login)\b|^node\s+\S*nodata-pull\.mjs\b/i,"the vault's secrets, outside nodata_run's approval and each key's policy"],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],ki=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Ln=/^(?:cat|type|get-content|gc|more|less|head|tail|bat|nl|strings|xxd|od|hexdump|grep|egrep|rg|select-string|sls|awk|sed|jq|yq|python\d*|py|node|ruby|perl)\b/i,xi=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function vi(e,t,r){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&_t.test((X(n)?n:C(r,n)).replace(/\\/g,"/")))return`a saved login (${xt(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let s=t.command.split(/(\|\||&&|[;|\n])/);for(let i=0;i<s.length;i+=2){let o=s[i+1]==="|",a=s[i].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Ln.test(a)&&_t.test(a))return"a saved login file";for(let[c,u]of _i)if(c.test(a))return u;let l=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(l&&(!l[1]||Me.test(l[1])))return l[1]?`the variable ${l[1]}`:"every environment variable";if(!o&&(ki.test(a)||/GetEnvironmentVariable/i.test(a)))for(let c of a.matchAll(xi)){let u=c[1]??c[2]??c[3]??c[4]??"";if(Me.test(u))return`the variable ${u}`}}return null}var Dn=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,wi=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,Si=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),An=4e3,Ei=5;function Ai(e){let t=0,r=0,n=(s,i)=>{if(i>Ei||t>An)return;let o;try{o=ni(s,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>An)return;let l=Fe(s,a.name);a.isDirectory()?Si.has(a.name)||n(l,i+1):(Z.test(a.name.toLowerCase())||_t.test(l.replace(/\\/g,"/"))||pe(l))&&r++}};return n(e,0),r}var je=e=>{try{return kt(e).isDirectory()}catch{return!1}};function Ii(e,t){let r=si(C(t),C(e));return r===""||!r.startsWith("..")&&!X(r)}function $i(e,t,r){let n=i=>C(r,i.replace(/^~(?=[\\/]|$)/,fe())),s=[];if(e==="Grep"){let i=typeof t.path=="string"&&t.path?n(t.path):C(r);if(je(i)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");s.push({roots:[i],bySecret:Me.test(o)||/\.env|env\b/i.test(String(t.glob??""))})}}else if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string")for(let i of t.command.split(/\|\||&&|[;|\n]/)){let o=i.trim().replace(/^(?:sudo\s+|xargs\s+(?:-\S+\s+)*)/i,"");if(!/^find\b.*-exec\s+(?:grep|egrep|rg|cat)\b/i.test(o)&&!(Dn.test(o)&&(wi.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let c=o.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(je);s.push({roots:c.length?c:[C(r)],bySecret:Me.test(o)||/\.env\b/i.test(o)})}for(let i of s)for(let o of i.roots){if(!i.bySecret&&Ii(o,r))continue;let a=Ai(o);if(a>0)return{why:i.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var Ne=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function Ti(e,t,r){let n=s=>C(r,s.replace(/^~(?=[\\/]|$)/,fe()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(Ne.has(e)){let s=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return s?{action:"write",paths:[n(s)],roots:[]}:null}if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):C(r);return{action:"search",paths:[s],roots:je(s)?[s]:[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let s=t.command,o=[...[...s.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...s.matchAll(/'([^']*)'/g)].map(c=>c[1]),...s.split(/[\s|;&<>(),=`]+/)].map(c=>c.trim()).filter(c=>c&&!c.startsWith("-")&&/[\\/.~]/.test(c)).map(n).filter(c=>$n(c)),a=s.split(/\|\||&&|[;|\n]/).some(c=>Dn.test(c.trim())||/^find\b/i.test(c.trim())),l=o.filter(je);return{action:a?"search":Ln.test(s.trim())?"read":"run",paths:[C(r),...o],roots:a?l.length?l:[C(r)]:[]}}return null}function Ri(e,t,r,n=new Date){let s=Ti(e,t,r);if(!s)return null;let{rules:i,tampered:o}=xn(),a=Sn();if(!i.length&&!a.length)return null;let l={allow:0,ask:1,clean_copy:2,deny:3},c=null;for(let d of s.paths){let p=yt(a,{action:s.action,path:d,now:n});p&&(!c||l[p.rule.effect]>l[c.rule.effect])&&(c={...p,org:!0})}for(let d of s.roots){let p=bt(a,d,s.action,n);p&&p.rule.effect!=="allow"&&(!c||l[p.rule.effect]>l[c.rule.effect])&&(c={...p,org:!0})}let u=Ci(i,o,s,n,l);return c&&(!u||l[c.rule.effect]>=l[u.rule.effect])?c:u}function Ci(e,t,r,n,s){if(!e.length)return null;if(t){for(let o of r.paths){let a=e.find(l=>U(l.path,o)||U(o,l.path));if(a)return{rule:{...a,effect:"deny",when:[]},n:e.indexOf(a)+1,touched:o,tampered:!0}}return null}let i=null;for(let o of r.paths){let a=yt(e,{action:r.action,path:o,now:n});a&&(!i||s[a.rule.effect]>s[i.rule.effect])&&(i=a)}for(let o of r.roots){let a=bt(e,o,r.action,n);a&&a.rule.effect!=="allow"&&(!i||s[a.rule.effect]>s[i.rule.effect])&&(i=a)}return i}function Pi(e){let t;try{t=typeof e=="string"?e:JSON.stringify(e??"")}catch{return{}}if(!t)return{};t=t.slice(0,2*1024*1024);let r={};for(let n of q()){let s=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),i=(t.match(s)??[]).length;i&&(r[n.id]=(r[n.id]??0)+i)}return r}function Li(e){let t=Object.keys(e);if(t.length===0)return null;let r=t.reduce((s,i)=>s+e[i],0),n=[...new Set(t.map(s=>{let i=mt(s);return i.url?`${i.provider}: ${i.url}`:i.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${r}: ${t.join(", ")}). It is now in this conversation and was sent to the AI model. Do not repeat, quote, shorten, mask-by-hand or reuse it \u2014 not in your answer, not in a command, not in a file. Tell the user in one line that a key was shown here and should be replaced at its provider (${n.join(" \xB7 ")}); nodata_scan_folder gives the full steps. Next time, run commands that need secrets through nodata_run: the output comes back with every value blanked.`+(K()==="he"?" Answer the user in Hebrew.":"")}function Di(e,t,r){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",s=e==="Grep"&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&ui(n)||s&&pe(X(s)?s:C(r,s))||Cn(e,t,r).some(pe)?R("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function Oi(e,t,r,n){let s=Di(e,t,r);if(s)return{decision:"deny",reason:s};let i=vi(e,t,r);if(i){let u=R(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${i}. \u05DE\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05DE\u05D3\u05E4\u05D9\u05E1\u05D4 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4 \u05D5\u05E0\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05E8\u05D0\u05D4 \u05DB\u05D0\u05DF \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D7\u05DC\u05D9\u05E3.
|
|
39
|
-
\u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05D4 \u05D1\u05E2\u05E6\u05DE\u05DA \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC (\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8), \u05D0\u05D5 nodata_run \u2014 \u05E9\u05DE\u05E8\u05D9\u05E5 \u05E4\u05E7\u05D5\u05D3\u05D4 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05DE\u05D7\u05D6\u05D9\u05E8 \u05D0\u05EA \u05D4\u05E4\u05DC\u05D8 \u05DB\u05E9\u05DB\u05DC \u05E2\u05E8\u05DA \u05DE\u05D5\u05E1\u05EA\u05E8.`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this shows ${
|
|
40
|
-
Instead: run it yourself in a terminal (not the chat), or nodata_run \u2014 it runs a command with the secrets and returns the output with every value blanked.`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:
|
|
41
|
-
\u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D7\u05E4\u05E9 \u05D1\u05EA\u05D5\u05DA \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8, \u05D0\u05D5 nodata_run \u05E2\u05DD \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D4\u05DB\u05E1\u05E4\u05EA (\u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05D4 \u05DE\u05D0\u05D5\u05E9\u05E8\u05EA \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D9\u05D0).`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this is ${
|
|
42
|
-
Instead: search inside the project, or nodata_run with the keys from the vault (each command approved as written).`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:
|
|
43
|
-
${
|
|
32
|
+
`)}function pi(e,t,r){let n=new RegExp(`<${t}\\b[^>]*\\b${r}="([^"]*)"`,"g"),i=[],s;for(;(s=n.exec(e))!==null;)s[1]&&i.push(B(s[1]));return i}function fi(e,t){let r=[];if(Me.has(e)){for(let n of t)(n==="content.xml"||n==="styles.xml"||n==="meta.xml")&&r.push(n);return r}e=si(e);for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&r.push(n);if(e===".xlsx"||e===".xlsm")for(let n of t)(n==="xl/sharedStrings.xml"||n==="xl/workbook.xml"||/^xl\/worksheets\/sheet\d+\.xml$/.test(n)||/^xl\/comments\d*\.xml$/.test(n))&&r.push(n);else if(e===".docx")for(let n of t)(n==="word/document.xml"||/^word\/(header|footer|footnotes|endnotes|comments)\d*\.xml$/.test(n))&&r.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&r.push(n);return r}function hi(e,t){let r=me(e);if(!r||r.length===0)return null;let n=new Map(r.map(l=>[l.name,l])),i=fi(t,r.map(l=>l.name));if(i.length===0)return null;let s=[],o=[],a=0,c=!1;for(let l of i){if(a>=J){c=!0;break}let u=n.get(l);if(!u)continue;let d=li(e,u);if(d===null)continue;let p=ui(d);if(l==="xl/workbook.xml"){let f=pi(d,"sheet","name");f.length&&(p+=`
|
|
33
|
+
`+f.join(`
|
|
34
|
+
`))}a+p.length>J&&(p=p.slice(0,Math.max(0,J-a)),c=!0),p.trim().length!==0&&(s.push(p),o.push(l),a+=p.length)}return s.length===0?null:{text:s.join(`
|
|
35
|
+
`),truncated:c,parts:o}}function pn(e,t,r={}){if(pe(e)){let n=ut(e,J);return"text"in n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:n.parts,attachments:n.attachments}}:{ok:!1,reason:n.reason}}if(Fe(e)){let n=pt(e.toString("latin1"));if(!n.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=n.length>J;return{ok:!0,result:{text:i?n.slice(0,J):n,truncated:i,parts:["rtf"]}}}if(ft.has(t)||Me.has(t)){let n=hi(e,t);return n?{ok:!0,result:n}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Ie.has(t)){let n=De(e,r);return n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}}:{ok:!1,reason:tn(e)}}return ht.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}function mt(e,t,r={}){let n=pn(e,t,r);return n.ok?n.result:null}var gt=new Set([...ft,...Me,...ht,...un,...Ie]);var na=5*6e4,ra=2*6e4;import{deflateRawSync as bi}from"node:zlib";var fn={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},mi=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,gi=[...Ut].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function q(e,t,r=1){e[t]=(e[t]??0)+r}var hn=null,Y=e=>{let t=e.trim();hn&&t&&hn.add(t)};function N(e,t={}){let r=e;for(let n of ce()){let i=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g");r=r.replace(i,s=>(q(t,"secret"),Y(s),"[SECRET]"))}for(let n of gi)n.pattern.lastIndex=0,r=r.replace(n.pattern,i=>n.validate(i)?(q(t,n.subkind),Y(i),fn[n.subkind]??`[${n.subkind.toUpperCase()}]`):i);r=r.replace(mi,n=>(q(t,"email"),Y(n),fn.email));for(let n of Se()){let i=n.find(r).sort((s,o)=>o.start-s.start);for(let s of i)Y(r.slice(s.start,s.end)),r=r.slice(0,s.start)+`[${n.kind.toUpperCase()}]`+r.slice(s.end),q(t,n.kind)}return{text:r,counts:t,columnsHidden:[]}}function He(e,t,r={}){let n=e;for(let[i,s]of[...t].sort((o,a)=>a[0].length-o[0].length))n.includes(i)&&(n=n.split(i).join(`[${s.toUpperCase()}]`),q(r,s),Y(i));return n}function yt(){let e=new Map,t={};return(r,n)=>{Y(n);let i=`${r}\0${n.trim()}`,s=e.get(i);return s===void 0&&(s=t[r]=(t[r]??0)+1,e.set(i,s)),`[${r.toUpperCase()}-${s}]`}}function bt(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var gn=/^\s*-?\d+(?:\.\d+)?\s*$/;function _t(e){let t=new Set;for(let[r,n]of e){let i=n.filter(o=>gn.test(o));if(i.length<3)continue;i.filter(o=>N(o).text!==o).length/i.length<.5&&t.add(r)}return t}function mn(e,t){return e.includes(t)||e.includes('"')||e.includes(`
|
|
36
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function yi(e){let t=(e.match(/\t/g)??[]).length,r=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=r?" ":r>n?";":","}function kt(e,t){let r=e.split(/\r?\n/),n=t??yi(r[0]??""),i=Ae(r[0]??"",n),s=i.map(f=>le(f)),o={},a=yt(),c=r.slice(1).map(f=>f===""?null:Ae(f,n)),l=new Map;for(let f of c)f?.forEach((m,y)=>l.set(y,[...l.get(y)??[],m]));let u=_t(l),d=ae();if(d){let f=c.filter(m=>m!==null).slice(0,200);for(let m of d({name:"table",headers:i,rows:f})){let y=i.indexOf(m.column);y>=0&&!(m.how==="header"&&u.has(y))&&(s[y]={type:m.type,label:m.category})}}let p=[i.map(f=>mn(f,n)).join(n)];for(let f of c){if(f===null){p.push("");continue}let m=f.map((y,S)=>{let h=s[S];return h&&y.trim()!==""&&!bt(y)?(q(o,`column:${h.type}`),a(h.type,y)):u.has(S)&&gn.test(y)?y:N(y,o).text});p.push(m.map(y=>mn(y,n)).join(n))}return{text:p.join(`
|
|
37
|
+
`),counts:o,columnsHidden:i.filter((f,m)=>s[m])}}var _i=/^xl\/(pivotCache|charts|externalLinks)\//,_n=10;function yn(e,t,r=1){e[t]=(e[t]??0)+r}function kn(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),r="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))r+=n[1];return B(r)}function ki(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>xn(t[1]??"")):[]}var vn=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function je(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function Q(e,t){if(e.type==="s"){let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?t[Number(n[1])]??null:null}if(e.type==="inlineStr"){let n=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return n?xn(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?B(r[1]):null}function xi(e){let t=[];for(let r of e.matchAll(vn)){let n=je(r[1],"r"),i=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!i)return null;t.push({full:r[0],attrs:r[1],inner:r[2]??"",col:i[1],row:Number(i[2]),type:je(r[1],"t")??"n"})}return t}function vi(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,_n);for(let n of r){let i=new Map;for(let s of e.filter(o=>o.row===n)){let o=Q(s,t),a=o?le(o):null;a&&i.set(s.col,{type:a.type,header:o.trim()})}if(i.size>0)return{row:n,cols:i}}return{row:-1,cols:new Map}}var wi=/^xl\/worksheets\/sheet\d+\.xml$/,Si=200;function Ei(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function Ai(e,t){let r=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,_n),n=-1,i=-1/0;for(let s of r){let o=e.filter(l=>l.row===s).map(l=>(Q(l,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(l=>!Ei(l)).length,c=a*2-(o.length-a);c>i&&(i=c,n=s)}return n}function Ii(e,t,r){let n=vi(t,r),i=ae();if(!i)return n;let s=n.row>=0?n.row:Ai(t,r);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(Q(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,p)=>[d.col,p])),c=new Map;for(let d of t){if(d.row<=s)continue;let p=a.get(d.col);if(p!==void 0){if(!c.has(d.row)){if(c.size>=Si)continue;c.set(d.row,o.map(()=>""))}c.get(d.row)[p]=Q(d,r)??""}}let l=new Map(s===n.row?n.cols:[]),u=o.map(d=>d.text);for(let d of i({name:e,headers:u,rows:[...c.values()]})){let p=u.indexOf(d.column);p<0||l.set(o[p].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:l}}function xt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${kn(t)}</t></is></c>`}var $i=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let n=0;n<8;n+=1)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function Ti(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=$i[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var bn=33;function wn(e){let t=[],r=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),c=o.name.endsWith("/"),l=c?Buffer.alloc(0):bi(o.data),u=c?0:8,d=c?0:Ti(o.data),p=Buffer.alloc(30);p.writeUInt32LE(67324752,0),p.writeUInt16LE(20,4),p.writeUInt16LE(2048,6),p.writeUInt16LE(u,8),p.writeUInt16LE(bn,12),p.writeUInt32LE(d,14),p.writeUInt32LE(l.length,18),p.writeUInt32LE(o.data.length,22),p.writeUInt16LE(a.length,26),t.push(p,a,l);let f=Buffer.alloc(46);f.writeUInt32LE(33639248,0),f.writeUInt16LE(20,4),f.writeUInt16LE(20,6),f.writeUInt16LE(2048,8),f.writeUInt16LE(u,10),f.writeUInt16LE(bn,14),f.writeUInt32LE(d,16),f.writeUInt32LE(l.length,20),f.writeUInt32LE(o.data.length,24),f.writeUInt16LE(a.length,28),f.writeUInt32LE(n,42),r.push(f,a),n+=p.length+a.length+l.length}let i=Buffer.concat(r),s=Buffer.alloc(22);return s.writeUInt32LE(101010256,0),s.writeUInt16LE(e.length,8),s.writeUInt16LE(e.length,10),s.writeUInt32LE(i.length,12),s.writeUInt32LE(n,16),Buffer.concat([...t,i,s])}function vt(e,t){let r=me(e);if(!r||r.length===0||r.some(h=>_i.test(h.name)))return null;let n=new Map;for(let h of r){if(h.name.endsWith("/")){n.set(h.name,Buffer.alloc(0));continue}let _=ge(e,h);if(!_)return null;n.set(h.name,_)}let i=[...n.keys()].filter(h=>wi.test(h));if(i.length===0)return null;let s=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,o=ki(s),a=new Set,c={},l=new Set,u=yt(),d=nt();for(let h of i){let _=n.get(h).toString("utf8"),k=xi(_);if(!k)return null;let I=Ii(h.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),k,o),L=I.row,F=new Map;for(let R of k){if(R.type!=="n"||R.row<=L)continue;let D=Q(R,o);D!==null&&F.set(R.col,[...F.get(R.col)??[],D])}let M=_t(F),O=new Map;for(let[R,{type:D,header:U,how:K}]of I.cols)K==="header"&&M.has(R)||(O.set(R,D),l.add(U));let V=_.replace(vn,(R,D,U)=>{let K=je(D,"r"),[,H,g]=/^([A-Z]+)(\d+)$/.exec(K),b={full:R,attrs:D,inner:U??"",col:H,row:Number(g),type:je(D,"t")??"n"},v=Q(b,o),E=()=>{if(b.type==="s"){let Ft=/<v>([^<]*)<\/v>/.exec(b.inner);Ft&&a.add(Number(Ft[1]))}return R};if(v===null||v.trim()==="")return E();if(d&&b.type==="n"&&M.has(H)&&b.row>L)return yn(c,"amount"),xt(D,"[AMOUNT]");let x=O.get(H);if(x&&b.row>L&&!bt(v))return yn(c,`column:${x}`),xt(D,u(x,v));if(b.type==="n"&&M.has(H))return E();let z=N(v,c),oe=t?.size?He(z.text,t,c):z.text;return oe===v?E():xt(D,oe)});n.set(h,Buffer.from(V,"utf8"))}if(s){let h=-1,_=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,k=>(h+=1,a.has(h)?k:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(_,"utf8"))}for(let h of[...n.keys()].filter(_=>/^xl\/comments\d*\.xml$/.test(_))){let k=n.get(h).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(I,L,F,M)=>{let O=N(B(F),c);return`${L}${kn(t?.size?He(O.text,t,c):O.text)}${M}`});n.set(h,Buffer.from(k,"utf8"))}let p=n.get("docProps/core.xml");if(p){let h=p.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");n.set("docProps/core.xml",Buffer.from(h,"utf8"))}let f=n.get("xl/workbook.xml");if(f){let h=f.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");n.set("xl/workbook.xml",Buffer.from(h,"utf8"))}let m=n.get("docProps/app.xml");if(m){let h=m.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");n.set("docProps/app.xml",Buffer.from(h,"utf8"))}let y=n.has("xl/calcChain.xml"),S=r.map(h=>h.name).filter(h=>!(y&&h==="xl/calcChain.xml"));if(y)for(let h of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let _=n.get(h);_&&n.set(h,Buffer.from(_.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:wn(S.map(h=>({name:h,data:n.get(h)}))),counts:c,columnsHidden:[...l]}}var ee=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,Ri=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,Ci=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function wt(e){let t=0;for(let r of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!n||!Ri.test(n[1])||Ci.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var Ua=64*1024*1024,za=4*1024*1024;var Ba=512*1024*1024,Wa=1024*1024*1024;var Ga=256*1024*1024;var Va=new Sn("utf-8",{fatal:!0}),Ka=new Sn("windows-1255");var Za=new Set([".cache",".cargo",".rustup",".npm",".pnpm-store",".yarn",".gradle",".m2",".nuget",".conda",".pyenv",".rbenv",".nvm",".volta",".bun",".deno",".docker",".android",".vscode-server",".agents",".agent",".codeium",".continue","antigravity",".antigravity","__pycache__",".venv","venv","site-packages",".next",".turbo",".expo",".nx",".parcel-cache",".svelte-kit","appdata",".trash","$recycle.bin"].map(e=>e.toLowerCase()));var Bi=["Put the new key where the app reads it (for a developer machine: the NoData vault + nodata_run, not a .env file).","Check that the app still works with the new key.","Only then delete / revoke the OLD key \u2014 until you do, whoever copied it can still use it."],w=(e,t,r)=>({provider:e,url:t,steps:[...r,...Bi]}),Wi={"aws-access-key":w("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault)."]),"aws-secret-key":w("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault).","Mark the old key Inactive before deleting it."]),"gcp-api-key":w("Google Cloud","https://console.cloud.google.com/apis/credentials",["Open APIs & Services \u2192 Credentials.","Pick the key \u2192 Regenerate key (or create a new one and restrict it to the APIs you use)."]),"gcp-service-account":w("Google Cloud (service account)","https://console.cloud.google.com/iam-admin/serviceaccounts",["Open IAM & Admin \u2192 Service accounts \u2192 the account \u2192 Keys.","Add key \u2192 Create new key (JSON). Keep the file out of Git and out of shared folders."]),"firebase-key":w("Firebase / Google Cloud","https://console.cloud.google.com/apis/credentials",["A Firebase web key is meant to be public \u2014 restrict it instead: Credentials \u2192 the key \u2192 Application restrictions (your domains only).","If it is not a web key, regenerate it."]),"github-token":w("GitHub","https://github.com/settings/tokens",["Open Settings \u2192 Developer settings \u2192 Personal access tokens.","Generate a new token with only the scopes you need."]),"github-fine-grained":w("GitHub","https://github.com/settings/tokens?type=beta",["Open Fine-grained tokens.","Regenerate the token (or create a new one for only the repositories you need)."]),"gitlab-token":w("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":w("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys.","Roll the secret key (Stripe can keep the old one alive for a short overlap)."]),"stripe-restricted":w("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys \u2192 Restricted keys.","Roll the key, or create a new restricted key."]),"slack-token":w("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":w("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":w("Twilio","https://console.twilio.com/us1/account/keys-credentials/api-keys",["Open Account \u2192 API keys & tokens.","Create a new API key."]),"sendgrid-api-key":w("SendGrid","https://app.sendgrid.com/settings/api_keys",["Open Settings \u2192 API Keys.","Create a new key with only the permissions you need."]),"openai-key":w("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":w("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":w("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":w("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new SECRET key (a service_role / secret key bypasses every database rule \u2014 treat it like a root password).","Older projects with JWT keys: rotating the JWT secret replaces every key and signs everyone out \u2014 plan it."]),"supabase-access-token":w("Supabase (personal access token \u2014 reaches every project of the account)","https://supabase.com/dashboard/account/tokens",["Open Account \u2192 Access Tokens.","Revoke this token, then generate a new one only where it is needed (CLI, MCP) \u2014 prefer a read-only MCP."]),"supabase-secret-key":w("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new secret key, switch your servers to it, then delete this one."]),"postgres-uri":w("PostgreSQL (the password in the connection string)","https://supabase.com/dashboard/project/_/settings/database",["Change the database user's password: in Supabase \u2192 Project Settings \u2192 Database \u2192 Reset password; elsewhere, your host's console or ALTER USER \u2026 WITH PASSWORD.","Update the connection string with the new password."]),"mongodb-uri":w("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":w("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":w("Private key (SSH / TLS / signing)","",["Generate a new key pair.","Register the new PUBLIC key where the old one was trusted (server authorized_keys, certificate, service settings)."]),"jwt-secret":w("Your app's JWT secret","",["Set a new long random secret in the app's configuration.","Every signed-in user will be signed out \u2014 plan the moment."]),"password-in-code":w("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":w("An access token","",["Revoke the token in the service that issued it and issue a new one."])},Gi=w("A credential","",["Find the service it belongs to and issue a new credential there."]);function St(e){return Wi[e]??Gi}function In(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||Vi(e)}function Vi(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as Ki,mkdirSync as Kc,readFileSync as Zi,statSync as Et,writeFileSync as Zc}from"node:fs";import{homedir as Xi}from"node:os";import{join as Ji}from"node:path";var qi=()=>Ji(Xi(),".nodata","flagged.json");var $n="unread";function Tn(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var ye=null;function Rn(){let e=qi();try{if(!Ki(e))return{};let t=Et(e).mtimeMs;if(ye&&ye.path===e&&ye.mtimeMs===t)return ye.store;let r=JSON.parse(Zi(e,"utf8"));return ye={path:e,mtimeMs:t,store:r},r}catch{return{}}}function Ue(e){let t=Rn()[Tn(e)];if(!t)return null;try{if(Et(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==$n));return Object.keys(r).length?r:null}function ze(e){let t=Rn()[Tn(e)];if(!t||!t.kinds[$n])return null;try{return{changed:Et(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as Cn,mkdirSync as Qc,readFileSync as Pn,writeFileSync as el}from"node:fs";import{homedir as Yi}from"node:os";import{join as Qi}from"node:path";var Be=()=>Qi(Yi(),".nodata","prefs.json");function es(){try{let e=Cn(Be())?JSON.parse(Pn(Be(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function ts(){let t=process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"";try{t||=Intl.DateTimeFormat().resolvedOptions().locale}catch{}return/^(he|iw)(?:[-_.@]|$)/i.test(t)?"he":"en"}function te(){return es()??ts()}function At(){try{return Cn(Be())&&JSON.parse(Pn(Be(),"utf8")).amounts_sensitive===!0}catch{return!1}}function T(e,t,r=te()){return r==="he"?e:t}import{createHmac as rs,randomBytes as is}from"node:crypto";import{existsSync as Ge,mkdirSync as ss,readdirSync as os,readFileSync as It,writeFileSync as as}from"node:fs";import{homedir as _e}from"node:os";import{basename as cs,extname as ls,isAbsolute as ds,join as ke,relative as us,resolve as ps}from"node:path";function W(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function ns(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function Ln(e,t,r){switch(t){case"eq":return e===r;case"ne":return e!==r;case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"prefix":return typeof e=="string"&&typeof r=="string"&&e.toLowerCase().startsWith(r.toLowerCase());case"gte":{let n=W(e),i=W(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=W(e),i=W(r);return n!==null&&i!==null&&n<=i}case"between":{let n=W(e);return n!==null&&Array.isArray(r)&&r.length===2&&ns(n,W(r[0]),W(r[1]))}default:return!1}}function Dn(e,t,r){switch(t){case"in":return Array.isArray(r)&&e.some(n=>r.includes(n));case"not_in":return Array.isArray(r)&&!e.some(n=>r.includes(n));default:return!1}}var On=()=>ke(_e(),".nodata","rules.json"),We=()=>ke(_e(),".nodata","rules-key"),Nn={allow:0,ask:1,clean_copy:2,deny:3},fs=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Fn=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,hs={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write"],label:"what the agent does (read, search, run, write)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>ls(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>cs(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${fs.join(", ")} \u2026)`,extract:e=>Fn(e.who?.host)},"agent.type":{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"sub-agent type inside the agent (main = the main conversation; general-purpose, explore \u2026)",extract:e=>Fn(e.who?.type)}};function ms(){try{if(Ge(We())){let t=It(We(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=is(32);return ss(ke(_e(),".nodata"),{recursive:!0}),as(We(),e.toString("hex")+`
|
|
38
|
+
`,{mode:384}),e}var gs=(e,t)=>rs("sha256",t).update(JSON.stringify(e)).digest("hex");function Mn(){if(!Ge(On()))return{rules:[],tampered:!1};try{let e=JSON.parse(It(On(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=Ge(We())&&typeof e.mac=="string"&&e.mac===gs(t,ms());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var be=e=>{let t=ps(e.replace(/^~(?=[\\/]|$)/,_e())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function G(e,t){if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),i=be(t).toLowerCase();return i.endsWith("/"+n)||i.includes("/"+n+"/")}let r=us(be(e),be(t));return r===""||!r.startsWith("..")&&!ds(r)}function Hn(e,t,r){let n=hs[e.field];if(!n)return!1;let i=n.extract(t);return n.agentScope&&i===void 0?r!=="allow":e.op==="exists"?i!==void 0&&i!=="":i===void 0?!1:n.cardinality==="set"?Dn(Array.isArray(i)?i:[],e.op,e.value):Ln(i,e.op,e.value)}function $t(e,t){let r=e.map((n,i)=>({rule:n,n:i+1})).filter(n=>G(n.rule.path,t.path)).sort((n,i)=>be(i.rule.path).length-be(n.rule.path).length||n.n-i.n);for(let n of r)if((n.rule.when??[]).every(i=>Hn(i,t,n.rule.effect)))return{...n,touched:t.path};return null}function Tt(e,t,r,n,i){let s=null;for(let[o,a]of e.entries())G(a.path,t)||(a.path.startsWith("**/")?!ys(t,a.path):!G(t,a.path))||(a.when??[]).every(c=>Hn(c,{action:r,path:a.path,now:n,who:i},a.effect))&&(!s||Nn[a.effect]>Nn[s.rule.effect])&&(s={rule:a,n:o+1,touched:a.path});return s}function ys(e,t){let r=0,n=(i,s)=>{if(s>5||r>4e3)return!1;let o;try{o=os(i,{withFileTypes:!0})}catch{return!1}for(let a of o){if(++r>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let c=ke(i,a.name);if(G(t,c)||n(c,s+1))return!0}return!1};return n(e,0)}var bs={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};var jn=(e,t=!1)=>bs[e][t?1:0];function Un(){try{let e=ke(_e(),".nodata","org-mandate.json");if(!Ge(e))return[];let t=JSON.parse(It(e,"utf8"));return Array.isArray(t.folder_rules)?t.folder_rules:[]}catch{return[]}}var Ss=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...gt]),Es=50*1024*1024,zn=8,As={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function Ot(e){let t=Dt(e).toLowerCase();return Ss.has(Kn(t))||ee.test(t)}var Is=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,$s=/\.nodata[\\/]+(device-key\.json|secrets\.json|credentials\.json|issuer-ed25519\.json|capsule\.json|capsule-key|shares|approvals|fabric-key\.json|machine-salt|pending-link\.json|api-shares\.json|secret-shares\.json|quarantine)\b/i;function ne(e){let t=Ve(re(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!Is.test(n)}function Ts(e){return $s.test(e)}var se=e=>e.startsWith("mcp__"),Zn=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),Rs=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,Cs=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,Ps=/(search|grep|find|glob|list|tree|director|query)/i,Bn=16;function Xe(e){let t=e.split("__").slice(2).join("__");return Cs.test(t)?"write":Ps.test(t)?"search":"read"}function ve(e,t){let r=[],n=(s,o)=>{let a=s.trim();if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname).replace(/^\/([a-zA-Z]:)/,"$1")}catch{return}else if(!(o||/^(~[\\/]|\/|[a-zA-Z]:[\\/])/.test(a)))return;if(!a||a.length>1024||/[\n\r]/.test(a)||/^[a-z][a-z0-9+.-]*:\/\//i.test(a))return;let c=C(t,a.replace(/^~(?=[\\/]|$)/,re()));!r.includes(c)&&r.length<Bn&&r.push(c)},i=(s,o,a)=>{if(!(a>3||r.length>=Bn)){if(typeof s=="string")n(s,Rs.test(o));else if(Array.isArray(s))for(let c of s.slice(0,50))i(c,o,a+1);else if(s&&typeof s=="object")for(let[c,l]of Object.entries(s))i(l,c,a+1)}};return i(e,"",0),r}var Rt=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,Ls=/(>|\bsed\s+-i|\btee\b|\b(rm|del|erase|mv|move|cp|copy|ren|rename)\b|Set-Content|Add-Content|Out-File|Remove-Item|Move-Item|Copy-Item|Rename-Item|WriteAllText|writeFileSync|unlinkSync)/i;function Ds(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return Rt.test(i)&&Ls.test(i)}if(se(e))return Xe(e)==="write"&&ve(t,r).some(i=>Rt.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?Rt.test((ie(n)?n:C(r,n)).replace(/\\/g,"/")):!1}function Os(e){return Ot(e)||Ue(e)!==null||ze(e)!==null}var Ke=class extends Error{};function Ns(e){let t=Kn(e).toLowerCase(),r=vs(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=kt(i,t===".tsv"?" ":void 0).counts;else if(gt.has(t)){let o=t===".xlsx"||t===".xlsm"?vt(r):null,a=mt(r,t);if(!a&&!o)throw new Ke;i=a?.text??"",n=o?o.counts:N(i).counts}else i=r.toString("utf8"),n=N(i).counts;let s=Ee.filter(o=>o.pattern.test(i)).length;return ee.test(Dt(e).toLowerCase())&&(s=Math.max(s,wt(i))),s&&(n.secret=Math.max(n.secret??0,s)),n}var Fs={israeli_id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",credit_card:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",iban:"IBAN",israeli_phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",email:'\u05D3\u05D5\u05D0"\u05DC',secret:"\u05E1\u05D5\u05D3",name:"\u05E9\u05DD",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",financial:"\u05DE\u05D9\u05D3\u05E2 \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",bank_account:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7",plate:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"};function Xn(e){let t=te()==="he",r=n=>(t?Fs[n]:As[n])??n;return Object.entries(e).sort((n,i)=>i[1]-n[1]).map(([n,i])=>`${i} ${n.startsWith("column:")?`${r(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:r(n)}`).join(", ")}function Ms(e){return Xn(e)}function Jn(e,t,r){let n=s=>ie(s)?s:C(r,s),i=s=>{try{return Lt(s).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&i(n(t.path)))return[n(t.path)];if(se(e))return Xe(e)==="write"?[]:ve(t,r).filter(i).slice(0,zn);if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let s=t.command,o=[...[...s.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...s.matchAll(/'([^']*)'/g)].map(c=>c[1]),...s.split(/[\s|;&<>(),=`]+/)],a=[];for(let c of o){let l=c.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,re()).replace(/^\/([a-zA-Z])\//,(d,p)=>process.platform==="win32"?`${p}:/`:d);if(!l)continue;let u=n(l);if(!(!Ot(l)&&!ne(u)&&Ue(u)===null&&ze(u)===null)&&(i(u)&&!a.includes(u)&&a.push(u),a.length>=zn))break}return a}return[]}function j(e){return e.replace(/\\+/g,"/")}function Hs(e){let t=e.trim();return/[;|&\n]|`|\$\(/.test(t.replace(/^cmd(?:\.exe)?\s+\/c\s+/i,""))?!1:/^(?:cmd(?:\.exe)?\s+\/c\s+)?(?:explorer(?:\.exe)?|start|invoke-item|ii|start-process|open|xdg-open)\b/i.test(t)}function Wn(e,t){return`${j(e)}: ${t?T("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5, \u05D5\u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4 \u05DE\u05D0\u05D6 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it, and it changed since \u2014 NOT checked, treat it as sensitive"):T("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it \u2014 NOT checked, treat it as sensitive")}`}function qn(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&Hs(t.command))return n;for(let i of Jn(e,t,r)){if(!Os(i)||In(i)||!Vn(i))continue;let s=ze(i);if(!Ot(i)){let o=Ue(i);o?n.push({line:`${j(i)}: ${T("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${Ms(o)}`,kind:"flagged_code"}):s&&n.push({line:Wn(i,s.changed),kind:"unread"});continue}try{if(Lt(i).size>Es)n.push({line:`${j(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let o=Ns(i);Object.keys(o).length?n.push({line:`${j(i)}: ${Xn(o)}`,kind:"data_file"}):s&&!s.changed&&n.push({line:Wn(i,!1),kind:"unread"})}}catch(o){n.push(o instanceof Ke?{line:`${j(i)}: ${T("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`,kind:"unreadable"}:{line:`${j(i)}: could not be checked`,kind:"unreadable"})}}return n}var Pt=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,Ze=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,Yn="the vault's secrets, outside nodata_run's per-command approval",js=/(?:^|[^\w.@-])(?:npx|pnpx|bunx|npm|pnpm|yarn|bun|node|nodejs|deno|nodata-mcp)(?:\.cmd|\.exe|\.ps1|\.js)?(?![\w-])[\s\S]*?(?<![\w-])secrets-(?:run|login|set|import|share)(?![\w-])/i;function Us(e){return js.test(e)}var zs=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^node\s+\S*nodata-pull\.mjs\b/i,Yn],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],Bs=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Qn=/^(?:cat|type|get-content|gc|more|less|head|tail|bat|nl|strings|xxd|od|hexdump|grep|egrep|rg|select-string|sls|awk|sed|jq|yq|python\d*|py|node|ruby|perl)\b/i,Ws=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function Gs(e,t,r){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&Pt.test((ie(n)?n:C(r,n)).replace(/\\/g,"/")))return`a saved login (${Dt(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let i=t.command.split(/(\|\||&&|[;|\n])/);for(let s=0;s<i.length;s+=2){let o=i[s+1]==="|",a=i[s].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Qn.test(a)&&Pt.test(a))return"a saved login file";if(Us(a))return Yn;for(let[l,u]of zs)if(l.test(a))return u;let c=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(c&&(!c[1]||Ze.test(c[1])))return c[1]?`the variable ${c[1]}`:"every environment variable";if(!o&&(Bs.test(a)||/GetEnvironmentVariable/i.test(a)))for(let l of a.matchAll(Ws)){let u=l[1]??l[2]??l[3]??l[4]??"";if(Ze.test(u))return`the variable ${u}`}}return null}var er=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,Vs=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,Ks=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),Gn=4e3,Zs=5;function Xs(e){let t=0,r=0,n=(i,s)=>{if(s>Zs||t>Gn)return;let o;try{o=xs(i,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>Gn)return;let c=Ve(i,a.name);a.isDirectory()?Ks.has(a.name)||n(c,s+1):(ee.test(a.name.toLowerCase())||Pt.test(c.replace(/\\/g,"/"))||ne(c))&&r++}};return n(e,0),r}var xe=e=>{try{return Lt(e).isDirectory()}catch{return!1}};function Js(e,t){let r=ws(C(t),C(e));return r===""||!r.startsWith("..")&&!ie(r)}function qs(e,t,r){let n=s=>C(r,s.replace(/^~(?=[\\/]|$)/,re())),i=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):C(r);if(xe(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[s],bySecret:Ze.test(o)||/\.env|env\b/i.test(String(t.glob??""))})}}else if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string")for(let s of t.command.split(/\|\||&&|[;|\n]/)){let o=s.trim().replace(/^(?:sudo\s+|xargs\s+(?:-\S+\s+)*)/i,"");if(!/^find\b.*-exec\s+(?:grep|egrep|rg|cat)\b/i.test(o)&&!(er.test(o)&&(Vs.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let l=o.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(xe);i.push({roots:l.length?l:[C(r)],bySecret:Ze.test(o)||/\.env\b/i.test(o)})}for(let s of i)for(let o of s.roots){if(!s.bySecret&&Js(o,r))continue;let a=Xs(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var tr=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),Ct=e=>tr.has(e)||se(e)&&Xe(e)==="write";function Ys(e,t,r){let n=i=>C(r,i.replace(/^~(?=[\\/]|$)/,re()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(tr.has(e)){let i=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return i?{action:"write",paths:[n(i)],roots:[]}:null}if(e==="Grep"||e==="Glob"){let i=typeof t.path=="string"&&t.path?n(t.path):C(r);return{action:"search",paths:[i],roots:xe(i)?[i]:[]}}if(se(e)){let i=ve(t,r);if(!i.length)return null;let s=Xe(e);return{action:s,paths:i,roots:s==="search"?i.filter(xe):[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let i=t.command,o=[...[...i.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...i.matchAll(/'([^']*)'/g)].map(l=>l[1]),...i.split(/[\s|;&<>(),=`]+/)].map(l=>l.trim()).filter(l=>l&&!l.startsWith("-")&&/[\\/.~]/.test(l)).map(n).filter(l=>Vn(l)),a=i.split(/\|\||&&|[;|\n]/).some(l=>er.test(l.trim())||/^find\b/i.test(l.trim())),c=o.filter(xe);return{action:a?"search":Qn.test(i.trim())?"read":"run",paths:[C(r),...o],roots:a?c.length?c:[C(r)]:[]}}return null}function Qs(e,t,r,n=new Date,i){let s=Ys(e,t,r);if(!s)return null;let{rules:o,tampered:a}=Mn(),c=Un();if(!o.length&&!c.length)return null;let l={allow:0,ask:1,clean_copy:2,deny:3},u=null;for(let p of s.paths){let f=$t(c,{action:s.action,path:p,now:n,who:i});f&&(!u||l[f.rule.effect]>l[u.rule.effect])&&(u={...f,org:!0})}for(let p of s.roots){let f=Tt(c,p,s.action,n,i);f&&f.rule.effect!=="allow"&&(!u||l[f.rule.effect]>l[u.rule.effect])&&(u={...f,org:!0})}let d=eo(o,a,s,n,l,i);return u&&(!d||l[u.rule.effect]>=l[d.rule.effect])?u:d}function eo(e,t,r,n,i,s){if(!e.length)return null;if(t){for(let a of r.paths){let c=e.find(l=>G(l.path,a)||G(a,l.path));if(c)return{rule:{...c,effect:"deny",when:[]},n:e.indexOf(c)+1,touched:a,tampered:!0}}return null}let o=null;for(let a of r.paths){let c=$t(e,{action:r.action,path:a,now:n,who:s});c&&(!o||i[c.rule.effect]>i[o.rule.effect])&&(o=c)}for(let a of r.roots){let c=Tt(e,a,r.action,n,s);c&&c.rule.effect!=="allow"&&(!o||i[c.rule.effect]>i[o.rule.effect])&&(o=c)}return o}function to(e){let t;try{t=typeof e=="string"?e:JSON.stringify(e??"")}catch{return{}}if(!t)return{};t=t.slice(0,2*1024*1024);let r={};for(let n of ce()){let i=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),s=(t.match(i)??[]).length;s&&(r[n.id]=(r[n.id]??0)+s)}return r}function no(e){let t=Object.keys(e);if(t.length===0)return null;let r=t.reduce((i,s)=>i+e[s],0),n=[...new Set(t.map(i=>{let s=St(i);return s.url?`${s.provider}: ${s.url}`:s.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${r}: ${t.join(", ")}). It is now in this conversation and was sent to the AI model. Do not repeat, quote, shorten, mask-by-hand or reuse it \u2014 not in your answer, not in a command, not in a file. Tell the user in one line that a key was shown here and should be replaced at its provider (${n.join(" \xB7 ")}); nodata_scan_folder gives the full steps. Next time, run commands that need secrets through nodata_run: the output comes back with every value blanked.`+(te()==="he"?" Answer the user in Hebrew.":"")}function ro(e,t,r){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",i=(e==="Grep"||e==="Glob")&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&Ts(n)||i&&ne(ie(i)?i:C(r,i))||se(e)&&ve(t,r).some(ne)||Jn(e,t,r).some(ne)?T("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function io(e,t,r,n,i){if(Zn(e))return{decision:"allow"};let s=ro(e,t,r);if(s)return{decision:"deny",reason:s,kind:"nodata_key"};let o=Gs(e,t,r);if(o){let f=T(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${o}. \u05DE\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05DE\u05D3\u05E4\u05D9\u05E1\u05D4 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4 \u05D5\u05E0\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05E8\u05D0\u05D4 \u05DB\u05D0\u05DF \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D7\u05DC\u05D9\u05E3.
|
|
39
|
+
\u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05D4 \u05D1\u05E2\u05E6\u05DE\u05DA \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC (\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8), \u05D0\u05D5 nodata_run \u2014 \u05E9\u05DE\u05E8\u05D9\u05E5 \u05E4\u05E7\u05D5\u05D3\u05D4 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05DE\u05D7\u05D6\u05D9\u05E8 \u05D0\u05EA \u05D4\u05E4\u05DC\u05D8 \u05DB\u05E9\u05DB\u05DC \u05E2\u05E8\u05DA \u05DE\u05D5\u05E1\u05EA\u05E8.`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this shows ${o}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
|
|
40
|
+
Instead: run it yourself in a terminal (not the chat), or nodata_run \u2014 it runs a command with the secrets and returns the output with every value blanked.`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:f,kind:"credential_print"}}if((Ct(e)||e==="Bash"||e==="PowerShell")&&Ds(e,t,r))return{decision:"ask",kind:"gate_holder",reason:T("NoData: \u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8 \u2014 \u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E7\u05D5\u05D3 \u05D4\u05DE\u05D5\u05EA\u05E7\u05DF \u05E9\u05DC NoData. \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D9\u05E0\u05D5\u05D9 \u05DB\u05D6\u05D4 \u05D9\u05D9\u05EA\u05DB\u05DF \u05E9\u05D4\u05E9\u05E2\u05E8 \u05DC\u05D0 \u05D9\u05D1\u05D3\u05D5\u05E7 \u05D9\u05D5\u05EA\u05E8. \u05DC\u05D0\u05E9\u05E8 \u05E8\u05E7 \u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D9\u05E7\u05E9\u05EA \u05D0\u05EA \u05D6\u05D4.","NoData: this changes what runs the gate \u2014 Claude Code's settings or NoData's installed code. After such a change the gate may stop checking. Approve only if you asked for it.")};if(Ct(e)){let f=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if((se(e)?ve(t,r):f?[ie(f)?f:C(r,f)]:[]).some(ne))return{decision:"deny",kind:"nodata_write",reason:T("NoData \u05D7\u05E1\u05DD: \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 ~/.nodata \u05E1\u05D2\u05D5\u05E8\u05D4 \u05DC\u05E1\u05D5\u05DB\u05E0\u05D9\u05DD, \u05D2\u05DD \u05DC\u05DB\u05EA\u05D9\u05D1\u05D4 (\u05DB\u05DC\u05DC\u05D9\u05DD, \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA, \u05D0\u05D9\u05E9\u05D5\u05E8\u05D9\u05DD).","NoData refused: ~/.nodata is closed to agents, writes included (rules, keys, approvals).")}}let a=Qs(e,t,r,new Date,i);if(a&&a.rule.effect!=="allow"){let f=te()==="he",m=a.tampered?T("\u05E7\u05D5\u05D1\u05E5 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05D5\u05E0\u05D4 \u05E9\u05DC\u05D0 \u05D3\u05E8\u05DA nodata_rules, \u05D5\u05DC\u05DB\u05DF \u05DB\u05DC \u05E0\u05EA\u05D9\u05D1 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8 \u05E2\u05D3 \u05E9\u05EA\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9.","the rules file was changed outside nodata_rules, so every path it names is closed until you save the rules again."):`${a.org?T("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):T("\u05DB\u05DC\u05DC","rule")} ${a.n}: ${a.rule.path.startsWith("**/")?a.rule.path:j(a.rule.path)} \u2192 ${jn(a.rule.effect,f)}${a.rule.note?` (${a.rule.note})`:""}`,y=a.rule.effect==="clean_copy"?T(`NoData: ${m}. \u05D4\u05E1\u05D5\u05DB\u05DF \u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E8\u05E7 \u05E2\u05DC \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9: nodata_redact \u05D9\u05D5\u05E6\u05E8 \u05D0\u05D5\u05EA\u05D5 (\u05DE\u05D6\u05D4\u05D9\u05DD \u05DE\u05D5\u05D7\u05DC\u05E4\u05D9\u05DD, \u05E0\u05D1\u05D3\u05E7 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9).`,`NoData: ${m}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):a.rule.effect==="ask"?T(`NoData: ${m}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${m}. Allow?`):T(`NoData: ${m}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD \u05D5\u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${m}. Your file and folder rules: nodata_rules.`);return{decision:a.rule.effect==="ask"?"ask":"deny",reason:y,kind:"rule"}}if(Ct(e))return{decision:"allow"};let c=qs(e,t,r);if(c){let f=j(c.root),m=T(`NoData: \u05D6\u05D4 ${c.why==="by_name"?"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05E9\u05DD":"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05DE\u05D7\u05D5\u05E5 \u05DC\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8"}, \u05D1\u05EA\u05D5\u05DA ${f}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${c.keyFiles} \u05E7\u05D1\u05E6\u05D9 \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA (.env, \u05D4\u05EA\u05D7\u05D1\u05E8\u05D5\u05D9\u05D5\u05EA). \u05DE\u05D4 \u05E9\u05D4\u05D7\u05D9\u05E4\u05D5\u05E9 \u05D9\u05DE\u05E6\u05D0 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05DE\u05E6\u05D0 \u05DB\u05DA \u05D9\u05DB\u05D5\u05DC \u05DC\u05E9\u05DE\u05E9 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u2014 \u05D2\u05DD \u05DC\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E9\u05E2\u05D5\u05DC\u05D5\u05EA \u05DB\u05E1\u05E3 \u2014 \u05D1\u05DC\u05D9 \u05E9\u05D0\u05D9\u05E9\u05E8\u05EA \u05D0\u05D5\u05EA\u05D5.
|
|
41
|
+
\u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D7\u05E4\u05E9 \u05D1\u05EA\u05D5\u05DA \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8, \u05D0\u05D5 nodata_run \u05E2\u05DD \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D4\u05DB\u05E1\u05E4\u05EA (\u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05D4 \u05DE\u05D0\u05D5\u05E9\u05E8\u05EA \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D9\u05D0).`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this is ${c.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${f}, where ${c.keyFiles} key file(s) (.env, logins) are. Whatever it finds enters the conversation, and a key found this way can be used by the agent \u2014 for paid calls too \u2014 without you approving it.
|
|
42
|
+
Instead: search inside the project, or nodata_run with the keys from the vault (each command approved as written).`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:m,kind:"secret_search"}}if(a?.rule.effect==="allow")return{decision:"allow"};let l=qn(e,t,r);if(l.length===0)return{decision:"allow"};let u=l.map(f=>f.line),d=T(`NoData \u05E1\u05E8\u05E7 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D1\u05DE\u05D7\u05E9\u05D1 \u05E9\u05DC\u05DA \u2014 \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05D9\u05E6\u05D0:
|
|
43
|
+
${u.join(`
|
|
44
44
|
`)}
|
|
45
45
|
`+(n?"\u05D4\u05E7\u05E8\u05D9\u05D0\u05D4 \u05E0\u05D7\u05E1\u05DE\u05D4: Claude \u05DC\u05D0 \u05D9\u05E7\u05E8\u05D0 \u05D0\u05EA \u05D4\u05DE\u05E7\u05D5\u05E8. \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: nodata_redact (\u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9 \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4) \u05D0\u05D5 nodata_protect (\u05E0\u05E2\u05D9\u05DC\u05D4).":"\u05D0\u05DD \u05EA\u05D0\u05E9\u05E8, Claude \u05D9\u05E7\u05E8\u05D0 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05E2\u05E6\u05DE\u05D5 \u05D5\u05D4\u05EA\u05D5\u05DB\u05DF \u05D9\u05D9\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA. \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: nodata_redact (\u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9 \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4) \u05D0\u05D5 nodata_protect (\u05E0\u05E2\u05D9\u05DC\u05D4). \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData scanned this file on your machine \u2014 nothing left it:
|
|
46
|
-
${
|
|
46
|
+
${u.join(`
|
|
47
47
|
`)}
|
|
48
|
-
`+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?"));return{decision:n?"deny":"ask",reason:
|
|
48
|
+
`+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?")),p=[...new Set(l.map(f=>f.kind))];return{decision:n?"deny":"ask",reason:d,kind:p[0],...p.length>1?{kinds:p}:{}}}function so(e,t,r){let n=qn(e,t,r).map(i=>i.line);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
|
|
49
49
|
${n.join(`
|
|
50
50
|
`)}
|
|
51
|
-
The user's screen is not private \u2014 someone may be beside them. Answer with totals, counts, groupings and trends. Do not print names, ID / policy / account numbers, addresses, phones, or amounts tied to a person \u2014 not in a table, not as an "example" \u2014 unless the user explicitly asks to see those values. For a clean, anonymised or shareable version use nodata_redact \u2014 never your own script: it verifies the copy and records a proof.`+(
|
|
52
|
-
`,{mode:384})}catch{}}async function
|
|
51
|
+
The user's screen is not private \u2014 someone may be beside them. Answer with totals, counts, groupings and trends. Do not print names, ID / policy / account numbers, addresses, phones, or amounts tied to a person \u2014 not in a table, not as an "example" \u2014 unless the user explicitly asks to see those values. For a clean, anonymised or shareable version use nodata_redact \u2014 never your own script: it verifies the copy and records a proof.`+(te()==="he"?" Answer the user in Hebrew.":"")}function nr(e){try{let t=Ve(re(),".nodata");ks(t,{recursive:!0}),_s(Ve(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
|
|
52
|
+
`,{mode:384})}catch{}}function oo(e,t){nr({tool:e,decision:t.decision,...t.kind?{kind:t.kind}:{},...t.kinds?.length?{kinds:t.kinds}:{}})}function ao(e,t){let r=typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,n=typeof t.agent_type=="string"&&t.agent_type.trim()?t.agent_type.trim().toLowerCase():r==="claude-code"?"main":void 0;return{host:r,type:n}}async function rr(e){let t=e.includes("--block"),r=e.includes("--post"),n=e.indexOf("--host"),i=n>=0&&e[n+1]&&!e[n+1].startsWith("--")?e[n+1]:void 0,s="";for await(let l of process.stdin)s+=l;let o;try{o=JSON.parse(s)}catch{return}let a=o.tool_name??"";if(Zn(a))return;if(r){let l=to(o.tool_response);Object.keys(l).length&&nr({tool:a,leaked:Object.values(l).reduce((d,p)=>d+p,0)});let u=[no(l),so(a,o.tool_input??{},o.cwd??process.cwd())].filter(Boolean).join(`
|
|
53
53
|
|
|
54
|
-
`);l&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:l}}));return}let o=Oi(i,s.tool_input??{},s.cwd??process.cwd(),t);o.decision!=="allow"&&(In({tool:i,decision:o.decision}),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:o.decision,permissionDecisionReason:o.reason}})))}var Fi=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:e=>{let[,t]=e.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${t}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function Hi(e){if(e.length!==9)return!1;let t=e.split("").map(Number),r=0;for(let n=0;n<9;n++){let s=t[n]*(n%2===0?1:2);s>9&&(s-=9),r+=s}return r%10===0}var Ue=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let i of Fi)if(this.enabledTypes.has(i.type))for(let o of i.patterns){let a=new RegExp(o.source,o.flags),l;for(;(l=a.exec(t))!==null;){let c=l[0],u=`${i.type}:${l.index}`;if(!n.has(u)){if(n.add(u),i.type==="id_number"){let d=c.replace(/\D/g,"");if(/^\d{9}$/.test(c)&&d.length===9&&!Hi(d))continue}r.push({type:i.type,value:c,startIndex:l.index,endIndex:l.index+c.length,confidence:i.confidence,replacement:i.replacement(c,i.type)})}}}r.sort((i,o)=>i.startIndex-o.startIndex||o.confidence-i.confidence);let s=[];for(let i of r)s.some(a=>i.startIndex<a.endIndex&&i.endIndex>a.startIndex)||s.push(i);return s}};var Mi=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם_אדם|שם הלקוח|שם_הלקוח|שם בן זוג|שם בן_זוג|שם המבוטח|שם_המבוטח|שם המוטב|שם_המוטב|שם מבוטח|שם_מבוטח|שם מוטב|שם_מוטב|שם הילד|שם_הילד|שם הקטין|שם_הקטין|firstname_he|lastname_he|shem|shem_mishpacha|shem_prati)$/i,type:"name",label:"Person name (Hebrew)",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מספר_זהות|מס' זהות|מס_זהות|מס' ת"ז|teudat_zehut|tz|t_z|israeli_id|il_id)$/i,type:"id",label:"Israeli ID",labelHe:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|מס דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה|מס רישיון|דרכון_מספר)$/i,type:"id",label:"Passport / DL (Hebrew)",labelHe:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|דואר_אלקטרוני|אימייל|כתובת מייל|כתובת_מייל|כתובת דואר|כתובת_דואר)$/i,type:"email",label:"Email (Hebrew)",labelHe:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|מספר_טלפון|טלפון נייד|טלפון_נייד|מס נייד|מס_נייד|מס' טל)$/i,type:"phone",label:"Phone (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|כתובת_מגורים|רחוב|מס בית|מספר בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|כתובת_מלאה|מען)$/i,type:"address",label:"Address (Hebrew)",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|תאריך_לידה|ת לידה|תאריך הולדת|תאריך_הולדת|יום הולדת|יום_הולדת|גיל)$/i,type:"dob",label:"Date of birth (Hebrew)",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|חשבון_בנק|מספר חשבון|מספר_חשבון|מס חשבון|מס' חשבון|בנק|סניף|מס סניף|iban|iban_il)$/i,type:"financial",label:"Bank account (Hebrew)",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|כרטיס_אשראי|מספר אשראי|מס אשראי|מס' אשראי|cvv|אשראי|מס כרטיס|מס_כרטיס)$/i,type:"financial",label:"Credit card (Hebrew)",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר_ברוטו|שכר נטו|שכר_נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"Salary / income (Hebrew)",labelHe:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|בדיקה_רפואית|מצב רפואי|מצב_רפואי|חיסון|תוצאת בדיקה|תוצאת_בדיקה|רופא|רגישות|אלרגיה|סוג דם|סוג_דם)$/i,type:"medical",label:"Medical (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מספר_פוליסה|מס פוליסה|מס' פוליסה|פוליסה|מספר חבר|מספר_חבר|מס חבר|מספר ביטוח|מספר_ביטוח|policy_?number|policy_?no|policy_?id)$/i,type:"policy",label:"Insurance policy number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"},{pattern:/^(?:מספר סוכן|מספר_סוכן|מס סוכן|מס' סוכן|מס_סוכן|קוד סוכן|קוד_סוכן|מספר משווק|מספר_משווק|מספר יצרן|סוכן ביטוח|agent_?number|agent_?no|agent_?id|agent_?code|broker_?id|broker_?number)$/i,type:"agent_id",label:"Insurance agent / broker number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"},{pattern:/^(?:שם הילד|שם_הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|מספר_ילדים|תעודת לידה|ת לידה ילד)$/i,type:"minor_data",label:"Minor data (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|נטייה_מינית|השקפה פוליטית|השקפה_פוליטית|מצב משפחתי|מצב_משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"Sensitive personal (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מספר_רכב|מס רכב|מס' רכב|לוחית רישוי|לוחית_רישוי|מספר רישוי|מספר_רישוי)$/i,type:"tracking",label:"Vehicle ID (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}];function wt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let s=0;s<9;s++){let i=parseInt(r[s]??"0",10)*(s%2+1);i>9&&(i-=9),n+=i}return n%10===0&&parseInt(r,10)>0}var ze=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,Be=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,We=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function Nn(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let r=0,n=!1;for(let s=t.length-1;s>=0;s--){let i=t.charCodeAt(s)-48;if(i<0||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),r+=i,n=!n}return r%10===0}function Fn(e){if(!e)return null;let t=e.trim();for(let r of Mi)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var ji=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function Ge(e){if(!e)return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let r=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of ji)if(n.phrases?.some(i=>t.includes(i))||n.tokens?.some(i=>r.has(i)))return{type:n.type,label:n.type,labelHe:Ve(n.type)};return null}function Ve(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function Hn(e){let t=0,r=0,n=0,s=0,i=0;for(let a of e)typeof a=="string"&&(wt(a)&&t++,ze.lastIndex=0,ze.test(a)&&r++,Be.lastIndex=0,Be.test(a)&&n++,We.lastIndex=0,We.test(a)&&s++,Nn(a)&&i++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:s/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:s}:r/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:r}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:i/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:i}:null}var Mn={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var Bi=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D6\u05D4\u05D4"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Financial data",labelHe:"\u05E0\u05EA\u05D5\u05DF \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(ip_?address)$/i,type:"tracking",label:"IP address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA IP"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D3\u05E8\u05DB\u05D5\u05DF"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license",labelHe:"\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"},{pattern:/^(iban|swift_?code|bic)$/i,type:"financial",label:"Banking code",labelHe:"\u05E7\u05D5\u05D3 \u05D1\u05E0\u05E7\u05D0\u05D9"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E1"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Member ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7/\u05D7\u05D1\u05E8"},{pattern:/^(blood_?type|allergy|allergies|prescription)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation",labelHe:"\u05DE\u05D9\u05E7\u05D5\u05DD \u05D2\u05D9\u05D0\u05D5\u05D2\u05E8\u05E4\u05D9"},{pattern:/^(mac_?address|device_?fingerprint|imei|serial_?number)$/i,type:"tracking",label:"Device identifier",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"},{pattern:/^(ethnicity|race|religion|political_?affiliation|sexual_?orientation)$/i,type:"sensitive_personal",label:"Sensitive personal",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(minor|child_?name|child_?age|dependent)$/i,type:"minor_data",label:"Minor data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05E0\u05D9\u05DD"},{pattern:/^(signature|digital_?signature)$/i,type:"id",label:"Signature",labelHe:"\u05D7\u05EA\u05D9\u05DE\u05D4"},{pattern:/^(vehicle_?number|license_?plate|plate_?number)$/i,type:"tracking",label:"Vehicle ID",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05E8\u05DB\u05D1"}],Wi=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|sort_?order|position|enabled|active|public|version|metadata|config|settings|options|data|content|body|raw|json|text|note|comment|label|color|icon|image|avatar|logo|thumbnail|preview|template|schema|format|mode|level|priority|severity|source|target|parent|child|owner|creator|modifier|assignee|project|workspace|organization|team|group|channel|thread|room|session|device|platform|browser|locale|timezone|currency|country|region|city|zip|postal|state|province|name|display_?name|user_?agent|password_?hash|secret|token|private_?key|auth_?token|constraint|index|sequence|trigger|function|procedure|database|namespace|migration|revision)$/i,Gi=/^(beacon_?registr|device_?config|hardware|sensor|firmware|telemetry|metric|analytic|log_?event|audit_?log|system_?config|cache|queue|job|migration|schema_?version|spatial_?ref)/i,Vi=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function jn(e,t){if(Wi.test(e)||/^name$/i.test(e)||t&&Gi.test(t)||Vi.test(e))return null;for(let n of Bi)if(n.pattern.test(e))return n.type;let r=Fn(e);return r?r.type:null}var Vc=Mn.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var Zc=512*1024,Kc=50*1024*1024;var Zi={id:"high",agent_id:"high",policy:"high",financial:"high",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"medium",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"low"};function Ki(e){return Zi[e]??"low"}function zn(e,t){let r=[];for(let n of t){let s=n.rows.length;for(let i=0;i<n.headers.length;i++){let o=n.headers[i]??"",a=o?jn(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??Ge(o)?.type??null:null,l=[];for(let u of n.rows){let d=u[i];typeof d=="string"&&d.length>0&&l.push(d)}let c=l.length>0?Hn(l):null;c?r.push(Un(e,n.name,o,c.type,c.label,"value",c.matchedSample,s)):a&&r.push(Un(e,n.name,o,a,Ve(a),"header",0,s))}}return r}function Un(e,t,r,n,s,i,o,a){return{file:e,location:t,column:r,type:n,label:s,category:Ve(n),severity:Ki(n),matchKind:i,hits:o,sampleSize:a}}var Bn={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var Ji=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],qi=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function Yi(e,t,r,n){if(n==="address")return{start:t,end:r};let s=qi.exec(e.slice(t,r));return s&&t+s[0].length<r?{start:t+s[0].length,end:r}:{start:t,end:r}}var Qi=new Set(["hex-secret-32","base64-secret"]),Wn=!1;function Gn(){if(Wn)return;Wn=!0;let e=Ji.map(({type:r,kind:n,severity:s,hint:i})=>{let o=new Ue([r]);return{kind:n,severity:s,hint:i,find:a=>o.detect(a).map(l=>Yi(a,l.startIndex,l.endIndex,n))}}),t=Bn.rules.filter(r=>!Qi.has(r.id)).map(r=>({id:r.id,name:r.name,severity:r.severity,pattern:new RegExp(r.pattern)}));Ze({text:e,header:r=>{let n=Ge(r);return n?{type:n.type,label:n.labelHe||n.label}:null},secrets:t,table:r=>zn("",[r]).filter(n=>n.column).map(n=>({column:n.column,type:n.type,category:n.category,severity:n.severity,hits:n.hits,how:n.matchKind==="value"?"value":"header"}))})}Gn();On(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});
|
|
54
|
+
`);u&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:u}}));return}let c=io(a,o.tool_input??{},o.cwd??process.cwd(),t,ao(i,o));c.decision!=="allow"&&(oo(a,c),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:c.decision,permissionDecisionReason:c.reason}})))}var co="claude-code",xl=` --host ${co}`;var lo=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:e=>{let[,t]=e.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${t}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function uo(e){if(e.length!==9)return!1;let t=e.split("").map(Number),r=0;for(let n=0;n<9;n++){let i=t[n]*(n%2===0?1:2);i>9&&(i-=9),r+=i}return r%10===0}var we=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let s of lo)if(this.enabledTypes.has(s.type))for(let o of s.patterns){let a=new RegExp(o.source,o.flags),c;for(;(c=a.exec(t))!==null;){let l=c[0],u=`${s.type}:${c.index}`;if(!n.has(u)){if(n.add(u),s.type==="id_number"){let d=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&d.length===9&&!uo(d))continue}r.push({type:s.type,value:l,startIndex:c.index,endIndex:c.index+l.length,confidence:s.confidence,replacement:s.replacement(l,s.type)})}}}r.sort((s,o)=>s.startIndex-o.startIndex||o.confidence-s.confidence);let i=[];for(let s of r)i.some(a=>s.startIndex<a.endIndex&&s.endIndex>a.startIndex)||i.push(s);return i}};var A=["GDPR","CPRA","PPL"],po=["GDPR-9","CPRA","PPL"],fo=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...A],en:["firstname","lastname","fname","lname","middle name","maiden name","birth name","preferred name","display name","nickname","surname","given name","full name"],he:["\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0","\u05DB\u05D9\u05E0\u05D5\u05D9","\u05E9\u05DD \u05E0\u05E2\u05D5\u05E8\u05D9\u05DD"],ar:["\u0627\u0644\u0627\u0633\u0645","\u0627\u0633\u0645 \u0627\u0644\u0639\u0627\u0626\u0644\u0629","\u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0643\u0627\u0645\u0644"],ru:["\u0438\u043C\u044F","\u0444\u0430\u043C\u0438\u043B\u0438\u044F","\u043E\u0442\u0447\u0435\u0441\u0442\u0432\u043E","\u0444\u0438\u043E"]},{id:"birth_place",type:"location",sensitivity:"medium",regulations:[...A],en:["birth place","birthplace","place of birth"],he:["\u05DE\u05E7\u05D5\u05DD \u05DC\u05D9\u05D3\u05D4","\u05D0\u05E8\u05E5 \u05DC\u05D9\u05D3\u05D4"],ar:["\u0645\u0643\u0627\u0646 \u0627\u0644\u0645\u064A\u0644\u0627\u062F"],ru:["\u043C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F"]},{id:"citizenship",type:"sensitive_personal",sensitivity:"high",regulations:[...A],en:["citizenship","nationality"],he:["\u05D0\u05D6\u05E8\u05D7\u05D5\u05EA","\u05DC\u05D0\u05D5\u05DD"],ar:["\u0627\u0644\u062C\u0646\u0633\u064A\u0629"],ru:["\u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E"]},{id:"marital_status",type:"sensitive_personal",sensitivity:"high",regulations:[...A],en:["marital status"],he:["\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9"],ar:["\u0627\u0644\u062D\u0627\u0644\u0629 \u0627\u0644\u0627\u062C\u062A\u0645\u0627\u0639\u064A\u0629"],ru:["\u0441\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435"]},{id:"government_id",type:"id",sensitivity:"critical",regulations:[...A],en:["ssn","national id","passport","driver license","drivers license","tax id","social security","national insurance","military id","voter id","resident id","residence permit","visa number"],he:["\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7 \u05DC\u05D0\u05D5\u05DE\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D0\u05D9\u05E9\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D5\u05D9\u05D6\u05D4","\u05EA\u05E2\u05D5\u05D3\u05EA \u05EA\u05D5\u05E9\u05D1","\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05E1\u05E7"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629","\u062C\u0648\u0627\u0632 \u0627\u0644\u0633\u0641\u0631","\u0631\u062E\u0635\u0629 \u0627\u0644\u0642\u064A\u0627\u062F\u0629"],ru:["\u043F\u0430\u0441\u043F\u043E\u0440\u0442","\u0441\u043D\u0438\u043B\u0441","\u0438\u043D\u043D","\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u0435\u043D\u0438\u0435"]},{id:"institution_person_id",type:"tracking",sensitivity:"medium",regulations:[...A],en:["employee id","employee number","employee no","student id","student number","user id","userid","customer id","customer number","customer no","client id","member id","subscriber id","participant id","profile id","person id","person uuid","lead id","crm contact","account id"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05D1\u05D3","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D8\u05D5\u05D3\u05E0\u05D8","\u05DE\u05E1\u05E4\u05E8 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05D6\u05D4\u05D4 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E0\u05D5\u05D9","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05E9\u05EA\u05DE\u05E9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0648\u0638\u0641","\u0631\u0642\u0645 \u0627\u0644\u0639\u0645\u064A\u0644"],ru:["\u0442\u0430\u0431\u0435\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440","\u043D\u043E\u043C\u0435\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430"]},{id:"patient_id",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["patient id","patient number","mrn","medical record number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D8\u05D5\u05E4\u05DC","\u05DE\u05E1\u05E4\u05E8 \u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0631\u064A\u0636"],ru:["\u043D\u043E\u043C\u0435\u0440 \u043F\u0430\u0446\u0438\u0435\u043D\u0442\u0430"]},{id:"email",type:"email",sensitivity:"high",regulations:[...A],en:["emailaddress","e mail","recovery email","contact email"],he:["\u05D3\u05D5\u05D0\u05DC","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"],ar:["\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A"],ru:["\u043F\u043E\u0447\u0442\u0430","\u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430","email"]},{id:"phone",type:"phone",sensitivity:"high",regulations:[...A],en:["cellphone","contact number","work phone","home phone","whatsapp","recovery phone","telephone"],he:["\u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D9\u05EA","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D5\u05D5\u05D8\u05E1\u05D0\u05E4","\u05DE\u05E1\u05E4\u05E8 \u05E0\u05D9\u05D9\u05D3"],ar:["\u0647\u0627\u062A\u0641","\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641","\u062C\u0648\u0627\u0644"],ru:["\u0442\u0435\u043B\u0435\u0444\u043E\u043D","\u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u0439"]},{id:"social_handle",type:"tracking",sensitivity:"medium",regulations:[...A],en:["telegram","linkedin","facebook","twitter","instagram","tiktok","social profile"],he:["\u05D8\u05DC\u05D2\u05E8\u05DD","\u05DC\u05D9\u05E0\u05E7\u05D3\u05D0\u05D9\u05DF","\u05E4\u05D9\u05D9\u05E1\u05D1\u05D5\u05E7","\u05D0\u05D9\u05E0\u05E1\u05D8\u05D2\u05E8\u05DD"]},{id:"address",type:"address",sensitivity:"high",regulations:[...A],en:["house number","apartment","apt","billing address","shipping address","postal code","zip code","postcode","street"],he:["\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05EA","\u05D3\u05D9\u05E8\u05D4","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05DE\u05E9\u05DC\u05D5\u05D7","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05D7\u05D9\u05D5\u05D1","\u05EA.\u05D3","\u05EA\u05D0 \u05D3\u05D5\u05D0\u05E8"],ar:["\u0627\u0644\u0639\u0646\u0648\u0627\u0646","\u0627\u0644\u0634\u0627\u0631\u0639","\u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u0628\u0631\u064A\u062F\u064A"],ru:["\u0430\u0434\u0440\u0435\u0441","\u0443\u043B\u0438\u0446\u0430","\u0438\u043D\u0434\u0435\u043A\u0441","\u043A\u0432\u0430\u0440\u0442\u0438\u0440\u0430"]},{id:"geo",type:"location",sensitivity:"high",regulations:[...A],en:["geo location","geolocation","latitude","longitude","coordinates","home location","current location"],he:["\u05DE\u05D9\u05E7\u05D5\u05DD","\u05E7\u05D5\u05D0\u05D5\u05E8\u05D3\u05D9\u05E0\u05D8\u05D5\u05EA"],ar:["\u0627\u0644\u0645\u0648\u0642\u0639"],ru:["\u043C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435","\u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u044B"]},{id:"bank_card",type:"financial",sensitivity:"critical",regulations:[...A],en:["bank account","iban","swift","bic","routing number","credit card","creditcard","card number","cvv","card expiry","cc exp","paypal","wallet address","crypto wallet","bitcoin address"],he:["\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05D0\u05E8\u05E0\u05E7 \u05E7\u05E8\u05D9\u05E4\u05D8\u05D5","\u05D0\u05E8\u05E0\u05E7 \u05D3\u05D9\u05D2\u05D9\u05D8\u05DC\u05D9"],ar:["\u062D\u0633\u0627\u0628 \u0628\u0646\u0643\u064A","\u0631\u0642\u0645 \u0627\u0644\u062D\u0633\u0627\u0628","\u0628\u0637\u0627\u0642\u0629 \u0627\u0626\u062A\u0645\u0627\u0646"],ru:["\u0440\u0430\u0441\u0447\u0435\u0442\u043D\u044B\u0439 \u0441\u0447\u0435\u0442","\u043D\u043E\u043C\u0435\u0440 \u0441\u0447\u0435\u0442\u0430","\u043D\u043E\u043C\u0435\u0440 \u043A\u0430\u0440\u0442\u044B","\u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430"]},{id:"income_tax",type:"financial",sensitivity:"high",regulations:[...A],en:["salary","income","wage","tax record","tax return","payment history","credit score","net worth","salary grade"],he:["\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4","\u05EA\u05DC\u05D5\u05E9 \u05E9\u05DB\u05E8","\u05D3\u05D5\u05D7 \u05DE\u05E1","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05EA\u05E9\u05DC\u05D5\u05DE\u05D9\u05DD","\u05D3\u05D9\u05E8\u05D5\u05D2 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05D5\u05D5\u05D9 \u05E0\u05E7\u05D9","\u05D3\u05E8\u05D2\u05EA \u05E9\u05DB\u05E8"],ar:["\u0627\u0644\u0631\u0627\u062A\u0628","\u0627\u0644\u062F\u062E\u0644"],ru:["\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430","\u0434\u043E\u0445\u043E\u0434"]},{id:"assets",type:"financial",sensitivity:"high",regulations:[...A],en:["property id","land record","ownership record","title deed","holdings"],he:["\u05D2\u05D5\u05E9 \u05D7\u05DC\u05E7\u05D4","\u05E0\u05E1\u05D7 \u05D8\u05D0\u05D1\u05D5","\u05E8\u05D9\u05E9\u05D5\u05DD \u05DE\u05E7\u05E8\u05E7\u05E2\u05D9\u05DF","\u05D1\u05E2\u05DC\u05D5\u05EA","\u05D0\u05D7\u05D6\u05E7\u05D5\u05EA"],ru:["\u0441\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u044C","\u043D\u0435\u0434\u0432\u0438\u0436\u0438\u043C\u043E\u0441\u0442\u044C"]},{id:"vehicle",type:"tracking",sensitivity:"medium",regulations:[...A],en:["vin","vehicle id","license plate","registration number","plate number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E9\u05DC\u05D3\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1","\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9"],ru:["\u043D\u043E\u043C\u0435\u0440 \u0430\u0432\u0442\u043E\u043C\u043E\u0431\u0438\u043B\u044F","vin"]},{id:"health",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["medical record","health condition","health data","lab result","lab results","vaccination","mental health","hospitalization","hospitalisation","disability","insurance number","diagnosis","allergy","prescription","medication","blood type"],he:["\u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05DE\u05E2\u05D1\u05D3\u05D4","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4","\u05D7\u05D9\u05E1\u05D5\u05E0\u05D9\u05DD","\u05D1\u05E8\u05D9\u05D0\u05D5\u05EA \u05E0\u05E4\u05E9","\u05D0\u05E9\u05E4\u05D5\u05D6","\u05E0\u05DB\u05D5\u05EA","\u05DE\u05E6\u05D1 \u05D1\u05E8\u05D9\u05D0\u05D5\u05EA\u05D9"],ar:["\u0627\u0644\u062A\u0634\u062E\u064A\u0635","\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u0637\u0628\u064A","\u0627\u0644\u0623\u062F\u0648\u064A\u0629"],ru:["\u0434\u0438\u0430\u0433\u043D\u043E\u0437","\u043C\u0435\u0434\u0438\u0446\u0438\u043D\u0441\u043A\u0430\u044F \u043A\u0430\u0440\u0442\u0430","\u0430\u043D\u0430\u043B\u0438\u0437\u044B"]},{id:"biometric",type:"biometric",sensitivity:"critical",regulations:["GDPR-9","CPRA","PPL"],en:["face embedding","face scan","iris scan","retina scan","voice print","voiceprint","voice signature","hand geometry","biometric template","biometric data","dna","genetic data","genome"],he:["\u05D8\u05D1\u05D9\u05E2\u05EA \u05E7\u05D5\u05DC","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E4\u05E0\u05D9\u05DD","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E7\u05E9\u05EA\u05D9\u05EA","\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D2\u05E0\u05D8\u05D9\u05D9\u05DD",'\u05D3\u05E0"\u05D0'],ar:["\u0628\u0635\u0645\u0629"],ru:["\u0431\u0438\u043E\u043C\u0435\u0442\u0440\u0438\u044F","\u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043E\u043A"]},{id:"employment",type:"employment",sensitivity:"medium",regulations:[...A],en:["employer","job title","employment status","hire date","start date of employment","termination date","performance review","disciplinary"],he:["\u05DE\u05E2\u05E1\u05D9\u05E7","\u05DE\u05E7\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05E4\u05E7\u05D9\u05D3 \u05D4\u05E2\u05D5\u05D1\u05D3","\u05EA\u05D0\u05E8\u05D9\u05DA \u05EA\u05D7\u05D9\u05DC\u05EA \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05D0\u05E8\u05D9\u05DA \u05E1\u05D9\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D4\u05E2\u05E8\u05DB\u05EA \u05D1\u05D9\u05E6\u05D5\u05E2\u05D9\u05DD","\u05E9\u05D9\u05DE\u05D5\u05E2"],ar:["\u062C\u0647\u0629 \u0627\u0644\u0639\u0645\u0644","\u0627\u0644\u0645\u0633\u0645\u0649 \u0627\u0644\u0648\u0638\u064A\u0641\u064A"],ru:["\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044C","\u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C"]},{id:"manager",type:"name",sensitivity:"medium",regulations:[...A],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...A],en:["school","university","college","degree","transcript","education history","gpa"],he:["\u05D1\u05D9\u05EA \u05E1\u05E4\u05E8","\u05D0\u05D5\u05E0\u05D9\u05D1\u05E8\u05E1\u05D9\u05D8\u05D4","\u05DE\u05DB\u05DC\u05DC\u05D4","\u05D2\u05D9\u05DC\u05D9\u05D5\u05DF \u05E6\u05D9\u05D5\u05E0\u05D9\u05DD","\u05D4\u05E9\u05DB\u05DC\u05D4","\u05EA\u05D5\u05D0\u05E8 \u05D0\u05E7\u05D3\u05DE\u05D9"],ar:["\u0627\u0644\u062C\u0627\u0645\u0639\u0629","\u0627\u0644\u0645\u062F\u0631\u0633\u0629"],ru:["\u043E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435","\u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442"]},{id:"device_online",type:"tracking",sensitivity:"medium",regulations:[...A],en:["ip","ipaddress","ip address","mac address","device id","deviceid","advertising id","idfa","gaid","android id","apple id","cookie id","cookieid","browser fingerprint","user agent","imei"],he:["\u05DB\u05EA\u05D5\u05D1\u05EA ip","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"],ru:["ip \u0430\u0434\u0440\u0435\u0441"]},{id:"account",type:"tracking",sensitivity:"medium",regulations:[...A],en:["username","user name","login","screen name"],he:["\u05E9\u05DD \u05DE\u05E9\u05EA\u05DE\u05E9"],ru:["\u043B\u043E\u0433\u0438\u043D"]},{id:"credential",type:"auth",sensitivity:"critical",regulations:[...A],en:["password","password hash","mfa secret","otp secret","security question","security answer","session id","session token","api key"],he:["\u05E1\u05D9\u05E1\u05DE\u05D4","\u05E1\u05D9\u05E1\u05DE\u05D0","\u05E9\u05D0\u05DC\u05EA \u05D0\u05D1\u05D8\u05D7\u05D4"],ar:["\u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631"],ru:["\u043F\u0430\u0440\u043E\u043B\u044C"]},{id:"behavior",type:"behavior",sensitivity:"high",regulations:[...A],en:["purchase history","search history","browsing history","clickstream","usage pattern","behavior profile","behaviour profile"],he:["\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E8\u05DB\u05D9\u05E9\u05D5\u05EA","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D7\u05D9\u05E4\u05D5\u05E9","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D2\u05DC\u05D9\u05E9\u05D4","\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA"]},{id:"special_category",type:"sensitive_personal",sensitivity:"critical",regulations:[...po],en:["race","ethnicity","religion","political opinion","political party","union membership","trade union","sexual orientation","gender identity","criminal record"],he:["\u05D2\u05D6\u05E2","\u05D3\u05EA","\u05D4\u05E9\u05E7\u05E4\u05D4 \u05E4\u05D5\u05DC\u05D9\u05D8\u05D9\u05EA","\u05D7\u05D1\u05E8\u05D5\u05EA \u05D1\u05D0\u05D9\u05D2\u05D5\u05D3","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA","\u05D6\u05D4\u05D5\u05EA \u05DE\u05D2\u05D3\u05E8\u05D9\u05EA","\u05E8\u05D9\u05E9\u05D5\u05DD \u05E4\u05DC\u05D9\u05DC\u05D9"],ar:["\u0627\u0644\u062F\u064A\u0627\u0646\u0629","\u0627\u0644\u0639\u0631\u0642"],ru:["\u0440\u0435\u043B\u0438\u0433\u0438\u044F","\u043D\u0430\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C"]},{id:"family_names",type:"name",sensitivity:"high",regulations:[...A],en:["mother name","father name","spouse","partner name","emergency contact","next of kin","family member","guardian","beneficiary"],he:["\u05E9\u05DD \u05D4\u05D0\u05DD","\u05E9\u05DD \u05D4\u05D0\u05D1","\u05D1\u05DF \u05D6\u05D5\u05D2","\u05D1\u05EA \u05D6\u05D5\u05D2","\u05D0\u05D9\u05E9 \u05E7\u05E9\u05E8 \u05DC\u05D7\u05D9\u05E8\u05D5\u05DD","\u05E7\u05E8\u05D5\u05D1 \u05DE\u05E9\u05E4\u05D7\u05D4","\u05D0\u05E4\u05D5\u05D8\u05E8\u05D5\u05E4\u05D5\u05E1","\u05DE\u05D5\u05D8\u05D1"],ar:["\u0627\u0633\u0645 \u0627\u0644\u0623\u0645","\u0627\u0633\u0645 \u0627\u0644\u0623\u0628","\u0627\u0644\u0632\u0648\u062C"],ru:["\u0441\u0443\u043F\u0440\u0443\u0433","\u043E\u043F\u0435\u043A\u0443\u043D"]},{id:"children",type:"minor_data",sensitivity:"critical",regulations:[...A],en:["children","child name","dependents","dependants"],he:["\u05D9\u05DC\u05D3\u05D9\u05DD","\u05E9\u05DE\u05D5\u05EA \u05D4\u05D9\u05DC\u05D3\u05D9\u05DD"],ar:["\u0627\u0644\u0623\u0637\u0641\u0627\u0644"],ru:["\u0434\u0435\u0442\u0438"]}];function ho(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function ir(){return fo.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(ho).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var mo=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם_אדם|שם הלקוח|שם_הלקוח|שם בן זוג|שם בן_זוג|שם המבוטח|שם_המבוטח|שם המוטב|שם_המוטב|שם מבוטח|שם_מבוטח|שם מוטב|שם_מוטב|שם הילד|שם_הילד|שם הקטין|שם_הקטין|firstname_he|lastname_he|shem|shem_mishpacha|shem_prati)$/i,type:"name",label:"Person name (Hebrew)",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מספר_זהות|מס' זהות|מס_זהות|מס' ת"ז|teudat_zehut|tz|t_z|israeli_id|il_id)$/i,type:"id",label:"Israeli ID",labelHe:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|מס דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה|מס רישיון|דרכון_מספר)$/i,type:"id",label:"Passport / DL (Hebrew)",labelHe:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|דואר_אלקטרוני|אימייל|כתובת מייל|כתובת_מייל|כתובת דואר|כתובת_דואר)$/i,type:"email",label:"Email (Hebrew)",labelHe:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|מספר_טלפון|טלפון נייד|טלפון_נייד|מס נייד|מס_נייד|מס' טל)$/i,type:"phone",label:"Phone (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|כתובת_מגורים|רחוב|מס בית|מספר בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|כתובת_מלאה|מען)$/i,type:"address",label:"Address (Hebrew)",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|תאריך_לידה|ת לידה|תאריך הולדת|תאריך_הולדת|יום הולדת|יום_הולדת|גיל)$/i,type:"dob",label:"Date of birth (Hebrew)",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|חשבון_בנק|מספר חשבון|מספר_חשבון|מס חשבון|מס' חשבון|בנק|סניף|מס סניף|iban|iban_il)$/i,type:"financial",label:"Bank account (Hebrew)",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|כרטיס_אשראי|מספר אשראי|מס אשראי|מס' אשראי|cvv|אשראי|מס כרטיס|מס_כרטיס)$/i,type:"financial",label:"Credit card (Hebrew)",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר_ברוטו|שכר נטו|שכר_נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"Salary / income (Hebrew)",labelHe:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|בדיקה_רפואית|מצב רפואי|מצב_רפואי|חיסון|תוצאת בדיקה|תוצאת_בדיקה|רופא|רגישות|אלרגיה|סוג דם|סוג_דם)$/i,type:"medical",label:"Medical (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מספר_פוליסה|מס פוליסה|מס' פוליסה|פוליסה|מספר חבר|מספר_חבר|מס חבר|מספר ביטוח|מספר_ביטוח|policy_?number|policy_?no|policy_?id)$/i,type:"policy",label:"Insurance policy number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"},{pattern:/^(?:מספר סוכן|מספר_סוכן|מס סוכן|מס' סוכן|מס_סוכן|קוד סוכן|קוד_סוכן|מספר משווק|מספר_משווק|מספר יצרן|סוכן ביטוח|agent_?number|agent_?no|agent_?id|agent_?code|broker_?id|broker_?number)$/i,type:"agent_id",label:"Insurance agent / broker number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"},{pattern:/^(?:שם הילד|שם_הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|מספר_ילדים|תעודת לידה|ת לידה ילד)$/i,type:"minor_data",label:"Minor data (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|נטייה_מינית|השקפה פוליטית|השקפה_פוליטית|מצב משפחתי|מצב_משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"Sensitive personal (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מספר_רכב|מס רכב|מס' רכב|לוחית רישוי|לוחית_רישוי|מספר רישוי|מספר_רישוי)$/i,type:"tracking",label:"Vehicle ID (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}];function Nt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}var Je=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,qe=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,Ye=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function sr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i--){let s=t.charCodeAt(i)-48;if(s<0||s>9)return!1;n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function or(e){if(!e)return null;let t=e.trim();for(let r of mo)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var go=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},...ir(),{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function Qe(e){if(!e)return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let r=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of go)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>r.has(s)))return{type:n.type,label:n.type,labelHe:et(n.type)};return null}function et(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",employment:"\u05E4\u05E8\u05D8\u05D9 \u05EA\u05E2\u05E1\u05D5\u05E7\u05D4",education:"\u05D4\u05E9\u05DB\u05DC\u05D4",behavior:"\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function ar(e){let t=0,r=0,n=0,i=0,s=0;for(let a of e)typeof a=="string"&&(Nt(a)&&t++,Je.lastIndex=0,Je.test(a)&&r++,qe.lastIndex=0,qe.test(a)&&n++,Ye.lastIndex=0,Ye.test(a)&&i++,sr(a)&&s++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:i/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:i}:r/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:r}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:s/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:s}:null}var cr={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var _o=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D6\u05D4\u05D4"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Financial data",labelHe:"\u05E0\u05EA\u05D5\u05DF \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(ip_?address)$/i,type:"tracking",label:"IP address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA IP"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D3\u05E8\u05DB\u05D5\u05DF"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license",labelHe:"\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"},{pattern:/^(iban|swift_?code|bic)$/i,type:"financial",label:"Banking code",labelHe:"\u05E7\u05D5\u05D3 \u05D1\u05E0\u05E7\u05D0\u05D9"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E1"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Member ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7/\u05D7\u05D1\u05E8"},{pattern:/^(blood_?type|allergy|allergies|prescription)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation",labelHe:"\u05DE\u05D9\u05E7\u05D5\u05DD \u05D2\u05D9\u05D0\u05D5\u05D2\u05E8\u05E4\u05D9"},{pattern:/^(mac_?address|device_?fingerprint|imei|serial_?number)$/i,type:"tracking",label:"Device identifier",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"},{pattern:/^(ethnicity|race|religion|political_?affiliation|sexual_?orientation)$/i,type:"sensitive_personal",label:"Sensitive personal",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(minor|child_?name|child_?age|dependent)$/i,type:"minor_data",label:"Minor data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05E0\u05D9\u05DD"},{pattern:/^(signature|digital_?signature)$/i,type:"id",label:"Signature",labelHe:"\u05D7\u05EA\u05D9\u05DE\u05D4"},{pattern:/^(vehicle_?number|license_?plate|plate_?number)$/i,type:"tracking",label:"Vehicle ID",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05E8\u05DB\u05D1"}],ko=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|sort_?order|position|enabled|active|public|version|metadata|config|settings|options|data|content|body|raw|json|text|note|comment|label|color|icon|image|avatar|logo|thumbnail|preview|template|schema|format|mode|level|priority|severity|source|target|parent|child|owner|creator|modifier|assignee|project|workspace|organization|team|group|channel|thread|room|session|device|platform|browser|locale|timezone|currency|country|region|city|zip|postal|state|province|name|display_?name|user_?agent|password_?hash|secret|token|private_?key|auth_?token|constraint|index|sequence|trigger|function|procedure|database|namespace|migration|revision)$/i,xo=/^(beacon_?registr|device_?config|hardware|sensor|firmware|telemetry|metric|analytic|log_?event|audit_?log|system_?config|cache|queue|job|migration|schema_?version|spatial_?ref)/i,vo=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function lr(e,t){if(ko.test(e)||/^name$/i.test(e)||t&&xo.test(t)||vo.test(e))return null;for(let n of _o)if(n.pattern.test(e))return n.type;let r=or(e);return r?r.type:null}var Rl=cr.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var Cl=512*1024,Pl=50*1024*1024;var wo={id:"high",agent_id:"high",policy:"high",financial:"high",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"medium",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"low",employment:"medium",education:"medium",behavior:"high"};function So(e){return wo[e]??"low"}function ur(e,t){let r=[];for(let n of t){let i=n.rows.length;for(let s=0;s<n.headers.length;s++){let o=n.headers[s]??"",a=o?lr(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??Qe(o)?.type??null:null,c=[];for(let u of n.rows){let d=u[s];typeof d=="string"&&d.length>0&&c.push(d)}let l=c.length>0?ar(c):null;l?r.push(dr(e,n.name,o,l.type,l.label,"value",l.matchedSample,i)):a&&r.push(dr(e,n.name,o,a,et(a),"header",0,i))}}return r}function dr(e,t,r,n,i,s,o,a){return{file:e,location:t,column:r,type:n,label:i,category:et(n),severity:So(n),matchKind:s,hits:o,sampleSize:a}}var pr={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var Ao=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],Io=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function $o(e,t,r,n){if(n==="address")return{start:t,end:r};let i=Io.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}var To=new Set(["hex-secret-32","base64-secret"]),Ro=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3}){1,}(?:\.\d+)?\b/g];function Co(){let e=new we(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:t=>{if(!At())return[];let r=e.detect(t).map(i=>({start:i.startIndex,end:i.endIndex}));for(let i of Ro){i.lastIndex=0;for(let s of t.matchAll(i))r.push({start:s.index,end:s.index+s[0].length})}r.sort((i,s)=>i.start-s.start||s.end-i.end);let n=[];for(let i of r){let s=n[n.length-1];s&&i.start<s.end?s.end=Math.max(s.end,i.end):n.push({...i})}return n}}}var fr=!1;function hr(){if(fr)return;fr=!0;let e=[...Ao.map(({type:r,kind:n,severity:i,hint:s})=>{let o=new we([r]);return{kind:n,severity:i,hint:s,find:a=>o.detect(a).map(c=>$o(a,c.startIndex,c.endIndex,n))}}),Co()],t=pr.rules.filter(r=>!To.has(r.id)).map(r=>({id:r.id,name:r.name,severity:r.severity,pattern:new RegExp(r.pattern)}));tt({text:e,amounts:At,header:r=>{let n=Qe(r);return n?{type:n.type,label:n.labelHe||n.label}:null},secrets:t,table:r=>ur("",[r]).filter(n=>n.column).map(n=>({column:n.column,type:n.type,category:n.category,severity:n.severity,hits:n.hits,how:n.matchKind==="value"?"value":"header"}))})}hr();rr(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});
|