@nodatachat/mcp 1.6.0 → 1.6.3
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 +43 -43
- package/dist/index.js +361 -359
- package/dist/scan-worker.js +29 -27
- package/dist/status.js +1 -1
- package/package.json +1 -1
package/dist/gate.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
/*! @nodatachat/mcp 1.6.
|
|
2
|
-
import{appendFileSync as ra,copyFileSync as Qu,existsSync as mn,mkdirSync as qr,readdirSync as ia,readFileSync as gn,statSync as ut,writeFileSync as sa}from"node:fs";import{homedir as V}from"node:os";import{basename as ft,extname as Qr,isAbsolute as q,join as be,relative as ei,resolve as D}from"node:path";import{TextDecoder as lr}from"node:util";var F={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function xt(e){e.table&&(F.table=e.table),e.severity&&(F.severity=e.severity),e.amounts&&(F.amounts=e.amounts);for(let t of e.text??[])F.text.some(r=>r.kind===t.kind)||F.text.push(t);e.header&&!F.header.includes(e.header)&&F.header.push(e.header);for(let t of e.secrets??[])F.secrets.some(r=>r.id===t.id)||F.secrets.push(t)}function wt(){return F.amounts?.()===!0}function Ce(){return F.text}function Sn(){return F.header}function we(){return F.table}function En(){return F.secrets}var Le=[{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 ke(){let e=En().filter(t=>!Le.some(r=>r.id===t.id));return[...Le,...e]}var Ii=[{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"}],Ri=[{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"}],Ti=/^(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,Ci=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(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 ve(e){if(!e)return null;let t=e.trim();if(Ti.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...Ri,...Ii])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(Ci.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 Sn()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function An(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 Li(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 Pi(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 kt="(?<!\\d)(?<!\\d[.,])",vt="(?!\\d)(?![.,]\\d)",St=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${kt}\\d{9}${vt}`,"g"),validate:An,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(`${kt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${vt}`,"g"),validate:Li,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:Pi,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${kt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${vt}`,"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 Pe(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 hs}from"node:zlib";import{inflateSync as Ni}from"node:zlib";var Ne=new Set([".pdf"]),$n=8*1024*1024;function Cn(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,f=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
|
|
4
|
-
`),n="",a=0},
|
|
5
|
-
`)}var
|
|
6
|
-
`);return
|
|
7
|
-
`).map(
|
|
1
|
+
/*! @nodatachat/mcp 1.6.3 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
|
|
2
|
+
import{appendFileSync as ka,copyFileSync as If,existsSync as xn,mkdirSync as si,readdirSync as va,readFileSync as wn,statSync as ft,writeFileSync as Sa}from"node:fs";import{homedir as V}from"node:os";import{basename as pt,extname as oi,isAbsolute as q,join as _e,relative as ai,resolve as D}from"node:path";import{TextDecoder as yr}from"node:util";var F={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function wt(e){e.table&&(F.table=e.table),e.severity&&(F.severity=e.severity),e.amounts&&(F.amounts=e.amounts);for(let t of e.text??[])F.text.some(r=>r.kind===t.kind)||F.text.push(t);e.header&&!F.header.includes(e.header)&&F.header.push(e.header);for(let t of e.secrets??[])F.secrets.some(r=>r.id===t.id)||F.secrets.push(t)}function kt(){return F.amounts?.()===!0}function Pe(){return F.text}function Tn(){return F.header}function ke(){return F.table}function Cn(){return F.secrets}var Le=[{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 ve(){let e=Cn().filter(t=>!Le.some(r=>r.id===t.id));return[...Le,...e]}var Oi=[{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"}],Di=[{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"}],Fi=/^(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,ji=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(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 Se(e){if(!e)return null;let t=e.trim();if(Fi.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...Di,...Oi])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(ji.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 Tn()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function Pn(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 Mi(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 Hi(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 vt="(?<!\\d)(?<!\\d[.,])",St="(?!\\d)(?![.,]\\d)",Et=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${vt}\\d{9}${St}`,"g"),validate:Pn,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(`${vt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${St}`,"g"),validate:Mi,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:Hi,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${vt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${St}`,"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 Ne(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 _s}from"node:zlib";import{inflateSync as Ln}from"node:zlib";var Oe=new Set([".pdf"]),Nn=8*1024*1024;function jn(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,p=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 m=t.indexOf("endstream",d);m>d&&(p=e.subarray(d,m))}else l=t.slice(o,a);r.set(s,{num:s,dict:l,stream:p})}for(let s of[...r.values()]){if(!s.stream||!/\/Type\s*\/ObjStm\b/.test(s.dict))continue;let o=De(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 p=0;p<a;p+=1){let d=l[2*p],m=l[2*p+1];if(d===void 0||m===void 0||Number.isNaN(d)||Number.isNaN(m))break;let f=p+1<a?l[2*(p+1)+1]:void 0,g=o.slice(c+m,f!==void 0?c+f:void 0);r.has(d)||r.set(d,{num:d,dict:g,stream:null})}}return r}function At(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 Ui(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 Bi(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 zi(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(r=>r[1]??"")}function De(e,t){if(!e.stream)return null;let r=e.stream;for(let n of zi(e.dict)){let i=null;if(n==="FlateDecode")try{i=t!==void 0?Ln(r,{maxOutputLength:Math.max(1,t)}):Ln(r)}catch{return null}else if(n==="ASCII85Decode")i=Ui(r);else if(n==="ASCIIHexDecode")i=Bi(r);else return null;if(i===null)return null;r=i}return r.toString("latin1")}function Wi(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 p=0;p+3<c.length+1;p+=4){let d=parseInt(c.slice(p,p+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,p;for(;(p=l.exec(c))!==null;){let d=parseInt(p[1]??"0",16),m=parseInt(p[2]??"0",16),f=parseInt((p[3]??"0").slice(0,4)||"0",16);if(!(m-d>65535))for(let g=d;g<=m;g+=1)t.set(g,String.fromCharCode(f+(g-d)))}}return{map:t,bytes:r}}function Gi(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])),m=d?De(d):null;m&&(c=Wi(m))}if(c||(c=Ki(a.dict,e)),!c)continue;let p=t.get(s)??[];p.push(c),t.set(s,p)}return t}var Vi=["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 Xi(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=Vi.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 Ki(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=Xi(a.slice(1));c!==null&&s.set(o,c),o+=1}return s.size?{map:s,bytes:1}:null}function Mn(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 Hn(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 On(e,t){let r=Hn(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 Zi(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 Dn(e,t){if(!t||t.length<=1)return On(e,t?.[0]);let r="",n=-1/0;for(let i of t){let s=On(e,i),o=Zi(s);o>n&&(r=s,n=o)}return r}function Yi(e,t){let r="",n="",i,s=!1,o="",a=0,c=null,l=()=>{n.trim()&&(r+=n+`
|
|
4
|
+
`),n="",a=0},p=()=>{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,m;for(;(m=d.exec(e))!==null;){let f=m[0];if(m[1]!==void 0&&f.endsWith("Tf")){i=t.get(m[1]);continue}if(m[2]!==void 0){Math.abs(Number(m[3]))>.01?l():Number(m[2])!==0&&p();continue}if(m[4]!==void 0){let g=Number(m[4]);c!==null&&Math.abs(g-c)>.01?l():c!==null&&p(),c=g;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+=Dn(Mn(f.slice(1,-1)),i);else if(f.startsWith("<")){let g=f.slice(1,-1).replace(/\s+/g,""),u=[];for(let y=0;y+1<g.length;y+=2)u.push(parseInt(g.slice(y,y+2),16));o+=Dn(u,i)}else s&&Number(f)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),l(),r}function Ji(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=Mn(c.slice(1,-1));s.push(Hn(l)??l.map(p=>String.fromCharCode(p)).join(""))}else{let l=c.slice(1,-1).replace(/\s+/g,""),p="";if(l.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<l.length+1;d+=4)p+=String.fromCharCode(parseInt(l.slice(d,d+4),16));else for(let d=0;d+1<l.length;d+=2)p+=String.fromCharCode(parseInt(l.slice(d,d+2),16));s.push(p)}}return s.join(`
|
|
5
|
+
`)}var Fn="\u05DD\u05DF\u05E5\u05E3\u05DA";function Fe(e){let t=0,r=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])Fn.includes(n[0])&&(t+=1),Fn.includes(n[n.length-1])&&(r+=1);return t>=3&&t>r*2}var qi={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function je(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(r=>qi[r]??r).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,r=>[...r].reverse().join("")):e}function $t(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=jn(e);if(r.size===0)return null;let n=Gi(r),i=[];i.push(Ji(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=De(l);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let m=Yi(d,n);if(m.trim().length!==0){if(o+=1,s+m.length>Nn){i.push(m.slice(0,Math.max(0,Nn-s))),a=!0;break}i.push(m),s+=m.length}}if(o===0)return null;let c=i.slice(1).join(`
|
|
6
|
+
`);return At(c)?null:(Fe(c)&&(c=c.split(`
|
|
7
|
+
`).map(je).join(`
|
|
8
8
|
`)),{text:[i[0]??"",c].join(`
|
|
9
|
-
`),truncated:a,streams:o})}function
|
|
9
|
+
`),truncated:a,streams:o})}var ol=64*1024*1024;function Un(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=jn(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=De(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 Qi}from"node:child_process";import{existsSync as es,mkdtempSync as ts,readFileSync as zn,readdirSync as Ue,rmSync as ns,statSync as rs,writeFileSync as Wn}from"node:fs";import{tmpdir as is}from"node:os";import{delimiter as ss,join as O}from"node:path";var ce="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)",Me=null;function Bn(e){try{return rs(e).isFile()}catch{return!1}}function os(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),r=process.env.LOCALAPPDATA;for(let n of t)e.push(O(n,"Tesseract-OCR"));if(r){e.push(O(r,"Programs","Tesseract-OCR"),O(r,"Microsoft","WinGet","Links"));let n=O(r,"Microsoft","WinGet","Packages");try{for(let i of Ue(n))if(/^oschwartz10612\.Poppler/i.test(i))for(let s of Ue(O(n,i)))e.push(O(n,i,s,"Library","bin"))}catch{}}for(let n of t)try{for(let i of Ue(n))/^poppler/i.test(i)&&e.push(O(n,i,"Library","bin"),O(n,i,"bin"))}catch{}return e}function He(e,t){let r=process.env[t];if(r)return Bn(r)?r:void 0;let n=process.platform==="win32",i=n?[`${e}.exe`,e]:[e],s=(process.env.PATH??"").split(ss).filter(Boolean);n&&s.push(...os());for(let o of s)for(let a of i)if(Bn(O(o,a)))return O(o,a)}function te(e,t,r){try{return Qi(e,t,{encoding:"utf8",timeout:r,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function le(){if(Me)return Me;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return Me={ocrLangs:[],osd:!1};let e={pdftotext:He("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:He("pdftoppm","NODATA_PDFTOPPM"),tesseract:He("tesseract","NODATA_TESSERACT"),ocrmypdf:He("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((te(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 Me=e}function Rt(e,t,r=".pdf"){let n=ts(O(is(),"nd-read-"));try{let i=O(n,`in${r}`);return Wn(i,e,{mode:384}),t(n,i)}finally{ns(n,{recursive:!0,force:!0})}}function Tt(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
|
|
11
|
+
`).trim();return t.replace(/\s/g,"").length<2||At(t)?null:Fe(t)?t.split(`
|
|
12
|
+
`).map(je).join(`
|
|
13
|
+
`):t}function Gn(e){let t=le().pdftotext;if(!t)return null;let r=Rt(e,(n,i)=>te(t,["-enc","UTF-8","-q",i,"-"],6e4));return r===null?null:Tt(r)}var as=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function Vn(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 cs(e,t){let r=Vn(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 p=0;p<i;p++)for(let d=0;d<n;d++){let m=o[p*n+d];t===180?l[(i-1-p)*n+(n-1-d)]=m:t===90?l[d*a+(i-1-p)]=m:l[(n-1-d)*a+p]=m}return Buffer.concat([Buffer.from(`P5
|
|
14
14
|
${a} ${c}
|
|
15
15
|
255
|
|
16
|
-
`,"latin1"),l])}function
|
|
17
|
-
`))??
|
|
18
|
-
`).filter(
|
|
16
|
+
`,"latin1"),l])}function Xn(e,t){if(!e.osd)return;let r=te(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=cs(zn(t),n);s&&Wn(t,s,{mode:384})}function ls(e,t,r){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=O(t,"side.txt");return te(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,r,O(t,"out.pdf")],3e5),es(n)?Tt(zn(n,"utf8")):null}function Kn(e){let t=le();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let r=as();return Rt(e,(n,i)=>{if(te(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(r+1),i,O(n,"p")],12e4)===null)return null;let s=Ue(n).filter(l=>/^p-\d+\.pgm$/.test(l)).sort((l,p)=>Number(l.match(/\d+/)[0])-Number(p.match(/\d+/)[0])),o=s.length>r,a=[];for(let l of s.slice(0,r)){Xn(t,O(n,l));let p=te(t.tesseract,[O(n,l),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);p&&a.push(p)}let c=Tt(a.join(`
|
|
17
|
+
`))??ls(t,n,i);return c===null?null:{text:c,truncated:o,pages:Math.min(s.length,r)}})}function It(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function Be(e,t={}){let r=$t(e),n=Gn(e);if(r){if(n===null)return{...r,engine:"builtin",uncertain:!1};let s=It(r.text),o=n.split(`
|
|
18
|
+
`).filter(p=>[...It(p)].some(d=>!s.has(d))),a=It(n),c=[...a].filter(p=>!s.has(p)),l=c.length>Math.max(3,a.size*.1)||c.some(p=>/^\d{5,}$/.test(p));return o.length===0?{...r,engine:"builtin",uncertain:!1}:{...r,text:r.text+`
|
|
19
19
|
`+o.join(`
|
|
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=
|
|
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=Kn(e);return i?{text:i.text,truncated:i.truncated,streams:0,engine:"ocr",uncertain:!1}:null}function Zn(e){let t=Un(e),r=le();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: ${ce}`:/encrypted/.test(t)?t+(r.pdftotext?"":` \u2014 if it opens without a password, the second reader can read it: ${ce}`):/letter map|compressed/.test(t)&&!r.pdftotext?`${t}. A second reader may read it: ${ce}`:/letter map|compressed/.test(t)?`${t} (the second reader, pdftotext, could not read it either)`:t}var Yn=[208,207,17,224,161,177,26,225],Ct=4294967294,ze=4294967295,ds=64*1024*1024;function Ee(e){if(e.length<512)return!1;for(let t=0;t<Yn.length;t+=1)if(e[t]!==Yn[t])return!1;return!0}function Pt(e){if(!Ee(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),p=e.readUInt32LE(72),d=Math.floor((e.length-n)/n)+1,m=_=>{let w=(_+1)*n;return _>=d||w>=e.length?null:e.subarray(w,Math.min(w+n,e.length))},f=[];for(let _=0;_<109&&f.length<s;_+=1){let w=e.readUInt32LE(76+_*4);w!==ze&&f.push(w)}let g=l;for(let _=0;_<p&&g!==Ct&&g!==ze;_+=1){let w=m(g);if(!w)return null;let A=n/4-1;for(let T=0;T<A&&f.length<s;T+=1){let E=w.readUInt32LE(T*4);E!==ze&&f.push(E)}g=w.readUInt32LE(A*4)}let u=[];for(let _ of f){let w=m(_);if(!w)return null;for(let A=0;A+4<=w.length;A+=4)u.push(w.readUInt32LE(A))}let y=(_,w,A)=>{let T=[],E=_;for(;E!==Ct&&E!==ze;){if(E>=w.length||T.length>A)return null;T.push(E),E=w[E]}return T},h=(_,w)=>{let A=y(_,u,d);if(!A)return null;let T=[];for(let ee of A){let we=m(ee);if(!we)return null;T.push(we)}let E=Buffer.concat(T);return w>=0?E.subarray(0,Math.min(w,E.length)):E},x=h(o,-1);if(!x)return null;let b=[],R=new Map;for(let _=0,w=0;_+128<=x.length;_+=128,w+=1){let A=x.readUInt16LE(_+64),T=x[_+66];if(T===0||A<2||A>64)continue;let E=x.subarray(_,_+A-2).toString("utf16le"),ee={id:w,name:E,type:T,left:x.readUInt32LE(_+68),right:x.readUInt32LE(_+72),child:x.readUInt32LE(_+76),start:x.readUInt32LE(_+116),size:x.readUInt32LE(_+120),path:E};b.push(ee),R.set(w,ee)}let S=new Set,j=(_,w)=>{let A=[_];for(;A.length;){let T=A.pop(),E=R.get(T);!E||S.has(T)||(S.add(T),E.path=w?`${w}/${E.name}`:E.name,A.push(E.left,E.right),E.type===1&&j(E.child,E.path))}},z=b.find(_=>_.type===5);z&&j(z.child,"");let P=b.find(_=>_.type===5);if(!P)return null;let G=null,N=[];if(b.some(_=>_.type===2&&_.size<a&&_.size>0)){G=h(P.start,P.size);let _=c!==Ct?h(c,-1):null;if(_)for(let w=0;w+4<=_.length;w+=4)N.push(_.readUInt32LE(w));else N=[]}let M=new Map,H=new Map,K=(_,w)=>{M.has(_.name)||M.set(_.name,w),H.set(_.path,w)};for(let _ of b)if(_.type===2&&!(_.size>ds)){if(_.size===0){K(_,Buffer.alloc(0));continue}if(_.size<a){if(!G)continue;let w=y(_.start,N,Math.ceil(G.length/i)+1);if(!w)continue;let A=w.map(T=>G.subarray(T*i,T*i+i));K(_,Buffer.concat(A).subarray(0,_.size))}else{let w=h(_.start,_.size);w&&K(_,w)}}return{streams:M,paths:H}}catch{return null}}import{TextDecoder as Jn}from"node:util";var Ae="password-protected: open it with its password, or check it by hand";function us(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 tr=e=>{try{return new Jn(e)}catch{return new Jn("latin1")}},de=tr("windows-1252");function $e(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
|
|
23
|
+
`)}function fs(e,t){return e.length>t?{text:e.slice(0,t),truncated:!0}:{text:e,truncated:!1}}function ps(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:Ae};if(t.readUInt16LE(2)<101){let g=t.readUInt32LE(24),u=t.readUInt32LE(28);return u<=g||u>t.length?{kind:"doc",reason:"damaged Word file"}:$e(de.decode(t.subarray(g,u)))}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,p=a+c,d=null;for(;l<p;){let g=i[l];if(g===1)l+=3+i.readInt16LE(l+1);else if(g===2){let u=i.readUInt32LE(l+1);d=i.subarray(l+5,Math.min(l+5+u,i.length));break}else break}if(!d||d.length<16)return{kind:"doc",reason:"damaged Word file (no piece table)"};let m=Math.floor((d.length-4)/12),f=[];for(let g=0;g<m;g+=1){let u=d.readUInt32LE(g*4),h=d.readUInt32LE((g+1)*4)-u;if(h<=0||h>t.length)continue;let x=d.readUInt32LE(4*(m+1)+g*8+2);if(x&1073741824){let b=(x&1073741823)/2;f.push(de.decode(t.subarray(b,Math.min(b+h,t.length))))}else f.push(t.subarray(x,Math.min(x+h*2,t.length)).toString("utf16le"))}return $e(f.join(""))}var Lt=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 p=a.subarray(this.p,this.p+l*(s?2:1));n+=s?p.toString("utf16le"):p.toString("latin1"),this.p+=p.length,i-=l}return n}};function hs(e){let t=new Lt(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 qn(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 Qn(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 We=e=>Number.isFinite(e)?String(e):"";function ms(e){let t=e.streams.get("Workbook")??e.streams.get("Book"),r=!0,n=de,i=[],s=new Set,o=[],a=[],c=-1,l=null,p=0,d=(u,y,h)=>{if(c<0||!h)return;let x=a[c],b=x.get(u)??new Map;b.set(y,h),x.set(u,b)},m=0;for(;m+4<=t.length;){let u=t.readUInt16LE(m),y=t.readUInt16LE(m+2),h=t.subarray(m+4,Math.min(m+4+y,t.length)),x=m+4+y;switch(u){case 2057:p+=1,h.length>=4&&(r=h.readUInt16LE(0)===1536),p===1&&h.length>=4&&h.readUInt16LE(2)!==5&&(c=a.length,a.push(new Map));break;case 10:p=Math.max(0,p-1);break;case 47:return{kind:"xls",reason:Ae};case 66:if(h.length>=2&&!r){let b=h.readUInt16LE(0);n=b===1200?de:tr(`windows-${b}`)}break;case 133:if(h.length>6){let b=h[6];if(r){let R=h[7]&1;o.push(R?h.subarray(8,8+b*2).toString("utf16le"):h.subarray(8,8+b).toString("latin1"))}else o.push(n.decode(h.subarray(7,7+b)))}break;case 252:{let b=[h];for(;x+4<=t.length&&t.readUInt16LE(x)===60;){let R=t.readUInt16LE(x+2);b.push(t.subarray(x+4,Math.min(x+4+R,t.length))),x+=4+R}i=hs(b);break}case 253:if(h.length>=10){let b=h.readUInt32LE(6);s.add(b),d(h.readUInt16LE(0),h.readUInt16LE(2),i[b]??"")}break;case 516:case 214:h.length>=8&&d(h.readUInt16LE(0),h.readUInt16LE(2),qn(h,6,r,n));break;case 515:h.length>=14&&d(h.readUInt16LE(0),h.readUInt16LE(2),We(h.readDoubleLE(6)));break;case 638:h.length>=10&&d(h.readUInt16LE(0),h.readUInt16LE(2),We(Qn(h.readUInt32LE(6))));break;case 189:{if(h.length>=6){let b=h.readUInt16LE(0),R=h.readUInt16LE(2);for(let S=4;S+6<=h.length-2;S+=6)d(b,R++,We(Qn(h.readUInt32LE(S+2))))}break}case 6:if(h.length>=14){let b=h.readUInt16LE(0),R=h.readUInt16LE(2);h.readUInt16LE(12)===65535?l=h[6]===0?[b,R]:null:d(b,R,We(h.readDoubleLE(6)))}break;case 519:l&&d(l[0],l[1],qn(h,0,r,n)),l=null;break}m=x}let f=[];a.forEach((u,y)=>{f.push(o[y]??"");for(let h of[...u.keys()].sort((x,b)=>x-b)){let x=u.get(h);f.push([...x.keys()].sort((b,R)=>b-R).map(b=>x.get(b)).join(" "))}f.push("")});let g=i.filter((u,y)=>!s.has(y));return g.length&&f.push(...g),$e(f.join(`
|
|
24
|
+
`))}function gs(e){if(e.streams.has("EncryptedSummary"))return{kind:"ppt",reason:Ae};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:Ae};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(de.decode(a)),n+=8+o}return $e(r.join(`
|
|
25
|
+
`))}function ys(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"):de.decode(n))}return $e(t.join(`
|
|
26
|
+
`))}function er(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 Nt(e,t){let r=Pt(e);if(!r)return{kind:null,reason:"damaged Office 97-2003 file"};let n=us(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:Ae};let i;try{i=n==="doc"?ps(r):n==="xls"?ms(r):n==="ppt"?gs(r):ys(r)}catch{i={kind:n,reason:"damaged Office 97-2003 file"}}if(typeof i!="string")return i;if(!i.trim()&&!(n==="msg"&&er(r).length))return{kind:n,reason:"no text inside (an empty file, or only pictures)"};let s=fs(i,t),o=n==="msg"?er(r):[];return{kind:n,text:s.text,truncated:s.truncated,parts:[`cfb:${n}`],...o.length?{attachments:o}:{}}}import{TextDecoder as nr}from"node:util";var bs=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"]),rr=e=>{try{return new nr(e===65001?"utf-8":`windows-${e}`)}catch{return new nr("windows-1252")}};function Ge(e){return e.length>=5&&e.subarray(0,5).toString("latin1")==="{\\rtf"}function Ot(e){let t=rr(1252),r=[],n=[],i=()=>{n.length&&(r.push(t.decode(Uint8Array.from(n))),n=[])},s=[],o=!1,a=1,c=0,l=0,p=e.length;for(;l<p;){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 m=s.pop();m&&(o=m.skip,a=m.uc),l+=1;continue}if(d==="\\"){let m=e[l+1];if(m==="'"){let y=parseInt(e.substr(l+2,2),16);if(l+=4,c>0){c-=1;continue}!o&&Number.isFinite(y)&&n.push(y);continue}if(m==="\\"||m==="{"||m==="}"){o||(i(),r.push(m)),l+=2;continue}if(m==="~"){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 g=f[1].toLowerCase(),u=f[2]!==void 0?Number(f[2]):null;if(bs.has(g)){o=!0;continue}g==="ansicpg"&&u?t=rr(u):g==="uc"&&u!==null?a=u:g==="u"&&u!==null?(i(),o||r.push(String.fromCharCode(u<0?u+65536:u)),c=a):!o&&(g==="par"||g==="line"||g==="row"||g==="sect"||g==="page")?(i(),r.push(`
|
|
27
27
|
`)):!o&&(g==="tab"||g==="cell")&&(i(),r.push(" "));continue}if(d==="\r"||d===`
|
|
28
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 Dt=new Set([".xlsx",".xlsm",".xltx",".xltm",".docx",".docm",".dotx",".dotm",".pptx",".pptm",".ppsx",".ppsm",".potx"]),Ve=new Set([".odt",".ods",".odp",".ott",".ots",".otp"]),Ft=new Set([".doc",".dot",".xls",".xlt",".ppt",".pps",".pot",".msg"]),ir=new Set([".rtf"]);function xs(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 ue=8*1024*1024,ws=101010256,ks=33639248,vs=67324752;function fe(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)===ws){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)!==ks);o+=1){let a=e.readUInt16LE(i+8),c=e.readUInt16LE(i+10),l=e.readUInt32LE(i+20),p=e.readUInt32LE(i+24),d=e.readUInt16LE(i+28),m=e.readUInt16LE(i+30),f=e.readUInt16LE(i+32),g=e.readUInt32LE(i+42),u=e.subarray(i+46,i+46+d).toString("utf8");s.push({name:u,flags:a,method:c,compSize:l,uncompSize:p,localHeaderOffset:g}),i+=46+d+m+f}return s}function pe(e,t,r=256*1024*1024){let n=t.localHeaderOffset;if(n+30>e.length||e.readUInt32LE(n)!==vs)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 _s(c,{maxOutputLength:r})}catch{return null}return null}function Ss(e,t){return pe(e,t)?.toString("utf8")??null}var Es={"&":"&","<":"<",">":">",""":'"',"'":"'"};function Z(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>Es[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 As(e){return Z(e.replace(/<[^>]*>/g,`
|
|
31
31
|
`)).replace(/\n{2,}/g,`
|
|
32
|
-
`)}function
|
|
33
|
-
`+
|
|
34
|
-
`))}a+
|
|
35
|
-
`),truncated:c,parts:o}}function
|
|
36
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function
|
|
37
|
-
`),counts:o,columnsHidden:i.filter((p,g)=>s[g])}}var Cs=/^xl\/(pivotCache|charts|externalLinks)\//,ir=10;function nr(e,t,r=1){e[t]=(e[t]??0)+r}function sr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function or(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 Z(r)}function Ls(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>or(t[1]??"")):[]}var ar=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Xe(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function me(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?or(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?Z(r[1]):null}function Ps(e){let t=[];for(let r of e.matchAll(ar)){let n=Xe(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:Xe(r[1],"t")??"n"})}return t}function Ns(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,ir);for(let n of r){let i=new Map;for(let s of e.filter(o=>o.row===n)){let o=me(s,t),a=o?ve(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 Os=/^xl\/worksheets\/sheet\d+\.xml$/,Ds=200;function Fs(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function js(e,t){let r=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,ir),n=-1,i=-1/0;for(let s of r){let o=e.filter(l=>l.row===s).map(l=>(me(l,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(l=>!Fs(l)).length,c=a*2-(o.length-a);c>i&&(i=c,n=s)}return n}function Ms(e,t,r){let n=Ns(t,r),i=we();if(!i)return n;let s=n.row>=0?n.row:js(t,r);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(me(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,h)=>[d.col,h])),c=new Map;for(let d of t){if(d.row<=s)continue;let h=a.get(d.col);if(h!==void 0){if(!c.has(d.row)){if(c.size>=Ds)continue;c.set(d.row,o.map(()=>""))}c.get(d.row)[h]=me(d,r)??""}}let l=new Map(s===n.row?n.cols:[]),f=o.map(d=>d.text);for(let d of i({name:e,headers:f,rows:[...c.values()]})){let h=f.indexOf(d.column);h<0||l.set(o[h].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:l}}function Bt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${sr(t)}</t></is></c>`}var Hs=(()=>{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 Us(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=Hs[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var rr=33;function zt(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):Ts(o.data),f=c?0:8,d=c?0:Us(o.data),h=Buffer.alloc(30);h.writeUInt32LE(67324752,0),h.writeUInt16LE(20,4),h.writeUInt16LE(2048,6),h.writeUInt16LE(f,8),h.writeUInt16LE(rr,12),h.writeUInt32LE(d,14),h.writeUInt32LE(l.length,18),h.writeUInt32LE(o.data.length,22),h.writeUInt16LE(a.length,26),t.push(h,a,l);let p=Buffer.alloc(46);p.writeUInt32LE(33639248,0),p.writeUInt16LE(20,4),p.writeUInt16LE(20,6),p.writeUInt16LE(2048,8),p.writeUInt16LE(f,10),p.writeUInt16LE(rr,14),p.writeUInt32LE(d,16),p.writeUInt32LE(l.length,20),p.writeUInt32LE(o.data.length,24),p.writeUInt16LE(a.length,28),p.writeUInt32LE(n,42),r.push(p,a),n+=h.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 Wt(e,t){let r=fe(e);if(!r||r.length===0||r.some(m=>Cs.test(m.name)))return null;let n=new Map;for(let m of r){if(m.name.endsWith("/")){n.set(m.name,Buffer.alloc(0));continue}let x=pe(e,m);if(!x)return null;n.set(m.name,x)}let i=[...n.keys()].filter(m=>Os.test(m));if(i.length===0)return null;let s=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,o=Ls(s),a=new Set,c={},l=new Set,f=Mt(),d=wt();for(let m of i){let x=n.get(m).toString("utf8"),b=Ps(x);if(!b)return null;let I=Ms(m.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),b,o),S=I.row,j=new Map;for(let N of b){if(N.type!=="n"||N.row<=S)continue;let L=me(N,o);L!==null&&j.set(N.col,[...j.get(N.col)??[],L])}let z=Ht(j),P=new Map;for(let[N,{type:L,header:M,how:H}]of I.cols)H==="header"&&z.has(N)||(P.set(N,L),l.add(M));let G=x.replace(ar,(N,L,M)=>{let H=Xe(L,"r"),[,K,_]=/^([A-Z]+)(\d+)$/.exec(H),w={full:N,attrs:L,inner:M??"",col:K,row:Number(_),type:Xe(L,"t")??"n"},A=me(w,o),R=()=>{if(w.type==="s"){let vn=/<v>([^<]*)<\/v>/.exec(w.inner);vn&&a.add(Number(vn[1]))}return N};if(A===null||A.trim()==="")return R();if(d&&w.type==="n"&&z.has(K)&&w.row>S)return nr(c,"amount"),Bt(L,"[AMOUNT]");let E=P.get(K);if(E&&w.row>S&&!Ve(A))return nr(c,`column:${E}`),Bt(L,f(E,A));if(w.type==="n"&&z.has(K))return R();let ee=U(A,c),xe=t?.size?he(ee.text,t,c):ee.text;return xe===A?R():Bt(L,xe)});n.set(m,Buffer.from(G,"utf8"))}if(s){let m=-1,x=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,b=>(m+=1,a.has(m)?b:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(x,"utf8"))}for(let m of[...n.keys()].filter(x=>/^xl\/comments\d*\.xml$/.test(x))){let b=n.get(m).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(I,S,j,z)=>{let P=U(Z(j),c);return`${S}${sr(t?.size?he(P.text,t,c):P.text)}${z}`});n.set(m,Buffer.from(b,"utf8"))}let h=n.get("docProps/core.xml");if(h){let m=h.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(m,"utf8"))}let p=n.get("xl/workbook.xml");if(p){let m=p.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");n.set("xl/workbook.xml",Buffer.from(m,"utf8"))}let g=n.get("docProps/app.xml");if(g){let m=g.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");n.set("docProps/app.xml",Buffer.from(m,"utf8"))}let u=n.has("xl/calcChain.xml"),y=r.map(m=>m.name).filter(m=>!(u&&m==="xl/calcChain.xml"));if(u)for(let m of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let x=n.get(m);x&&n.set(m,Buffer.from(x.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:zt(y.map(m=>({name:m,data:n.get(m)}))),counts:c,columnsHidden:[...l]}}var ge=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,Bs=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,zs=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Gt(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||!Bs.test(n[1])||zs.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var Xl=64*1024*1024,Kl=4*1024*1024;var Zl=512*1024*1024,Yl=1024*1024*1024;var Jl=256*1024*1024;var ql=new lr("utf-8",{fatal:!0}),Ql=new lr("windows-1255");var ed=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 fd=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var to=["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."],$=(e,t,r)=>({provider:e,url:t,steps:[...r,...to]}),no={"aws-access-key":$("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":$("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":$("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":$("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":$("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":$("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":$("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":$("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":$("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":$("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":$("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":$("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":$("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":$("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":$("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":$("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":$("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":$("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":$("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":$("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":$("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":$("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":$("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":$("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":$("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":$("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":$("An access token","",["Revoke the token in the service that issued it and issue a new one."])},ro=$("A credential","",["Find the service it belongs to and issue a new credential there."]);function Vt(e){return no[e]??ro}function pr(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||io(e)}function io(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as so,mkdirSync as bu,readFileSync as oo,statSync as Xt,writeFileSync as _u}from"node:fs";import{homedir as ao}from"node:os";import{join as co}from"node:path";var lo=()=>co(ao(),".nodata","flagged.json");var hr="unread";function mr(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var $e=null;function gr(){let e=lo();try{if(!so(e))return{};let t=Xt(e).mtimeMs;if($e&&$e.path===e&&$e.mtimeMs===t)return $e.store;let r=JSON.parse(oo(e,"utf8"));return $e={path:e,mtimeMs:t,store:r},r}catch{return{}}}function Ke(e){let t=gr()[mr(e)];if(!t)return null;try{if(Xt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==hr));return Object.keys(r).length?r:null}function Ze(e){let t=gr()[mr(e)];if(!t||!t.kinds[hr])return null;try{return{changed:Xt(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as yr,mkdirSync as Su,readFileSync as br,writeFileSync as Eu}from"node:fs";import{homedir as uo}from"node:os";import{join as fo}from"node:path";var Ye=()=>fo(uo(),".nodata","prefs.json");function po(){try{let e=yr(Ye())?JSON.parse(br(Ye(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function ho(){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 Y(){return po()??ho()}function _r(){try{return yr(Ye())&&JSON.parse(br(Ye(),"utf8")).amounts_sensitive===!0}catch{return!1}}function T(e,t,r=Y()){return r==="he"?e:t}import{createHmac as Ro,randomBytes as To}from"node:crypto";import{existsSync as Jt,mkdirSync as Co,readdirSync as Lo,readFileSync as qt,writeFileSync as Po}from"node:fs";import{homedir as it}from"node:os";import{basename as No,extname as Oo,isAbsolute as Do,join as st,relative as Fo,resolve as jo}from"node:path";function ie(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function mo(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function xr(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=ie(e),i=ie(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=ie(e),i=ie(r);return n!==null&&i!==null&&n<=i}case"between":{let n=ie(e);return n!==null&&Array.isArray(r)&&r.length===2&&mo(n,ie(r[0]),ie(r[1]))}default:return!1}}function wr(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}}import{existsSync as Je,mkdirSync as Cu,readdirSync as kr,readFileSync as go,rmSync as Lu,writeFileSync as Pu,chmodSync as Nu}from"node:fs";import{homedir as vr}from"node:os";import{basename as Fu,isAbsolute as yo,join as se,relative as bo,resolve as _o}from"node:path";var et=()=>se(vr(),".nodata"),xo=()=>se(et(),"credentials.json"),qe=()=>se(et(),"orgs"),wo=()=>se(et(),"bindings.json"),ko=/^[A-Za-z0-9_.-]{1,80}$/,Kt=e=>ko.test(e)&&e!=="."&&e!=="..";function Sr(e){try{return Je(e)?JSON.parse(go(e,"utf8")):null}catch{return null}}function vo(e){return e?e.device?.org_id?e.device.org_id:e.api_key?`key-${(e.key_prefix??e.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function Er(){return vo(Sr(xo()))}function Zt(){let e=[],t=Er();t&&e.push(t);try{for(let r of kr(qe()))Kt(r)&&!e.includes(r)&&Je(se(qe(),r,"credentials.json"))&&e.push(r)}catch{}return e}var So=e=>process.platform==="win32"||process.platform==="darwin"?e.toLowerCase():e,Qe=e=>So(_o(e.replace(/^~(?=[\\/]|$)/,vr())));function Eo(e,t){let r=bo(Qe(e),Qe(t));return r===""||!r.startsWith("..")&&!yo(r)}function J(){let e=Sr(wo());return(Array.isArray(e?.bindings)?e.bindings:[]).filter(r=>!!r&&typeof r.folder=="string"&&typeof r.org_id=="string"&&Kt(r.org_id)).map(r=>r.project===void 0||Io(r.project)===r.project?r:{...r,project:void 0}).map(r=>r.client===void 0||typeof r.client?.org_id=="string"&&Ao.test(r.client.org_id)?r:{...r,client:void 0})}var Ao=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ar(e,t=J()){let r=null;for(let n of t)Eo(n.folder,e)&&(!r||Qe(n.folder).length>Qe(r.folder).length)&&(r=n);return r}function $o(e,t=Zt(),r=J()){if(t.length===0)return{kind:"none"};let n=Ar(e,r.filter(i=>t.includes(i.org_id)));return n?{kind:"bound",org_id:n.org_id,folder:n.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function $r(e){let t=$o(e);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function Io(e){if(typeof e!="string")return null;let t=e.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function Ir(){let e=[],t=se(et(),"org-mandate.json");Je(t)&&e.push({owner:Er(),file:t});try{for(let r of kr(qe())){let n=se(qe(),r,"org-mandate.json");Kt(r)&&Je(n)&&e.push({owner:r,file:n})}}catch{}return e}function tt(e,t,r=J()){if(!e)return!0;let n=Ar(t,r);return!n||n.org_id===e}var Rr=()=>st(it(),".nodata","rules.json"),nt=()=>st(it(),".nodata","rules-key"),oe={allow:0,ask:1,clean_copy:2,deny:3},Mo=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Yt=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,Ho={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write","browse","interact"],label:"what the agent does (read, search, run, write; on a site: browse, interact)",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=>Oo(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>No(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${Mo.join(", ")} \u2026)`,extract:e=>Yt(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=>Yt(e.who?.type)},org:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"which organisation the agent works for (the one its folder is bound to)",extract:e=>Yt(e.who?.org)}};function Uo(){try{if(Jt(nt())){let t=qt(nt(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=To(32);return Co(st(it(),".nodata"),{recursive:!0}),Po(nt(),e.toString("hex")+`
|
|
38
|
-
`,{mode:384}),e}var
|
|
39
|
-
`,{mode:384})}function dn(e){try{let t=Fr(),r=t[e.id];t[e.id]={...r,...e,at:r&&!r.passed_at?r.at:Date.now()},jr(t)}catch{}}function un(e){try{let t=Fr();return t[e]?.passed_at?(delete t[e],jr(t),!0):!1}catch{return!1}}function fn(){try{if(!Xo(Nr()))return!1;let e=JSON.parse(Or(Nr(),"utf8")).state;return e==="connected"||e==="reconnecting"||e==="restart"}catch{return!1}}var v=(e,t,r)=>e==="he"?t:r,Mr={safe:0,review:1,destructive:2},Hr=(e,t)=>Mr[t]>Mr[e]?t:e;function ea(e){let t=e.replace(/\/\*[\s\S]*?\*\//g," ");return t=t.replace(/--[^\n]*/g," "),t=t.replace(/\$([A-Za-z_]*)\$[\s\S]*?\$\1\$/g," $$body$$ "),t.split(";").map(r=>r.replace(/\s+/g," ").trim()).filter(Boolean)}var W='("?[\\w.]+"?)',k=e=>e.replace(/"/g,"").replace(/^public\./i,"");function ta(e,t,r=!1){let n=[],i=[],s=[],o=[],a=new Set,c=new Set,l=new Set,f=new Map;for(let p of ea(e)){let g=p.toUpperCase(),u;if(u=p.match(new RegExp(`^CREATE (?:UNLOGGED )?TABLE (?:IF NOT EXISTS )?${W}`,"i"))){a.add(k(u[1]).toLowerCase()),s.push(v(t,`\u05D8\u05D1\u05DC\u05D4 \u05D7\u05D3\u05E9\u05D4 ${k(u[1])}`,`new table ${k(u[1])}`));continue}if(u=p.match(new RegExp(`^DROP TABLE (?:IF EXISTS )?${W}`,"i"))){n.push(v(t,`\u05DE\u05D5\u05D7\u05E7 \u05D0\u05EA \u05D4\u05D8\u05D1\u05DC\u05D4 ${k(u[1])} \u05D5\u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05E9\u05D1\u05D4`,`deletes table ${k(u[1])} and every row in it`));continue}if(/^TRUNCATE/i.test(p)){n.push(v(t,"\u05DE\u05E8\u05D5\u05E7\u05DF \u05D8\u05D1\u05DC\u05D4 (TRUNCATE): \u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05E0\u05DE\u05D7\u05E7\u05D5\u05EA","empties a table (TRUNCATE): every row is deleted"));continue}if(u=p.match(new RegExp(`^ALTER TABLE (?:IF EXISTS )?(?:ONLY )?${W} (.*)$`,"i"))){let y=k(u[1]),m=u[2];for(let b of m.matchAll(/DROP COLUMN (?:IF EXISTS )?("?[\w]+"?)/gi))n.push(v(t,`\u05DE\u05D5\u05D7\u05E7 \u05D0\u05EA \u05D4\u05E2\u05DE\u05D5\u05D3\u05D4 ${y}.${k(b[1])} \u05D5\u05D4\u05DE\u05D9\u05D3\u05E2 \u05E9\u05D1\u05D4`,`deletes column ${y}.${k(b[1])} and its data`));for(let b of m.matchAll(/ADD COLUMN (?:IF NOT EXISTS )?("?[\w]+"?)\s+([^,]*)/gi)){let I=/NOT NULL/i.test(b[2])&&!/DEFAULT/i.test(b[2])&&!a.has(y.toLowerCase());(I?i:s).push(I?v(t,`\u05E2\u05DE\u05D5\u05D3\u05D4 \u05D7\u05D3\u05E9\u05D4 ${y}.${k(b[1])} \u05D7\u05D5\u05D1\u05D4 \u05D5\u05D1\u05DC\u05D9 \u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC: \u05D9\u05D9\u05DB\u05E9\u05DC \u05D0\u05DD \u05D9\u05E9 \u05DB\u05D1\u05E8 \u05E9\u05D5\u05E8\u05D5\u05EA`,`new required column ${y}.${k(b[1])} with no default: fails if rows exist`):v(t,`\u05E2\u05DE\u05D5\u05D3\u05D4 \u05D7\u05D3\u05E9\u05D4 ${y}.${k(b[1])}`,`new column ${y}.${k(b[1])}`))}for(let b of m.matchAll(/ALTER COLUMN ("?[\w]+"?) (?:SET DATA )?TYPE/gi))i.push(v(t,`\u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05D4\u05E1\u05D5\u05D2 \u05E9\u05DC ${y}.${k(b[1])}: \u05DE\u05D9\u05D3\u05E2 \u05E7\u05D9\u05D9\u05DD \u05DE\u05D5\u05DE\u05E8`,`changes the type of ${y}.${k(b[1])}: existing data is converted`));for(let b of m.matchAll(/RENAME (?:COLUMN )?("?[\w]+"?) TO ("?[\w]+"?)/gi))i.push(v(t,`\u05DE\u05E9\u05E0\u05D4 \u05E9\u05DD ${y}.${k(b[1])} \u05DC-${k(b[2])}: \u05E7\u05D5\u05D3 \u05E9\u05DE\u05E9\u05EA\u05DE\u05E9 \u05D1\u05E9\u05DD \u05D4\u05D9\u05E9\u05DF \u05D9\u05D9\u05E9\u05D1\u05E8`,`renames ${y}.${k(b[1])} to ${k(b[2])}: code using the old name breaks`));/DISABLE ROW LEVEL SECURITY/i.test(m)&&n.push(v(t,`\u05DE\u05DB\u05D1\u05D4 \u05D0\u05EA \u05D4\u05D4\u05D2\u05E0\u05D4 \u05E2\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA (RLS) \u05D1\u05D8\u05D1\u05DC\u05D4 ${y}: \u05DB\u05DC \u05DE\u05D9 \u05E9\u05DE\u05D7\u05D5\u05D1\u05E8 \u05E8\u05D5\u05D0\u05D4 \u05D4\u05DB\u05DC`,`turns off row security (RLS) on ${y}: anyone connected sees everything`)),/ENABLE ROW LEVEL SECURITY/i.test(m)&&s.push(v(t,`\u05DE\u05D3\u05DC\u05D9\u05E7 \u05D4\u05D2\u05E0\u05D4 \u05E2\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA (RLS) \u05D1\u05D8\u05D1\u05DC\u05D4 ${y}`,`turns on row security (RLS) on ${y}`));let x=y.toLowerCase();/DROP CONSTRAINT/i.test(m)&&f.set(x,{table:y,drop:!0,add:f.get(x)?.add??!1}),/ADD CONSTRAINT/i.test(m)&&f.set(x,{table:y,drop:f.get(x)?.drop??!1,add:!0});continue}if(u=p.match(new RegExp(`^DELETE FROM (?:ONLY )?${W}(.*)$`,"i"))){let y=/\bWHERE\b/i.test(u[2]);(y?i:n).push(y?v(t,`\u05DE\u05D5\u05D7\u05E7 \u05E9\u05D5\u05E8\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4 ${k(u[1])} (\u05DC\u05E4\u05D9 \u05EA\u05E0\u05D0\u05D9)`,`deletes rows from ${k(u[1])} (by a condition)`):v(t,`\u05DE\u05D5\u05D7\u05E7 \u05D0\u05EA \u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05D8\u05D1\u05DC\u05D4 ${k(u[1])}`,`deletes every row in ${k(u[1])}`));continue}if(u=p.match(new RegExp(`^UPDATE (?:ONLY )?${W}(.*)$`,"i"))){let y=/\bWHERE\b/i.test(u[2]);(y?i:n).push(y?v(t,`\u05DE\u05E9\u05E0\u05D4 \u05E9\u05D5\u05E8\u05D5\u05EA \u05E7\u05D9\u05D9\u05DE\u05D5\u05EA \u05D1\u05D8\u05D1\u05DC\u05D4 ${k(u[1])} (\u05DC\u05E4\u05D9 \u05EA\u05E0\u05D0\u05D9)`,`changes existing rows in ${k(u[1])} (by a condition)`):v(t,`\u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05D8\u05D1\u05DC\u05D4 ${k(u[1])}`,`changes every row in ${k(u[1])}`));continue}if(u=p.match(new RegExp(`^INSERT INTO ${W}`,"i"))){o.push(v(t,`\u05DE\u05D5\u05E1\u05D9\u05E3 \u05E9\u05D5\u05E8\u05D5\u05EA \u05DC\u05D8\u05D1\u05DC\u05D4 ${k(u[1])}`,`adds rows to ${k(u[1])}`));continue}if(u=p.match(new RegExp(`^DROP POLICY (?:IF EXISTS )?("[^"]+"|\\S+) ON ${W}`,"i"))){c.add(k(u[2]).toLowerCase());continue}if(u=p.match(new RegExp(`^CREATE POLICY ("[^"]+"|\\S+) ON ${W}`,"i"))){l.add(k(u[2]).toLowerCase()),/\bTO (anon|public)\b/i.test(p)&&/USING \(\s*true\s*\)/i.test(p)&&i.push(v(t,`\u05DB\u05DC\u05DC \u05D2\u05D9\u05E9\u05D4 \u05D1-${k(u[2])} \u05E9\u05E4\u05D5\u05EA\u05D7 \u05D4\u05DB\u05DC \u05DC\u05D0\u05D5\u05E8\u05D7\u05D9\u05DD (anon)`,`an access rule on ${k(u[2])} that opens everything to guests (anon)`));continue}if((u=p.match(/^GRANT (.+) ON (?:TABLE |ALL TABLES IN SCHEMA )?(\S+) TO (.+)$/i))&&/\b(anon|public|authenticated)\b/i.test(u[3])){i.push(v(t,`\u05E0\u05D5\u05EA\u05DF \u05D4\u05E8\u05E9\u05D0\u05D4 (${u[1].trim()}) \u05E2\u05DC ${k(u[2])} \u05DC-${u[3].trim()}`,`grants ${u[1].trim()} on ${k(u[2])} to ${u[3].trim()}`));continue}if(u=p.match(new RegExp(`^DROP (FUNCTION|VIEW|TYPE|TRIGGER|INDEX)(?: IF EXISTS)? ${W}`,"i"))){i.push(v(t,`\u05DE\u05D5\u05D7\u05E7 ${u[1].toLowerCase()} ${k(u[2])}: \u05E7\u05D5\u05D3 \u05E9\u05DE\u05E9\u05EA\u05DE\u05E9 \u05D1\u05D5 \u05D9\u05D9\u05E9\u05D1\u05E8`,`drops ${u[1].toLowerCase()} ${k(u[2])}: code using it breaks`));continue}if(u=p.match(new RegExp(`^CREATE (?:UNIQUE )?INDEX (?:CONCURRENTLY )?(?:IF NOT EXISTS )?\\S+ ON (?:ONLY )?${W}`,"i"))){s.push(v(t,`\u05D0\u05D9\u05E0\u05D3\u05E7\u05E1 \u05E2\u05DC ${k(u[1])}`,`index on ${k(u[1])}`));continue}if(/^CREATE (OR REPLACE )?(FUNCTION|PROCEDURE)/i.test(p)){let y=p.match(/(?:FUNCTION|PROCEDURE) ("?[\w.]+"?)/i)?.[1];(/SECURITY DEFINER/i.test(g)?i:s).push(/SECURITY DEFINER/i.test(g)?v(t,`\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4 ${k(y??"")} \u05E9\u05E8\u05E6\u05D4 \u05D1\u05D4\u05E8\u05E9\u05D0\u05D5\u05EA \u05E9\u05DC \u05D4\u05D1\u05E2\u05DC\u05D9\u05DD (SECURITY DEFINER)`,`function ${k(y??"")} that runs with its owner's rights (SECURITY DEFINER)`):v(t,`\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4 ${k(y??"")}`,`function ${k(y??"")}`));continue}/^CREATE (OR REPLACE )?(VIEW|TRIGGER|TYPE|SCHEMA|EXTENSION)/i.test(p)&&s.push(v(t,p.split(" ").slice(0,4).join(" ").toLowerCase(),p.split(" ").slice(0,4).join(" ").toLowerCase()))}for(let p of c)l.has(p)||i.push(v(t,`\u05DE\u05D5\u05D7\u05E7 \u05DB\u05DC\u05DC \u05D2\u05D9\u05E9\u05D4 \u05D1\u05D8\u05D1\u05DC\u05D4 ${p} \u05D1\u05DC\u05D9 \u05DC\u05D9\u05E6\u05D5\u05E8 \u05D7\u05D3\u05E9`,`drops an access rule on ${p} without creating a new one`));c.size&&[...c].every(p=>l.has(p))&&s.push(v(t,`\u05DE\u05D7\u05DC\u05D9\u05E3 \u05DB\u05DC\u05DC\u05D9 \u05D2\u05D9\u05E9\u05D4 (${[...c].join(", ")})`,`replaces access rules (${[...c].join(", ")})`));for(let{table:p,drop:g,add:u}of f.values())i.push(g&&u?v(t,`\u05DE\u05D7\u05DC\u05D9\u05E3 \u05D0\u05D9\u05DC\u05D5\u05E5 \u05D1\u05D8\u05D1\u05DC\u05D4 ${p}: \u05D9\u05D9\u05DB\u05E9\u05DC \u05D0\u05DD \u05DE\u05D9\u05D3\u05E2 \u05E7\u05D9\u05D9\u05DD \u05DC\u05D0 \u05E2\u05D5\u05DE\u05D3 \u05D1\u05D7\u05D3\u05E9`,`replaces a constraint on ${p}: fails if existing data does not meet the new one`):g?v(t,`\u05DE\u05E1\u05D9\u05E8 \u05D0\u05D9\u05DC\u05D5\u05E5 \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4 ${p}: \u05DE\u05D9\u05D3\u05E2 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D9\u05D5\u05DB\u05DC \u05DC\u05D4\u05D9\u05DB\u05E0\u05E1`,`removes a constraint from ${p}: invalid data can get in`):v(t,`\u05DE\u05D5\u05E1\u05D9\u05E3 \u05D0\u05D9\u05DC\u05D5\u05E5 \u05DC\u05D8\u05D1\u05DC\u05D4 ${p}: \u05D9\u05D9\u05DB\u05E9\u05DC \u05D0\u05DD \u05DE\u05D9\u05D3\u05E2 \u05E7\u05D9\u05D9\u05DD \u05DC\u05D0 \u05E2\u05D5\u05DE\u05D3 \u05D1\u05D5`,`adds a constraint to ${p}: fails if existing data does not meet it`));r&&i.unshift(v(t,"\u05DE\u05E9\u05E0\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05D9\u05D2\u05E8\u05E6\u05D9\u05D4 \u05E7\u05D9\u05D9\u05DD: \u05D0\u05DD \u05D4\u05D5\u05D0 \u05DB\u05D1\u05E8 \u05D4\u05D5\u05E8\u05E5 \u05D1\u05E4\u05E8\u05D5\u05D3\u05E7\u05E9\u05DF, \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9 \u05DC\u05D0 \u05D9\u05E8\u05D5\u05E5 \u05E9\u05D5\u05D1","edits an existing migration file: if it already ran in production, the change will not run again")),/--\s*Rollback/i.test(e)||i.push(v(t,"\u05D0\u05D9\u05DF \u05D4\u05E2\u05E8\u05EA Rollback (\u05D0\u05D9\u05DA \u05D7\u05D5\u05D6\u05E8\u05D9\u05DD \u05D0\u05D7\u05D5\u05E8\u05D4)","no Rollback note (how to undo it)"));let d="safe";i.length&&(d=Hr(d,"review")),n.length&&(d=Hr(d,"destructive"));let h=[...new Set([...n,...i,...o,...s])];return{risk:d,lines:h.length?h:[v(t,"\u05DC\u05D0 \u05D6\u05D5\u05D4\u05D5 \u05E4\u05E7\u05D5\u05D3\u05D5\u05EA \u05DE\u05D5\u05DB\u05E8\u05D5\u05EA \u05D1\u05E7\u05D5\u05D1\u05E5","no known statements found in the file")]}}function na(e,t){let r=[],n="review",i=[...new Set([...e.matchAll(/secrets\.([A-Z0-9_]+)/g)].map(o=>o[1]).filter(o=>o!=="GITHUB_TOKEN"))];/\bpull_request_target\b/.test(e)&&(n="destructive",r.push(v(t,"\u05E8\u05E5 \u05E2\u05DC pull_request_target: \u05E7\u05D5\u05D3 \u05DE-PR \u05D6\u05E8 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E8\u05D5\u05E5 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA","runs on pull_request_target: code from an outside PR can run with the secrets"))),i.length&&r.push(v(t,`\u05DE\u05E9\u05EA\u05DE\u05E9 \u05D1\u05E1\u05D5\u05D3\u05D5\u05EA: ${i.join(", ")}`,`uses secrets: ${i.join(", ")}`)),/permissions:\s*write-all|contents:\s*write/.test(e)&&r.push(v(t,"\u05DE\u05E7\u05D1\u05DC \u05D4\u05E8\u05E9\u05D0\u05EA \u05DB\u05EA\u05D9\u05D1\u05D4 \u05DC\u05E8\u05D9\u05E4\u05D5","gets write access to the repository"));let s=[...e.matchAll(/uses:\s*([^\s@#]+)@([^\s#]+)/g)].filter(o=>!/^[0-9a-f]{40}$/.test(o[2])&&!o[1].startsWith("./"));return s.length&&r.push(v(t,`${s.length} \u05E8\u05DB\u05D9\u05D1\u05D9\u05DD \u05D7\u05D9\u05E6\u05D5\u05E0\u05D9\u05D9\u05DD \u05DC\u05D0 \u05E0\u05E2\u05D5\u05DC\u05D9\u05DD \u05DC\u05D2\u05E8\u05E1\u05D4 \u05DE\u05D3\u05D5\u05D9\u05E7\u05EA`,`${s.length} outside actions not pinned to an exact version`)),r.length||r.push(v(t,"\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D1-CI \u05D1\u05DC\u05D9 \u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05D1\u05DC\u05D9 \u05D4\u05E8\u05E9\u05D0\u05D5\u05EA \u05DB\u05EA\u05D9\u05D1\u05D4","a CI change with no secrets and no write access")),{risk:n,lines:r}}function Ur(e,t,r,n){let i=e.replace(/\\/g,"/"),s=typeof t.content=="string"?t.content:typeof t.new_string=="string"?t.new_string:Array.isArray(t.edits)?t.edits.map(c=>typeof c?.new_string=="string"?c.new_string:"").join(`
|
|
40
|
-
`):null;if(s===null)return null;if(/\/migrations\/[^/]+\.sql$/i.test(i))return
|
|
32
|
+
`)}function $s(e,t,r){let n=new RegExp(`<${t}\\b[^>]*\\b${r}="([^"]*)"`,"g"),i=[],s;for(;(s=n.exec(e))!==null;)s[1]&&i.push(Z(s[1]));return i}function Is(e,t){let r=[];if(Ve.has(e)){for(let n of t)(n==="content.xml"||n==="styles.xml"||n==="meta.xml")&&r.push(n);return r}e=xs(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 Rs(e,t){let r=fe(e);if(!r||r.length===0)return null;let n=new Map(r.map(l=>[l.name,l])),i=Is(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>=ue){c=!0;break}let p=n.get(l);if(!p)continue;let d=Ss(e,p);if(d===null)continue;let m=As(d);if(l==="xl/workbook.xml"){let f=$s(d,"sheet","name");f.length&&(m+=`
|
|
33
|
+
`+f.join(`
|
|
34
|
+
`))}a+m.length>ue&&(m=m.slice(0,Math.max(0,ue-a)),c=!0),m.trim().length!==0&&(s.push(m),o.push(l),a+=m.length)}return s.length===0?null:{text:s.join(`
|
|
35
|
+
`),truncated:c,parts:o}}function sr(e,t,r={}){if(Ee(e)){let n=Nt(e,ue);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(Ge(e)){let n=Ot(e.toString("latin1"));if(!n.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=n.length>ue;return{ok:!0,result:{text:i?n.slice(0,ue):n,truncated:i,parts:["rtf"]}}}if(Dt.has(t)||Ve.has(t)){let n=Rs(e,t);return n?{ok:!0,result:n}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Oe.has(t)){let n=Be(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:Zn(e)}}return Ft.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}function jt(e,t,r={}){let n=sr(e,t,r);return n.ok?n.result:null}var Mt=new Set([...Dt,...Ve,...Ft,...ir,...Oe]);var $l=5*6e4,Il=2*6e4;import{deflateRawSync as Os}from"node:zlib";var or={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},Ts=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,Cs=[...Et].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function ne(e,t,r=1){e[t]=(e[t]??0)+r}var ar=null,re=e=>{let t=e.trim();ar&&t&&ar.add(t)};function U(e,t={},r){let n=e;for(let s of ve()){let o=new RegExp(s.pattern.source,s.pattern.flags.includes("g")?s.pattern.flags:s.pattern.flags+"g");n=n.replace(o,a=>(ne(t,"secret"),re(a),"[SECRET]"))}for(let s of Cs)s.pattern.lastIndex=0,n=n.replace(s.pattern,o=>s.validate(o)?(ne(t,s.subkind),re(o),or[s.subkind]??`[${s.subkind.toUpperCase()}]`):o);n=n.replace(Ts,s=>(ne(t,"email"),re(s),or.email));let i=r??new Set;for(let s of Pe()){let o=s.find(n).sort((a,c)=>c.start-a.start);for(let a of o){let c=n.slice(a.start,a.end);re(c),s.kind==="name"&&i.add(c.trim()),n=n.slice(0,a.start)+`[${s.kind.toUpperCase()}]`+n.slice(a.end),ne(t,s.kind)}}return i.size&&(n=Ls(n,i,t)),{text:n,counts:t,columnsHidden:[]}}var Ps=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Ls(e,t,r){let n=new Set;for(let s of t){n.add(s);let o=s.split(/\s+/)[0]??"";o.length>=3&&o!==s&&n.add(o)}let i=e;for(let s of[...n].sort((o,a)=>a.length-o.length)){let o=new RegExp(`(?<![\\p{L}\\p{N}@.\\[-])${Ps(s)}(?![\\p{L}\\p{N}@\\]-])`,"gu");i=i.replace(o,a=>(ne(r,"name"),re(a),"[NAME]"))}return i}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()}]`),ne(r,s),re(i));return n}function Ht(){let e=new Map,t={};return(r,n)=>{re(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 Xe(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var lr=/^\s*-?\d+(?:\.\d+)?\s*$/;function Ut(e){let t=new Set;for(let[r,n]of e){let i=n.filter(o=>lr.test(o));if(i.length<3)continue;i.filter(o=>U(o).text!==o).length/i.length<.5&&t.add(r)}return t}function cr(e,t){return e.includes(t)||e.includes('"')||e.includes(`
|
|
36
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function Ns(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 Bt(e,t){let r=e.split(/\r?\n/),n=t??Ns(r[0]??""),i=Ne(r[0]??"",n),s=i.map(f=>Se(f)),o={},a=Ht(),c=r.slice(1).map(f=>f===""?null:Ne(f,n)),l=new Map;for(let f of c)f?.forEach((g,u)=>l.set(u,[...l.get(u)??[],g]));let p=Ut(l),d=ke();if(d){let f=c.filter(g=>g!==null).slice(0,200);for(let g of d({name:"table",headers:i,rows:f})){let u=i.indexOf(g.column);u>=0&&!(g.how==="header"&&p.has(u))&&(s[u]={type:g.type,label:g.category})}}let m=[i.map(f=>cr(f,n)).join(n)];for(let f of c){if(f===null){m.push("");continue}let g=f.map((u,y)=>{let h=s[y];return h&&u.trim()!==""&&!Xe(u)?(ne(o,`column:${h.type}`),a(h.type,u)):p.has(y)&&lr.test(u)?u:U(u,o).text});m.push(g.map(u=>cr(u,n)).join(n))}return{text:m.join(`
|
|
37
|
+
`),counts:o,columnsHidden:i.filter((f,g)=>s[g])}}var Ds=/^xl\/(pivotCache|charts|externalLinks)\//,fr=10;function dr(e,t,r=1){e[t]=(e[t]??0)+r}function pr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function hr(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 Z(r)}function Fs(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>hr(t[1]??"")):[]}var mr=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Ke(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function me(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?hr(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?Z(r[1]):null}function js(e){let t=[];for(let r of e.matchAll(mr)){let n=Ke(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:Ke(r[1],"t")??"n"})}return t}function Ms(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,fr);for(let n of r){let i=new Map;for(let s of e.filter(o=>o.row===n)){let o=me(s,t),a=o?Se(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 Hs=/^xl\/worksheets\/sheet\d+\.xml$/,Us=200;function Bs(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function zs(e,t){let r=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,fr),n=-1,i=-1/0;for(let s of r){let o=e.filter(l=>l.row===s).map(l=>(me(l,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(l=>!Bs(l)).length,c=a*2-(o.length-a);c>i&&(i=c,n=s)}return n}function Ws(e,t,r){let n=Ms(t,r),i=ke();if(!i)return n;let s=n.row>=0?n.row:zs(t,r);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(me(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,m)=>[d.col,m])),c=new Map;for(let d of t){if(d.row<=s)continue;let m=a.get(d.col);if(m!==void 0){if(!c.has(d.row)){if(c.size>=Us)continue;c.set(d.row,o.map(()=>""))}c.get(d.row)[m]=me(d,r)??""}}let l=new Map(s===n.row?n.cols:[]),p=o.map(d=>d.text);for(let d of i({name:e,headers:p,rows:[...c.values()]})){let m=p.indexOf(d.column);m<0||l.set(o[m].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:l}}function zt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${pr(t)}</t></is></c>`}var Gs=(()=>{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 Vs(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=Gs[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var ur=33;function Wt(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):Os(o.data),p=c?0:8,d=c?0:Vs(o.data),m=Buffer.alloc(30);m.writeUInt32LE(67324752,0),m.writeUInt16LE(20,4),m.writeUInt16LE(2048,6),m.writeUInt16LE(p,8),m.writeUInt16LE(ur,12),m.writeUInt32LE(d,14),m.writeUInt32LE(l.length,18),m.writeUInt32LE(o.data.length,22),m.writeUInt16LE(a.length,26),t.push(m,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(p,10),f.writeUInt16LE(ur,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+=m.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 Gt(e,t){let r=fe(e);if(!r||r.length===0||r.some(h=>Ds.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 x=pe(e,h);if(!x)return null;n.set(h.name,x)}let i=[...n.keys()].filter(h=>Hs.test(h));if(i.length===0)return null;let s=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,o=Fs(s),a=new Set,c={},l=new Set,p=Ht(),d=kt();for(let h of i){let x=n.get(h).toString("utf8"),b=js(x);if(!b)return null;let R=Ws(h.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),b,o),S=R.row,j=new Map;for(let N of b){if(N.type!=="n"||N.row<=S)continue;let L=me(N,o);L!==null&&j.set(N.col,[...j.get(N.col)??[],L])}let z=Ut(j),P=new Map;for(let[N,{type:L,header:M,how:H}]of R.cols)H==="header"&&z.has(N)||(P.set(N,L),l.add(M));let G=x.replace(mr,(N,L,M)=>{let H=Ke(L,"r"),[,K,_]=/^([A-Z]+)(\d+)$/.exec(H),w={full:N,attrs:L,inner:M??"",col:K,row:Number(_),type:Ke(L,"t")??"n"},A=me(w,o),T=()=>{if(w.type==="s"){let Rn=/<v>([^<]*)<\/v>/.exec(w.inner);Rn&&a.add(Number(Rn[1]))}return N};if(A===null||A.trim()==="")return T();if(d&&w.type==="n"&&z.has(K)&&w.row>S)return dr(c,"amount"),zt(L,"[AMOUNT]");let E=P.get(K);if(E&&w.row>S&&!Xe(A))return dr(c,`column:${E}`),zt(L,p(E,A));if(w.type==="n"&&z.has(K))return T();let ee=U(A,c),we=t?.size?he(ee.text,t,c):ee.text;return we===A?T():zt(L,we)});n.set(h,Buffer.from(G,"utf8"))}if(s){let h=-1,x=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,b=>(h+=1,a.has(h)?b:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(x,"utf8"))}for(let h of[...n.keys()].filter(x=>/^xl\/comments\d*\.xml$/.test(x))){let b=n.get(h).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(R,S,j,z)=>{let P=U(Z(j),c);return`${S}${pr(t?.size?he(P.text,t,c):P.text)}${z}`});n.set(h,Buffer.from(b,"utf8"))}let m=n.get("docProps/core.xml");if(m){let h=m.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 g=n.get("docProps/app.xml");if(g){let h=g.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 u=n.has("xl/calcChain.xml"),y=r.map(h=>h.name).filter(h=>!(u&&h==="xl/calcChain.xml"));if(u)for(let h of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let x=n.get(h);x&&n.set(h,Buffer.from(x.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:Wt(y.map(h=>({name:h,data:n.get(h)}))),counts:c,columnsHidden:[...l]}}var ge=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,Xs=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,Ks=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Vt(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||!Xs.test(n[1])||Ks.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var gd=64*1024*1024,yd=4*1024*1024;var bd=512*1024*1024,_d=1024*1024*1024;var xd=256*1024*1024;var wd=new yr("utf-8",{fatal:!0}),kd=new yr("windows-1255");var vd=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 Od=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var oo=["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."],$=(e,t,r)=>({provider:e,url:t,steps:[...r,...oo]}),ao={"aws-access-key":$("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":$("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":$("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":$("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":$("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":$("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":$("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":$("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":$("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":$("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":$("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":$("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":$("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":$("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":$("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":$("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":$("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":$("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":$("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":$("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":$("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":$("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":$("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":$("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":$("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":$("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":$("An access token","",["Revoke the token in the service that issued it and issue a new one."])},co=$("A credential","",["Find the service it belongs to and issue a new credential there."]);function Xt(e){return ao[e]??co}function wr(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||lo(e)}function lo(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as uo,mkdirSync as Uu,readFileSync as fo,statSync as Kt,writeFileSync as Bu}from"node:fs";import{homedir as po}from"node:os";import{join as ho}from"node:path";var mo=()=>ho(po(),".nodata","flagged.json");var kr="unread";function vr(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var Ie=null;function Sr(){let e=mo();try{if(!uo(e))return{};let t=Kt(e).mtimeMs;if(Ie&&Ie.path===e&&Ie.mtimeMs===t)return Ie.store;let r=JSON.parse(fo(e,"utf8"));return Ie={path:e,mtimeMs:t,store:r},r}catch{return{}}}function Ze(e){let t=Sr()[vr(e)];if(!t)return null;try{if(Kt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==kr));return Object.keys(r).length?r:null}function Ye(e){let t=Sr()[vr(e)];if(!t||!t.kinds[kr])return null;try{return{changed:Kt(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as Er,mkdirSync as Xu,readFileSync as Ar,writeFileSync as Ku}from"node:fs";import{homedir as go}from"node:os";import{join as yo}from"node:path";var Je=()=>yo(go(),".nodata","prefs.json");function bo(){try{let e=Er(Je())?JSON.parse(Ar(Je(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function _o(){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 Y(){return bo()??_o()}function $r(){try{return Er(Je())&&JSON.parse(Ar(Je(),"utf8")).amounts_sensitive===!0}catch{return!1}}function I(e,t,r=Y()){return r==="he"?e:t}import{createHmac as No,randomBytes as Oo}from"node:crypto";import{existsSync as qt,mkdirSync as Do,readdirSync as Fo,readFileSync as Qt,writeFileSync as jo}from"node:fs";import{homedir as st}from"node:os";import{basename as Mo,extname as Ho,isAbsolute as Uo,join as ot,relative as Bo,resolve as zo}from"node:path";function ie(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function xo(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function Ir(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=ie(e),i=ie(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=ie(e),i=ie(r);return n!==null&&i!==null&&n<=i}case"between":{let n=ie(e);return n!==null&&Array.isArray(r)&&r.length===2&&xo(n,ie(r[0]),ie(r[1]))}default:return!1}}function Rr(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}}import{existsSync as qe,mkdirSync as ef,readdirSync as Tr,readFileSync as wo,rmSync as tf,writeFileSync as nf,chmodSync as rf}from"node:fs";import{homedir as Cr}from"node:os";import{basename as af,isAbsolute as ko,join as se,relative as vo,resolve as So}from"node:path";var tt=()=>se(Cr(),".nodata"),Eo=()=>se(tt(),"credentials.json"),Qe=()=>se(tt(),"orgs"),Ao=()=>se(tt(),"bindings.json"),$o=/^[A-Za-z0-9_.-]{1,80}$/,Zt=e=>$o.test(e)&&e!=="."&&e!=="..";function Pr(e){try{return qe(e)?JSON.parse(wo(e,"utf8")):null}catch{return null}}function Io(e){return e?e.device?.org_id?e.device.org_id:e.api_key?`key-${(e.key_prefix??e.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function Lr(){return Io(Pr(Eo()))}function Yt(){let e=[],t=Lr();t&&e.push(t);try{for(let r of Tr(Qe()))Zt(r)&&!e.includes(r)&&qe(se(Qe(),r,"credentials.json"))&&e.push(r)}catch{}return e}var Ro=e=>process.platform==="win32"||process.platform==="darwin"?e.toLowerCase():e,et=e=>Ro(So(e.replace(/^~(?=[\\/]|$)/,Cr())));function To(e,t){let r=vo(et(e),et(t));return r===""||!r.startsWith("..")&&!ko(r)}function J(){let e=Pr(Ao());return(Array.isArray(e?.bindings)?e.bindings:[]).filter(r=>!!r&&typeof r.folder=="string"&&typeof r.org_id=="string"&&Zt(r.org_id)).map(r=>r.project===void 0||Lo(r.project)===r.project?r:{...r,project:void 0}).map(r=>r.client===void 0||typeof r.client?.org_id=="string"&&Co.test(r.client.org_id)?r:{...r,client:void 0})}var Co=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Nr(e,t=J()){let r=null;for(let n of t)To(n.folder,e)&&(!r||et(n.folder).length>et(r.folder).length)&&(r=n);return r}function Po(e,t=Yt(),r=J()){if(t.length===0)return{kind:"none"};let n=Nr(e,r.filter(i=>t.includes(i.org_id)));return n?{kind:"bound",org_id:n.org_id,folder:n.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function Or(e){let t=Po(e);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function Lo(e){if(typeof e!="string")return null;let t=e.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function Dr(){let e=[],t=se(tt(),"org-mandate.json");qe(t)&&e.push({owner:Lr(),file:t});try{for(let r of Tr(Qe())){let n=se(Qe(),r,"org-mandate.json");Zt(r)&&qe(n)&&e.push({owner:r,file:n})}}catch{}return e}function nt(e,t,r=J()){if(!e)return!0;let n=Nr(t,r);return!n||n.org_id===e}var Fr=()=>ot(st(),".nodata","rules.json"),rt=()=>ot(st(),".nodata","rules-key"),oe={allow:0,ask:1,clean_copy:2,deny:3},Wo=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Jt=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,Go={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write","browse","interact"],label:"what the agent does (read, search, run, write; on a site: browse, interact)",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=>Ho(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Mo(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${Wo.join(", ")} \u2026)`,extract:e=>Jt(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=>Jt(e.who?.type)},org:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"which organisation the agent works for (the one its folder is bound to)",extract:e=>Jt(e.who?.org)}};function Vo(){try{if(qt(rt())){let t=Qt(rt(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=Oo(32);return Do(ot(st(),".nodata"),{recursive:!0}),jo(rt(),e.toString("hex")+`
|
|
38
|
+
`,{mode:384}),e}var Xo=(e,t)=>No("sha256",t).update(JSON.stringify(e)).digest("hex");function en(){if(!qt(Fr()))return{rules:[],tampered:!1};try{let e=JSON.parse(Qt(Fr(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=qt(rt())&&typeof e.mac=="string"&&e.mac===Xo(t,Vo());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var Re=e=>{let t=zo(e.replace(/^~(?=[\\/]|$)/,st())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function ae(e,t){if(jr(e)||jr(t))return!1;if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),i=Re(t).toLowerCase();return i.endsWith("/"+n)||i.includes("/"+n+"/")}let r=Bo(Re(e),Re(t));return r===""||!r.startsWith("..")&&!Uo(r)}var Ko="site:",jr=e=>e.startsWith(Ko);function tn(e){try{let t=new URL(e.trim());return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname.toLowerCase().replace(/\.$/,"")||null}catch{return null}}function nn(e,t){return e==="*"?!0:t===e||t.endsWith("."+e)}function it(e,t,r){let n=Go[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"?Rr(Array.isArray(i)?i:[],e.op,e.value):Ir(i,e.op,e.value)}function at(e,t){let r=e.map((n,i)=>({rule:n,n:i+1})).filter(n=>ae(n.rule.path,t.path)).sort((n,i)=>Re(i.rule.path).length-Re(n.rule.path).length||n.n-i.n);for(let n of r)if((n.rule.when??[]).every(i=>it(i,t,n.rule.effect)))return{...n,touched:t.path};return null}function ct(e,t,r,n,i){let s=null;for(let[o,a]of e.entries())ae(a.path,t)||(a.path.startsWith("**/")?!Zo(t,a.path):!ae(t,a.path))||(a.when??[]).every(c=>it(c,{action:r,path:a.path,now:n,who:i},a.effect))&&(!s||oe[a.effect]>oe[s.rule.effect])&&(s={rule:a,n:o+1,touched:a.path});return s}function rn(e,t){let r=s=>s==="*"?0:s.length,n=t.site,i=e.map((s,o)=>({rule:s,n:o+1})).filter(s=>s.rule.site&&(n===void 0||nn(s.rule.site,n))).sort((s,o)=>r(o.rule.site)-r(s.rule.site)||s.n-o.n);if(n===void 0){let s=null;for(let o of i)o.rule.effect==="allow"||!(o.rule.when??[]).every(a=>it(a,t,o.rule.effect))||(!s||oe[o.rule.effect]>oe[s.rule.effect])&&(s=o);return s?{...s,touched:""}:null}for(let s of i)if((s.rule.when??[]).every(o=>it(o,t,s.rule.effect)))return{...s,touched:n};return null}function Zo(e,t){let r=0,n=(i,s)=>{if(s>5||r>4e3)return!1;let o;try{o=Fo(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=ot(i,a.name);if(ae(t,c)||n(c,s+1))return!0}return!1};return n(e,0)}var Yo={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"]};function Mr(e,t=!1){return e.site?e.site==="*"?t?"\u05DB\u05DC \u05D0\u05EA\u05E8":"every site":`${t?"\u05D0\u05EA\u05E8":"site"} ${e.site}`:e.path}var Hr=(e,t=!1)=>Yo[e][t?1:0];function sn(){let e=[];for(let{owner:t,file:r}of Dr())try{let n=JSON.parse(Qt(r,"utf8"));Array.isArray(n?.folder_rules)&&n.folder_rules.length&&e.push({owner:t,rules:n.folder_rules})}catch{}return e}function Ur(){let e=Yt();return e.length<2?[]:J().filter(t=>e.includes(t.org_id)).map(t=>({path:t.folder,effect:"deny",when:[{field:"org",op:"ne",value:t.org_id.toLowerCase()}],note:`works for organisation ${t.org_id}; another organisation's agent does not touch it`}))}import{closeSync as Jo,mkdirSync as qo,openSync as Qo,readdirSync as ea,readFileSync as ta,rmSync as na,statSync as ra,writeSync as ia}from"node:fs";import{createHash as sa}from"node:crypto";import{homedir as oa}from"node:os";import{join as on}from"node:path";var aa=()=>on(oa(),".nodata","gate-calls"),ca=5e3,la=600*1e3;function da(e){try{let t=Date.now();for(let r of ea(e)){let n=on(e,r);t-ra(n).mtimeMs>la&&na(n,{force:!0})}}catch{}}async function an(e,t,r){if(!e)return{value:r(),first:!0};let n=aa(),i=on(n,sa("sha256").update(`${t}\0${e}`).digest("hex").slice(0,32)+".json"),s;try{qo(n,{recursive:!0,mode:448}),s=Qo(i,"wx",384)}catch{let a=Date.now()+ca;for(;Date.now()<a;){try{let c=ta(i,"utf8");if(c)return{value:JSON.parse(c),first:!1}}catch{}await new Promise(c=>setTimeout(c,40))}return{value:r(),first:!0}}let o=r();try{ia(s,JSON.stringify(o??null))}finally{Jo(s)}return Math.random()<.05&&da(n),{value:o,first:!0}}import{createHash as ua}from"node:crypto";import{existsSync as fa,mkdirSync as pa,readFileSync as zr,writeFileSync as ha}from"node:fs";import{homedir as ln}from"node:os";import{join as dn}from"node:path";var Wr=()=>dn(ln(),".nodata","checkpoints.json"),Br=()=>dn(ln(),".nodata","connection.json"),ma=900*1e3,ga=300*1e3,ya=100;function cn(e){return Array.isArray(e)?e.map(cn):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,cn(e[t])])):e}function un(e,t,r,n){return ua("sha256").update(JSON.stringify([e,t,r,cn(n)])).digest("hex").slice(0,12)}var ba=/^(element|selector|ref|uid|target|name|label|button|key|role|title|description|link|url|href|uri|startUrl|start_url|page_url)$/i;function fn(e){let t=[];for(let[r,n]of Object.entries(e)){if(!ba.test(r)||typeof n!="string"&&typeof n!="number")continue;let i=String(n);if(/^https?:\/\//i.test(i))try{let s=new URL(i);i=`${s.origin}${s.pathname}`}catch{continue}if(t.push(`${r}: ${i.replace(/[\r\n]+/g," ").slice(0,120)}`),t.length>=4)break}return t.join(" \xB7 ").slice(0,300)}function Gr(){try{let e=JSON.parse(zr(Wr(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{})){if(!i||typeof i.at!="number")continue;(i.passed_at?t-i.passed_at<ga:t-i.at<ma)&&(r[n]=i)}return r}catch{return{}}}function Vr(e){let t=Object.entries(e).sort((r,n)=>n[1].at-r[1].at).slice(0,ya);pa(dn(ln(),".nodata"),{recursive:!0}),ha(Wr(),JSON.stringify(Object.fromEntries(t))+`
|
|
39
|
+
`,{mode:384})}function pn(e){try{let t=Gr(),r=t[e.id];t[e.id]={...r,...e,at:r&&!r.passed_at?r.at:Date.now()},Vr(t)}catch{}}function hn(e){try{let t=Gr();return t[e]?.passed_at?(delete t[e],Vr(t),!0):!1}catch{return!1}}function mn(){try{if(!fa(Br()))return!1;let e=JSON.parse(zr(Br(),"utf8")).state;return e==="connected"||e==="reconnecting"||e==="restart"}catch{return!1}}var v=(e,t,r)=>e==="he"?t:r,Xr={safe:0,review:1,destructive:2},Kr=(e,t)=>Xr[t]>Xr[e]?t:e;function _a(e){let t=e.replace(/\/\*[\s\S]*?\*\//g," ");return t=t.replace(/--[^\n]*/g," "),t=t.replace(/\$([A-Za-z_]*)\$[\s\S]*?\$\1\$/g," $$body$$ "),t.split(";").map(r=>r.replace(/\s+/g," ").trim()).filter(Boolean)}var W='("?[\\w.]+"?)',k=e=>e.replace(/"/g,"").replace(/^public\./i,"");function xa(e,t,r=!1){let n=[],i=[],s=[],o=[],a=new Set,c=new Set,l=new Set,p=new Map;for(let f of _a(e)){let g=f.toUpperCase(),u;if(u=f.match(new RegExp(`^CREATE (?:UNLOGGED )?TABLE (?:IF NOT EXISTS )?${W}`,"i"))){a.add(k(u[1]).toLowerCase()),s.push(v(t,`\u05D8\u05D1\u05DC\u05D4 \u05D7\u05D3\u05E9\u05D4 ${k(u[1])}`,`new table ${k(u[1])}`));continue}if(u=f.match(new RegExp(`^DROP TABLE (?:IF EXISTS )?${W}`,"i"))){n.push(v(t,`\u05DE\u05D5\u05D7\u05E7 \u05D0\u05EA \u05D4\u05D8\u05D1\u05DC\u05D4 ${k(u[1])} \u05D5\u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05E9\u05D1\u05D4`,`deletes table ${k(u[1])} and every row in it`));continue}if(/^TRUNCATE/i.test(f)){n.push(v(t,"\u05DE\u05E8\u05D5\u05E7\u05DF \u05D8\u05D1\u05DC\u05D4 (TRUNCATE): \u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05E0\u05DE\u05D7\u05E7\u05D5\u05EA","empties a table (TRUNCATE): every row is deleted"));continue}if(u=f.match(new RegExp(`^ALTER TABLE (?:IF EXISTS )?(?:ONLY )?${W} (.*)$`,"i"))){let y=k(u[1]),h=u[2];for(let b of h.matchAll(/DROP COLUMN (?:IF EXISTS )?("?[\w]+"?)/gi))n.push(v(t,`\u05DE\u05D5\u05D7\u05E7 \u05D0\u05EA \u05D4\u05E2\u05DE\u05D5\u05D3\u05D4 ${y}.${k(b[1])} \u05D5\u05D4\u05DE\u05D9\u05D3\u05E2 \u05E9\u05D1\u05D4`,`deletes column ${y}.${k(b[1])} and its data`));for(let b of h.matchAll(/ADD COLUMN (?:IF NOT EXISTS )?("?[\w]+"?)\s+([^,]*)/gi)){let R=/NOT NULL/i.test(b[2])&&!/DEFAULT/i.test(b[2])&&!a.has(y.toLowerCase());(R?i:s).push(R?v(t,`\u05E2\u05DE\u05D5\u05D3\u05D4 \u05D7\u05D3\u05E9\u05D4 ${y}.${k(b[1])} \u05D7\u05D5\u05D1\u05D4 \u05D5\u05D1\u05DC\u05D9 \u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC: \u05D9\u05D9\u05DB\u05E9\u05DC \u05D0\u05DD \u05D9\u05E9 \u05DB\u05D1\u05E8 \u05E9\u05D5\u05E8\u05D5\u05EA`,`new required column ${y}.${k(b[1])} with no default: fails if rows exist`):v(t,`\u05E2\u05DE\u05D5\u05D3\u05D4 \u05D7\u05D3\u05E9\u05D4 ${y}.${k(b[1])}`,`new column ${y}.${k(b[1])}`))}for(let b of h.matchAll(/ALTER COLUMN ("?[\w]+"?) (?:SET DATA )?TYPE/gi))i.push(v(t,`\u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05D4\u05E1\u05D5\u05D2 \u05E9\u05DC ${y}.${k(b[1])}: \u05DE\u05D9\u05D3\u05E2 \u05E7\u05D9\u05D9\u05DD \u05DE\u05D5\u05DE\u05E8`,`changes the type of ${y}.${k(b[1])}: existing data is converted`));for(let b of h.matchAll(/RENAME (?:COLUMN )?("?[\w]+"?) TO ("?[\w]+"?)/gi))i.push(v(t,`\u05DE\u05E9\u05E0\u05D4 \u05E9\u05DD ${y}.${k(b[1])} \u05DC-${k(b[2])}: \u05E7\u05D5\u05D3 \u05E9\u05DE\u05E9\u05EA\u05DE\u05E9 \u05D1\u05E9\u05DD \u05D4\u05D9\u05E9\u05DF \u05D9\u05D9\u05E9\u05D1\u05E8`,`renames ${y}.${k(b[1])} to ${k(b[2])}: code using the old name breaks`));/DISABLE ROW LEVEL SECURITY/i.test(h)&&n.push(v(t,`\u05DE\u05DB\u05D1\u05D4 \u05D0\u05EA \u05D4\u05D4\u05D2\u05E0\u05D4 \u05E2\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA (RLS) \u05D1\u05D8\u05D1\u05DC\u05D4 ${y}: \u05DB\u05DC \u05DE\u05D9 \u05E9\u05DE\u05D7\u05D5\u05D1\u05E8 \u05E8\u05D5\u05D0\u05D4 \u05D4\u05DB\u05DC`,`turns off row security (RLS) on ${y}: anyone connected sees everything`)),/ENABLE ROW LEVEL SECURITY/i.test(h)&&s.push(v(t,`\u05DE\u05D3\u05DC\u05D9\u05E7 \u05D4\u05D2\u05E0\u05D4 \u05E2\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA (RLS) \u05D1\u05D8\u05D1\u05DC\u05D4 ${y}`,`turns on row security (RLS) on ${y}`));let x=y.toLowerCase();/DROP CONSTRAINT/i.test(h)&&p.set(x,{table:y,drop:!0,add:p.get(x)?.add??!1}),/ADD CONSTRAINT/i.test(h)&&p.set(x,{table:y,drop:p.get(x)?.drop??!1,add:!0});continue}if(u=f.match(new RegExp(`^DELETE FROM (?:ONLY )?${W}(.*)$`,"i"))){let y=/\bWHERE\b/i.test(u[2]);(y?i:n).push(y?v(t,`\u05DE\u05D5\u05D7\u05E7 \u05E9\u05D5\u05E8\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4 ${k(u[1])} (\u05DC\u05E4\u05D9 \u05EA\u05E0\u05D0\u05D9)`,`deletes rows from ${k(u[1])} (by a condition)`):v(t,`\u05DE\u05D5\u05D7\u05E7 \u05D0\u05EA \u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05D8\u05D1\u05DC\u05D4 ${k(u[1])}`,`deletes every row in ${k(u[1])}`));continue}if(u=f.match(new RegExp(`^UPDATE (?:ONLY )?${W}(.*)$`,"i"))){let y=/\bWHERE\b/i.test(u[2]);(y?i:n).push(y?v(t,`\u05DE\u05E9\u05E0\u05D4 \u05E9\u05D5\u05E8\u05D5\u05EA \u05E7\u05D9\u05D9\u05DE\u05D5\u05EA \u05D1\u05D8\u05D1\u05DC\u05D4 ${k(u[1])} (\u05DC\u05E4\u05D9 \u05EA\u05E0\u05D0\u05D9)`,`changes existing rows in ${k(u[1])} (by a condition)`):v(t,`\u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DB\u05DC \u05D4\u05E9\u05D5\u05E8\u05D5\u05EA \u05D1\u05D8\u05D1\u05DC\u05D4 ${k(u[1])}`,`changes every row in ${k(u[1])}`));continue}if(u=f.match(new RegExp(`^INSERT INTO ${W}`,"i"))){o.push(v(t,`\u05DE\u05D5\u05E1\u05D9\u05E3 \u05E9\u05D5\u05E8\u05D5\u05EA \u05DC\u05D8\u05D1\u05DC\u05D4 ${k(u[1])}`,`adds rows to ${k(u[1])}`));continue}if(u=f.match(new RegExp(`^DROP POLICY (?:IF EXISTS )?("[^"]+"|\\S+) ON ${W}`,"i"))){c.add(k(u[2]).toLowerCase());continue}if(u=f.match(new RegExp(`^CREATE POLICY ("[^"]+"|\\S+) ON ${W}`,"i"))){l.add(k(u[2]).toLowerCase()),/\bTO (anon|public)\b/i.test(f)&&/USING \(\s*true\s*\)/i.test(f)&&i.push(v(t,`\u05DB\u05DC\u05DC \u05D2\u05D9\u05E9\u05D4 \u05D1-${k(u[2])} \u05E9\u05E4\u05D5\u05EA\u05D7 \u05D4\u05DB\u05DC \u05DC\u05D0\u05D5\u05E8\u05D7\u05D9\u05DD (anon)`,`an access rule on ${k(u[2])} that opens everything to guests (anon)`));continue}if((u=f.match(/^GRANT (.+) ON (?:TABLE |ALL TABLES IN SCHEMA )?(\S+) TO (.+)$/i))&&/\b(anon|public|authenticated)\b/i.test(u[3])){i.push(v(t,`\u05E0\u05D5\u05EA\u05DF \u05D4\u05E8\u05E9\u05D0\u05D4 (${u[1].trim()}) \u05E2\u05DC ${k(u[2])} \u05DC-${u[3].trim()}`,`grants ${u[1].trim()} on ${k(u[2])} to ${u[3].trim()}`));continue}if(u=f.match(new RegExp(`^DROP (FUNCTION|VIEW|TYPE|TRIGGER|INDEX)(?: IF EXISTS)? ${W}`,"i"))){i.push(v(t,`\u05DE\u05D5\u05D7\u05E7 ${u[1].toLowerCase()} ${k(u[2])}: \u05E7\u05D5\u05D3 \u05E9\u05DE\u05E9\u05EA\u05DE\u05E9 \u05D1\u05D5 \u05D9\u05D9\u05E9\u05D1\u05E8`,`drops ${u[1].toLowerCase()} ${k(u[2])}: code using it breaks`));continue}if(u=f.match(new RegExp(`^CREATE (?:UNIQUE )?INDEX (?:CONCURRENTLY )?(?:IF NOT EXISTS )?\\S+ ON (?:ONLY )?${W}`,"i"))){s.push(v(t,`\u05D0\u05D9\u05E0\u05D3\u05E7\u05E1 \u05E2\u05DC ${k(u[1])}`,`index on ${k(u[1])}`));continue}if(/^CREATE (OR REPLACE )?(FUNCTION|PROCEDURE)/i.test(f)){let y=f.match(/(?:FUNCTION|PROCEDURE) ("?[\w.]+"?)/i)?.[1];(/SECURITY DEFINER/i.test(g)?i:s).push(/SECURITY DEFINER/i.test(g)?v(t,`\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4 ${k(y??"")} \u05E9\u05E8\u05E6\u05D4 \u05D1\u05D4\u05E8\u05E9\u05D0\u05D5\u05EA \u05E9\u05DC \u05D4\u05D1\u05E2\u05DC\u05D9\u05DD (SECURITY DEFINER)`,`function ${k(y??"")} that runs with its owner's rights (SECURITY DEFINER)`):v(t,`\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4 ${k(y??"")}`,`function ${k(y??"")}`));continue}/^CREATE (OR REPLACE )?(VIEW|TRIGGER|TYPE|SCHEMA|EXTENSION)/i.test(f)&&s.push(v(t,f.split(" ").slice(0,4).join(" ").toLowerCase(),f.split(" ").slice(0,4).join(" ").toLowerCase()))}for(let f of c)l.has(f)||i.push(v(t,`\u05DE\u05D5\u05D7\u05E7 \u05DB\u05DC\u05DC \u05D2\u05D9\u05E9\u05D4 \u05D1\u05D8\u05D1\u05DC\u05D4 ${f} \u05D1\u05DC\u05D9 \u05DC\u05D9\u05E6\u05D5\u05E8 \u05D7\u05D3\u05E9`,`drops an access rule on ${f} without creating a new one`));c.size&&[...c].every(f=>l.has(f))&&s.push(v(t,`\u05DE\u05D7\u05DC\u05D9\u05E3 \u05DB\u05DC\u05DC\u05D9 \u05D2\u05D9\u05E9\u05D4 (${[...c].join(", ")})`,`replaces access rules (${[...c].join(", ")})`));for(let{table:f,drop:g,add:u}of p.values())i.push(g&&u?v(t,`\u05DE\u05D7\u05DC\u05D9\u05E3 \u05D0\u05D9\u05DC\u05D5\u05E5 \u05D1\u05D8\u05D1\u05DC\u05D4 ${f}: \u05D9\u05D9\u05DB\u05E9\u05DC \u05D0\u05DD \u05DE\u05D9\u05D3\u05E2 \u05E7\u05D9\u05D9\u05DD \u05DC\u05D0 \u05E2\u05D5\u05DE\u05D3 \u05D1\u05D7\u05D3\u05E9`,`replaces a constraint on ${f}: fails if existing data does not meet the new one`):g?v(t,`\u05DE\u05E1\u05D9\u05E8 \u05D0\u05D9\u05DC\u05D5\u05E5 \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4 ${f}: \u05DE\u05D9\u05D3\u05E2 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D9\u05D5\u05DB\u05DC \u05DC\u05D4\u05D9\u05DB\u05E0\u05E1`,`removes a constraint from ${f}: invalid data can get in`):v(t,`\u05DE\u05D5\u05E1\u05D9\u05E3 \u05D0\u05D9\u05DC\u05D5\u05E5 \u05DC\u05D8\u05D1\u05DC\u05D4 ${f}: \u05D9\u05D9\u05DB\u05E9\u05DC \u05D0\u05DD \u05DE\u05D9\u05D3\u05E2 \u05E7\u05D9\u05D9\u05DD \u05DC\u05D0 \u05E2\u05D5\u05DE\u05D3 \u05D1\u05D5`,`adds a constraint to ${f}: fails if existing data does not meet it`));r&&i.unshift(v(t,"\u05DE\u05E9\u05E0\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05D9\u05D2\u05E8\u05E6\u05D9\u05D4 \u05E7\u05D9\u05D9\u05DD: \u05D0\u05DD \u05D4\u05D5\u05D0 \u05DB\u05D1\u05E8 \u05D4\u05D5\u05E8\u05E5 \u05D1\u05E4\u05E8\u05D5\u05D3\u05E7\u05E9\u05DF, \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9 \u05DC\u05D0 \u05D9\u05E8\u05D5\u05E5 \u05E9\u05D5\u05D1","edits an existing migration file: if it already ran in production, the change will not run again")),/--\s*Rollback/i.test(e)||i.push(v(t,"\u05D0\u05D9\u05DF \u05D4\u05E2\u05E8\u05EA Rollback (\u05D0\u05D9\u05DA \u05D7\u05D5\u05D6\u05E8\u05D9\u05DD \u05D0\u05D7\u05D5\u05E8\u05D4)","no Rollback note (how to undo it)"));let d="safe";i.length&&(d=Kr(d,"review")),n.length&&(d=Kr(d,"destructive"));let m=[...new Set([...n,...i,...o,...s])];return{risk:d,lines:m.length?m:[v(t,"\u05DC\u05D0 \u05D6\u05D5\u05D4\u05D5 \u05E4\u05E7\u05D5\u05D3\u05D5\u05EA \u05DE\u05D5\u05DB\u05E8\u05D5\u05EA \u05D1\u05E7\u05D5\u05D1\u05E5","no known statements found in the file")]}}function wa(e,t){let r=[],n="review",i=[...new Set([...e.matchAll(/secrets\.([A-Z0-9_]+)/g)].map(o=>o[1]).filter(o=>o!=="GITHUB_TOKEN"))];/\bpull_request_target\b/.test(e)&&(n="destructive",r.push(v(t,"\u05E8\u05E5 \u05E2\u05DC pull_request_target: \u05E7\u05D5\u05D3 \u05DE-PR \u05D6\u05E8 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E8\u05D5\u05E5 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA","runs on pull_request_target: code from an outside PR can run with the secrets"))),i.length&&r.push(v(t,`\u05DE\u05E9\u05EA\u05DE\u05E9 \u05D1\u05E1\u05D5\u05D3\u05D5\u05EA: ${i.join(", ")}`,`uses secrets: ${i.join(", ")}`)),/permissions:\s*write-all|contents:\s*write/.test(e)&&r.push(v(t,"\u05DE\u05E7\u05D1\u05DC \u05D4\u05E8\u05E9\u05D0\u05EA \u05DB\u05EA\u05D9\u05D1\u05D4 \u05DC\u05E8\u05D9\u05E4\u05D5","gets write access to the repository"));let s=[...e.matchAll(/uses:\s*([^\s@#]+)@([^\s#]+)/g)].filter(o=>!/^[0-9a-f]{40}$/.test(o[2])&&!o[1].startsWith("./"));return s.length&&r.push(v(t,`${s.length} \u05E8\u05DB\u05D9\u05D1\u05D9\u05DD \u05D7\u05D9\u05E6\u05D5\u05E0\u05D9\u05D9\u05DD \u05DC\u05D0 \u05E0\u05E2\u05D5\u05DC\u05D9\u05DD \u05DC\u05D2\u05E8\u05E1\u05D4 \u05DE\u05D3\u05D5\u05D9\u05E7\u05EA`,`${s.length} outside actions not pinned to an exact version`)),r.length||r.push(v(t,"\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D1-CI \u05D1\u05DC\u05D9 \u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05D1\u05DC\u05D9 \u05D4\u05E8\u05E9\u05D0\u05D5\u05EA \u05DB\u05EA\u05D9\u05D1\u05D4","a CI change with no secrets and no write access")),{risk:n,lines:r}}function Zr(e,t,r,n){let i=e.replace(/\\/g,"/"),s=typeof t.content=="string"?t.content:typeof t.new_string=="string"?t.new_string:Array.isArray(t.edits)?t.edits.map(c=>typeof c?.new_string=="string"?c.new_string:"").join(`
|
|
40
|
+
`):null;if(s===null)return null;if(/\/migrations\/[^/]+\.sql$/i.test(i))return xa(s,r,n);if(/\/\.github\/workflows\/[^/]+\.ya?ml$/i.test(i))return wa(s,r);let o=s.split(`
|
|
41
41
|
`).length,a=typeof t.old_string=="string"?t.old_string.split(`
|
|
42
|
-
`).length:0;return{risk:"review",lines:[v(r,`${n?"\u05DE\u05E9\u05E0\u05D4":"\u05D9\u05D5\u05E6\u05E8"} \u05E7\u05D5\u05D1\u05E5: +${o}${a?` \u2212${a}`:""} \u05E9\u05D5\u05E8\u05D5\u05EA`,`${n?"changes":"creates"} a file: +${o}${a?` \u2212${a}`:""} lines`)]}}function
|
|
43
|
-
`)}var oa=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...jt]),aa=50*1024*1024,zr=8,ca={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function yn(e){let t=ft(e).toLowerCase();return oa.has(Qr(t))||ge.test(t)}var ti=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,la=/\.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|bindings\.json|orgs)\b/i;function ye(e){let t=be(V(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!ti.test(n)}var da=["~","$home","${home}","%userprofile%","$env:userprofile","${env:userprofile}","$env:home","%homedrive%%homepath%"],ua=/\.nodata(?=$|[\\/\s"'`|;&<>()])(?:[\\/]+([^\s"'`|;&<>()]*))?/gi,fa=/^\s*(ls|dir|tree|Get-ChildItem|gci)\b[^|;&]*$/i;function pa(e){let t=(e.split(/[\s"'`=(|;&<>]/).pop()??"").replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),r=V().replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase();return t===r||da.includes(t)}function ha(e){if(la.test(e))return!0;for(let t of e.matchAll(ua)){if(!pa(e.slice(0,t.index).replace(/[\\/]+$/,"")))continue;let r=(t[1]??"").replace(/\\/g,"/").replace(/\/+$/,"");if(r===""){if(!fa.test(e))return!0;continue}if(/[*?[\]{}]/.test(r)||!ti.test(r))return!0}return!1}var Q=e=>e.startsWith("mcp__"),bn=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),ma=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,ga=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,ya=/(search|grep|find|glob|list|tree|director|query)/i,Wr=16;function pt(e){let t=e.split("__").slice(2).join("__");return ga.test(t)?"write":ya.test(t)?"search":"read"}function Te(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=D(t,a.replace(/^~(?=[\\/]|$)/,V()));!r.includes(c)&&r.length<Wr&&r.push(c)},i=(s,o,a)=>{if(!(a>3||r.length>=Wr)){if(typeof s=="string")n(s,ma.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 pn=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,ba=/(>|\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 _a(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return pn.test(i)&&ba.test(i)}if(Q(e))return pt(e)==="write"&&Te(t,r).some(i=>pn.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?pn.test((q(n)?n:D(r,n)).replace(/\\/g,"/")):!1}function xa(e){return yn(e)||Ke(e)!==null||Ze(e)!==null}var lt=class extends Error{};function wa(e){let t=Qr(e).toLowerCase(),r=gn(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=Ut(i,t===".tsv"?" ":void 0).counts;else if(jt.has(t)){let o=t===".xlsx"||t===".xlsm"?Wt(r):null,a=Ft(r,t);if(!a&&!o)throw new lt;i=a?.text??"",n=o?o.counts:U(i).counts}else i=r.toString("utf8"),n=U(i).counts;let s=Le.filter(o=>o.pattern.test(i)).length;return ge.test(ft(e).toLowerCase())&&(s=Math.max(s,Gt(i))),s&&(n.secret=Math.max(n.secret??0,s)),n}var ka={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 ni(e){let t=Y()==="he",r=n=>(t?ka[n]:ca[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 va(e){return ni(e)}function ri(e,t,r){let n=s=>q(s)?s:D(r,s),i=s=>{try{return ut(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(Q(e))return pt(e)==="write"?[]:Te(t,r).filter(i).slice(0,zr);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(/^~(?=[\\/])/,V()).replace(/^\/([a-zA-Z])\//,(d,h)=>process.platform==="win32"?`${h}:/`:d);if(!l)continue;let f=n(l);if(!(!yn(l)&&!ye(f)&&Ke(f)===null&&Ze(f)===null)&&(i(f)&&!a.includes(f)&&a.push(f),a.length>=zr))break}return a}return[]}function B(e){return e.replace(/\\+/g,"/")}function Sa(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 Gr(e,t){return`${B(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 ii(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&Sa(t.command))return n;for(let i of ri(e,t,r)){if(!xa(i)||pr(i)||!mn(i))continue;let s=Ze(i);if(!yn(i)){let o=Ke(i);o?n.push({line:`${B(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 ${va(o)}`,kind:"flagged_code"}):s&&n.push({line:Gr(i,s.changed),kind:"unread"});continue}try{if(ut(i).size>aa)n.push({line:`${B(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let o=wa(i);Object.keys(o).length?n.push({line:`${B(i)}: ${ni(o)}`,kind:"data_file"}):s&&!s.changed&&n.push({line:Gr(i,!1),kind:"unread"})}}catch(o){n.push(o instanceof lt?{line:`${B(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:`${B(i)}: could not be checked`,kind:"unreadable"})}}return n}var hn=/(?:\.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,dt=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,si="the vault's secrets, outside nodata_run's per-command approval",Ea=/(?:^|[^\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 Aa(e){return Ea.test(e)}var $a=[[/^(?: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,si],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],Ia=/^(?:echo|printf|print|write-output|write-host|say)\b/i,oi=/^(?: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,Ra=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function Ta(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&&hn.test((q(n)?n:D(r,n)).replace(/\\/g,"/")))return`a saved login (${ft(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(oi.test(a)&&hn.test(a))return"a saved login file";if(Aa(a))return si;for(let[l,f]of $a)if(l.test(a))return f;let c=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(c&&(!c[1]||dt.test(c[1])))return c[1]?`the variable ${c[1]}`:"every environment variable";if(!o&&(Ia.test(a)||/GetEnvironmentVariable/i.test(a)))for(let l of a.matchAll(Ra)){let f=l[1]??l[2]??l[3]??l[4]??"";if(dt.test(f))return`the variable ${f}`}}return null}var ai=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,Ca=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,La=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),Vr=4e3,Pa=5;function Na(e){let t=0,r=0,n=(i,s)=>{if(s>Pa||t>Vr)return;let o;try{o=ia(i,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>Vr)return;let c=be(i,a.name);a.isDirectory()?La.has(a.name)||n(c,s+1):(ge.test(a.name.toLowerCase())||hn.test(c.replace(/\\/g,"/"))||ye(c))&&r++}};return n(e,0),r}var Re=e=>{try{return ut(e).isDirectory()}catch{return!1}};function Oa(e,t){let r=ei(D(t),D(e));return r===""||!r.startsWith("..")&&!q(r)}function Da(e,t,r){let n=s=>D(r,s.replace(/^~(?=[\\/]|$)/,V())),i=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):D(r);if(Re(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[s],bySecret:dt.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)&&!(ai.test(o)&&(Ca.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let l=o.split(/\s+/).slice(1).map(f=>f.replace(/^['"]|['"]$/g,"")).filter(f=>f&&!f.startsWith("-")&&!/^\/[a-z]$/i.test(f)).map(n).filter(Re);i.push({roots:l.length?l:[D(r)],bySecret:dt.test(o)||/\.env\b/i.test(o)})}for(let s of i)for(let o of s.roots){if(!s.bySecret&&Oa(o,r))continue;let a=Na(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var ci=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),ct=e=>ci.has(e)||Q(e)&&pt(e)==="write";function _n(e,t,r){let n=i=>D(r,i.replace(/^~(?=[\\/]|$)/,V()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(ci.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):D(r);return{action:"search",paths:[i],roots:Re(i)?[i]:[]}}if(Q(e)){let i=Te(t,r);if(!i.length)return null;let s=pt(e);return{action:s,paths:i,roots:s==="search"?i.filter(Re):[]}}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)).filter(l=>e==="PowerShell"||!/^\\+$/.test(l)).map(n).filter(l=>mn(l)),a=i.split(/\|\||&&|[;|\n]/).some(l=>ai.test(l.trim())||/^find\b/i.test(l.trim())),c=o.filter(Re);return{action:a?"search":oi.test(i.trim())?"read":"run",paths:[D(r),...o],roots:a?c.length?c:[D(r)]:[]}}return null}var Fa=/(browser|playwright|puppeteer|chrome|chromium|stagehand|browserbase|selenium|webdriver)/i,ja=/(click|type|fill|press|select|submit|hover|drag|drop|upload|form|key|input|check|scroll|evaluate|dialog|tap|act\b|execute)/i,Ma=/^(url|uri|href|link|address|page_?url|start_?url)$/i,li=()=>be(V(),".nodata","gate-sites.json"),Ha=720*60*1e3,Ua=50;function Ba(e,t){let r,n,i=(s,o,a)=>{if(!(a>3||r)){if(typeof s=="string"){let c=s.trim();if(!/^https?:\/\//i.test(c)||c.length>4096)return;Ma.test(o)?r=c:n??=c}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??(t?n:void 0)}function xn(e,t){if(e==="WebFetch")return typeof t.url=="string"?{action:"browse",url:t.url}:null;if(!Q(e)||bn(e))return null;let r=e.split("__").slice(2).join("__"),n=Fa.test(e),i=Ba(t,n);return!i&&!n?null:{action:ja.test(r)?"interact":"browse",...i?{url:i}:{}}}function di(){try{let e=JSON.parse(gn(li(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{}))typeof i?.host=="string"&&typeof i.at=="number"&&t-i.at<Ha&&(r[n]={host:i.host,at:i.at});return r}catch{return{}}}function za(e){return e?di()[e]?.host:void 0}function Wa(e,t,r,n){if(!e||t==="WebFetch")return;let i=xn(t,r);if(!i)return;let s="";try{s=typeof n=="string"?n:JSON.stringify(n??"")}catch{}let o=/Page URL:\s*(https?:\/\/[^\s"\\]+)/i.exec(s)?.[1]??/"(?:url|pageUrl|page_url)"\s*:\s*"(https?:\/\/[^"\\]+)"/i.exec(s)?.[1],a=en(o??i.url??"");if(a)try{let c=di();c[e]={host:a,at:Date.now()};let l=Object.entries(c).sort((f,d)=>d[1].at-f[1].at).slice(0,Ua);qr(be(V(),".nodata"),{recursive:!0}),sa(li(),JSON.stringify(Object.fromEntries(l))+`
|
|
44
|
-
`,{mode:384})}catch{}}function
|
|
45
|
-
${o}`:"";if(!
|
|
46
|
-
\u05DB\u05D3\u05D9 \u05DC\u05D1\u05E7\u05E9: nodata_rules {action:"approve", checkpoint:"${c}"}. \u05D4\u05D5\u05D0 \u05E4\u05D5\u05EA\u05D7 \u05D0\u05EA \u05D3\u05E3 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D5\u05DE\u05D7\u05DB\u05D4. \u05D0\u05D7\u05E8\u05D9 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D7\u05D6\u05D5\u05E8 \u05E2\u05DC \u05D0\u05D5\u05EA\u05D4 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05D1\u05D3\u05D9\u05D5\u05E7 (\u05E4\u05E2\u05DD \u05D0\u05D7\u05EA, \u05EA\u05D5\u05DA 5 \u05D3\u05E7\u05D5\u05EA). \u05D0\u05EA\u05D4 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC \u05DC\u05D0\u05E9\u05E8 \u05D1\u05E2\u05E6\u05DE\u05DA.`,`NoData: ${i}.
|
|
47
|
-
To ask: nodata_rules {action:"approve", checkpoint:"${c}"}. It opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)+a})}function
|
|
42
|
+
`).length:0;return{risk:"review",lines:[v(r,`${n?"\u05DE\u05E9\u05E0\u05D4":"\u05D9\u05D5\u05E6\u05E8"} \u05E7\u05D5\u05D1\u05E5: +${o}${a?` \u2212${a}`:""} \u05E9\u05D5\u05E8\u05D5\u05EA`,`${n?"changes":"creates"} a file: +${o}${a?` \u2212${a}`:""} lines`)]}}function Yr(e,t){return[e.risk==="destructive"?v(t,"\u{1F534} \u05DE\u05D5\u05D7\u05E7 \u05D0\u05D5 \u05D7\u05D5\u05E9\u05E3 \u05DE\u05D9\u05D3\u05E2","\u{1F534} deletes or exposes data"):e.risk==="review"?v(t,"\u{1F7E1} \u05DB\u05D3\u05D0\u05D9 \u05DC\u05D4\u05E1\u05EA\u05DB\u05DC","\u{1F7E1} worth a look"):v(t,"\u{1F7E2} \u05E8\u05E7 \u05DE\u05D5\u05E1\u05D9\u05E3","\u{1F7E2} only adds"),...e.lines.slice(0,8).map(n=>`\u2022 ${n}`),...e.lines.length>8?[v(t,`\u05D5\u05E2\u05D5\u05D3 ${e.lines.length-8}`,`and ${e.lines.length-8} more`)]:[]].join(`
|
|
43
|
+
`)}var Ea=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...Mt]),Aa=50*1024*1024,Jr=8,$a={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function kn(e){let t=pt(e).toLowerCase();return Ea.has(oi(t))||ge.test(t)}var ci=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,Ia=/\.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|bindings\.json|orgs)\b/i;function be(e){let t=_e(V(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!ci.test(n)}var Ra=["~","$home","${home}","%userprofile%","$env:userprofile","${env:userprofile}","$env:home","%homedrive%%homepath%"],Ta=/\.nodata(?=$|[\\/\s"'`|;&<>()])(?:[\\/]+([^\s"'`|;&<>()]*))?/gi,Ca=/^\s*(ls|dir|tree|Get-ChildItem|gci)\b[^|;&]*$/i;function Pa(e){let t=(e.split(/[\s"'`=(|;&<>]/).pop()??"").replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),r=V().replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase();return t===r||Ra.includes(t)}function La(e){if(Ia.test(e))return!0;for(let t of e.matchAll(Ta)){if(!Pa(e.slice(0,t.index).replace(/[\\/]+$/,"")))continue;let r=(t[1]??"").replace(/\\/g,"/").replace(/\/+$/,"");if(r===""){if(!Ca.test(e))return!0;continue}if(/[*?[\]{}]/.test(r)||!ci.test(r))return!0}return!1}var Q=e=>e.startsWith("mcp__"),vn=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),Na=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,Oa=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,Da=/(search|grep|find|glob|list|tree|director|query)/i,qr=16;function ht(e){let t=e.split("__").slice(2).join("__");return Oa.test(t)?"write":Da.test(t)?"search":"read"}function Ce(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=D(t,a.replace(/^~(?=[\\/]|$)/,V()));!r.includes(c)&&r.length<qr&&r.push(c)},i=(s,o,a)=>{if(!(a>3||r.length>=qr)){if(typeof s=="string")n(s,Na.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 gn=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,Fa=/(>|\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 ja(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return gn.test(i)&&Fa.test(i)}if(Q(e))return ht(e)==="write"&&Ce(t,r).some(i=>gn.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?gn.test((q(n)?n:D(r,n)).replace(/\\/g,"/")):!1}function Ma(e){return kn(e)||Ze(e)!==null||Ye(e)!==null}var dt=class extends Error{};function Ha(e){let t=oi(e).toLowerCase(),r=wn(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=Bt(i,t===".tsv"?" ":void 0).counts;else if(Mt.has(t)){let o=t===".xlsx"||t===".xlsm"?Gt(r):null,a=jt(r,t);if(!a&&!o)throw new dt;i=a?.text??"",n=o?o.counts:U(i).counts}else i=r.toString("utf8"),n=U(i).counts;let s=Le.filter(o=>o.pattern.test(i)).length;return ge.test(pt(e).toLowerCase())&&(s=Math.max(s,Vt(i))),s&&(n.secret=Math.max(n.secret??0,s)),n}var Ua={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 li(e){let t=Y()==="he",r=n=>(t?Ua[n]:$a[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 Ba(e){return li(e)}function di(e,t,r){let n=s=>q(s)?s:D(r,s),i=s=>{try{return ft(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(Q(e))return ht(e)==="write"?[]:Ce(t,r).filter(i).slice(0,Jr);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(/^~(?=[\\/])/,V()).replace(/^\/([a-zA-Z])\//,(d,m)=>process.platform==="win32"?`${m}:/`:d);if(!l)continue;let p=n(l);if(!(!kn(l)&&!be(p)&&Ze(p)===null&&Ye(p)===null)&&(i(p)&&!a.includes(p)&&a.push(p),a.length>=Jr))break}return a}return[]}function B(e){return e.replace(/\\+/g,"/")}function za(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 Qr(e,t){return`${B(e)}: ${t?I("\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"):I("\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 ui(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&za(t.command))return n;for(let i of di(e,t,r)){if(!Ma(i)||wr(i)||!xn(i))continue;let s=Ye(i);if(!kn(i)){let o=Ze(i);o?n.push({line:`${B(i)}: ${I("\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 ${Ba(o)}`,kind:"flagged_code"}):s&&n.push({line:Qr(i,s.changed),kind:"unread"});continue}try{if(ft(i).size>Aa)n.push({line:`${B(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let o=Ha(i);Object.keys(o).length?n.push({line:`${B(i)}: ${li(o)}`,kind:"data_file"}):s&&!s.changed&&n.push({line:Qr(i,!1),kind:"unread"})}}catch(o){n.push(o instanceof dt?{line:`${B(i)}: ${I("\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:`${B(i)}: could not be checked`,kind:"unreadable"})}}return n}var bn=/(?:\.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,ut=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,fi="the vault's secrets, outside nodata_run's per-command approval",Wa=/(?:^|[^\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 Ga(e){return Wa.test(e)}var Va=[[/^(?: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,fi],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],Xa=/^(?:echo|printf|print|write-output|write-host|say)\b/i,pi=/^(?: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,Ka=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function Za(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&&bn.test((q(n)?n:D(r,n)).replace(/\\/g,"/")))return`a saved login (${pt(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(pi.test(a)&&bn.test(a))return"a saved login file";if(Ga(a))return fi;for(let[l,p]of Va)if(l.test(a))return p;let c=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(c&&(!c[1]||ut.test(c[1])))return c[1]?`the variable ${c[1]}`:"every environment variable";if(!o&&(Xa.test(a)||/GetEnvironmentVariable/i.test(a)))for(let l of a.matchAll(Ka)){let p=l[1]??l[2]??l[3]??l[4]??"";if(ut.test(p))return`the variable ${p}`}}return null}var hi=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,Ya=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,Ja=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),ei=4e3,qa=5;function Qa(e){let t=0,r=0,n=(i,s)=>{if(s>qa||t>ei)return;let o;try{o=va(i,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>ei)return;let c=_e(i,a.name);a.isDirectory()?Ja.has(a.name)||n(c,s+1):(ge.test(a.name.toLowerCase())||bn.test(c.replace(/\\/g,"/"))||be(c))&&r++}};return n(e,0),r}var Te=e=>{try{return ft(e).isDirectory()}catch{return!1}};function ec(e,t){let r=ai(D(t),D(e));return r===""||!r.startsWith("..")&&!q(r)}function tc(e,t,r){let n=s=>D(r,s.replace(/^~(?=[\\/]|$)/,V())),i=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):D(r);if(Te(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[s],bySecret:ut.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)&&!(hi.test(o)&&(Ya.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let l=o.split(/\s+/).slice(1).map(p=>p.replace(/^['"]|['"]$/g,"")).filter(p=>p&&!p.startsWith("-")&&!/^\/[a-z]$/i.test(p)).map(n).filter(Te);i.push({roots:l.length?l:[D(r)],bySecret:ut.test(o)||/\.env\b/i.test(o)})}for(let s of i)for(let o of s.roots){if(!s.bySecret&&ec(o,r))continue;let a=Qa(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var mi=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),lt=e=>mi.has(e)||Q(e)&&ht(e)==="write";function Sn(e,t,r){let n=i=>D(r,i.replace(/^~(?=[\\/]|$)/,V()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(mi.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):D(r);return{action:"search",paths:[i],roots:Te(i)?[i]:[]}}if(Q(e)){let i=Ce(t,r);if(!i.length)return null;let s=ht(e);return{action:s,paths:i,roots:s==="search"?i.filter(Te):[]}}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)).filter(l=>e==="PowerShell"||!/^\\+$/.test(l)).map(n).filter(l=>xn(l)),a=i.split(/\|\||&&|[;|\n]/).some(l=>hi.test(l.trim())||/^find\b/i.test(l.trim())),c=o.filter(Te);return{action:a?"search":pi.test(i.trim())?"read":"run",paths:[D(r),...o],roots:a?c.length?c:[D(r)]:[]}}return null}var nc=/(browser|playwright|puppeteer|chrome|chromium|stagehand|browserbase|selenium|webdriver)/i,rc=/(click|type|fill|press|select|submit|hover|drag|drop|upload|form|key|input|check|scroll|evaluate|dialog|tap|act\b|execute)/i,ic=/^(url|uri|href|link|address|page_?url|start_?url)$/i,gi=()=>_e(V(),".nodata","gate-sites.json"),sc=720*60*1e3,oc=50;function ac(e,t){let r,n,i=(s,o,a)=>{if(!(a>3||r)){if(typeof s=="string"){let c=s.trim();if(!/^https?:\/\//i.test(c)||c.length>4096)return;ic.test(o)?r=c:n??=c}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??(t?n:void 0)}function En(e,t){if(e==="WebFetch")return typeof t.url=="string"?{action:"browse",url:t.url}:null;if(!Q(e)||vn(e))return null;let r=e.split("__").slice(2).join("__"),n=nc.test(e),i=ac(t,n);return!i&&!n?null:{action:rc.test(r)?"interact":"browse",...i?{url:i}:{}}}function yi(){try{let e=JSON.parse(wn(gi(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{}))typeof i?.host=="string"&&typeof i.at=="number"&&t-i.at<sc&&(r[n]={host:i.host,at:i.at});return r}catch{return{}}}function cc(e){return e?yi()[e]?.host:void 0}function lc(e,t,r,n){if(!e||t==="WebFetch")return;let i=En(t,r);if(!i)return;let s="";try{s=typeof n=="string"?n:JSON.stringify(n??"")}catch{}let o=/Page URL:\s*(https?:\/\/[^\s"\\]+)/i.exec(s)?.[1]??/"(?:url|pageUrl|page_url)"\s*:\s*"(https?:\/\/[^"\\]+)"/i.exec(s)?.[1],a=tn(o??i.url??"");if(a)try{let c=yi();c[e]={host:a,at:Date.now()};let l=Object.entries(c).sort((p,d)=>d[1].at-p[1].at).slice(0,oc);si(_e(V(),".nodata"),{recursive:!0}),Sa(gi(),JSON.stringify(Object.fromEntries(l))+`
|
|
44
|
+
`,{mode:384})}catch{}}function dc(e,t,r,n=new Date,i,s){let o=En(e,t);if(!o)return null;let a;if(o.url){let y=tn(o.url);if(!y)return null;a=y}else a=cc(s);let{rules:c,tampered:l}=en(),p=sn(),d={allow:0,ask:1,clean_copy:2,deny:3},m={action:o.action,path:"",now:n,who:i,site:a},f=J(),g=null;for(let{owner:y,rules:h}of p){if(!nt(y,D(r),f))continue;let x=rn(h,m);x&&(!g||d[x.rule.effect]>d[g.rule.effect])&&(g={...x,org:!0})}let u=null;if(l){let y=c.find(h=>h.site&&(a===void 0||nn(h.site,a)));y&&(u={rule:{...y,effect:"deny",when:[]},n:c.indexOf(y)+1,touched:a??"",tampered:!0})}else u=rn(c,m);return g&&(!u||d[g.rule.effect]>=d[u.rule.effect])?g:u}function ti(e,t,r,n=new Date,i){let s=Sn(e,t,r);if(!s)return null;let{rules:o,tampered:a}=en(),c=sn();if(!o.length&&!c.length)return null;let l={allow:0,ask:1,clean_copy:2,deny:3},p=J(),d=null;for(let{owner:f,rules:g}of c){for(let u of s.paths){if(!nt(f,u,p))continue;let y=at(g,{action:s.action,path:u,now:n,who:i});y&&(!d||l[y.rule.effect]>l[d.rule.effect])&&(d={...y,org:!0})}for(let u of s.roots){if(!nt(f,u,p))continue;let y=ct(g,u,s.action,n,i);y&&y.rule.effect!=="allow"&&(!d||l[y.rule.effect]>l[d.rule.effect])&&(d={...y,org:!0})}}let m=uc(o,a,s,n,l,i);return d&&(!m||l[d.rule.effect]>=l[m.rule.effect])?d:m}function uc(e,t,r,n,i,s){if(!e.length)return null;if(t){for(let a of r.paths){let c=e.find(l=>ae(l.path,a)||ae(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=at(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=ct(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 fc(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 ve()){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 pc(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=Xt(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.`+(Y()==="he"?" Answer the user in Hebrew.":"")}function hc(e,t,r,n){let i=Ur();if(!i.length)return null;let s=Sn(e,t,r);if(!s)return null;let o=new Date,a=s.paths.map(l=>at(i,{action:s.action,path:l,now:o,who:n})).find(Boolean)??s.roots.map(l=>ct(i,l,s.action,o,n)).find(Boolean);if(!a)return null;let c=String(a.rule.when?.[0]?.value??"");return I(`NoData \u05D7\u05E1\u05DD: ${B(a.rule.path)} \u05E2\u05D5\u05D1\u05D3\u05EA \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 (${c}) \u05DE\u05D6\u05D4 \u05E9\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5. \u05E1\u05D5\u05DB\u05DF \u05E9\u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05D3 \u05DC\u05D0 \u05E0\u05D5\u05D2\u05E2 \u05D1\u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05DC \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4 \u05E9\u05DD: \u05DC\u05E4\u05EA\u05D5\u05D7 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u05D1\u05EA\u05D5\u05DA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D4\u05D9\u05D0.`,`NoData refused: ${B(a.rule.path)} works for another organisation (${c}) than this folder. An agent working here for one organisation does not touch another organisation's files \u2014 not even with approval. To work there, start the agent inside that folder.`)}function mc(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&&La(n)||i&&be(q(i)?i:D(r,i))||Q(e)&&Ce(t,r).some(be)||di(e,t,r).some(be)?I("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}var An="unreported",gc=new Set(["auto","bypassPermissions",An]),yn=e=>!!e&&gc.has(e);function ye(e){return e===An?I("\u05D4\u05E1\u05E9\u05DF \u05D4\u05D6\u05D4 \u05DC\u05D0 \u05DE\u05D3\u05D5\u05D5\u05D7 \u05D0\u05DD \u05D0\u05D3\u05DD \u05E2\u05D5\u05E0\u05D4 \u05D1\u05D5 \u05E2\u05DC \u05D1\u05E7\u05E9\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8 (\u05DB\u05DA \u05D1-Claude Desktop \u05D5-Cowork), \u05D5\u05DC\u05DB\u05DF NoData \u05DC\u05D0 \u05E1\u05D5\u05DE\u05DB\u05EA \u05E2\u05DC \u05D7\u05DC\u05D5\u05DF \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC\u05D5","this session does not report whether a person answers its approval dialog (as in Claude Desktop and Cowork), so NoData does not rely on that dialog"):I(`\u05D4\u05E1\u05E9\u05DF \u05D4\u05D6\u05D4 \u05E8\u05E5 \u05D1\u05DE\u05E6\u05D1 ${e}, \u05E9\u05D1\u05D5 Claude Code \u05E2\u05D5\u05E0\u05D4 \u05D1\u05E2\u05E6\u05DE\u05D5 \u05E2\u05DC \u05D1\u05E7\u05E9\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8`,`this session runs in ${e} mode, where Claude Code answers its own approval dialog`)}var _n=e=>e.charAt(0).toUpperCase()+e.slice(1);function ni(e,t){let r=ai(t,e);return r&&!r.startsWith("..")&&!q(r)?B(r):pt(e)}function ri(e,t,r){if(!lt(t)||Q(t))return"";let n=xn(e),i=r;if(n&&(t==="Edit"||t==="MultiEdit"))try{let o=ft(e).size<=1e6?wn(e,"utf8"):null,a=t==="Edit"?[r]:Array.isArray(r.edits)?r.edits:[];for(let c of a)o!==null&&typeof c.old_string=="string"&&typeof c.new_string=="string"&&(o=c.replace_all?o.split(c.old_string).join(c.new_string):o.replace(c.old_string,()=>c.new_string));o!==null&&(i={content:o,old_string:r.old_string})}catch{}let s=Zr(e,i,Y()==="he"?"he":"en",n);return s?Yr(s,Y()==="he"?"he":"en"):""}function ii(e,t,r,n,i,s,o=""){let a=o?`
|
|
45
|
+
${o}`:"";if(!mn())return{decision:"deny",kind:"checkpoint",reason:I(`NoData: ${i}. ${ye(s)}, \u05D5\u05D4\u05DE\u05D7\u05E9\u05D1 \u05DC\u05D0 \u05DE\u05D7\u05D5\u05D1\u05E8 \u05DC-NoData \u05DB\u05D3\u05D9 \u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05EA \u05D4\u05D1\u05E2\u05DC\u05D9\u05DD \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF. \u05DC\u05DB\u05DF \u05D4\u05E6\u05E2\u05D3 \u05E0\u05D7\u05E1\u05DD. \u05D0\u05E4\u05E9\u05E8 \u05DC\u05D7\u05D1\u05E8 \u05D0\u05EA \u05D4\u05DE\u05D7\u05E9\u05D1 (nodata_connect), \u05D0\u05D5 \u05E9\u05D4\u05D0\u05D3\u05DD \u05D9\u05E2\u05E9\u05D4 \u05D0\u05EA \u05D4\u05E6\u05E2\u05D3 \u05D1\u05E2\u05E6\u05DE\u05D5.`,`NoData: ${i}. ${_n(ye(s))}, and this computer is not connected to NoData to ask its owner in the browser. So the step is refused. Connect the computer (nodata_connect), or the person takes this step themselves.`)+a};let c=un(e,t,r,n);return hn(c)?{decision:"allow"}:(pn({id:c,site:"",file:e,action:t,tool:r,what:fn(n),...o?{summary:o}:{}}),{decision:"deny",kind:"checkpoint",reason:I(`NoData: ${i}. ${ye(s)}, \u05D5\u05DC\u05DB\u05DF \u05D4\u05E6\u05E2\u05D3 \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC \u05D1\u05E2\u05DC\u05D9 \u05D4\u05DE\u05D7\u05E9\u05D1 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF.
|
|
46
|
+
\u05DB\u05D3\u05D9 \u05DC\u05D1\u05E7\u05E9: nodata_rules {action:"approve", checkpoint:"${c}"}. \u05D4\u05D5\u05D0 \u05E4\u05D5\u05EA\u05D7 \u05D0\u05EA \u05D3\u05E3 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D5\u05DE\u05D7\u05DB\u05D4. \u05D0\u05D7\u05E8\u05D9 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D7\u05D6\u05D5\u05E8 \u05E2\u05DC \u05D0\u05D5\u05EA\u05D4 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05D1\u05D3\u05D9\u05D5\u05E7 (\u05E4\u05E2\u05DD \u05D0\u05D7\u05EA, \u05EA\u05D5\u05DA 5 \u05D3\u05E7\u05D5\u05EA). \u05D0\u05EA\u05D4 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC \u05DC\u05D0\u05E9\u05E8 \u05D1\u05E2\u05E6\u05DE\u05DA.`,`NoData: ${i}. ${_n(ye(s))}, so the step waits for the computer's owner to approve it in the browser.
|
|
47
|
+
To ask: nodata_rules {action:"approve", checkpoint:"${c}"}. It opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)+a})}function yc(e,t,r,n,i,s,o){if(vn(e))return{decision:"allow"};let a=Or(r),c={...i,org:a??void 0},l=mc(e,t,r);if(l)return{decision:"deny",reason:l,kind:"nodata_key"};let p=hc(e,t,r,c);if(p)return{decision:"deny",reason:p,kind:"org_wall"};let d=Za(e,t,r);if(d&&ti(e,t,r,new Date,c)?.rule.effect!=="deny"){let S=I(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${d}. \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.
|
|
48
48
|
\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 ${d}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
|
|
49
|
-
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:S,kind:"credential_print"}}if((
|
|
49
|
+
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:S,kind:"credential_print"}}if((lt(e)||e==="Bash"||e==="PowerShell")&&ja(e,t,r)){if(yn(o)){let S=typeof t.file_path=="string"?ni(q(t.file_path)?t.file_path:D(r,t.file_path),r):I("\u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E9\u05E2\u05E8 \u05E9\u05DC NoData","Claude Code's settings or NoData's gate");return ii(S,"write",e,t,I("\u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8","this changes what runs the gate"),o)}return{decision:"ask",kind:"gate_holder",reason:I("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(lt(e)){let S=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if((Q(e)?Ce(t,r):S?[q(S)?S:D(r,S)]:[]).some(be))return{decision:"deny",kind:"nodata_write",reason:I("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 m=new Date,f=ti(e,t,r,m,c),g=dc(e,t,r,m,c,s),u=g&&(!f||oe[g.rule.effect]>oe[f.rule.effect])?g:f;if(u&&u.rule.effect!=="allow"){let S=Y()==="he",j=u.rule.site?Mr(u.rule,S):u.rule.path.startsWith("**/")?u.rule.path:B(u.rule.path),z=u.rule.site&&!u.touched?I(" (NoData \u05DC\u05D0 \u05D9\u05D5\u05D3\u05E2 \u05D1\u05D0\u05D9\u05D6\u05D4 \u05D0\u05EA\u05E8 \u05D4\u05D3\u05E3 \u05D4\u05D6\u05D4, \u05D5\u05DC\u05DB\u05DF \u05D4\u05DB\u05DC\u05DC \u05D4\u05DE\u05D7\u05DE\u05D9\u05E8 \u05DE\u05D1\u05D9\u05DF \u05DB\u05DC\u05DC\u05D9 \u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05D7\u05DC)"," (NoData does not know which site this page is on, so the strictest site rule applies)"):"",P=u.tampered?I("\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 \u05D5\u05D0\u05EA\u05E8 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8\u05D9\u05DD \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 and site it names is closed until you save the rules again."):`${u.org?I("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):I("\u05DB\u05DC\u05DC","rule")} ${u.n}: ${j} \u2192 ${Hr(u.rule.effect,S)}${u.rule.note?` (${u.rule.note})`:""}${z}`;if(u.rule.site&&u.rule.effect==="ask"&&!u.tampered&&mn()){let L=En(e,t),M=u.touched,H=un(M,L.action,e,t);return hn(H)?{decision:"allow"}:(pn({id:H,site:M,action:L.action,tool:e,what:fn(t)}),{decision:"deny",kind:"checkpoint",reason:I(`NoData: ${P}. \u05D4\u05E6\u05E2\u05D3 \u05D4\u05D6\u05D4 \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC \u05D1\u05E2\u05DC\u05D9 \u05D4\u05DE\u05D7\u05E9\u05D1 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF, \u05DC\u05D0 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05DB\u05D0\u05DF.
|
|
50
50
|
\u05DB\u05D3\u05D9 \u05DC\u05D1\u05E7\u05E9: nodata_rules {action:"approve", checkpoint:"${H}"} \u2014 \u05D4\u05D5\u05D0 \u05E4\u05D5\u05EA\u05D7 \u05D0\u05EA \u05D3\u05E3 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D5\u05DE\u05D7\u05DB\u05D4. \u05D0\u05D7\u05E8\u05D9 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D7\u05D6\u05D5\u05E8 \u05E2\u05DC \u05D0\u05D5\u05EA\u05D4 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05D1\u05D3\u05D9\u05D5\u05E7 (\u05E4\u05E2\u05DD \u05D0\u05D7\u05EA, \u05EA\u05D5\u05DA 5 \u05D3\u05E7\u05D5\u05EA). \u05D0\u05EA\u05D4 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC \u05DC\u05D0\u05E9\u05E8 \u05D1\u05E2\u05E6\u05DE\u05DA.`,`NoData: ${P}. This step waits for the computer's owner to approve it in the browser, not here.
|
|
51
|
-
To ask: nodata_rules {action:"approve", checkpoint:"${H}"} \u2014 it opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)})}if(!u.rule.site&&u.rule.effect==="ask"&&!u.tampered&&
|
|
52
|
-
${G}`:""):
|
|
51
|
+
To ask: nodata_rules {action:"approve", checkpoint:"${H}"} \u2014 it opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)})}if(u.rule.site&&u.rule.effect==="ask"&&!u.tampered&&yn(o))return{decision:"deny",kind:"checkpoint",reason:I(`NoData: ${P}. ${ye(o)}, \u05D5\u05D4\u05DE\u05D7\u05E9\u05D1 \u05DC\u05D0 \u05DE\u05D7\u05D5\u05D1\u05E8 \u05DC-NoData \u05DB\u05D3\u05D9 \u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05EA \u05D4\u05D1\u05E2\u05DC\u05D9\u05DD \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF. \u05DC\u05DB\u05DF \u05D4\u05E6\u05E2\u05D3 \u05E0\u05D7\u05E1\u05DD. \u05D0\u05E4\u05E9\u05E8 \u05DC\u05D7\u05D1\u05E8 \u05D0\u05EA \u05D4\u05DE\u05D7\u05E9\u05D1 (nodata_connect), \u05D0\u05D5 \u05E9\u05D4\u05D0\u05D3\u05DD \u05D9\u05E2\u05E9\u05D4 \u05D0\u05EA \u05D4\u05E6\u05E2\u05D3 \u05D1\u05E2\u05E6\u05DE\u05D5.`,`NoData: ${P}. ${_n(ye(o))}, and this computer is not connected to NoData to ask its owner in the browser. So the step is refused. Connect the computer (nodata_connect), or the person takes this step themselves.`)};if(!u.rule.site&&u.rule.effect==="ask"&&!u.tampered&&yn(o)){let L=Sn(e,t,r)?.action,M=L==="read"||L==="search"||L==="run"?L:"write";return ii(ni(u.touched,r),M,e,t,P,o,ri(u.touched,e,t))}let G=u.rule.effect==="ask"?ri(u.touched,e,t):"",N=u.rule.effect==="clean_copy"?I(`NoData: ${P}. \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: ${P}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):u.rule.effect==="ask"?I(`NoData: ${P}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${P}. Allow?`)+(G?`
|
|
52
|
+
${G}`:""):I(`NoData: ${P}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD, \u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05D5\u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${P}. Your file, folder and site rules: nodata_rules.`);return{decision:u.rule.effect==="ask"?"ask":"deny",reason:N,kind:"rule"}}if(lt(e))return{decision:"allow"};let y=tc(e,t,r);if(y){let S=B(y.root),j=I(`NoData: \u05D6\u05D4 ${y.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 ${S}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${y.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.
|
|
53
53
|
\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 ${y.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${S}, where ${y.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.
|
|
54
|
-
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:j,kind:"secret_search"}}if(u?.rule.effect==="allow")return{decision:"allow"};let
|
|
54
|
+
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:j,kind:"secret_search"}}if(u?.rule.effect==="allow")return{decision:"allow"};let h=ui(e,t,r);if(h.length===0)return{decision:"allow"};let x=h.map(S=>S.line),b=I(`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:
|
|
55
55
|
${x.join(`
|
|
56
56
|
`)}
|
|
57
57
|
`+(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:
|
|
58
58
|
${x.join(`
|
|
59
59
|
`)}
|
|
60
|
-
`+(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?")),
|
|
60
|
+
`+(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?")),R=[...new Set(h.map(S=>S.kind))];return{decision:n?"deny":"ask",reason:b,kind:R[0],...R.length>1?{kinds:R}:{}}}function bc(e,t,r){let n=ui(e,t,r).map(i=>i.line);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
|
|
61
61
|
${n.join(`
|
|
62
62
|
`)}
|
|
63
|
-
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.`+(Y()==="he"?" Answer the user in Hebrew.":"")}function
|
|
64
|
-
`,{mode:384})}catch{}}function
|
|
63
|
+
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.`+(Y()==="he"?" Answer the user in Hebrew.":"")}function bi(e){try{let t=_e(V(),".nodata");si(t,{recursive:!0}),ka(_e(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
|
|
64
|
+
`,{mode:384})}catch{}}function _c(e,t){bi({tool:e,decision:t.decision,...t.kind?{kind:t.kind}:{},...t.kinds?.length?{kinds:t.kinds}:{}})}function xc(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}}function wc(e,t,r){let n=typeof r=="string"&&r?r:void 0;return e?{host:t??(n?"claude-code":"claude-desktop"),mode:n??An}:{host:t,mode:n}}async function _i(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=e.includes("--plugin"),o="";for await(let g of process.stdin)o+=g;let a;try{a=JSON.parse(o)}catch{return}let c=a.tool_name??"";if(vn(c))return;let{host:l,mode:p}=wc(s,i,a.permission_mode),d=typeof a.tool_use_id=="string"&&a.tool_use_id?a.tool_use_id:void 0;if(r){let g=await an(d,"post",()=>{lc(a.session_id,c,a.tool_input??{},a.tool_response);let u=fc(a.tool_response);return Object.keys(u).length&&bi({tool:c,leaked:Object.values(u).reduce((y,h)=>y+h,0)}),[pc(u),bc(c,a.tool_input??{},a.cwd??process.cwd())].filter(Boolean).join(`
|
|
65
65
|
|
|
66
|
-
`);f&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:f}}));return}let c=qa(a,o.tool_input??{},o.cwd??process.cwd(),t,tc(i,o),o.session_id,o.permission_mode);c.decision!=="allow"&&(ec(a,c),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:c.decision,permissionDecisionReason:c.reason}})))}var nc="claude-code",uf=` --host ${nc}`;var rc=[{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 ic(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 _e=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let s of rc)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],f=`${s.type}:${c.index}`;if(!n.has(f)){if(n.add(f),s.type==="id_number"){let d=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&d.length===9&&!ic(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 C=["GDPR","CPRA","PPL"],sc=["GDPR-9","CPRA","PPL"],oc=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...sc],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:[...C],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:[...C],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 ac(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function pi(){return oc.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(ac).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var cc=[{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 wn(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 ht=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,mt=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,gt=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function hi(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 mi(e){if(!e)return null;let t=e.trim();for(let r of cc)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var lc=[{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"]},...pi(),{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 yt(e){if(!e||/^\[[A-Z_]+(?:-\d+)?\]$/.test(e.trim()))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 lc)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>r.has(s)))return{type:n.type,label:n.type,labelHe:bt(n.type)};return null}function bt(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 gi(e){let t=0,r=0,n=0,i=0,s=0;for(let a of e)typeof a=="string"&&(wn(a)&&t++,ht.lastIndex=0,ht.test(a)&&r++,mt.lastIndex=0,mt.test(a)&&n++,gt.lastIndex=0,gt.test(a)&&i++,hi(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 dc=[{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, or Client: / Mr.).`},{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."}],uc=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function fc(e,t,r,n){if(n==="address")return{start:t,end:r};let i=uc.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}function X(e,t,r=()=>!0){let n=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let s of t.matchAll(i)){let o=s[1];if(!o||!r(o))continue;let a=(s.index??0)+s[0].indexOf(o);n.push({start:a,end:a+o.length})}return n}var yi=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,kn=String.raw`${yi}(?:[ \t]+${yi}){0,2}`,pc=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${kn})`),hc=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${kn})`),mc=new RegExp(String.raw`\b(${kn})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),gc=/^(?:Figure|Fig|Table|Step|Section|Chapter|Page|Shot|Scene|Part|Item|Note|Appendix|Version|Level|Phase|Round|Room|Floor|Line|Act|Episode|Season|Slide|Clip|Take)$/,yc=/\b(\d{1,5}[ \t]+(?:[A-Z][A-Za-z'-]*[ \t]+){1,3}(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Way|Court|Ct|Place|Pl)\b\.?)/,bc=/\b(?:policy|claim|account|member|customer|client|contract|case|reference|ref|company|registration)[ \t]+(?:number|no\.?|num\.?|#)[ \t]*:?[ \t]*([A-Z]{0,4}-?\d[\d-]{3,}\d[A-Z]?)\b/i,_c=String.raw`\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}|\d{4}[\/\-.]\d{1,2}[\/\-.]\d{1,2}|\d{1,2}\s+[A-Z][a-z]{2,8}\s+\d{4}|[A-Z][a-z]{2,8}\s+\d{1,2},?\s+\d{4}`,xc=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${_c})`,"i"),wc=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,kc=/\b((?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D])\b/,vc=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,bi=e=>e.replace(/\D/g,"").length,Sc=[{kind:"name",severity:"medium",hint:"A person's name in free text (after Mr. / Dr. / Client: \u2026, or with an age beside it).",find:e=>[...X(pc,e),...X(hc,e),...X(mc,e,t=>!gc.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>X(yc,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>X(bc,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>X(xc,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...X(wc,e),...X(kc,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>X(vc,e,t=>bi(t)>=8&&bi(t)<=15)}];function Ec(e){let t=new Map;for(let r of e){let n=t.get(r.kind);t.set(r.kind,n?{...n,find:i=>[...n.find(i),...r.find(i)]}:r)}return[...t.values()]}function _i(){let e=dc.map(({type:t,kind:r,severity:n,hint:i})=>{let s=new _e([t]);return{kind:r,severity:n,hint:i,find:o=>s.detect(o).map(a=>fc(o,a.startIndex,a.endIndex,r))}});return Ec([...e,...Sc])}var _t={_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 Ic=[{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"}],Rc=/^(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,Tc=/^(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,Cc=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function xi(e,t){if(Rc.test(e)||/^name$/i.test(e)||t&&Tc.test(t)||Cc.test(e))return null;for(let n of Ic)if(n.pattern.test(e))return n.type;let r=mi(e);return r?r.type:null}var $f=_t.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var If=512*1024,Rf=50*1024*1024;var ki={id:"critical",agent_id:"high",policy:"high",financial:"critical",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"high",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"medium",employment:"medium",education:"medium",behavior:"high"};function vi(e){return ki[e]}function Lc(e){return ki[e]??"low"}function Si(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?xi(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??yt(o)?.type??null:null,c=[];for(let f of n.rows){let d=f[s];typeof d=="string"&&d.length>0&&c.push(d)}let l=c.length>0?gi(c):null;l?r.push(wi(e,n.name,o,l.type,l.label,"value",l.matchedSample,i)):a&&r.push(wi(e,n.name,o,a,bt(a),"header",0,i))}}return r}function wi(e,t,r,n,i,s,o,a){return{file:e,location:t,column:r,type:n,label:i,category:bt(n),severity:Lc(n),matchKind:s,hits:o,sampleSize:a}}var Pc=new Set(["hex-secret-32","base64-secret"]),Nc=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\b/g];function Oc(e){let t=new _e(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:r=>{if(!e())return[];let n=t.detect(r).map(s=>({start:s.startIndex,end:s.endIndex}));for(let s of Nc){s.lastIndex=0;for(let o of r.matchAll(s))n.push({start:o.index,end:o.index+o[0].length})}n.sort((s,o)=>s.start-o.start||o.end-s.end);let i=[];for(let s of n){let o=i[i.length-1];o&&s.start<o.end?o.end=Math.max(o.end,s.end):i.push({...s})}return i}}}function Ei(e={}){let t=e.amounts??(()=>!1),r=[..._i(),Oc(t)],n=_t.rules.filter(i=>!Pc.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:r,amounts:t,header:i=>{let s=yt(i);return s?{type:s.type,label:s.labelHe||s.label}:null},secrets:n,table:i=>Si("",[i]).filter(s=>s.column).map(s=>({column:s.column,type:s.type,category:s.category,severity:s.severity,hits:s.hits,how:s.matchKind==="value"?"value":"header"})),severity:i=>vi(i)}}var Ai=!1;function $i(){Ai||(Ai=!0,xt(Ei({amounts:_r})))}$i();fi(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?"}}))});
|
|
66
|
+
`)});g.first&&g.value&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:g.value}}));return}let m=await an(d,"pre",()=>yc(c,a.tool_input??{},a.cwd??process.cwd(),t,xc(l,a),a.session_id,p)),f=m.value;f.decision!=="allow"&&(m.first&&_c(c,f),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:f.decision,permissionDecisionReason:f.reason}})))}var kc="claude-code",Hf=` --host ${kc}`;var vc=[{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 Sc(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 xe=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let s of vc)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],p=`${s.type}:${c.index}`;if(!n.has(p)){if(n.add(p),s.type==="id_number"){let d=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&d.length===9&&!Sc(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 C=["GDPR","CPRA","PPL"],Ec=["GDPR-9","CPRA","PPL"],Ac=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...C],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...C],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:[...C],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:[...C],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:[...C],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:[...C],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:[...Ec],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:[...C],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:[...C],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 $c(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function xi(){return Ac.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map($c).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var Ic=[{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 $n(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 mt=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,gt=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,yt=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function wi(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 ki(e){if(!e)return null;let t=e.trim();for(let r of Ic)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var Rc=[{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"]},...xi(),{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 bt(e){if(!e||/^\[[A-Z_]+(?:-\d+)?\]$/.test(e.trim()))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 Rc)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>r.has(s)))return{type:n.type,label:n.type,labelHe:_t(n.type)};return null}function _t(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 vi(e){let t=0,r=0,n=0,i=0,s=0;for(let a of e)typeof a=="string"&&($n(a)&&t++,mt.lastIndex=0,mt.test(a)&&r++,gt.lastIndex=0,gt.test(a)&&n++,yt.lastIndex=0,yt.test(a)&&i++,wi(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 Tc=[{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, or Client: / Mr.).`},{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."}],Cc=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function Pc(e,t,r,n){if(n==="address")return{start:t,end:r};let i=Cc.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}function X(e,t,r=()=>!0){let n=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let s of t.matchAll(i)){let o=s[1];if(!o||!r(o))continue;let a=(s.index??0)+s[0].indexOf(o);n.push({start:a,end:a+o.length})}return n}var Si=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,In=String.raw`${Si}(?:[ \t]+${Si}){0,2}`,Lc=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${In})`),Nc=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${In})`),Oc=new RegExp(String.raw`\b(${In})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),Dc=/^(?:Figure|Fig|Table|Step|Section|Chapter|Page|Shot|Scene|Part|Item|Note|Appendix|Version|Level|Phase|Round|Room|Floor|Line|Act|Episode|Season|Slide|Clip|Take)$/,Fc=/\b(\d{1,5}[ \t]+(?:[A-Z][A-Za-z'-]*[ \t]+){1,3}(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Way|Court|Ct|Place|Pl)\b\.?)/,jc=/\b(?:policy|claim|account|member|customer|client|contract|case|reference|ref|company|registration)[ \t]+(?:number|no\.?|num\.?|#)[ \t]*:?[ \t]*([A-Z]{0,4}-?\d[\d-]{3,}\d[A-Z]?)\b/i,Mc=String.raw`\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}|\d{4}[\/\-.]\d{1,2}[\/\-.]\d{1,2}|\d{1,2}\s+[A-Z][a-z]{2,8}\s+\d{4}|[A-Z][a-z]{2,8}\s+\d{1,2},?\s+\d{4}`,Hc=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${Mc})`,"i"),Uc=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,Bc=/\b((?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D])\b/,zc=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,Ei=e=>e.replace(/\D/g,"").length,Wc=[{kind:"name",severity:"medium",hint:"A person's name in free text (after Mr. / Dr. / Client: \u2026, or with an age beside it).",find:e=>[...X(Lc,e),...X(Nc,e),...X(Oc,e,t=>!Dc.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>X(Fc,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>X(jc,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>X(Hc,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...X(Uc,e),...X(Bc,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>X(zc,e,t=>Ei(t)>=8&&Ei(t)<=15)}];function Gc(e){let t=new Map;for(let r of e){let n=t.get(r.kind);t.set(r.kind,n?{...n,find:i=>[...n.find(i),...r.find(i)]}:r)}return[...t.values()]}function Ai(){let e=Tc.map(({type:t,kind:r,severity:n,hint:i})=>{let s=new xe([t]);return{kind:r,severity:n,hint:i,find:o=>s.detect(o).map(a=>Pc(o,a.startIndex,a.endIndex,r))}});return Gc([...e,...Wc])}var xt={_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 Kc=[{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"}],Zc=/^(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,Yc=/^(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,Jc=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function $i(e,t){if(Zc.test(e)||/^name$/i.test(e)||t&&Yc.test(t)||Jc.test(e))return null;for(let n of Kc)if(n.pattern.test(e))return n.type;let r=ki(e);return r?r.type:null}var np=xt.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var rp=512*1024,ip=50*1024*1024;var Ri={id:"critical",agent_id:"high",policy:"high",financial:"critical",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"high",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"medium",employment:"medium",education:"medium",behavior:"high"};function Ti(e){return Ri[e]}function qc(e){return Ri[e]??"low"}function Ci(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?$i(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??bt(o)?.type??null:null,c=[];for(let p of n.rows){let d=p[s];typeof d=="string"&&d.length>0&&c.push(d)}let l=c.length>0?vi(c):null;l?r.push(Ii(e,n.name,o,l.type,l.label,"value",l.matchedSample,i)):a&&r.push(Ii(e,n.name,o,a,_t(a),"header",0,i))}}return r}function Ii(e,t,r,n,i,s,o,a){return{file:e,location:t,column:r,type:n,label:i,category:_t(n),severity:qc(n),matchKind:s,hits:o,sampleSize:a}}var Qc=new Set(["hex-secret-32","base64-secret"]),el=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\b/g];function tl(e){let t=new xe(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:r=>{if(!e())return[];let n=t.detect(r).map(s=>({start:s.startIndex,end:s.endIndex}));for(let s of el){s.lastIndex=0;for(let o of r.matchAll(s))n.push({start:o.index,end:o.index+o[0].length})}n.sort((s,o)=>s.start-o.start||o.end-s.end);let i=[];for(let s of n){let o=i[i.length-1];o&&s.start<o.end?o.end=Math.max(o.end,s.end):i.push({...s})}return i}}}function Pi(e={}){let t=e.amounts??(()=>!1),r=[...Ai(),tl(t)],n=xt.rules.filter(i=>!Qc.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:r,amounts:t,header:i=>{let s=bt(i);return s?{type:s.type,label:s.labelHe||s.label}:null},secrets:n,table:i=>Ci("",[i]).filter(s=>s.column).map(s=>({column:s.column,type:s.type,category:s.category,severity:s.severity,hits:s.hits,how:s.matchKind==="value"?"value":"header"})),severity:i=>Ti(i)}}var Li=!1;function Ni(){Li||(Li=!0,wt(Pi({amounts:$r})))}Ni();_i(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?"}}))});
|