Obfuscated vendor code detected
Custom HTML tags use obfuscation techniques (atob + String.fromCharCode, charCodeAt + fromCharCode) to construct URLs or code at runtime. This makes the tag's behavior impossible to verify through static analysis.
Summary
- rule_id —
obfuscated-vendor-code - purpose — Detect Custom HTML tags that use runtime obfuscation to construct URLs or code
- effect — Tag behavior cannot be verified through static analysis; actual data destinations are hidden
- layer — container
- reversibility — non-destructive
What fires this
The rule iterates over active Custom HTML tags and checks each tag's code property for two obfuscation patterns. The first pattern matches atob( combined with String.fromCharCode — a technique that decodes base64 strings into character sequences at runtime. The second pattern matches charCodeAt( combined with fromCharCode — a character-level encoding loop. A tag triggers the rule if either pattern is present. Paused tags are excluded from evaluation.
Why it matters
Obfuscated code hides its behavior from any tool that reads the container statically. The actual destination URLs, data payloads, and collection practices are only visible at runtime — and only to whoever controls the tag. A vendor can update what the obfuscated code decodes to without any change appearing in the container diff. This prevents meaningful auditing for PII handling, data sharing agreements, or consent scope. The atob + String.fromCharCode combination is a known technique for embedding unpublished endpoints in GTM (Google Tag Manager) tags.
Before / after
// Vendor-supplied Custom HTML tag
var _d = atob('aHR0cHM6Ly90cmFjay52ZW5kb3IuY29tL2NvbGxlY3Q=');
var _u = '';
for (var i = 0; i < _d.length; i++) {
_u += String.fromCharCode(_d.charCodeAt(i));
}
// _u is now the destination URL — not visible in static analysis
fetch(_u, { method: 'POST', body: JSON.stringify(payload) });
// Vendor provides the endpoint directly — auditable
fetch('https://track.vendor.com/collect', {
method: 'POST',
body: JSON.stringify(payload)
});
Remediation
- Identify every flagged tag in the audit results and note the vendor name for each.
- Contact the vendor and request an unobfuscated version of the tag.
- Check whether the vendor publishes an official GTM Community Template — prefer that over a Custom HTML tag.
- If the vendor cannot or will not provide readable code, evaluate whether the tag is necessary and remove it if not.
- Replace accepted tags with the unobfuscated version and verify the destination domains match what the vendor documented.
- Add the destination domain to your approved-vendor list and re-run the audit to confirm the flag clears.
Metadata
- Severity
- low
- Tier
- info
- Category
- security
- Layer
- container
- Version
- 1
- Effort
strategic(no fixed time; needs a plan)- Reversibility
- non-destructive
See also
- Security rules — other rules in this category
- Health score — how this rule contributes to the score
- Rules catalog — browse all rules
Examples
curl https://developer.tagmanifest.com/v1/evaluate-rule \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id":"obfuscated-vendor-code","url":"https://example.com"}'
User: Run obfuscated-vendor-code on https://example.com
# Tool call
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "obfuscated-vendor-code",
"url": "https://example.com"
}
}