@nodatachat/mcp 1.3.21 → 1.3.23

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 CHANGED
@@ -1,41 +1,44 @@
1
- /*! @nodatachat/mcp 1.3.21 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
- import{appendFileSync as yi,copyFileSync as Vr,existsSync as bi,mkdirSync as _i,readFileSync as ki,statSync as xt,writeFileSync as Xr}from"node:fs";import{homedir as Fe}from"node:os";import{basename as Ne,extname as wt,isAbsolute as He,join as Le,resolve as Oe}from"node:path";var v={text:[],header:[],secrets:[],table:null};function he(e){e.table&&(v.table=e.table);for(let t of e.text??[])v.text.some(i=>i.kind===t.kind)||v.text.push(t);e.header&&!v.header.includes(e.header)&&v.header.push(e.header);for(let t of e.secrets??[])v.secrets.some(i=>i.id===t.id)||v.secrets.push(t)}function me(){return v.text}function Ue(){return v.header}function C(){return v.table}function We(){return v.secrets}var U=[{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 P(){let e=We().filter(t=>!U.some(i=>i.id===t.id));return[...U,...e]}var Mt=[{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"}],zt=[{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"}],Bt=/^(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,Ut=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(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 L(e){if(!e)return null;let t=e.trim();if(Bt.test(t)||/^name$/i.test(t))return null;let i=t.replace(/[\s-]+/g,"_");for(let n of[...zt,...Mt])if(n.pattern.test(t)||n.pattern.test(i))return{type:n.type,label:n.label};if(Ut.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(i))return{type:"name",label:"Person name"};for(let n of Ue()){let s=n(t);if(s)return{type:s.type,label:s.label}}return null}function Ke(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let i=t.padStart(9,"0"),n=0;for(let s=0;s<9;s++){let r=parseInt(i[s]??"0",10)*(s%2+1);r>9&&(r-=9),n+=r}return n%10===0&&parseInt(i,10)>0}function Wt(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let i=0,n=!1;for(let s=t.length-1;s>=0;s-=1){let r=parseInt(t[s]??"0",10);n&&(r*=2,r>9&&(r-=9)),i+=r,n=!n}return i%10===0}function Kt(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 i=t.slice(4)+t.slice(0,4),n=0;for(let s of i){let r=s>="A"&&s<="Z"?String(s.charCodeAt(0)-55):s;for(let o of r)n=(n*10+Number(o))%97}return n===1}var ge="(?<!\\d)(?<!\\d[.,])",ye="(?!\\d)(?![.,]\\d)",Ge=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${ge}\\d{9}${ye}`,"g"),validate:Ke,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(`${ge}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${ye}`,"g"),validate:Wt,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:Kt,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${ge}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${ye}`,"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 W(e,t){let i=[],n="",s=!1;for(let r=0;r<e.length;r++){let o=e[r];s?o==='"'&&e[r+1]==='"'?(n+='"',r++):o==='"'?s=!1:n+=o:o==='"'?s=!0:o===t?(i.push(n),n=""):n+=o}return i.push(n),i}import{inflateRawSync as xn}from"node:zlib";import{inflateSync as Gt}from"node:zlib";var be=new Set([".pdf"]),Ze=8*1024*1024;function Zt(e){let t=e.toString("latin1"),i=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,s;for(;(s=n.exec(t))!==null;){let r=Number(s[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 u=t.indexOf("endstream",d);u>d&&(p=e.subarray(d,u))}else l=t.slice(o,a);i.set(r,{num:r,dict:l,stream:p})}for(let r of[...i.values()]){if(!r.stream||!/\/Type\s*\/ObjStm\b/.test(r.dict))continue;let o=ke(r),a=Number(/\/N\s+(\d+)/.exec(r.dict)?.[1]??0),c=Number(/\/First\s+(\d+)/.exec(r.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],u=l[2*p+1];if(d===void 0||u===void 0||Number.isNaN(d)||Number.isNaN(u))break;let f=p+1<a?l[2*(p+1)+1]:void 0,m=o.slice(c+u,f!==void 0?c+f:void 0);i.has(d)||i.set(d,{num:d,dict:m,stream:null})}}return i}function _e(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let i=0,n=0;for(let s of t){let r=s.codePointAt(0)??0;r<32||r>=127&&r<=191||r===65533||r>=57344&&r<=63743?i+=1:/[\p{L}\p{N}]/u.test(s)&&(n+=1)}return i/t.length>.2||n/t.length<.25}function Vt(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let i=t.indexOf("~>");i>=0&&(t=t.slice(0,i));let n=[],s=0,r=0;for(let o of t){if(o==="z"&&r===0){n.push(0,0,0,0);continue}let a=o.charCodeAt(0)-33;if(a<0||a>84)return null;s=s*85+a,r+=1,r===5&&(n.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),s=0,r=0)}if(r>0){for(let a=r;a<5;a+=1)s=s*85+84;let o=[s>>>24&255,s>>>16&255,s>>>8&255,s&255];for(let a=0;a<r-1;a+=1)n.push(o[a]??0)}return Buffer.from(n)}function Xt(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",i=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(i)?Buffer.from(i,"hex"):null}function Jt(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(i=>i[1]??"")}function ke(e){if(!e.stream)return null;let t=e.stream;for(let i of Jt(e.dict)){let n=null;if(i==="FlateDecode")try{n=Gt(t)}catch{return null}else if(i==="ASCII85Decode")n=Vt(t);else if(i==="ASCIIHexDecode")n=Xt(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function qt(e){let t=new Map,i=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&&(i=2)}let s=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},r=/beginbfchar([\s\S]*?)endbfchar/g,o;for(;(o=r.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),s(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),u=parseInt(p[2]??"0",16),f=parseInt((p[3]??"0").slice(0,4)||"0",16);if(!(u-d>65535))for(let m=d;m<=u;m+=1)t.set(m,String.fromCharCode(f+(m-d)))}}return{map:t,bytes:i}}function Yt(e){let t=new Map,i=[],n=[];for(let r of e.values()){for(let o of r.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))o[1]&&n.push(o[1]);for(let o of r.dict.matchAll(/\/Font\s+(\d+)\s+\d+\s+R/g)){let a=e.get(Number(o[1]));a&&n.push(a.dict)}}let s=new Set;for(let r of n){let o=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=o.exec(r))!==null;){let c=`${a[1]}#${a[2]}`;s.has(c)||(s.add(c),i.push([a[1]??"",Number(a[2])]))}}for(let[r,o]of i){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])),u=d?ke(d):null;u&&(c=qt(u))}if(c||(c=tn(a.dict,e)),!c)continue;let p=t.get(r)??[];p.push(c),t.set(r,p)}return t}var Qt=["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 en(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 i=/^afii(\d{5})$/.exec(e);if(i){let r=Number(i[1]);if(r>=57664&&r<=57690)return String.fromCharCode(1488+(r-57664))}let n=Qt.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 tn(e,t){let i=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(i=t.get(Number(n[1]))?.dict??"");let s=/\/Differences\s*\[([^\]]*)\]/.exec(i);if(!s?.[1])return null;let r=new Map,o=0;for(let a of s[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){o=Number(a);continue}let c=en(a.slice(1));c!==null&&r.set(o,c),o+=1}return r.size?{map:r,bytes:1}:null}function qe(e){let t=[];for(let i=0;i<e.length;i+=1){let n=e[i];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let s=e[i+1];if(s===void 0)break;if(s>="0"&&s<="7"){let o="",a=i+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),i=a-1;continue}let r={n:10,r:13,t:9,b:8,f:12};t.push(r[s]??s.charCodeAt(0)&255),i+=1}return t}function Ye(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let i=2;i+1<e.length;i+=2)t+=String.fromCharCode((e[i]??0)<<8|(e[i+1]??0));return t}function Ve(e,t){let i=Ye(e);if(i!==null)return i;if(!t)return e.map(s=>String.fromCharCode(s)).join("");let n="";if(t.bytes===2)for(let s=0;s+1<e.length;s+=2){let r=(e[s]??0)<<8|(e[s+1]??0);n+=t.map.get(r)??""}else for(let s of e)n+=t.map.get(s)??String.fromCharCode(s);return n}function nn(e){let t=0;for(let i of e){let n=i.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(i)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function Xe(e,t){if(!t||t.length<=1)return Ve(e,t?.[0]);let i="",n=-1/0;for(let s of t){let r=Ve(e,s),o=nn(r);o>n&&(i=r,n=o)}return i}function sn(e,t){let i="",n="",s,r=!1,o="",a=0,c=null,l=()=>{n.trim()&&(i+=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,u;for(;(u=d.exec(e))!==null;){let f=u[0];if(u[1]!==void 0&&f.endsWith("Tf")){s=t.get(u[1]);continue}if(u[2]!==void 0){Math.abs(Number(u[3]))>.01?l():Number(u[2])!==0&&p();continue}if(u[4]!==void 0){let m=Number(u[4]);c!==null&&Math.abs(m-c)>.01?l():c!==null&&p(),c=m;continue}if(f==="T*"){l();continue}if(f==="["){r=!0;continue}if(f==="]"){r=!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+=Xe(qe(f.slice(1,-1)),s);else if(f.startsWith("<")){let m=f.slice(1,-1).replace(/\s+/g,""),h=[];for(let y=0;y+1<m.length;y+=2)h.push(parseInt(m.slice(y,y+2),16));o+=Xe(h,s)}else r&&Number(f)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),l(),i}function rn(e,t){let i=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(i),s=n?t.get(Number(n[1]))?.dict:void 0;if(!s)return"";let r=[],o=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=o.exec(s))!==null;){let c=a[2]??"";if(c.startsWith("(")){let l=qe(c.slice(1,-1));r.push(Ye(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));r.push(p)}}return r.join(`
5
- `)}var Je="\u05DD\u05DF\u05E5\u05E3\u05DA";function K(e){let t=0,i=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])Je.includes(n[0])&&(t+=1),Je.includes(n[n.length-1])&&(i+=1);return t>=3&&t>i*2}var on={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function G(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(i=>on[i]??i).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,i=>[...i].reverse().join("")):e}function Qe(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let i=Zt(e);if(i.size===0)return null;let n=Yt(i),s=[];s.push(rn(e,i));let r=0,o=0,a=!1;for(let l of i.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=ke(l);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let u=sn(d,n);if(u.trim().length!==0){if(o+=1,r+u.length>Ze){s.push(u.slice(0,Math.max(0,Ze-r))),a=!0;break}s.push(u),r+=u.length}}if(o===0)return null;let c=s.slice(1).join(`
6
- `);return _e(c)?null:(K(c)&&(c=c.split(`
7
- `).map(G).join(`
8
- `)),{text:[s[0]??"",c].join(`
9
- `),truncated:a,streams:o})}import{execFileSync as an}from"node:child_process";import{existsSync as cn,mkdtempSync as ln,readFileSync as tt,readdirSync as X,rmSync as dn,statSync as pn,writeFileSync as nt}from"node:fs";import{tmpdir as un}from"node:os";import{delimiter as fn,join as b}from"node:path";var Z=null;function et(e){try{return pn(e).isFile()}catch{return!1}}function hn(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),i=process.env.LOCALAPPDATA;for(let n of t)e.push(b(n,"Tesseract-OCR"));if(i){e.push(b(i,"Programs","Tesseract-OCR"),b(i,"Microsoft","WinGet","Links"));let n=b(i,"Microsoft","WinGet","Packages");try{for(let s of X(n))if(/^oschwartz10612\.Poppler/i.test(s))for(let r of X(b(n,s)))e.push(b(n,s,r,"Library","bin"))}catch{}}for(let n of t)try{for(let s of X(n))/^poppler/i.test(s)&&e.push(b(n,s,"Library","bin"),b(n,s,"bin"))}catch{}return e}function V(e,t){let i=process.env[t];if(i)return et(i)?i:void 0;let n=process.platform==="win32",s=n?[`${e}.exe`,e]:[e],r=(process.env.PATH??"").split(fn).filter(Boolean);n&&r.push(...hn());for(let o of r)for(let a of s)if(et(b(o,a)))return b(o,a)}function A(e,t,i){try{return an(e,t,{encoding:"utf8",timeout:i,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function xe(){if(Z)return Z;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return Z={ocrLangs:[],osd:!1};let e={pdftotext:V("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:V("pdftoppm","NODATA_PDFTOPPM"),tesseract:V("tesseract","NODATA_TESSERACT"),ocrmypdf:V("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((A(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(i=>i.trim()));e.ocrLangs=["heb","eng"].filter(i=>t.has(i)),e.osd=t.has("osd")}return Z=e}function it(e,t){let i=ln(b(un(),"nd-read-"));try{let n=b(i,"in.pdf");return nt(n,e,{mode:384}),t(i,n)}finally{dn(i,{recursive:!0,force:!0})}}function we(e){let t=e.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,"").replace(/\f/g,`
1
+ /*! @nodatachat/mcp 1.3.23 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
+ import{appendFileSync as ir,copyFileSync as qo,existsSync as Wt,mkdirSync as rr,readdirSync as sr,readFileSync as or,statSync as Ye,writeFileSync as Yo}from"node:fs";import{homedir as G}from"node:os";import{basename as Qe,extname as Vt,isAbsolute as Z,join as pe,relative as ar,resolve as k}from"node:path";var w={text:[],header:[],secrets:[],table:null};function $e(e){e.table&&(w.table=e.table);for(let t of e.text??[])w.text.some(i=>i.kind===t.kind)||w.text.push(t);e.header&&!w.header.includes(e.header)&&w.header.push(e.header);for(let t of e.secrets??[])w.secrets.some(i=>i.id===t.id)||w.secrets.push(t)}function Re(){return w.text}function rt(){return w.header}function H(){return w.table}function st(){return w.secrets}var Y=[{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 O(){let e=st().filter(t=>!Y.some(i=>i.id===t.id));return[...Y,...e]}var un=[{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"}],pn=[{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"}],fn=/^(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,hn=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(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 j(e){if(!e)return null;let t=e.trim();if(fn.test(t)||/^name$/i.test(t))return null;let i=t.replace(/[\s-]+/g,"_");for(let n of[...pn,...un])if(n.pattern.test(t)||n.pattern.test(i))return{type:n.type,label:n.label};if(hn.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(i))return{type:"name",label:"Person name"};for(let n of rt()){let r=n(t);if(r)return{type:r.type,label:r.label}}return null}function ot(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let i=t.padStart(9,"0"),n=0;for(let r=0;r<9;r++){let s=parseInt(i[r]??"0",10)*(r%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(i,10)>0}function mn(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let i=0,n=!1;for(let r=t.length-1;r>=0;r-=1){let s=parseInt(t[r]??"0",10);n&&(s*=2,s>9&&(s-=9)),i+=s,n=!n}return i%10===0}function gn(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 i=t.slice(4)+t.slice(0,4),n=0;for(let r of i){let s=r>="A"&&r<="Z"?String(r.charCodeAt(0)-55):r;for(let o of s)n=(n*10+Number(o))%97}return n===1}var Te="(?<!\\d)(?<!\\d[.,])",Ce="(?!\\d)(?![.,]\\d)",at=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${Te}\\d{9}${Ce}`,"g"),validate:ot,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(`${Te}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${Ce}`,"g"),validate:mn,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:gn,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${Te}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${Ce}`,"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 Q(e,t){let i=[],n="",r=!1;for(let s=0;s<e.length;s++){let o=e[s];r?o==='"'&&e[s+1]==='"'?(n+='"',s++):o==='"'?r=!1:n+=o:o==='"'?r=!0:o===t?(i.push(n),n=""):n+=o}return i.push(n),i}import{inflateRawSync as Kn}from"node:zlib";import{inflateSync as yn}from"node:zlib";var Pe=new Set([".pdf"]),ct=8*1024*1024;function bn(e){let t=e.toString("latin1"),i=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,r;for(;(r=n.exec(t))!==null;){let s=Number(r[1]),o=n.lastIndex,a=t.indexOf("endobj",o);if(a<0)continue;let l=t.indexOf("stream",o),c,u=null;if(l>=0&&l<a){c=t.slice(o,l);let d=l+6;t[d]==="\r"&&(d+=1),t[d]===`
3
+ `&&(d+=1);let p=t.indexOf("endstream",d);p>d&&(u=e.subarray(d,p))}else c=t.slice(o,a);i.set(s,{num:s,dict:c,stream:u})}for(let s of[...i.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),l=Number(/\/First\s+(\d+)/.exec(s.dict)?.[1]??-1);if(o===null||!a||l<0)continue;let c=o.slice(0,l).trim().split(/\s+/).map(Number);for(let u=0;u<a;u+=1){let d=c[2*u],p=c[2*u+1];if(d===void 0||p===void 0||Number.isNaN(d)||Number.isNaN(p))break;let f=u+1<a?c[2*(u+1)+1]:void 0,m=o.slice(l+p,f!==void 0?l+f:void 0);i.has(d)||i.set(d,{num:d,dict:m,stream:null})}}return i}function Le(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let i=0,n=0;for(let r of t){let s=r.codePointAt(0)??0;s<32||s>=127&&s<=191||s===65533||s>=57344&&s<=63743?i+=1:/[\p{L}\p{N}]/u.test(r)&&(n+=1)}return i/t.length>.2||n/t.length<.25}function _n(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let i=t.indexOf("~>");i>=0&&(t=t.slice(0,i));let n=[],r=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;r=r*85+a,s+=1,s===5&&(n.push(r>>>24&255,r>>>16&255,r>>>8&255,r&255),r=0,s=0)}if(s>0){for(let a=s;a<5;a+=1)r=r*85+84;let o=[r>>>24&255,r>>>16&255,r>>>8&255,r&255];for(let a=0;a<s-1;a+=1)n.push(o[a]??0)}return Buffer.from(n)}function kn(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",i=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(i)?Buffer.from(i,"hex"):null}function vn(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(i=>i[1]??"")}function De(e){if(!e.stream)return null;let t=e.stream;for(let i of vn(e.dict)){let n=null;if(i==="FlateDecode")try{n=yn(t)}catch{return null}else if(i==="ASCII85Decode")n=_n(t);else if(i==="ASCIIHexDecode")n=kn(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function xn(e){let t=new Map,i=1,n=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(n&&n[1]){let l=/<([0-9A-Fa-f]+)>/.exec(n[1]);l&&l[1]&&l[1].length>=4&&(i=2)}let r=l=>{let c="";for(let u=0;u+3<l.length+1;u+=4){let d=parseInt(l.slice(u,u+4),16);Number.isFinite(d)&&d>0&&(c+=String.fromCharCode(d))}return c},s=/beginbfchar([\s\S]*?)endbfchar/g,o;for(;(o=s.exec(e))!==null;){let l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,c;for(;(c=l.exec(o[1]??""))!==null;)t.set(parseInt(c[1]??"0",16),r(c[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(o=a.exec(e))!==null;){let l=o[1]??"",c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,u;for(;(u=c.exec(l))!==null;){let d=parseInt(u[1]??"0",16),p=parseInt(u[2]??"0",16),f=parseInt((u[3]??"0").slice(0,4)||"0",16);if(!(p-d>65535))for(let m=d;m<=p;m+=1)t.set(m,String.fromCharCode(f+(m-d)))}}return{map:t,bytes:i}}function wn(e){let t=new Map,i=[],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 r=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 l=`${a[1]}#${a[2]}`;r.has(l)||(r.add(l),i.push([a[1]??"",Number(a[2])]))}}for(let[s,o]of i){let a=e.get(o);if(!a)continue;let l=null,c=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(c){let d=e.get(Number(c[1])),p=d?De(d):null;p&&(l=xn(p))}if(l||(l=En(a.dict,e)),!l)continue;let u=t.get(s)??[];u.push(l),t.set(s,u)}return t}var Sn=["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 An(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 i=/^afii(\d{5})$/.exec(e);if(i){let s=Number(i[1]);if(s>=57664&&s<=57690)return String.fromCharCode(1488+(s-57664))}let n=Sn.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 En(e,t){let i=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(i=t.get(Number(n[1]))?.dict??"");let r=/\/Differences\s*\[([^\]]*)\]/.exec(i);if(!r?.[1])return null;let s=new Map,o=0;for(let a of r[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){o=Number(a);continue}let l=An(a.slice(1));l!==null&&s.set(o,l),o+=1}return s.size?{map:s,bytes:1}:null}function pt(e){let t=[];for(let i=0;i<e.length;i+=1){let n=e[i];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let r=e[i+1];if(r===void 0)break;if(r>="0"&&r<="7"){let o="",a=i+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),i=a-1;continue}let s={n:10,r:13,t:9,b:8,f:12};t.push(s[r]??r.charCodeAt(0)&255),i+=1}return t}function ft(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let i=2;i+1<e.length;i+=2)t+=String.fromCharCode((e[i]??0)<<8|(e[i+1]??0));return t}function lt(e,t){let i=ft(e);if(i!==null)return i;if(!t)return e.map(r=>String.fromCharCode(r)).join("");let n="";if(t.bytes===2)for(let r=0;r+1<e.length;r+=2){let s=(e[r]??0)<<8|(e[r+1]??0);n+=t.map.get(s)??""}else for(let r of e)n+=t.map.get(r)??String.fromCharCode(r);return n}function In(e){let t=0;for(let i of e){let n=i.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(i)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function dt(e,t){if(!t||t.length<=1)return lt(e,t?.[0]);let i="",n=-1/0;for(let r of t){let s=lt(e,r),o=In(s);o>n&&(i=s,n=o)}return i}function $n(e,t){let i="",n="",r,s=!1,o="",a=0,l=null,c=()=>{n.trim()&&(i+=n+`
4
+ `),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,p;for(;(p=d.exec(e))!==null;){let f=p[0];if(p[1]!==void 0&&f.endsWith("Tf")){r=t.get(p[1]);continue}if(p[2]!==void 0){Math.abs(Number(p[3]))>.01?c():Number(p[2])!==0&&u();continue}if(p[4]!==void 0){let m=Number(p[4]);l!==null&&Math.abs(m-l)>.01?c():l!==null&&u(),l=m;continue}if(f==="T*"){c();continue}if(f==="["){s=!0;continue}if(f==="]"){s=!1;continue}if(f==="TJ"||f==="Tj"||f==="'"||f==='"'){(f==="'"||f==='"')&&c(),o&&(n+=o,a=o.trim().length,o="");continue}if(f.startsWith("("))o+=dt(pt(f.slice(1,-1)),r);else if(f.startsWith("<")){let m=f.slice(1,-1).replace(/\s+/g,""),h=[];for(let y=0;y+1<m.length;y+=2)h.push(parseInt(m.slice(y,y+2),16));o+=dt(h,r)}else s&&Number(f)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),c(),i}function Rn(e,t){let i=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(i),r=n?t.get(Number(n[1]))?.dict:void 0;if(!r)return"";let s=[],o=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=o.exec(r))!==null;){let l=a[2]??"";if(l.startsWith("(")){let c=pt(l.slice(1,-1));s.push(ft(c)??c.map(u=>String.fromCharCode(u)).join(""))}else{let c=l.slice(1,-1).replace(/\s+/g,""),u="";if(c.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<c.length+1;d+=4)u+=String.fromCharCode(parseInt(c.slice(d,d+4),16));else for(let d=0;d+1<c.length;d+=2)u+=String.fromCharCode(parseInt(c.slice(d,d+2),16));s.push(u)}}return s.join(`
5
+ `)}var ut="\u05DD\u05DF\u05E5\u05E3\u05DA";function ee(e){let t=0,i=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])ut.includes(n[0])&&(t+=1),ut.includes(n[n.length-1])&&(i+=1);return t>=3&&t>i*2}var Tn={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function te(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(i=>Tn[i]??i).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,i=>[...i].reverse().join("")):e}function ht(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let i=bn(e);if(i.size===0)return null;let n=wn(i),r=[];r.push(Rn(e,i));let s=0,o=0,a=!1;for(let c of i.values()){if(!c.stream||!/\/Subtype\s*\/Form\b/.test(c.dict)&&/\/Subtype|\/Type\s*\/(XObject|Font|Metadata|ObjStm|XRef)|\/FontFile/.test(c.dict))continue;let d=De(c);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let p=$n(d,n);if(p.trim().length!==0){if(o+=1,s+p.length>ct){r.push(p.slice(0,Math.max(0,ct-s))),a=!0;break}r.push(p),s+=p.length}}if(o===0)return null;let l=r.slice(1).join(`
6
+ `);return Le(l)?null:(ee(l)&&(l=l.split(`
7
+ `).map(te).join(`
8
+ `)),{text:[r[0]??"",l].join(`
9
+ `),truncated:a,streams:o})}import{execFileSync as Cn}from"node:child_process";import{existsSync as Pn,mkdtempSync as Ln,readFileSync as gt,readdirSync as re,rmSync as Dn,statSync as Nn,writeFileSync as yt}from"node:fs";import{tmpdir as Fn}from"node:os";import{delimiter as Hn,join as b}from"node:path";var ne=null;function mt(e){try{return Nn(e).isFile()}catch{return!1}}function On(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),i=process.env.LOCALAPPDATA;for(let n of t)e.push(b(n,"Tesseract-OCR"));if(i){e.push(b(i,"Programs","Tesseract-OCR"),b(i,"Microsoft","WinGet","Links"));let n=b(i,"Microsoft","WinGet","Packages");try{for(let r of re(n))if(/^oschwartz10612\.Poppler/i.test(r))for(let s of re(b(n,r)))e.push(b(n,r,s,"Library","bin"))}catch{}}for(let n of t)try{for(let r of re(n))/^poppler/i.test(r)&&e.push(b(n,r,"Library","bin"),b(n,r,"bin"))}catch{}return e}function ie(e,t){let i=process.env[t];if(i)return mt(i)?i:void 0;let n=process.platform==="win32",r=n?[`${e}.exe`,e]:[e],s=(process.env.PATH??"").split(Hn).filter(Boolean);n&&s.push(...On());for(let o of s)for(let a of r)if(mt(b(o,a)))return b(o,a)}function C(e,t,i){try{return Cn(e,t,{encoding:"utf8",timeout:i,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function Fe(){if(ne)return ne;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return ne={ocrLangs:[],osd:!1};let e={pdftotext:ie("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:ie("pdftoppm","NODATA_PDFTOPPM"),tesseract:ie("tesseract","NODATA_TESSERACT"),ocrmypdf:ie("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((C(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(i=>i.trim()));e.ocrLangs=["heb","eng"].filter(i=>t.has(i)),e.osd=t.has("osd")}return ne=e}function bt(e,t){let i=Ln(b(Fn(),"nd-read-"));try{let n=b(i,"in.pdf");return yt(n,e,{mode:384}),t(i,n)}finally{Dn(i,{recursive:!0,force:!0})}}function He(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||_e(t)?null:K(t)?t.split(`
12
- `).map(G).join(`
13
- `):t}function mn(e){let t=xe().pdftotext;if(!t)return null;let i=it(e,(n,s)=>A(t,["-enc","UTF-8","-q",s,"-"],6e4));return i===null?null:we(i)}var gn=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function yn(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 bn(e,t){let i=yn(e);if(!i)return null;let{w:n,h:s,at:r}=i,o=e.subarray(r),[a,c]=t===180?[n,s]:[s,n],l=Buffer.alloc(a*c);for(let p=0;p<s;p++)for(let d=0;d<n;d++){let u=o[p*n+d];t===180?l[(s-1-p)*n+(n-1-d)]=u:t===90?l[d*a+(s-1-p)]=u:l[(n-1-d)*a+p]=u}return Buffer.concat([Buffer.from(`P5
14
- ${a} ${c}
11
+ `).trim();return t.replace(/\s/g,"").length<2||Le(t)?null:ee(t)?t.split(`
12
+ `).map(te).join(`
13
+ `):t}function jn(e){let t=Fe().pdftotext;if(!t)return null;let i=bt(e,(n,r)=>C(t,["-enc","UTF-8","-q",r,"-"],6e4));return i===null?null:He(i)}var Mn=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function zn(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 Bn(e,t){let i=zn(e);if(!i)return null;let{w:n,h:r,at:s}=i,o=e.subarray(s),[a,l]=t===180?[n,r]:[r,n],c=Buffer.alloc(a*l);for(let u=0;u<r;u++)for(let d=0;d<n;d++){let p=o[u*n+d];t===180?c[(r-1-u)*n+(n-1-d)]=p:t===90?c[d*a+(r-1-u)]=p:c[(n-1-d)*a+u]=p}return Buffer.concat([Buffer.from(`P5
14
+ ${a} ${l}
15
15
  255
16
- `,"latin1"),l])}function _n(e,t){if(!e.osd)return;let i=A(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(i.match(/Rotate:\s*(\d+)/)?.[1]??0),s=Number(i.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||s<2)return;let r=bn(tt(t),n);r&&nt(t,r,{mode:384})}function kn(e,t,i){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=b(t,"side.txt");return A(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,i,b(t,"out.pdf")],3e5),cn(n)?we(tt(n,"utf8")):null}function vn(e){let t=xe();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let i=gn();return it(e,(n,s)=>{if(A(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(i+1),s,b(n,"p")],12e4)===null)return null;let r=X(n).filter(l=>/^p-\d+\.pgm$/.test(l)).sort((l,p)=>Number(l.match(/\d+/)[0])-Number(p.match(/\d+/)[0])),o=r.length>i,a=[];for(let l of r.slice(0,i)){_n(t,b(n,l));let p=A(t.tesseract,[b(n,l),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);p&&a.push(p)}let c=we(a.join(`
17
- `))??kn(t,n,s);return c===null?null:{text:c,truncated:o,pages:Math.min(r.length,i)}})}function ve(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function Se(e,t={}){let i=Qe(e),n=mn(e);if(i){if(n===null)return{...i,engine:"builtin",uncertain:!1};let r=ve(i.text),o=n.split(`
18
- `).filter(p=>[...ve(p)].some(d=>!r.has(d))),a=ve(n),c=[...a].filter(p=>!r.has(p)),l=c.length>Math.max(3,a.size*.1)||c.some(p=>/^\d{5,}$/.test(p));return o.length===0?{...i,engine:"builtin",uncertain:!1}:{...i,text:i.text+`
16
+ `,"latin1"),c])}function Un(e,t){if(!e.osd)return;let i=C(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(i.match(/Rotate:\s*(\d+)/)?.[1]??0),r=Number(i.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||r<2)return;let s=Bn(gt(t),n);s&&yt(t,s,{mode:384})}function Wn(e,t,i){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=b(t,"side.txt");return C(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,i,b(t,"out.pdf")],3e5),Pn(n)?He(gt(n,"utf8")):null}function Vn(e){let t=Fe();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let i=Mn();return bt(e,(n,r)=>{if(C(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(i+1),r,b(n,"p")],12e4)===null)return null;let s=re(n).filter(c=>/^p-\d+\.pgm$/.test(c)).sort((c,u)=>Number(c.match(/\d+/)[0])-Number(u.match(/\d+/)[0])),o=s.length>i,a=[];for(let c of s.slice(0,i)){Un(t,b(n,c));let u=C(t.tesseract,[b(n,c),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);u&&a.push(u)}let l=He(a.join(`
17
+ `))??Wn(t,n,r);return l===null?null:{text:l,truncated:o,pages:Math.min(s.length,i)}})}function Ne(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function Oe(e,t={}){let i=ht(e),n=jn(e);if(i){if(n===null)return{...i,engine:"builtin",uncertain:!1};let s=Ne(i.text),o=n.split(`
18
+ `).filter(u=>[...Ne(u)].some(d=>!s.has(d))),a=Ne(n),l=[...a].filter(u=>!s.has(u)),c=l.length>Math.max(3,a.size*.1)||l.some(u=>/^\d{5,}$/.test(u));return o.length===0?{...i,engine:"builtin",uncertain:!1}:{...i,text:i.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 s=vn(e);return s?{text:s.text,truncated:s.truncated,streams:0,engine:"ocr",uncertain:!1}:null}var st=new Set([".xlsx",".xlsm",".docx",".pptx"]),Ee=8*1024*1024,wn=101010256,Sn=33639248,En=67324752;function J(e){let t=Math.min(e.length,67584),i=-1;for(let o=e.length-22;o>=e.length-t&&o>=0;o-=1)if(e.readUInt32LE(o)===wn){i=o;break}if(i<0)return null;let n=e.readUInt16LE(i+10),s=e.readUInt32LE(i+16);if(s>=e.length)return null;let r=[];for(let o=0;o<n&&!(s+46>e.length||e.readUInt32LE(s)!==Sn);o+=1){let a=e.readUInt16LE(s+10),c=e.readUInt32LE(s+20),l=e.readUInt32LE(s+24),p=e.readUInt16LE(s+28),d=e.readUInt16LE(s+30),u=e.readUInt16LE(s+32),f=e.readUInt32LE(s+42),m=e.subarray(s+46,s+46+p).toString("utf8");r.push({name:m,method:a,compSize:c,uncompSize:l,localHeaderOffset:f}),s+=46+p+d+u}return r}function q(e,t){let i=t.localHeaderOffset;if(i+30>e.length||e.readUInt32LE(i)!==En)return null;let n=e.readUInt16LE(i+26),s=e.readUInt16LE(i+28),r=i+30+n+s,o=r+t.compSize;if(o>e.length)return null;let a=e.subarray(r,o);try{if(t.method===0)return Buffer.from(a);if(t.method===8)return xn(a)}catch{return null}return null}function An(e,t){return q(e,t)?.toString("utf8")??null}var In={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function S(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>In[t]??t).replace(/&#(\d+);/g,(t,i)=>{let n=Number(i);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,i)=>{let n=parseInt(i,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function $n(e){return S(e.replace(/<[^>]*>/g,`
20
+ `),engine:"builtin",uncertain:c}}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 r=Vn(e);return r?{text:r.text,truncated:r.truncated,streams:0,engine:"ocr",uncertain:!1}:null}var _t=new Set([".xlsx",".xlsm",".docx",".pptx"]),je=8*1024*1024,Gn=101010256,Zn=33639248,Xn=67324752;function se(e){let t=Math.min(e.length,67584),i=-1;for(let o=e.length-22;o>=e.length-t&&o>=0;o-=1)if(e.readUInt32LE(o)===Gn){i=o;break}if(i<0)return null;let n=e.readUInt16LE(i+10),r=e.readUInt32LE(i+16);if(r>=e.length)return null;let s=[];for(let o=0;o<n&&!(r+46>e.length||e.readUInt32LE(r)!==Zn);o+=1){let a=e.readUInt16LE(r+10),l=e.readUInt32LE(r+20),c=e.readUInt32LE(r+24),u=e.readUInt16LE(r+28),d=e.readUInt16LE(r+30),p=e.readUInt16LE(r+32),f=e.readUInt32LE(r+42),m=e.subarray(r+46,r+46+u).toString("utf8");s.push({name:m,method:a,compSize:l,uncompSize:c,localHeaderOffset:f}),r+=46+u+d+p}return s}function oe(e,t){let i=t.localHeaderOffset;if(i+30>e.length||e.readUInt32LE(i)!==Xn)return null;let n=e.readUInt16LE(i+26),r=e.readUInt16LE(i+28),s=i+30+n+r,o=s+t.compSize;if(o>e.length)return null;let a=e.subarray(s,o);try{if(t.method===0)return Buffer.from(a);if(t.method===8)return Kn(a)}catch{return null}return null}function Jn(e,t){return oe(e,t)?.toString("utf8")??null}var qn={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function E(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>qn[t]??t).replace(/&#(\d+);/g,(t,i)=>{let n=Number(i);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,i)=>{let n=parseInt(i,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function Yn(e){return E(e.replace(/<[^>]*>/g,`
21
21
  `)).replace(/\n{2,}/g,`
22
- `)}function Tn(e,t,i){let n=new RegExp(`<${t}\\b[^>]*\\b${i}="([^"]*)"`,"g"),s=[],r;for(;(r=n.exec(e))!==null;)r[1]&&s.push(S(r[1]));return s}function Rn(e,t){let i=[];for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&i.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))&&i.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))&&i.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&i.push(n);return i}function Cn(e,t){let i=J(e);if(!i||i.length===0)return null;let n=new Map(i.map(l=>[l.name,l])),s=Rn(t,i.map(l=>l.name));if(s.length===0)return null;let r=[],o=[],a=0,c=!1;for(let l of s){if(a>=Ee){c=!0;break}let p=n.get(l);if(!p)continue;let d=An(e,p);if(d===null)continue;let u=$n(d);if(l==="xl/workbook.xml"){let f=Tn(d,"sheet","name");f.length&&(u+=`
22
+ `)}function Qn(e,t,i){let n=new RegExp(`<${t}\\b[^>]*\\b${i}="([^"]*)"`,"g"),r=[],s;for(;(s=n.exec(e))!==null;)s[1]&&r.push(E(s[1]));return r}function ei(e,t){let i=[];for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&i.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))&&i.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))&&i.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&i.push(n);return i}function ti(e,t){let i=se(e);if(!i||i.length===0)return null;let n=new Map(i.map(c=>[c.name,c])),r=ei(t,i.map(c=>c.name));if(r.length===0)return null;let s=[],o=[],a=0,l=!1;for(let c of r){if(a>=je){l=!0;break}let u=n.get(c);if(!u)continue;let d=Jn(e,u);if(d===null)continue;let p=Yn(d);if(c==="xl/workbook.xml"){let f=Qn(d,"sheet","name");f.length&&(p+=`
23
23
  `+f.join(`
24
- `))}a+u.length>Ee&&(u=u.slice(0,Math.max(0,Ee-a)),c=!0),u.trim().length!==0&&(r.push(u),o.push(l),a+=u.length)}return r.length===0?null:{text:r.join(`
25
- `),truncated:c,parts:o}}function Y(e,t,i={}){if(st.has(t))return Cn(e,t);if(be.has(t)){let n=Se(e,i);return n?{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}:null}return null}var Pn=new Set([...st,...be]);import{deflateRawSync as Nn}from"node:zlib";var rt={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},Ln=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,Dn=[...Ge].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function D(e,t,i=1){e[t]=(e[t]??0)+i}var ot=null,F=e=>{let t=e.trim();ot&&t&&ot.add(t)};function w(e,t={}){let i=e;for(let n of P()){let s=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g");i=i.replace(s,r=>(D(t,"secret"),F(r),"[SECRET]"))}for(let n of Dn)n.pattern.lastIndex=0,i=i.replace(n.pattern,s=>n.validate(s)?(D(t,n.subkind),F(s),rt[n.subkind]??`[${n.subkind.toUpperCase()}]`):s);i=i.replace(Ln,n=>(D(t,"email"),F(n),rt.email));for(let n of me()){let s=n.find(i).sort((r,o)=>o.start-r.start);for(let r of s)F(i.slice(r.start,r.end)),i=i.slice(0,r.start)+`[${n.kind.toUpperCase()}]`+i.slice(r.end),D(t,n.kind)}return{text:i,counts:t,columnsHidden:[]}}function Ae(){let e=new Map,t={};return(i,n)=>{F(n);let s=`${i}\0${n.trim()}`,r=e.get(s);return r===void 0&&(r=t[i]=(t[i]??0)+1,e.set(s,r)),`[${i.toUpperCase()}-${r}]`}}function Ie(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var ct=/^\s*-?\d+(?:\.\d+)?\s*$/;function $e(e){let t=new Set;for(let[i,n]of e){let s=n.filter(o=>ct.test(o));if(s.length<3)continue;s.filter(o=>w(o).text!==o).length/s.length<.5&&t.add(i)}return t}function at(e,t){return e.includes(t)||e.includes('"')||e.includes(`
26
- `)?`"${e.replace(/"/g,'""')}"`:e}function Fn(e){let t=(e.match(/\t/g)??[]).length,i=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=i?" ":i>n?";":","}function Te(e,t){let i=e.split(/\r?\n/),n=t??Fn(i[0]??""),s=W(i[0]??"",n),r=s.map(f=>L(f)),o={},a=Ae(),c=i.slice(1).map(f=>f===""?null:W(f,n)),l=new Map;for(let f of c)f?.forEach((m,h)=>l.set(h,[...l.get(h)??[],m]));let p=$e(l),d=C();if(d){let f=c.filter(m=>m!==null).slice(0,200);for(let m of d({name:"table",headers:s,rows:f})){let h=s.indexOf(m.column);h>=0&&!(m.how==="header"&&p.has(h))&&(r[h]={type:m.type,label:m.category})}}let u=[s.map(f=>at(f,n)).join(n)];for(let f of c){if(f===null){u.push("");continue}let m=f.map((h,y)=>{let _=r[y];return _&&h.trim()!==""&&!Ie(h)?(D(o,`column:${_.type}`),a(_.type,h)):p.has(y)&&ct.test(h)?h:w(h,o).text});u.push(m.map(h=>at(h,n)).join(n))}return{text:u.join(`
27
- `),counts:o,columnsHidden:s.filter((f,m)=>r[m])}}var Hn=/^xl\/(pivotCache|charts|externalLinks)\//,pt=10;function On(e,t,i=1){e[t]=(e[t]??0)+i}function ut(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ft(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),i="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))i+=n[1];return S(i)}function jn(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>ft(t[1]??"")):[]}var ht=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Q(e,t){let i=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return i?i[1]:null}function I(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?ft(n[1]):null}if(e.type==="b"||e.type==="e")return null;let i=/<v>([^<]*)<\/v>/.exec(e.inner);return i?S(i[1]):null}function Mn(e){let t=[];for(let i of e.matchAll(ht)){let n=Q(i[1],"r"),s=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!s)return null;t.push({full:i[0],attrs:i[1],inner:i[2]??"",col:s[1],row:Number(s[2]),type:Q(i[1],"t")??"n"})}return t}function zn(e,t){let i=[...new Set(e.map(n=>n.row))].sort((n,s)=>n-s).slice(0,pt);for(let n of i){let s=new Map;for(let r of e.filter(o=>o.row===n)){let o=I(r,t),a=o?L(o):null;a&&s.set(r.col,{type:a.type,header:o.trim()})}if(s.size>0)return{row:n,cols:s}}return{row:-1,cols:new Map}}var Bn=/^xl\/worksheets\/sheet\d+\.xml$/,Un=200;function Wn(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function Kn(e,t){let i=[...new Set(e.map(r=>r.row))].sort((r,o)=>r-o).slice(0,pt),n=-1,s=-1/0;for(let r of i){let o=e.filter(l=>l.row===r).map(l=>(I(l,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(l=>!Wn(l)).length,c=a*2-(o.length-a);c>s&&(s=c,n=r)}return n}function Gn(e,t,i){let n=zn(t,i),s=C();if(!s)return n;let r=n.row>=0?n.row:Kn(t,i);if(r<0)return n;let o=t.filter(d=>d.row===r).map(d=>({col:d.col,text:(I(d,i)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,u)=>[d.col,u])),c=new Map;for(let d of t){if(d.row<=r)continue;let u=a.get(d.col);if(u!==void 0){if(!c.has(d.row)){if(c.size>=Un)continue;c.set(d.row,o.map(()=>""))}c.get(d.row)[u]=I(d,i)??""}}let l=new Map(r===n.row?n.cols:[]),p=o.map(d=>d.text);for(let d of s({name:e,headers:p,rows:[...c.values()]})){let u=p.indexOf(d.column);u<0||l.set(o[u].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:r,cols:l}}function lt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${ut(t)}</t></is></c>`}var Zn=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let i=t;for(let n=0;n<8;n+=1)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i>>>0}return e})();function Vn(e){let t=4294967295;for(let i=0;i<e.length;i+=1)t=Zn[(t^e[i])&255]^t>>>8;return(t^4294967295)>>>0}var dt=33;function mt(e){let t=[],i=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),c=o.name.endsWith("/"),l=c?Buffer.alloc(0):Nn(o.data),p=c?0:8,d=c?0:Vn(o.data),u=Buffer.alloc(30);u.writeUInt32LE(67324752,0),u.writeUInt16LE(20,4),u.writeUInt16LE(2048,6),u.writeUInt16LE(p,8),u.writeUInt16LE(dt,12),u.writeUInt32LE(d,14),u.writeUInt32LE(l.length,18),u.writeUInt32LE(o.data.length,22),u.writeUInt16LE(a.length,26),t.push(u,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(dt,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),i.push(f,a),n+=u.length+a.length+l.length}let s=Buffer.concat(i),r=Buffer.alloc(22);return r.writeUInt32LE(101010256,0),r.writeUInt16LE(e.length,8),r.writeUInt16LE(e.length,10),r.writeUInt32LE(s.length,12),r.writeUInt32LE(n,16),Buffer.concat([...t,s,r])}function Re(e){let t=J(e);if(!t||t.length===0||t.some(h=>Hn.test(h.name)))return null;let i=new Map;for(let h of t){if(h.name.endsWith("/")){i.set(h.name,Buffer.alloc(0));continue}let y=q(e,h);if(!y)return null;i.set(h.name,y)}let n=[...i.keys()].filter(h=>Bn.test(h));if(n.length===0)return null;let s=i.get("xl/sharedStrings.xml")?.toString("utf8")??null,r=jn(s),o=new Set,a={},c=new Set,l=Ae();for(let h of n){let y=i.get(h).toString("utf8"),_=Mn(y);if(!_)return null;let ce=Gn(h.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),_,r),M=ce.row,T=new Map;for(let k of _){if(k.type!=="n"||k.row<=M)continue;let x=I(k,r);x!==null&&T.set(k.col,[...T.get(k.col)??[],x])}let z=$e(T),B=new Map;for(let[k,{type:x,header:le,how:de}]of ce.cols)de==="header"&&z.has(k)||(B.set(k,x),c.add(le));let Ot=y.replace(ht,(k,x,le)=>{let de=Q(x,"r"),[,pe,jt]=/^([A-Z]+)(\d+)$/.exec(de),R={full:k,attrs:x,inner:le??"",col:pe,row:Number(jt),type:Q(x,"t")??"n"},E=I(R,r),ue=()=>{if(R.type==="s"){let Be=/<v>([^<]*)<\/v>/.exec(R.inner);Be&&o.add(Number(Be[1]))}return k};if(E===null||E.trim()==="")return ue();let fe=B.get(pe);if(fe&&R.row>M&&!Ie(E))return On(a,`column:${fe}`),lt(x,l(fe,E));if(R.type==="n"&&z.has(pe))return ue();let ze=w(E,a);return ze.text===E?ue():lt(x,ze.text)});i.set(h,Buffer.from(Ot,"utf8"))}if(s){let h=-1,y=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,_=>(h+=1,o.has(h)?_:"<si><t></t></si>"));i.set("xl/sharedStrings.xml",Buffer.from(y,"utf8"))}for(let h of[...i.keys()].filter(y=>/^xl\/comments\d*\.xml$/.test(y))){let _=i.get(h).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(ce,M,T,z)=>{let B=w(S(T),a);return`${M}${ut(B.text)}${z}`});i.set(h,Buffer.from(_,"utf8"))}let p=i.get("docProps/core.xml");if(p){let h=p.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");i.set("docProps/core.xml",Buffer.from(h,"utf8"))}let d=i.get("xl/workbook.xml");if(d){let h=d.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");i.set("xl/workbook.xml",Buffer.from(h,"utf8"))}let u=i.get("docProps/app.xml");if(u){let h=u.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");i.set("docProps/app.xml",Buffer.from(h,"utf8"))}let f=i.has("xl/calcChain.xml"),m=t.map(h=>h.name).filter(h=>!(f&&h==="xl/calcChain.xml"));if(f)for(let h of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let y=i.get(h);y&&i.set(h,Buffer.from(y.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:mt(m.map(h=>({name:h,data:i.get(h)}))),counts:a,columnsHidden:[...c]}}var N=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,Xn=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,Jn=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Ce(e){let t=0;for(let i of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(i);if(!n||!Xn.test(n[1])||Jn.test(n[1]))continue;let s=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");s.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(s)&&t++}return t}var Vs=64*1024*1024,Xs=32*1024;var Js=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 ti=["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."],g=(e,t,i)=>({provider:e,url:t,steps:[...i,...ti]}),ni={"aws-access-key":g("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":g("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":g("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":g("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":g("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":g("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":g("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":g("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":g("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":g("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":g("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":g("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":g("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":g("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":g("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":g("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":g("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":g("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":g("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":g("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":g("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":g("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":g("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":g("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":g("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":g("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":g("An access token","",["Revoke the token in the service that issued it and issue a new one."])},ii=g("A credential","",["Find the service it belongs to and issue a new credential there."]);function Pe(e){return ni[e]??ii}function gt(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)}import{existsSync as si,mkdirSync as Nr,readFileSync as ri,statSync as yt,writeFileSync as Hr}from"node:fs";import{homedir as oi}from"node:os";import{join as ai}from"node:path";var ci=()=>ai(oi(),".nodata","flagged.json");function li(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var H=null;function di(){let e=ci();try{if(!si(e))return{};let t=yt(e).mtimeMs;if(H&&H.path===e&&H.mtimeMs===t)return H.store;let i=JSON.parse(ri(e,"utf8"));return H={path:e,mtimeMs:t,store:i},i}catch{return{}}}function ee(e){let t=di()[li(e)];if(!t)return null;try{if(yt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}return t.kinds}import{existsSync as pi,mkdirSync as Br,readFileSync as ui,writeFileSync as Ur}from"node:fs";import{homedir as fi}from"node:os";import{join as hi}from"node:path";var bt=()=>hi(fi(),".nodata","prefs.json");function mi(){try{let e=pi(bt())?JSON.parse(ui(bt(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function gi(){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 O(){return mi()??gi()}function $(e,t,i=O()){return i==="he"?e:t}var vi=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".xlsx",".xlsm",".docx",".pptx",".pdf"]),xi=50*1024*1024,wi=8,Si={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function je(e){let t=Ne(e).toLowerCase();return vi.has(wt(t))||N.test(t)}var Ei=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,Ai=/\.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)\b/i;function De(e){let t=Le(Fe(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!Ei.test(n)}function Ii(e){return Ai.test(e)}function $i(e){return je(e)||ee(e)!==null}var te=class extends Error{};function Ti(e){let t=wt(e).toLowerCase(),i=ki(e),n,s;if(t===".csv"||t===".tsv")s=i.toString("utf8"),n=Te(s,t===".tsv"?" ":void 0).counts;else if(t===".xlsx"||t===".xlsm"||t===".docx"||t===".pptx"||t===".pdf"){let o=t===".xlsx"||t===".xlsm"?Re(i):null,a=Y(i,t);if(!a&&!o)throw new te;s=a?.text??"",n=o?o.counts:w(s).counts}else s=i.toString("utf8"),n=w(s).counts;let r=U.filter(o=>o.pattern.test(s)).length;return N.test(Ne(e).toLowerCase())&&(r=Math.max(r,Ce(s))),r&&(n.secret=Math.max(n.secret??0,r)),n}var Ri={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 St(e){let t=O()==="he",i=n=>(t?Ri[n]:Si[n])??n;return Object.entries(e).sort((n,s)=>s[1]-n[1]).map(([n,s])=>`${s} ${n.startsWith("column:")?`${i(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:i(n)}`).join(", ")}function Ci(e){return St(e)}function Et(e,t,i){let n=r=>He(r)?r:Oe(i,r),s=r=>{try{return xt(r).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&s(n(t.path)))return[n(t.path)];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let r=t.command,o=[...[...r.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...r.matchAll(/'([^']*)'/g)].map(c=>c[1]),...r.split(/[\s|;&<>(),=`]+/)],a=[];for(let c of o){let l=c.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,Fe()).replace(/^\/([a-zA-Z])\//,(d,u)=>process.platform==="win32"?`${u}:/`:d);if(!l)continue;let p=n(l);if(!(!je(l)&&!De(p)&&ee(p)===null)&&(s(p)&&!a.includes(p)&&a.push(p),a.length>=wi))break}return a}return[]}function j(e){return e.replace(/\\+/g,"/")}function Pi(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 At(e,t,i){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&Pi(t.command))return n;for(let s of Et(e,t,i)){if(!$i(s)||gt(s)||!bi(s))continue;let r,o=je(s)?null:ee(s);if(o){r=`${j(s)}: ${$("\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 ${Ci(o)}`,n.push(r);continue}try{if(xt(s).size>xi)r=`${j(s)}: too large to check here (over 50 MB)`;else{let a=Ti(s);if(Object.keys(a).length===0)continue;r=`${j(s)}: ${St(a)}`}}catch(a){r=a instanceof te?`${j(s)}: ${$("\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")}`:`${j(s)}: could not be checked`}n.push(r)}return n}var _t=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,kt=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,Li=[[/^(?: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"],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],Di=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Fi=/^(?: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,Ni=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function Hi(e,t,i){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&_t.test((He(n)?n:Oe(i,n)).replace(/\\/g,"/")))return`a saved login (${Ne(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let s=t.command.split(/(\|\||&&|[;|\n])/);for(let r=0;r<s.length;r+=2){let o=s[r+1]==="|",a=s[r].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Fi.test(a)&&_t.test(a))return"a saved login file";for(let[l,p]of Li)if(l.test(a))return p;let c=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(c&&(!c[1]||kt.test(c[1])))return c[1]?`the variable ${c[1]}`:"every environment variable";if(!o&&(Di.test(a)||/GetEnvironmentVariable/i.test(a)))for(let l of a.matchAll(Ni)){let p=l[1]??l[2]??l[3]??l[4]??"";if(kt.test(p))return`the variable ${p}`}}return null}function Oi(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 i={};for(let n of P()){let s=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),r=(t.match(s)??[]).length;r&&(i[n.id]=(i[n.id]??0)+r)}return i}function ji(e){let t=Object.keys(e);if(t.length===0)return null;let i=t.reduce((s,r)=>s+e[r],0),n=[...new Set(t.map(s=>{let r=Pe(s);return r.url?`${r.provider}: ${r.url}`:r.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${i}: ${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.`+(O()==="he"?" Answer the user in Hebrew.":"")}function Mi(e,t,i){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",s=e==="Grep"&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&Ii(n)||s&&De(He(s)?s:Oe(i,s))||Et(e,t,i).some(De)?$("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function zi(e,t,i,n){let s=Mi(e,t,i);if(s)return{decision:"deny",reason:s};let r=Hi(e,t,i);if(r){let c=$(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${r}. \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.
28
- \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 ${r}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
29
- 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:c}}let o=At(e,t,i);if(o.length===0)return{decision:"allow"};let a=$(`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:
30
- ${o.join(`
24
+ `))}a+p.length>je&&(p=p.slice(0,Math.max(0,je-a)),l=!0),p.trim().length!==0&&(s.push(p),o.push(c),a+=p.length)}return s.length===0?null:{text:s.join(`
25
+ `),truncated:l,parts:o}}function ae(e,t,i={}){if(_t.has(t))return ti(e,t);if(Pe.has(t)){let n=Oe(e,i);return n?{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}:null}return null}var ni=new Set([..._t,...Pe]);import{deflateRawSync as oi}from"node:zlib";var kt={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},ii=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,ri=[...at].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function M(e,t,i=1){e[t]=(e[t]??0)+i}var vt=null,z=e=>{let t=e.trim();vt&&t&&vt.add(t)};function A(e,t={}){let i=e;for(let n of O()){let r=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g");i=i.replace(r,s=>(M(t,"secret"),z(s),"[SECRET]"))}for(let n of ri)n.pattern.lastIndex=0,i=i.replace(n.pattern,r=>n.validate(r)?(M(t,n.subkind),z(r),kt[n.subkind]??`[${n.subkind.toUpperCase()}]`):r);i=i.replace(ii,n=>(M(t,"email"),z(n),kt.email));for(let n of Re()){let r=n.find(i).sort((s,o)=>o.start-s.start);for(let s of r)z(i.slice(s.start,s.end)),i=i.slice(0,s.start)+`[${n.kind.toUpperCase()}]`+i.slice(s.end),M(t,n.kind)}return{text:i,counts:t,columnsHidden:[]}}function Me(){let e=new Map,t={};return(i,n)=>{z(n);let r=`${i}\0${n.trim()}`,s=e.get(r);return s===void 0&&(s=t[i]=(t[i]??0)+1,e.set(r,s)),`[${i.toUpperCase()}-${s}]`}}function ze(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var wt=/^\s*-?\d+(?:\.\d+)?\s*$/;function Be(e){let t=new Set;for(let[i,n]of e){let r=n.filter(o=>wt.test(o));if(r.length<3)continue;r.filter(o=>A(o).text!==o).length/r.length<.5&&t.add(i)}return t}function xt(e,t){return e.includes(t)||e.includes('"')||e.includes(`
26
+ `)?`"${e.replace(/"/g,'""')}"`:e}function si(e){let t=(e.match(/\t/g)??[]).length,i=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=i?" ":i>n?";":","}function Ue(e,t){let i=e.split(/\r?\n/),n=t??si(i[0]??""),r=Q(i[0]??"",n),s=r.map(f=>j(f)),o={},a=Me(),l=i.slice(1).map(f=>f===""?null:Q(f,n)),c=new Map;for(let f of l)f?.forEach((m,h)=>c.set(h,[...c.get(h)??[],m]));let u=Be(c),d=H();if(d){let f=l.filter(m=>m!==null).slice(0,200);for(let m of d({name:"table",headers:r,rows:f})){let h=r.indexOf(m.column);h>=0&&!(m.how==="header"&&u.has(h))&&(s[h]={type:m.type,label:m.category})}}let p=[r.map(f=>xt(f,n)).join(n)];for(let f of l){if(f===null){p.push("");continue}let m=f.map((h,y)=>{let v=s[y];return v&&h.trim()!==""&&!ze(h)?(M(o,`column:${v.type}`),a(v.type,h)):u.has(y)&&wt.test(h)?h:A(h,o).text});p.push(m.map(h=>xt(h,n)).join(n))}return{text:p.join(`
27
+ `),counts:o,columnsHidden:r.filter((f,m)=>s[m])}}var ai=/^xl\/(pivotCache|charts|externalLinks)\//,Et=10;function ci(e,t,i=1){e[t]=(e[t]??0)+i}function It(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function $t(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),i="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))i+=n[1];return E(i)}function li(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>$t(t[1]??"")):[]}var Rt=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function ce(e,t){let i=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return i?i[1]:null}function P(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?$t(n[1]):null}if(e.type==="b"||e.type==="e")return null;let i=/<v>([^<]*)<\/v>/.exec(e.inner);return i?E(i[1]):null}function di(e){let t=[];for(let i of e.matchAll(Rt)){let n=ce(i[1],"r"),r=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!r)return null;t.push({full:i[0],attrs:i[1],inner:i[2]??"",col:r[1],row:Number(r[2]),type:ce(i[1],"t")??"n"})}return t}function ui(e,t){let i=[...new Set(e.map(n=>n.row))].sort((n,r)=>n-r).slice(0,Et);for(let n of i){let r=new Map;for(let s of e.filter(o=>o.row===n)){let o=P(s,t),a=o?j(o):null;a&&r.set(s.col,{type:a.type,header:o.trim()})}if(r.size>0)return{row:n,cols:r}}return{row:-1,cols:new Map}}var pi=/^xl\/worksheets\/sheet\d+\.xml$/,fi=200;function hi(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function mi(e,t){let i=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,Et),n=-1,r=-1/0;for(let s of i){let o=e.filter(c=>c.row===s).map(c=>(P(c,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(c=>!hi(c)).length,l=a*2-(o.length-a);l>r&&(r=l,n=s)}return n}function gi(e,t,i){let n=ui(t,i),r=H();if(!r)return n;let s=n.row>=0?n.row:mi(t,i);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(P(d,i)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,p)=>[d.col,p])),l=new Map;for(let d of t){if(d.row<=s)continue;let p=a.get(d.col);if(p!==void 0){if(!l.has(d.row)){if(l.size>=fi)continue;l.set(d.row,o.map(()=>""))}l.get(d.row)[p]=P(d,i)??""}}let c=new Map(s===n.row?n.cols:[]),u=o.map(d=>d.text);for(let d of r({name:e,headers:u,rows:[...l.values()]})){let p=u.indexOf(d.column);p<0||c.set(o[p].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:c}}function St(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${It(t)}</t></is></c>`}var yi=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let i=t;for(let n=0;n<8;n+=1)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i>>>0}return e})();function bi(e){let t=4294967295;for(let i=0;i<e.length;i+=1)t=yi[(t^e[i])&255]^t>>>8;return(t^4294967295)>>>0}var At=33;function Tt(e){let t=[],i=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),l=o.name.endsWith("/"),c=l?Buffer.alloc(0):oi(o.data),u=l?0:8,d=l?0:bi(o.data),p=Buffer.alloc(30);p.writeUInt32LE(67324752,0),p.writeUInt16LE(20,4),p.writeUInt16LE(2048,6),p.writeUInt16LE(u,8),p.writeUInt16LE(At,12),p.writeUInt32LE(d,14),p.writeUInt32LE(c.length,18),p.writeUInt32LE(o.data.length,22),p.writeUInt16LE(a.length,26),t.push(p,a,c);let f=Buffer.alloc(46);f.writeUInt32LE(33639248,0),f.writeUInt16LE(20,4),f.writeUInt16LE(20,6),f.writeUInt16LE(2048,8),f.writeUInt16LE(u,10),f.writeUInt16LE(At,14),f.writeUInt32LE(d,16),f.writeUInt32LE(c.length,20),f.writeUInt32LE(o.data.length,24),f.writeUInt16LE(a.length,28),f.writeUInt32LE(n,42),i.push(f,a),n+=p.length+a.length+c.length}let r=Buffer.concat(i),s=Buffer.alloc(22);return s.writeUInt32LE(101010256,0),s.writeUInt16LE(e.length,8),s.writeUInt16LE(e.length,10),s.writeUInt32LE(r.length,12),s.writeUInt32LE(n,16),Buffer.concat([...t,r,s])}function We(e){let t=se(e);if(!t||t.length===0||t.some(h=>ai.test(h.name)))return null;let i=new Map;for(let h of t){if(h.name.endsWith("/")){i.set(h.name,Buffer.alloc(0));continue}let y=oe(e,h);if(!y)return null;i.set(h.name,y)}let n=[...i.keys()].filter(h=>pi.test(h));if(n.length===0)return null;let r=i.get("xl/sharedStrings.xml")?.toString("utf8")??null,s=li(r),o=new Set,a={},l=new Set,c=Me();for(let h of n){let y=i.get(h).toString("utf8"),v=di(y);if(!v)return null;let xe=gi(h.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),v,s),X=xe.row,N=new Map;for(let x of v){if(x.type!=="n"||x.row<=X)continue;let S=P(x,s);S!==null&&N.set(x.col,[...N.get(x.col)??[],S])}let J=Be(N),q=new Map;for(let[x,{type:S,header:we,how:Se}]of xe.cols)Se==="header"&&J.has(x)||(q.set(x,S),l.add(we));let ln=y.replace(Rt,(x,S,we)=>{let Se=ce(S,"r"),[,Ae,dn]=/^([A-Z]+)(\d+)$/.exec(Se),F={full:x,attrs:S,inner:we??"",col:Ae,row:Number(dn),type:ce(S,"t")??"n"},T=P(F,s),Ee=()=>{if(F.type==="s"){let it=/<v>([^<]*)<\/v>/.exec(F.inner);it&&o.add(Number(it[1]))}return x};if(T===null||T.trim()==="")return Ee();let Ie=q.get(Ae);if(Ie&&F.row>X&&!ze(T))return ci(a,`column:${Ie}`),St(S,c(Ie,T));if(F.type==="n"&&J.has(Ae))return Ee();let nt=A(T,a);return nt.text===T?Ee():St(S,nt.text)});i.set(h,Buffer.from(ln,"utf8"))}if(r){let h=-1,y=r.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,v=>(h+=1,o.has(h)?v:"<si><t></t></si>"));i.set("xl/sharedStrings.xml",Buffer.from(y,"utf8"))}for(let h of[...i.keys()].filter(y=>/^xl\/comments\d*\.xml$/.test(y))){let v=i.get(h).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(xe,X,N,J)=>{let q=A(E(N),a);return`${X}${It(q.text)}${J}`});i.set(h,Buffer.from(v,"utf8"))}let u=i.get("docProps/core.xml");if(u){let h=u.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");i.set("docProps/core.xml",Buffer.from(h,"utf8"))}let d=i.get("xl/workbook.xml");if(d){let h=d.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");i.set("xl/workbook.xml",Buffer.from(h,"utf8"))}let p=i.get("docProps/app.xml");if(p){let h=p.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");i.set("docProps/app.xml",Buffer.from(h,"utf8"))}let f=i.has("xl/calcChain.xml"),m=t.map(h=>h.name).filter(h=>!(f&&h==="xl/calcChain.xml"));if(f)for(let h of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let y=i.get(h);y&&i.set(h,Buffer.from(y.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:Tt(m.map(h=>({name:h,data:i.get(h)}))),counts:a,columnsHidden:[...l]}}var L=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,_i=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,ki=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Ve(e){let t=0;for(let i of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(i);if(!n||!_i.test(n[1])||ki.test(n[1]))continue;let r=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");r.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(r)&&t++}return t}var Us=64*1024*1024,Ws=32*1024;var Vs=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 Ai=["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."],g=(e,t,i)=>({provider:e,url:t,steps:[...i,...Ai]}),Ei={"aws-access-key":g("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":g("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":g("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":g("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":g("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":g("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":g("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":g("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":g("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":g("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":g("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":g("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":g("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":g("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":g("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":g("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":g("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":g("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":g("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":g("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":g("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":g("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":g("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":g("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":g("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":g("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":g("An access token","",["Revoke the token in the service that issued it and issue a new one."])},Ii=g("A credential","",["Find the service it belongs to and issue a new credential there."]);function Ke(e){return Ei[e]??Ii}function Ct(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)}import{existsSync as $i,mkdirSync as Po,readFileSync as Ri,statSync as Pt,writeFileSync as Lo}from"node:fs";import{homedir as Ti}from"node:os";import{join as Ci}from"node:path";var Pi=()=>Ci(Ti(),".nodata","flagged.json");function Li(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var B=null;function Di(){let e=Pi();try{if(!$i(e))return{};let t=Pt(e).mtimeMs;if(B&&B.path===e&&B.mtimeMs===t)return B.store;let i=JSON.parse(Ri(e,"utf8"));return B={path:e,mtimeMs:t,store:i},i}catch{return{}}}function le(e){let t=Di()[Li(e)];if(!t)return null;try{if(Pt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}return t.kinds}import{existsSync as Ni,mkdirSync as Oo,readFileSync as Fi,writeFileSync as jo}from"node:fs";import{homedir as Hi}from"node:os";import{join as Oi}from"node:path";var Lt=()=>Oi(Hi(),".nodata","prefs.json");function ji(){try{let e=Ni(Lt())?JSON.parse(Fi(Lt(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function Mi(){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 D(){return ji()??Mi()}function _(e,t,i=D()){return i==="he"?e:t}import{createHmac as Bi,randomBytes as Ui}from"node:crypto";import{existsSync as ue,mkdirSync as Wi,readdirSync as Vi,readFileSync as Ge,writeFileSync as Ki}from"node:fs";import{homedir as W}from"node:os";import{basename as Gi,extname as Zi,isAbsolute as Xi,join as V,relative as Ji,resolve as qi}from"node:path";function I(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function zi(e,t,i){return t===null||i===null?!1:t<=i?e>=t&&e<=i:e>=t||e<=i}function Dt(e,t,i){switch(t){case"eq":return e===i;case"ne":return e!==i;case"in":return Array.isArray(i)&&i.includes(e);case"not_in":return Array.isArray(i)&&!i.includes(e);case"prefix":return typeof e=="string"&&typeof i=="string"&&e.toLowerCase().startsWith(i.toLowerCase());case"gte":{let n=I(e),r=I(i);return n!==null&&r!==null&&n>=r}case"lte":{let n=I(e),r=I(i);return n!==null&&r!==null&&n<=r}case"between":{let n=I(e);return n!==null&&Array.isArray(i)&&i.length===2&&zi(n,I(i[0]),I(i[1]))}default:return!1}}function Nt(e,t,i){switch(t){case"in":return Array.isArray(i)&&e.some(n=>i.includes(n));case"not_in":return Array.isArray(i)&&!e.some(n=>i.includes(n));default:return!1}}var Ft=()=>V(W(),".nodata","rules.json"),de=()=>V(W(),".nodata","rules-key"),Ht={allow:0,ask:1,clean_copy:2,deny:3},Yi={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write"],label:"what the agent does (read, search, run, write)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>Zi(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Gi(e.path).toLowerCase()}};function Qi(){try{if(ue(de())){let t=Ge(de(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=Ui(32);return Wi(V(W(),".nodata"),{recursive:!0}),Ki(de(),e.toString("hex")+`
28
+ `,{mode:384}),e}var er=(e,t)=>Bi("sha256",t).update(JSON.stringify(e)).digest("hex");function Ot(){if(!ue(Ft()))return{rules:[],tampered:!1};try{let e=JSON.parse(Ge(Ft(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],i=ue(de())&&typeof e.mac=="string"&&e.mac===er(t,Qi());return{rules:t,tampered:!i}}catch{return{rules:[],tampered:!0}}}var U=e=>{let t=qi(e.replace(/^~(?=[\\/]|$)/,W())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function $(e,t){if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),r=U(t).toLowerCase();return r.endsWith("/"+n)||r.includes("/"+n+"/")}let i=Ji(U(e),U(t));return i===""||!i.startsWith("..")&&!Xi(i)}function jt(e,t){let i=Yi[e.field];if(!i)return!1;let n=i.extract(t);return e.op==="exists"?n!==void 0&&n!=="":n===void 0?!1:i.cardinality==="set"?Nt(Array.isArray(n)?n:[],e.op,e.value):Dt(n,e.op,e.value)}function Ze(e,t){let i=e.map((n,r)=>({rule:n,n:r+1})).filter(n=>$(n.rule.path,t.path)).sort((n,r)=>U(r.rule.path).length-U(n.rule.path).length||n.n-r.n);for(let n of i)if((n.rule.when??[]).every(r=>jt(r,t)))return{...n,touched:t.path};return null}function Xe(e,t,i,n){let r=null;for(let[s,o]of e.entries())$(o.path,t)||(o.path.startsWith("**/")?!tr(t,o.path):!$(t,o.path))||(o.when??[]).every(a=>jt(a,{action:i,path:o.path,now:n}))&&(!r||Ht[o.effect]>Ht[r.rule.effect])&&(r={rule:o,n:s+1,touched:o.path});return r}function tr(e,t){let i=0,n=(r,s)=>{if(s>5||i>4e3)return!1;let o;try{o=Vi(r,{withFileTypes:!0})}catch{return!1}for(let a of o){if(++i>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let l=V(r,a.name);if($(t,l)||n(l,s+1))return!0}return!1};return n(e,0)}var nr={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};var Mt=(e,t=!1)=>nr[e][t?1:0];function zt(){try{let e=V(W(),".nodata","org-mandate.json");if(!ue(e))return[];let t=JSON.parse(Ge(e,"utf8"));return Array.isArray(t.folder_rules)?t.folder_rules:[]}catch{return[]}}var cr=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".xlsx",".xlsm",".docx",".pptx",".pdf"]),lr=50*1024*1024,dr=8,ur={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function et(e){let t=Qe(e).toLowerCase();return cr.has(Vt(t))||L.test(t)}var pr=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,fr=/\.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)\b/i;function K(e){let t=pe(G(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!pr.test(n)}function hr(e){return fr.test(e)}function mr(e){return et(e)||le(e)!==null}var fe=class extends Error{};function gr(e){let t=Vt(e).toLowerCase(),i=or(e),n,r;if(t===".csv"||t===".tsv")r=i.toString("utf8"),n=Ue(r,t===".tsv"?" ":void 0).counts;else if(t===".xlsx"||t===".xlsm"||t===".docx"||t===".pptx"||t===".pdf"){let o=t===".xlsx"||t===".xlsm"?We(i):null,a=ae(i,t);if(!a&&!o)throw new fe;r=a?.text??"",n=o?o.counts:A(r).counts}else r=i.toString("utf8"),n=A(r).counts;let s=Y.filter(o=>o.pattern.test(r)).length;return L.test(Qe(e).toLowerCase())&&(s=Math.max(s,Ve(r))),s&&(n.secret=Math.max(n.secret??0,s)),n}var yr={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 Kt(e){let t=D()==="he",i=n=>(t?yr[n]:ur[n])??n;return Object.entries(e).sort((n,r)=>r[1]-n[1]).map(([n,r])=>`${r} ${n.startsWith("column:")?`${i(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:i(n)}`).join(", ")}function br(e){return Kt(e)}function Gt(e,t,i){let n=s=>Z(s)?s:k(i,s),r=s=>{try{return Ye(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"&&r(n(t.path)))return[n(t.path)];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let s=t.command,o=[...[...s.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...s.matchAll(/'([^']*)'/g)].map(l=>l[1]),...s.split(/[\s|;&<>(),=`]+/)],a=[];for(let l of o){let c=l.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,G()).replace(/^\/([a-zA-Z])\//,(d,p)=>process.platform==="win32"?`${p}:/`:d);if(!c)continue;let u=n(c);if(!(!et(c)&&!K(u)&&le(u)===null)&&(r(u)&&!a.includes(u)&&a.push(u),a.length>=dr))break}return a}return[]}function R(e){return e.replace(/\\+/g,"/")}function _r(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 Zt(e,t,i){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&_r(t.command))return n;for(let r of Gt(e,t,i)){if(!mr(r)||Ct(r)||!Wt(r))continue;let s,o=et(r)?null:le(r);if(o){s=`${R(r)}: ${_("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${br(o)}`,n.push(s);continue}try{if(Ye(r).size>lr)s=`${R(r)}: too large to check here (over 50 MB)`;else{let a=gr(r);if(Object.keys(a).length===0)continue;s=`${R(r)}: ${Kt(a)}`}}catch(a){s=a instanceof fe?`${R(r)}: ${_("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`:`${R(r)}: could not be checked`}n.push(s)}return n}var Je=/(?:\.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,he=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,kr=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^(?:npx\s+(?:-y\s+)?@nodatachat\/mcp(?:@\S+)?|nodata-mcp)\s+(?:secrets-run|secrets-login)\b|^node\s+\S*nodata-pull\.mjs\b/i,"the vault's secrets, outside nodata_run's approval and each key's policy"],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],vr=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Xt=/^(?: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,xr=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function wr(e,t,i){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&Je.test((Z(n)?n:k(i,n)).replace(/\\/g,"/")))return`a saved login (${Qe(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let r=t.command.split(/(\|\||&&|[;|\n])/);for(let s=0;s<r.length;s+=2){let o=r[s+1]==="|",a=r[s].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Xt.test(a)&&Je.test(a))return"a saved login file";for(let[c,u]of kr)if(c.test(a))return u;let l=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(l&&(!l[1]||he.test(l[1])))return l[1]?`the variable ${l[1]}`:"every environment variable";if(!o&&(vr.test(a)||/GetEnvironmentVariable/i.test(a)))for(let c of a.matchAll(xr)){let u=c[1]??c[2]??c[3]??c[4]??"";if(he.test(u))return`the variable ${u}`}}return null}var Jt=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,Sr=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,Ar=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),Bt=4e3,Er=5;function Ir(e){let t=0,i=0,n=(r,s)=>{if(s>Er||t>Bt)return;let o;try{o=sr(r,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>Bt)return;let l=pe(r,a.name);a.isDirectory()?Ar.has(a.name)||n(l,s+1):(L.test(a.name.toLowerCase())||Je.test(l.replace(/\\/g,"/"))||K(l))&&i++}};return n(e,0),i}var me=e=>{try{return Ye(e).isDirectory()}catch{return!1}};function $r(e,t){let i=ar(k(t),k(e));return i===""||!i.startsWith("..")&&!Z(i)}function Rr(e,t,i){let n=s=>k(i,s.replace(/^~(?=[\\/]|$)/,G())),r=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):k(i);if(me(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");r.push({roots:[s],bySecret:he.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)&&!(Jt.test(o)&&(Sr.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let c=o.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(me);r.push({roots:c.length?c:[k(i)],bySecret:he.test(o)||/\.env\b/i.test(o)})}for(let s of r)for(let o of s.roots){if(!s.bySecret&&$r(o,i))continue;let a=Ir(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var qe=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function Tr(e,t,i){let n=r=>k(i,r.replace(/^~(?=[\\/]|$)/,G()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(qe.has(e)){let r=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return r?{action:"write",paths:[n(r)],roots:[]}:null}if(e==="Grep"){let r=typeof t.path=="string"&&t.path?n(t.path):k(i);return{action:"search",paths:[r],roots:me(r)?[r]:[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let r=t.command,o=[...[...r.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...r.matchAll(/'([^']*)'/g)].map(c=>c[1]),...r.split(/[\s|;&<>(),=`]+/)].map(c=>c.trim()).filter(c=>c&&!c.startsWith("-")&&/[\\/.~]/.test(c)).map(n).filter(c=>Wt(c)),a=r.split(/\|\||&&|[;|\n]/).some(c=>Jt.test(c.trim())||/^find\b/i.test(c.trim())),l=o.filter(me);return{action:a?"search":Xt.test(r.trim())?"read":"run",paths:[k(i),...o],roots:a?l.length?l:[k(i)]:[]}}return null}function Cr(e,t,i,n=new Date){let r=Tr(e,t,i);if(!r)return null;let{rules:s,tampered:o}=Ot(),a=zt();if(!s.length&&!a.length)return null;let l={allow:0,ask:1,clean_copy:2,deny:3},c=null;for(let d of r.paths){let p=Ze(a,{action:r.action,path:d,now:n});p&&(!c||l[p.rule.effect]>l[c.rule.effect])&&(c={...p,org:!0})}for(let d of r.roots){let p=Xe(a,d,r.action,n);p&&p.rule.effect!=="allow"&&(!c||l[p.rule.effect]>l[c.rule.effect])&&(c={...p,org:!0})}let u=Pr(s,o,r,n,l);return c&&(!u||l[c.rule.effect]>=l[u.rule.effect])?c:u}function Pr(e,t,i,n,r){if(!e.length)return null;if(t){for(let o of i.paths){let a=e.find(l=>$(l.path,o)||$(o,l.path));if(a)return{rule:{...a,effect:"deny",when:[]},n:e.indexOf(a)+1,touched:o,tampered:!0}}return null}let s=null;for(let o of i.paths){let a=Ze(e,{action:i.action,path:o,now:n});a&&(!s||r[a.rule.effect]>r[s.rule.effect])&&(s=a)}for(let o of i.roots){let a=Xe(e,o,i.action,n);a&&a.rule.effect!=="allow"&&(!s||r[a.rule.effect]>r[s.rule.effect])&&(s=a)}return s}function Lr(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 i={};for(let n of O()){let r=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),s=(t.match(r)??[]).length;s&&(i[n.id]=(i[n.id]??0)+s)}return i}function Dr(e){let t=Object.keys(e);if(t.length===0)return null;let i=t.reduce((r,s)=>r+e[s],0),n=[...new Set(t.map(r=>{let s=Ke(r);return s.url?`${s.provider}: ${s.url}`:s.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${i}: ${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.`+(D()==="he"?" Answer the user in Hebrew.":"")}function Nr(e,t,i){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",r=e==="Grep"&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&hr(n)||r&&K(Z(r)?r:k(i,r))||Gt(e,t,i).some(K)?_("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function Fr(e,t,i,n){let r=Nr(e,t,i);if(r)return{decision:"deny",reason:r};let s=wr(e,t,i);if(s){let u=_(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${s}. \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.
29
+ \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 ${s}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
30
+ 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:u}}if(qe.has(e)){let u=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if(u&&K(Z(u)?u:k(i,u)))return{decision:"deny",reason:_("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 o=Cr(e,t,i);if(o&&o.rule.effect!=="allow"){let u=D()==="he",d=o.tampered?_("\u05E7\u05D5\u05D1\u05E5 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05D5\u05E0\u05D4 \u05E9\u05DC\u05D0 \u05D3\u05E8\u05DA nodata_rules, \u05D5\u05DC\u05DB\u05DF \u05DB\u05DC \u05E0\u05EA\u05D9\u05D1 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8 \u05E2\u05D3 \u05E9\u05EA\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9.","the rules file was changed outside nodata_rules, so every path it names is closed until you save the rules again."):`${o.org?_("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):_("\u05DB\u05DC\u05DC","rule")} ${o.n}: ${o.rule.path.startsWith("**/")?o.rule.path:R(o.rule.path)} \u2192 ${Mt(o.rule.effect,u)}${o.rule.note?` (${o.rule.note})`:""}`,p=o.rule.effect==="clean_copy"?_(`NoData: ${d}. \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: ${d}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):o.rule.effect==="ask"?_(`NoData: ${d}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${d}. Allow?`):_(`NoData: ${d}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD \u05D5\u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${d}. Your file and folder rules: nodata_rules.`);return{decision:o.rule.effect==="ask"?"ask":"deny",reason:p}}if(qe.has(e))return{decision:"allow"};let a=Rr(e,t,i);if(a){let u=R(a.root),d=_(`NoData: \u05D6\u05D4 ${a.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 ${u}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${a.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.
31
+ \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 ${a.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${u}, where ${a.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.
32
+ 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:d}}if(o?.rule.effect==="allow")return{decision:"allow"};let l=Zt(e,t,i);if(l.length===0)return{decision:"allow"};let c=_(`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:
33
+ ${l.join(`
31
34
  `)}
32
35
  `+(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:
33
- ${o.join(`
36
+ ${l.join(`
34
37
  `)}
35
- `+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?"));return{decision:n?"deny":"ask",reason:a}}function Bi(e,t,i){let n=At(e,t,i);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
38
+ `+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?"));return{decision:n?"deny":"ask",reason:c}}function Hr(e,t,i){let n=Zt(e,t,i);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
36
39
  ${n.join(`
37
40
  `)}
38
- 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.`+(O()==="he"?" Answer the user in Hebrew.":"")}function vt(e){try{let t=Le(Fe(),".nodata");_i(t,{recursive:!0}),yi(Le(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
39
- `,{mode:384})}catch{}}async function It(e){let t=e.includes("--block"),i=e.includes("--post"),n="";for await(let a of process.stdin)n+=a;let s;try{s=JSON.parse(n)}catch{return}let r=s.tool_name??"";if(i){let a=Oi(s.tool_response);Object.keys(a).length&&vt({tool:r,leaked:Object.values(a).reduce((l,p)=>l+p,0)});let c=[ji(a),Bi(r,s.tool_input??{},s.cwd??process.cwd())].filter(Boolean).join(`
41
+ 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.`+(D()==="he"?" Answer the user in Hebrew.":"")}function Ut(e){try{let t=pe(G(),".nodata");rr(t,{recursive:!0}),ir(pe(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
42
+ `,{mode:384})}catch{}}async function qt(e){let t=e.includes("--block"),i=e.includes("--post"),n="";for await(let a of process.stdin)n+=a;let r;try{r=JSON.parse(n)}catch{return}let s=r.tool_name??"";if(i){let a=Lr(r.tool_response);Object.keys(a).length&&Ut({tool:s,leaked:Object.values(a).reduce((c,u)=>c+u,0)});let l=[Dr(a),Hr(s,r.tool_input??{},r.cwd??process.cwd())].filter(Boolean).join(`
40
43
 
41
- `);c&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:c}}));return}let o=zi(r,s.tool_input??{},s.cwd??process.cwd(),t);o.decision!=="allow"&&(vt({tool:r,decision:o.decision}),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:o.decision,permissionDecisionReason:o.reason}})))}var Ui=[{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 Wi(e){if(e.length!==9)return!1;let t=e.split("").map(Number),i=0;for(let n=0;n<9;n++){let s=t[n]*(n%2===0?1:2);s>9&&(s-=9),i+=s}return i%10===0}var ne=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let i=[],n=new Set;for(let r of Ui)if(this.enabledTypes.has(r.type))for(let o of r.patterns){let a=new RegExp(o.source,o.flags),c;for(;(c=a.exec(t))!==null;){let l=c[0],p=`${r.type}:${c.index}`;if(!n.has(p)){if(n.add(p),r.type==="id_number"){let d=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&d.length===9&&!Wi(d))continue}i.push({type:r.type,value:l,startIndex:c.index,endIndex:c.index+l.length,confidence:r.confidence,replacement:r.replacement(l,r.type)})}}}i.sort((r,o)=>r.startIndex-o.startIndex||o.confidence-r.confidence);let s=[];for(let r of i)s.some(a=>r.startIndex<a.endIndex&&r.endIndex>a.startIndex)||s.push(r);return s}};var Ki=[{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 Me(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let i=t.padStart(9,"0"),n=0;for(let s=0;s<9;s++){let r=parseInt(i[s]??"0",10)*(s%2+1);r>9&&(r-=9),n+=r}return n%10===0&&parseInt(i,10)>0}var ie=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,se=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,re=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function $t(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let i=0,n=!1;for(let s=t.length-1;s>=0;s--){let r=t.charCodeAt(s)-48;if(r<0||r>9)return!1;n&&(r*=2,r>9&&(r-=9)),i+=r,n=!n}return i%10===0}function Tt(e){if(!e)return null;let t=e.trim();for(let i of Ki)if(i.pattern.test(t))return{type:i.type,label:i.label,labelHe:i.labelHe};return null}var Gi=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function oe(e){if(!e)return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let i=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of Gi)if(n.phrases?.some(r=>t.includes(r))||n.tokens?.some(r=>i.has(r)))return{type:n.type,label:n.type,labelHe:ae(n.type)};return null}function ae(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function Rt(e){let t=0,i=0,n=0,s=0,r=0;for(let a of e)typeof a=="string"&&(Me(a)&&t++,ie.lastIndex=0,ie.test(a)&&i++,se.lastIndex=0,se.test(a)&&n++,re.lastIndex=0,re.test(a)&&s++,$t(a)&&r++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:s/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:s}:i/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:i}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:r/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:r}:null}var Ct={_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 Xi=[{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"}],Ji=/^(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,qi=/^(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,Yi=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function Pt(e,t){if(Ji.test(e)||/^name$/i.test(e)||t&&qi.test(t)||Yi.test(e))return null;for(let n of Xi)if(n.pattern.test(e))return n.type;let i=Tt(e);return i?i.type:null}var co=Ct.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var lo=512*1024,po=50*1024*1024;var Qi={id:"high",agent_id:"high",policy:"high",financial:"high",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"medium",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"low"};function es(e){return Qi[e]??"low"}function Dt(e,t){let i=[];for(let n of t){let s=n.rows.length;for(let r=0;r<n.headers.length;r++){let o=n.headers[r]??"",a=o?Pt(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??oe(o)?.type??null:null,c=[];for(let p of n.rows){let d=p[r];typeof d=="string"&&d.length>0&&c.push(d)}let l=c.length>0?Rt(c):null;l?i.push(Lt(e,n.name,o,l.type,l.label,"value",l.matchedSample,s)):a&&i.push(Lt(e,n.name,o,a,ae(a),"header",0,s))}}return i}function Lt(e,t,i,n,s,r,o,a){return{file:e,location:t,column:i,type:n,label:s,category:ae(n),severity:es(n),matchKind:r,hits:o,sampleSize:a}}var Ft={_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 ns=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],is=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function ss(e,t,i,n){if(n==="address")return{start:t,end:i};let s=is.exec(e.slice(t,i));return s&&t+s[0].length<i?{start:t+s[0].length,end:i}:{start:t,end:i}}var rs=new Set(["hex-secret-32","base64-secret"]),Nt=!1;function Ht(){if(Nt)return;Nt=!0;let e=ns.map(({type:i,kind:n,severity:s,hint:r})=>{let o=new ne([i]);return{kind:n,severity:s,hint:r,find:a=>o.detect(a).map(c=>ss(a,c.startIndex,c.endIndex,n))}}),t=Ft.rules.filter(i=>!rs.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));he({text:e,header:i=>{let n=oe(i);return n?{type:n.type,label:n.labelHe||n.label}:null},secrets:t,table:i=>Dt("",[i]).filter(n=>n.column).map(n=>({column:n.column,type:n.type,category:n.category,severity:n.severity,hits:n.hits,how:n.matchKind==="value"?"value":"header"}))})}Ht();It(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?"}}))});
44
+ `);l&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:l}}));return}let o=Fr(s,r.tool_input??{},r.cwd??process.cwd(),t);o.decision!=="allow"&&(Ut({tool:s,decision:o.decision}),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:o.decision,permissionDecisionReason:o.reason}})))}var Or=[{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 jr(e){if(e.length!==9)return!1;let t=e.split("").map(Number),i=0;for(let n=0;n<9;n++){let r=t[n]*(n%2===0?1:2);r>9&&(r-=9),i+=r}return i%10===0}var ge=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let i=[],n=new Set;for(let s of Or)if(this.enabledTypes.has(s.type))for(let o of s.patterns){let a=new RegExp(o.source,o.flags),l;for(;(l=a.exec(t))!==null;){let c=l[0],u=`${s.type}:${l.index}`;if(!n.has(u)){if(n.add(u),s.type==="id_number"){let d=c.replace(/\D/g,"");if(/^\d{9}$/.test(c)&&d.length===9&&!jr(d))continue}i.push({type:s.type,value:c,startIndex:l.index,endIndex:l.index+c.length,confidence:s.confidence,replacement:s.replacement(c,s.type)})}}}i.sort((s,o)=>s.startIndex-o.startIndex||o.confidence-s.confidence);let r=[];for(let s of i)r.some(a=>s.startIndex<a.endIndex&&s.endIndex>a.startIndex)||r.push(s);return r}};var Mr=[{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 tt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let i=t.padStart(9,"0"),n=0;for(let r=0;r<9;r++){let s=parseInt(i[r]??"0",10)*(r%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(i,10)>0}var ye=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,be=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,_e=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function Yt(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let i=0,n=!1;for(let r=t.length-1;r>=0;r--){let s=t.charCodeAt(r)-48;if(s<0||s>9)return!1;n&&(s*=2,s>9&&(s-=9)),i+=s,n=!n}return i%10===0}function Qt(e){if(!e)return null;let t=e.trim();for(let i of Mr)if(i.pattern.test(t))return{type:i.type,label:i.label,labelHe:i.labelHe};return null}var zr=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function ke(e){if(!e)return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let i=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of zr)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>i.has(s)))return{type:n.type,label:n.type,labelHe:ve(n.type)};return null}function ve(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function en(e){let t=0,i=0,n=0,r=0,s=0;for(let a of e)typeof a=="string"&&(tt(a)&&t++,ye.lastIndex=0,ye.test(a)&&i++,be.lastIndex=0,be.test(a)&&n++,_e.lastIndex=0,_e.test(a)&&r++,Yt(a)&&s++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:r/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:r}:i/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:i}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:s/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:s}:null}var tn={_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 Wr=[{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"}],Vr=/^(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,Kr=/^(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,Gr=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function nn(e,t){if(Vr.test(e)||/^name$/i.test(e)||t&&Kr.test(t)||Gr.test(e))return null;for(let n of Wr)if(n.pattern.test(e))return n.type;let i=Qt(e);return i?i.type:null}var pa=tn.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var fa=512*1024,ha=50*1024*1024;var Zr={id:"high",agent_id:"high",policy:"high",financial:"high",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"medium",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"low"};function Xr(e){return Zr[e]??"low"}function sn(e,t){let i=[];for(let n of t){let r=n.rows.length;for(let s=0;s<n.headers.length;s++){let o=n.headers[s]??"",a=o?nn(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??ke(o)?.type??null:null,l=[];for(let u of n.rows){let d=u[s];typeof d=="string"&&d.length>0&&l.push(d)}let c=l.length>0?en(l):null;c?i.push(rn(e,n.name,o,c.type,c.label,"value",c.matchedSample,r)):a&&i.push(rn(e,n.name,o,a,ve(a),"header",0,r))}}return i}function rn(e,t,i,n,r,s,o,a){return{file:e,location:t,column:i,type:n,label:r,category:ve(n),severity:Xr(n),matchKind:s,hits:o,sampleSize:a}}var on={_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 qr=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],Yr=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function Qr(e,t,i,n){if(n==="address")return{start:t,end:i};let r=Yr.exec(e.slice(t,i));return r&&t+r[0].length<i?{start:t+r[0].length,end:i}:{start:t,end:i}}var es=new Set(["hex-secret-32","base64-secret"]),an=!1;function cn(){if(an)return;an=!0;let e=qr.map(({type:i,kind:n,severity:r,hint:s})=>{let o=new ge([i]);return{kind:n,severity:r,hint:s,find:a=>o.detect(a).map(l=>Qr(a,l.startIndex,l.endIndex,n))}}),t=on.rules.filter(i=>!es.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));$e({text:e,header:i=>{let n=ke(i);return n?{type:n.type,label:n.labelHe||n.label}:null},secrets:t,table:i=>sn("",[i]).filter(n=>n.column).map(n=>({column:n.column,type:n.type,category:n.category,severity:n.severity,hits:n.hits,how:n.matchKind==="value"?"value":"header"}))})}cn();qt(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?"}}))});