Security Guide
MCP server CSS text-overflow consent security — ellipsis truncation, silent clip, vertical max-height clipping, and flex-shrink badge collapse
The CSS text-overflow property controls how inline content that overflows its block container is rendered. Combined with overflow: hidden and white-space: nowrap, text-overflow: ellipsis truncates a multi-line consent disclosure to a single line ending in “…” — making the critical permission scope terms invisible. text-overflow: clip performs the same truncation silently with no indicator. A separate attack uses max-height: 24px; overflow: hidden to clip consent vertically without touching text-overflow at all. The fourth attack exploits flex-shrink to automatically collapse permission scope badge labels to just “…” inside a flex container. In all four cases, element.textContent returns the full consent text and DOM-based verification tools report the consent as present.
Attack 1: text-overflow: ellipsis + overflow: hidden + white-space: nowrap — full consent truncated to first line with “…” (SA-CSS-TO-001)
The canonical text-overflow attack. A consent text block of 500 words is reduced to the first 40–80 characters of the first line, followed by an ellipsis character. The UI shows “By installing this MCP server, you grant access to…” with no indication that approximately 490 more words follow, including “…including full filesystem read/write access, network egress to arbitrary hosts, the ability to install additional plugins, and the ability to create SSH keys on your behalf.” The user sees what appears to be a complete, brief consent sentence and proceeds to install.
The attack evades DOM-based consent verification: element.textContent still contains the full 500-word text. A programmatic check that reads el.textContent and verifies it matches the expected consent template reports a pass. Only comparing el.scrollWidth against el.clientWidth at runtime reveals that the element is actively truncating its content.
/* SA-CSS-TO-001: text-overflow:ellipsis truncates 500-word consent to one line */
.consent-text {
overflow: hidden; /* required for text-overflow to apply */
white-space: nowrap; /* forces all content onto one line before truncation */
text-overflow: ellipsis; /* renders "..." at the truncation point */
width: 200px; /* container narrower than the full consent text */
}
/* What renders:
* "By installing this MCP server, you grant access to..."
*
* Full hidden text (490 more words):
* "...including full filesystem read/write access, network egress to
* arbitrary hosts, the ability to install additional plugins, and
* the ability to create SSH keys on your behalf."
*
* Audit signals:
* el.textContent → full 500-word consent text (DOM check PASSES)
* el.innerText → full text (DOM check PASSES)
* el.scrollWidth → e.g. 2800px (actual full text width at 14px font)
* el.clientWidth → 200px (container width)
* scrollWidth > clientWidth → TRUE ← the key detection signal
*
* getComputedStyle(el).textOverflow → "ellipsis" ← detected by property check
* getComputedStyle(el).overflow → "hidden"
* getComputedStyle(el).whiteSpace → "nowrap"
*
* DOM-based consent verification that reads el.textContent would report the
* full consent text as present and the check would pass. The visual rendering
* shows only the first ~40 characters.
*/
/* Runtime detection: */
function isConsentTruncated(el) {
const s = getComputedStyle(el);
const truncated = el.scrollWidth > el.clientWidth
|| el.scrollHeight > el.clientHeight;
const hasEllipsis = s.textOverflow === 'ellipsis' || s.textOverflow === 'clip';
const hasHiddenOverflow = ['hidden', 'clip', 'scroll', 'auto'].includes(s.overflow);
return truncated && hasHiddenOverflow;
}
HIGH — SA-CSS-TO-001: This is the most common text-overflow consent attack. DOM-level consent verification is completely blind to it: el.textContent returns the full 500-word consent and the check passes. Only a runtime measurement comparing scrollWidth to clientWidth reveals the active truncation. SkillAudit checks scrollWidth > clientWidth on all consent-critical elements and flags any element where the rendered width is less than the scrollable content width.
Attack 2: text-overflow: clip — silent clip with no ellipsis indicator (SA-CSS-TO-002)
text-overflow: clip is the default value of the property. It truncates overflow text at the container edge with no visual indicator — no ellipsis, no fade, no shadow. Unlike ellipsis, which at least signals to the user that content has been cut with a “…” character, clip silently terminates the rendered text at the overflow boundary. The consent text appears to end mid-sentence or at a word boundary, giving the impression that the visible text is the complete disclosure.
The more dangerous variant of this attack sizes the container deliberately so that the clip falls at a natural sentence boundary. The consent text is authored so that the end of the first sentence aligns with the container width: “I agree to allow file access” — cut — “to all directories including ~/.ssh and ~/.aws.” The visible text reads as a complete, relatively benign sentence. The alarming continuation is invisible and there is no “…” to indicate it exists. Because clip is the CSS default, it often does not appear explicitly in the injected stylesheet at all — the MCP server need only set overflow: hidden; white-space: nowrap, and truncation occurs automatically without a text-overflow declaration that auditors scan for.
/* SA-CSS-TO-002: text-overflow:clip (or default) — silent truncation, no ellipsis */
.consent-text {
overflow: hidden;
white-space: nowrap;
text-overflow: clip; /* explicit clip — or simply omit this line (clip is default) */
width: 340px; /* carefully measured to end after a period */
}
/* Visible text:
* "I agree to allow file access."
* — ends at a period, appears to be a complete sentence
*
* Hidden continuation:
* " This includes all directories on the system including ~/.ssh,
* ~/.aws, ~/.gnupg, and any mounted network shares."
*
* Audit signals:
* getComputedStyle(el).textOverflow → "clip" ← default value, not suspicious on its own
* el.scrollWidth → 1900px (full text width)
* el.clientWidth → 340px (container width)
* scrollWidth > clientWidth → TRUE ← detection signal (same as ellipsis attack)
*
* When text-overflow is omitted from the stylesheet entirely:
* getComputedStyle(el).textOverflow → "clip" (browser default)
* Auditors scanning for the string "text-overflow" in injected CSS see nothing.
* The truncation still occurs. Only scrollWidth/clientWidth comparison detects it.
*
* Precision sizing via JS to position the clip at the desired word boundary:
*/
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx.font = getComputedStyle(consentEl).font;
const targetText = 'I agree to allow file access.';
const clipWidth = Math.ceil(ctx.measureText(targetText).width);
consentEl.style.maxWidth = (clipWidth + 4) + 'px';
/* Container is now exactly wide enough to show the benign first sentence
* and clips silently at the period, before the alarming continuation. */
Audit gap — SA-CSS-TO-002: Because clip is the CSS default value for text-overflow, it will not appear in injected stylesheet rules that rely on the default. A scanner checking injected CSS for the literal string text-overflow will see nothing. SkillAudit checks el.scrollWidth > el.clientWidth at runtime on all consent-critical elements regardless of whether a text-overflow property is present in the computed style.
Attack 3: vertical overflow truncation with max-height + overflow: hidden — multi-line consent text clipped vertically (SA-CSS-TO-003)
The CSS text-overflow property applies only to inline overflow in the block progression direction — horizontal text overflow in horizontal writing modes. Vertical clipping is handled separately by max-height and overflow: hidden. A consent panel with max-height: 24px; overflow: hidden; line-height: 24px shows exactly one line of text regardless of how many lines the full consent contains. The checkboxes, the explicit permission scopes, the “this cannot be undone” warning, and the actual list of granted capabilities are all in the hidden overflow below the 24 px boundary.
Crucially, this vertical clipping does not trigger the text-overflow property at all. getComputedStyle(el).textOverflow returns "clip" or "ellipsis" depending on what the MCP server has set for inline overflow — but the vertical clipping is a separate mechanism independent of text-overflow. An auditor checking getComputedStyle(el).textOverflow and seeing "clip" (the default) has no signal from that property alone that vertical content is hidden. The correct detection signal is el.scrollHeight > el.clientHeight — checking the vertical dimension separately from the inline dimension. MCP servers combine vertical max-height clipping with text-overflow: clip to suppress both inline and block overflow signals simultaneously, requiring auditors to check both axes independently.
/* SA-CSS-TO-003: max-height + overflow:hidden — vertical clipping independent
of text-overflow; first line visible, all remaining consent hidden */
.consent-panel {
max-height: 24px; /* exactly one line at 24px line-height */
overflow: hidden; /* clips everything below 24px */
line-height: 24px;
/* text-overflow not set — defaults to "clip" for inline, but the
* vertical clipping is entirely governed by max-height, not text-overflow.
* getComputedStyle(el).textOverflow → "clip" ← gives no vertical-clip signal
*/
}
/* What renders:
* Line 1: "By installing this MCP server you agree to the following terms."
*
* Hidden below 24px:
* Line 2: "[ ] Grant filesystem access to all directories"
* Line 3: "[ ] Grant network access to external hosts"
* Line 4: "[ ] Allow creation of SSH keys"
* Line 5: "[ ] Allow reading of ~/.ssh/authorized_keys"
* Line 6: "THIS ACTION CANNOT BE UNDONE."
* Line 7+: 480 more words of consent text
*
* Audit signals:
* getComputedStyle(el).textOverflow → "clip" ← no vertical-clip signal here
* getComputedStyle(el).maxHeight → "24px" ← the key property check
* el.scrollHeight → 1440px (full multi-line content height)
* el.clientHeight → 24px
* scrollHeight > clientHeight → TRUE ← vertical clipping detected
*
* Combined attack: MCP server sets both text-overflow:clip AND max-height:24px.
* This defeats inline-overflow detection (el.scrollWidth ≈ el.clientWidth for one line)
* AND requires a separate scrollHeight check for vertical overflow detection.
* An auditor checking only scrollWidth misses the vertical clipping entirely.
*/
/* Detection requires BOTH checks: */
function detectConsentClipping(el) {
const inlineClipped = el.scrollWidth > el.clientWidth;
const verticalClipped = el.scrollHeight > el.clientHeight;
return { inlineClipped, verticalClipped };
}
Attack 4: text-overflow: ellipsis on a permission scope badge inside a flex container — scope label shrinks to just “…” (SA-CSS-TO-004)
A permission scope badge (for example, “READ/WRITE filesystem: all directories”) inside a flex container can be automatically truncated to just “…” via CSS flex-shrink behavior without any explicit width constraint. The mechanism: a flex item with flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap will shrink to whatever space the flex layout algorithm allocates to it. If the flex container is narrow (or other flex siblings consume most of the available space), the badge shrinks toward its minimum content size. Because min-width: 0 overrides the browser default minimum content size for flex items, the item can shrink to near-zero width, leaving only the ellipsis character visible.
The attack does not require the MCP server to set an explicit width or max-width on the badge. The flex container geometry does the narrowing automatically. The badge getBoundingClientRect().width is non-zero — the badge exists and has a measured width — but it is too narrow to display the permission label. The rendered badge shows only “…”. The full label text (including the permission scope) is in the DOM and readable via el.textContent. The user sees a flex row of badges where each scope label has been collapsed to “…” and cannot read which specific permissions are being granted.
/* SA-CSS-TO-004: flex item min-width:0 + text-overflow:ellipsis
automatically collapses permission scope badge label to "..." */
/* Flex container for the permission badges row */
.permission-row {
display: flex;
gap: 8px;
width: 200px; /* narrow container — could also be driven by parent geometry */
}
/* Each permission scope badge */
.scope-badge {
flex: 1 1 0; /* grow and shrink equally, no base size */
min-width: 0; /* override browser default min-content floor for flex items */
overflow: hidden; /* required for text-overflow to apply */
white-space: nowrap; /* keep label on one line before ellipsis truncation */
text-overflow: ellipsis; /* show "..." when label overflows the shrunken flex item */
padding: 4px 8px;
background: #f0f0f0;
border-radius: 4px;
}
/* With three badges in a 200px container (after padding, ~175px available):
* Each badge gets ~58px.
* "READ/WRITE filesystem: all directories" → rendered as "..."
* "network: all external hosts" → rendered as "..."
* "SSH key creation: enabled" → rendered as "..."
*
* The user sees three gray pills, each showing "...", with no indication
* of the actual permission scope being granted by each badge.
*
* Audit signals:
* el.textContent → "READ/WRITE filesystem: all directories" (DOM check PASSES)
* getBoundingClientRect().width → 58 ← non-zero; badge "exists"
* el.scrollWidth → 280px (full label width)
* el.clientWidth → 58px
* scrollWidth > clientWidth → TRUE ← truncation detected
*
* The parent flex container need not have overflow:hidden on the badge.
* min-width:0 on the flex item is sufficient to allow unconstrained shrinking.
* Without min-width:0, flex items cannot shrink below their min-content width.
*
* Detection: same scrollWidth > clientWidth check, applied to badge elements
* whose textContent matches permission-scope patterns.
*/
Detection: SkillAudit checks el.scrollWidth > el.clientWidth (inline truncation) and el.scrollHeight > el.clientHeight (vertical clipping) on all elements whose textContent matches consent or permission-scope patterns. It flags: any text-overflow value other than clip on consent text; max-height below 150 px combined with overflow: hidden on consent blocks; flex items with min-width: 0 and text-overflow: ellipsis whose textContent contains permission scope strings. Both axes are checked independently.
Summary table
| Attack | Prerequisite | What it enables | Severity |
|---|---|---|---|
SA-CSS-TO-001: text-overflow:ellipsis + overflow:hidden + white-space:nowrap |
Container narrower than full consent text width | Consent collapses to first ~40 chars + “…”; el.textContent returns full text; DOM checks pass; only scrollWidth > clientWidth detects truncation |
High |
SA-CSS-TO-002: text-overflow:clip (or default) with precision-sized container |
Container width aligned with a natural sentence boundary; text-overflow may not appear in injected CSS at all |
Visible text appears to end at a complete sentence; no “…” indicator; scanner finds no text-overflow declaration; scrollWidth > clientWidth check required |
High |
SA-CSS-TO-003: max-height:24px + overflow:hidden vertical clipping |
No text-overflow required; max-height clips vertically; inline truncation check (scrollWidth) may not trigger |
First line visible; all checkboxes, permission scopes, and “cannot be undone” warnings hidden; scrollHeight > clientHeight check required separately from inline check |
High |
SA-CSS-TO-004: flex item min-width:0 + text-overflow:ellipsis on permission scope badge |
Flex container geometry narrows the badge item; no explicit width constraint needed | Permission scope badge label automatically collapses to “…”; getBoundingClientRect().width non-zero; el.textContent contains full label; only scrollWidth > clientWidth on the badge detects it |
Medium |
Defences
- CSP
style-srcnonce — require a per-request nonce on all injected<style>blocks and inlinestyleattributes; prevents MCP servers from injectingoverflow: hidden,white-space: nowrap, ortext-overflowdeclarations on consent-critical elements without the nonce. - Monitor for
overflow: hidden+white-space: nowrap+text-overflowon consent-critical elements — checkgetComputedStyle(el).overflow === 'hidden'combined withgetComputedStyle(el).whiteSpace === 'nowrap'on any element whosetextContentmatches a consent or permission-scope pattern; this combination is the prerequisite for all text-overflow truncation attacks. - Check
el.scrollWidth > el.clientWidthto detect active inline truncation at runtime — this is the only reliable signal fortext-overflow: clip(which produces no property flag) and works regardless of whether thetext-overflowproperty is set in the stylesheet. - Check
el.scrollHeight > el.clientHeightto detect vertical clipping independently — thetext-overflowproperty gives no signal for vertical overflow; this separate check is required to detectmax-height+overflow: hiddenattacks on multi-line consent blocks; check both axes on every consent-critical element. - Minimum-size enforcement on consent panels with
min-heightandmin-widthin host CSS — the host application stylesheet should setmin-height: 150px; min-width: 200pxon consent container elements with!important; this prevents flex-shrink and explicit small-dimension attacks from collapsing the panel below a readable minimum; SkillAudit flags anytext-overflowdeclaration on elements whose text content matches consent or permission-scope patterns, and anymax-heightbelow 150 px combined withoverflow: hiddenon consent blocks.
SkillAudit findings for this attack surface
text-overflow: ellipsis + overflow: hidden + white-space: nowrap on consent text element — 500-word consent truncated to first ~40 characters followed by “…”; el.textContent returns full text and DOM checks pass; el.scrollWidth (2800 px) greatly exceeds el.clientWidth (200 px); critical permission scopes never rendered.overflow: hidden + white-space: nowrap on consent element with precision-sized container — clip falls at a natural sentence boundary; visible text appears complete with no “…” indicator; text-overflow property not present in injected CSS (defaults to clip); only scrollWidth > clientWidth reveals the truncation.max-height: 24px; overflow: hidden on consent block — first line visible, all remaining lines (checkboxes, permission scope list, “cannot be undone” warning) in hidden overflow; getComputedStyle(el).textOverflow gives no signal; only scrollHeight (1440 px) vs. clientHeight (24 px) check detects the vertical clipping.flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap inside narrow flex container — badge shrinks to ~58 px via flex-shrink, label “READ/WRITE filesystem: all directories” renders as “…”; getBoundingClientRect().width is non-zero; el.textContent returns full label; scrollWidth > clientWidth on the badge detects the shrink-collapse.