zellij-org/zellij · error

tag referencing '{}' is missing an integrity attribute

Error message

tag referencing '{}' is missing an integrity attribute

What it means

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.

Source

Thrown at xtask/src/assets.rs:322

            out.push('=');
        }
    }
    out
}

fn rewrite_integrity_attributes(
    source: &str,
    digests: &BTreeMap<String, String>,
) -> anyhow::Result<String> {
    let mut out = String::with_capacity(source.len());
    let trailing_newline = source.ends_with('\n');

    for line in source.lines() {
        let mut rewritten = line.to_string();
        if let Some(asset) = referenced_asset(line, digests) {
            let digest = &digests[&asset];
            rewritten = replace_integrity_value(&rewritten, digest).ok_or_else(|| {
                anyhow!(
                    "tag referencing '{}' is missing an integrity attribute",
                    asset
                )
            })?;
        }
        out.push_str(&rewritten);
        out.push('\n');
    }

    if !trailing_newline {
        out.pop();
    }
    Ok(out)
}

fn referenced_asset(line: &str, digests: &BTreeMap<String, String>) -> Option<String> {
    for asset in digests.keys() {
        for attribute in ["src=\"assets/", "href=\"assets/"] {

View on GitHub (pinned to 98a0837077)

Solutions

  1. Add `integrity="sha384-PLACEHOLDER"` to the tag; `cargo xtask assets` will overwrite the value with the real digest
  2. Keep one tag per line — the rewriter works line-by-line
  3. When adding a brand-new asset, also add its filename to HASHED_ASSETS so a digest is computed for it

Example fix

<!-- before (rejected) -->
<script src="assets/modals.js"></script>

<!-- after -->
<script src="assets/modals.js" integrity="sha384-x"></script>
Defensive patterns

Strategy: validation

Validate before calling

# every tag referencing assets/<file> must have an integrity attribute
python3 - <<'EOF'
import pathlib, re
idx = pathlib.Path('zellij-client/assets/index.html').read_text()
for n, line in enumerate(idx.splitlines(), 1):
    if re.search(r'(src|href)="assets/', line) and 'integrity="' not in line:
        print(f'index.html:{n}: asset tag missing integrity attribute')
EOF

Type guard

fn tag_has_integrity(line: &str) -> bool {
    (line.contains("src=\"assets/") || line.contains("href=\"assets/"))
        && line.contains("integrity=\"")
}

Prevention

When it happens

Trigger: 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.

Common situations: Hand-editing index.html; adding a new entry to HASHED_ASSETS without adding a matching tagged reference in index.html.

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/3406d7e30035a7ed. Report an issue: GitHub.