{"record":{"id":"3406d7e30035a7ed","repo":"zellij-org/zellij","slug":"tag-referencing-is-missing-an-integrity-attri","errorCode":null,"errorMessage":"tag referencing '{}' is missing an integrity attribute","messagePattern":"tag referencing '(.+?)' is missing an integrity attribute","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/assets.rs","lineNumber":322,"sourceCode":"            out.push('=');\n        }\n    }\n    out\n}\n\nfn rewrite_integrity_attributes(\n    source: &str,\n    digests: &BTreeMap<String, String>,\n) -> anyhow::Result<String> {\n    let mut out = String::with_capacity(source.len());\n    let trailing_newline = source.ends_with('\\n');\n\n    for line in source.lines() {\n        let mut rewritten = line.to_string();\n        if let Some(asset) = referenced_asset(line, digests) {\n            let digest = &digests[&asset];\n            rewritten = replace_integrity_value(&rewritten, digest).ok_or_else(|| {\n                anyhow!(\n                    \"tag referencing '{}' is missing an integrity attribute\",\n                    asset\n                )\n            })?;\n        }\n        out.push_str(&rewritten);\n        out.push('\\n');\n    }\n\n    if !trailing_newline {\n        out.pop();\n    }\n    Ok(out)\n}\n\nfn referenced_asset(line: &str, digests: &BTreeMap<String, String>) -> Option<String> {\n    for asset in digests.keys() {\n        for attribute in [\"src=\\\"assets/\", \"href=\\\"assets/\"] {","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/xtask/src/assets.rs#L304-L340","documentation":"During index.html rewriting, any line that references a hashed asset (matched via `src=\"assets/<file>\"` or `href=\"assets/<file>\"`) must carry an `integrity=\"...\"` attribute so the new SHA-384 digest can be substituted. If the tag has no integrity attribute, the rewrite fails and bundling aborts.","triggerScenarios":"Adding a new `<script src=\"assets/modals.js\"></script>` or `<link href=\"assets/style.css\">` tag to index.html without an integrity attribute; deleting the attribute while hand-editing.","commonSituations":"Hand-editing index.html; adding a new entry to HASHED_ASSETS without adding a matching tagged reference in index.html.","solutions":["Add `integrity=\"sha384-PLACEHOLDER\"` to the tag; `cargo xtask assets` will overwrite the value with the real digest","Keep one tag per line — the rewriter works line-by-line","When adding a brand-new asset, also add its filename to HASHED_ASSETS so a digest is computed for it"],"exampleFix":"<!-- before (rejected) -->\n<script src=\"assets/modals.js\"></script>\n\n<!-- after -->\n<script src=\"assets/modals.js\" integrity=\"sha384-x\"></script>","handlingStrategy":"validation","validationCode":"# every tag referencing assets/<file> must have an integrity attribute\npython3 - <<'EOF'\nimport pathlib, re\nidx = pathlib.Path('zellij-client/assets/index.html').read_text()\nfor n, line in enumerate(idx.splitlines(), 1):\n    if re.search(r'(src|href)=\"assets/', line) and 'integrity=\"' not in line:\n        print(f'index.html:{n}: asset tag missing integrity attribute')\nEOF","typeGuard":"fn tag_has_integrity(line: &str) -> bool {\n    (line.contains(\"src=\\\"assets/\") || line.contains(\"href=\\\"assets/\"))\n        && line.contains(\"integrity=\\\"\")\n}","tryCatchPattern":null,"preventionTips":["Copy an existing script/link tag as a template when adding assets — it already has integrity=\"sha384-...\"","Keep each asset tag on a single line; the rewriter is line-based","When adding an asset to HASHED_ASSETS, immediately add its tagged reference to index.html"],"tags":["html","integrity","assets","bundler"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}