[{"data":1,"prerenderedAt":502},["ShallowReactive",2],{"rule-btoa-pii":3},{"id":4,"title":5,"body":6,"breadcrumb":466,"coderail":473,"dateModified":492,"datePublished":492,"description":493,"extension":494,"meta":495,"navigation":314,"next":492,"path":496,"prev":492,"schemaType":497,"seo":498,"stem":499,"wide":500,"__hash__":501},"docs\u002Frules\u002Fbtoa-pii.md","Base64 encoding used for PII",{"type":7,"value":8,"toc":458},"minimark",[9,16,58,63,78,82,100,104,326,330,357,361,426,430,454],[10,11,12],"p",{},[13,14,15],"strong",{},"Summary",[17,18,19,30,40,46,52],"ul",{},[20,21,22,25,26],"li",{},[13,23,24],{},"rule_id"," — ",[27,28,29],"code",{},"btoa-pii",[20,31,32,35,36,39],{},[13,33,34],{},"purpose"," — Detect ",[27,37,38],{},"btoa()"," calls in Custom HTML tags that may be encoding PII",[20,41,42,45],{},[13,43,44],{},"effect"," — Reversible \"encoding\" of user identifiers; not a substitute for hashing",[20,47,48,51],{},[13,49,50],{},"layer"," — container",[20,53,54,57],{},[13,55,56],{},"reversibility"," — non-destructive",[59,60,62],"h2",{"id":61},"what-fires-this","What fires this",[10,64,65,66,69,70,73,74,77],{},"The rule checks active Custom HTML tags for ",[27,67,68],{},"codeAnalysis.hasBtoa",", set by the parser when it detects a ",[27,71,72],{},"btoa("," call in the tag code. Every tag with a ",[27,75,76],{},"btoa"," call is flagged — the rule does not distinguish PII encoding from legitimate uses (binary transport, opaque tokens). Manual triage is required when this rule fires. Paused tags are excluded.",[59,79,81],{"id":80},"why-it-matters","Why it matters",[10,83,84,85,88,89,92,93,96,97,99],{},"Base64 is encoding, not encryption. ",[27,86,87],{},"btoa('user@example.com')"," produces ",[27,90,91],{},"dXNlckBleGFtcGxlLmNvbQ==",", reversible in one step via ",[27,94,95],{},"atob()",". Any platform, vendor, or breach recipient receiving the encoded value can recover the original PII. The combination of ",[27,98,76],{}," in a tracking-tag context is a strong signal of an engineer encoding user identifiers before sending them to analytics. Use SHA-256 hashing for one-way transformation. Regulatory: GDPR Art. 5, Art. 32.",[59,101,103],{"id":102},"example","Before \u002F after",[105,106,107,157],"compare",{},[108,109,111],"compare-col",{"label":110},"Before — flagged",[112,113,118],"pre",{"className":114,"code":115,"language":116,"meta":117,"style":117},"language-js shiki shiki-themes github-light github-dark","dataLayer.push({\n  user_id: btoa(user.email)  \u002F\u002F reversible — flagged\n})\n","js","",[27,119,120,136,151],{"__ignoreMap":117},[121,122,125,129,133],"span",{"class":123,"line":124},"line",1,[121,126,128],{"class":127},"sVt8B","dataLayer.",[121,130,132],{"class":131},"sScJk","push",[121,134,135],{"class":127},"({\n",[121,137,139,142,144,147],{"class":123,"line":138},2,[121,140,141],{"class":127},"  user_id: ",[121,143,76],{"class":131},[121,145,146],{"class":127},"(user.email)  ",[121,148,150],{"class":149},"sJ8bj","\u002F\u002F reversible — flagged\n",[121,152,154],{"class":123,"line":153},3,[121,155,156],{"class":127},"})\n",[108,158,160],{"label":159},"After — fixed",[112,161,163],{"className":114,"code":162,"language":116,"meta":117,"style":117},"const buf = await crypto.subtle.digest(\n  'SHA-256',\n  new TextEncoder().encode(user.email)\n)\nconst hex = Array.from(new Uint8Array(buf))\n  .map(b => b.toString(16).padStart(2, '0')).join('')\n\ndataLayer.push({ user_id: hex })\n",[27,164,165,190,199,216,222,250,309,316],{"__ignoreMap":117},[121,166,167,171,175,178,181,184,187],{"class":123,"line":124},[121,168,170],{"class":169},"szBVR","const",[121,172,174],{"class":173},"sj4cs"," buf",[121,176,177],{"class":169}," =",[121,179,180],{"class":169}," await",[121,182,183],{"class":127}," crypto.subtle.",[121,185,186],{"class":131},"digest",[121,188,189],{"class":127},"(\n",[121,191,192,196],{"class":123,"line":138},[121,193,195],{"class":194},"sZZnC","  'SHA-256'",[121,197,198],{"class":127},",\n",[121,200,201,204,207,210,213],{"class":123,"line":153},[121,202,203],{"class":169},"  new",[121,205,206],{"class":131}," TextEncoder",[121,208,209],{"class":127},"().",[121,211,212],{"class":131},"encode",[121,214,215],{"class":127},"(user.email)\n",[121,217,219],{"class":123,"line":218},4,[121,220,221],{"class":127},")\n",[121,223,225,227,230,232,235,238,241,244,247],{"class":123,"line":224},5,[121,226,170],{"class":169},[121,228,229],{"class":173}," hex",[121,231,177],{"class":169},[121,233,234],{"class":127}," Array.",[121,236,237],{"class":131},"from",[121,239,240],{"class":127},"(",[121,242,243],{"class":169},"new",[121,245,246],{"class":131}," Uint8Array",[121,248,249],{"class":127},"(buf))\n",[121,251,253,256,259,261,265,268,271,274,276,279,282,285,287,290,293,296,299,302,304,307],{"class":123,"line":252},6,[121,254,255],{"class":127},"  .",[121,257,258],{"class":131},"map",[121,260,240],{"class":127},[121,262,264],{"class":263},"s4XuR","b",[121,266,267],{"class":169}," =>",[121,269,270],{"class":127}," b.",[121,272,273],{"class":131},"toString",[121,275,240],{"class":127},[121,277,278],{"class":173},"16",[121,280,281],{"class":127},").",[121,283,284],{"class":131},"padStart",[121,286,240],{"class":127},[121,288,289],{"class":173},"2",[121,291,292],{"class":127},", ",[121,294,295],{"class":194},"'0'",[121,297,298],{"class":127},")).",[121,300,301],{"class":131},"join",[121,303,240],{"class":127},[121,305,306],{"class":194},"''",[121,308,221],{"class":127},[121,310,312],{"class":123,"line":311},7,[121,313,315],{"emptyLinePlaceholder":314},true,"\n",[121,317,319,321,323],{"class":123,"line":318},8,[121,320,128],{"class":127},[121,322,132],{"class":131},[121,324,325],{"class":127},"({ user_id: hex })\n",[59,327,329],{"id":328},"remediation","Remediation",[331,332,333,339,342,348,351,354],"ol",{},[20,334,335,336,338],{},"Open each flagged tag and identify what is passed to ",[27,337,38],{},".",[20,340,341],{},"Determine whether the value is a user identifier (email, user ID, phone) or non-PII (binary, opaque token).",[20,343,344,345,281],{},"If PII: replace with SHA-256 (",[27,346,347],{},"crypto.subtle.digest",[20,349,350],{},"If non-PII: add a code comment documenting the purpose.",[20,352,353],{},"Verify the destination platform receives the correct hashed value.",[20,355,356],{},"If the data should not be collected at all, remove the call.",[59,358,360],{"id":359},"metadata","Metadata",[362,363,366,367,372,366,376,380,366,383,387,366,390,393,366,396,400,366,403,407,366,413,416,366,419,423],"dl",{"className":364},[365],"spec-list","\n  ",[368,369,371],"dt",{"id":370},"severity","Severity",[373,374,375],"dd",{},"high",[368,377,379],{"id":378},"tier","Tier",[373,381,382],{},"error",[368,384,386],{"id":385},"category","Category",[373,388,389],{},"pii",[368,391,392],{"id":50},"Layer",[373,394,395],{},"container",[368,397,399],{"id":398},"version","Version",[373,401,402],{},"1",[368,404,406],{"id":405},"effort","Effort",[373,408,409,412],{},[27,410,411],{},"2hr"," (about 2 hours)",[368,414,415],{"id":56},"Reversibility",[373,417,418],{},"non-destructive",[368,420,422],{"id":421},"regulatory","Regulatory",[373,424,425],{},"GDPR Art. 5 (data minimization), GDPR Art. 32 (security of processing)",[59,427,429],{"id":428},"see-also","See also",[17,431,432,440,447],{},[20,433,434,439],{},[435,436,438],"a",{"href":437},"\u002Fcategories\u002Fpii\u002F","PII rules"," — other rules in this category",[20,441,442,446],{},[435,443,445],{"href":444},"\u002Fhealth-score\u002F","Health score"," — how this rule contributes to the score",[20,448,449,453],{},[435,450,452],{"href":451},"\u002Frules\u002F","Rules catalog"," — browse all 92 rules",[455,456,457],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":117,"searchDepth":138,"depth":138,"links":459},[460,461,462,463,464,465],{"id":61,"depth":138,"text":62},{"id":80,"depth":138,"text":81},{"id":102,"depth":138,"text":103},{"id":328,"depth":138,"text":329},{"id":359,"depth":138,"text":360},{"id":428,"depth":138,"text":429},[467,470,472],{"label":468,"href":469},"API Reference","\u002F",{"label":471,"href":451},"Rules",{"label":29},{"cards":474,"onpage":486},[475],{"title":476,"tabs":477},"Evaluate",[478,482],{"label":479,"language":480,"code":481},"cURL","bash","curl https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\u002Fevaluate-rule \\\n  -H \"Authorization: Bearer $TM_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"rule_id\":\"btoa-pii\",\"url\":\"https:\u002F\u002Fexample.com\"}'\n",{"label":483,"language":484,"code":485},"MCP","text","User: Run btoa-pii on https:\u002F\u002Fexample.com\n\n# Tool call\n{\n  \"tool\": \"evaluate_rule\",\n  \"arguments\": {\n    \"rule_id\": \"btoa-pii\",\n    \"url\": \"https:\u002F\u002Fexample.com\"\n  }\n}\n",[487,488,489,490,491],{"id":61,"label":62},{"id":80,"label":81},{"id":102,"label":103},{"id":328,"label":329},{"id":359,"label":360},null,"Detects Custom HTML tags using btoa() to encode data, which is trivially reversible and not a substitute for proper hashing.","md",{},"\u002Frules\u002Fbtoa-pii","TechArticle",{"title":5,"description":493},"rules\u002Fbtoa-pii",false,"Fjv7tTR7DYJKZaInCcEKz-GK-oWxrir0YbiY60tqz2Q",1796069484195]