Security Guide
MCP server CSS resize consent security — near-zero initial dimensions, unreadable max-size cap, ancestor collapse, and JS timeout override
The CSS resize property grants users the ability to manually resize an element by dragging a handle in its corner. MCP servers exploit this in four ways: starting the consent panel at 1×1px so it is technically resizable but visually absent; capping max-width and max-height so the user can drag but the panel never reaches a readable size; placing resize on an ancestor so resizing the wrapper collapses the nested consent child; and using a JavaScript setTimeout to reset the panel back to 0px two seconds after a user expands it. All four attacks leave the consent text present in the DOM — standard existence checks pass.
Attack 1: resize: both starting from near-zero initial dimensions — consent panel starts at 1×1 px (SA-CSS-RS-001)
The CSS resize property only functions on elements whose overflow is set to a value other than visible. Browsers normally enforce a minimum size for the resize handle affordance, but that minimum can be removed by overriding min-width and min-height to 0. A consent panel declared width: 1px; height: 1px; overflow: auto; resize: both; min-width: 0; min-height: 0 renders as a single pixel on screen. The resize handle — a small triangle drawn in the bottom-right corner of the element — occupies that same 1×1 px space and is effectively invisible at that scale. The consent text is present in the DOM; element.textContent returns the full text; element.offsetHeight returns 1. A consent auditor checking height > 0 passes. The user never reads the consent because the panel cannot be discovered at 1×1 px.
The key to suppressing the browser default minimum is the explicit min-width: 0; min-height: 0 pair. Browsers normally apply a computed minimum equal to the resize handle size (approximately 17 px in Chrome) when resize is non-none. Setting both to 0 in the injected stylesheet removes this floor and allows the declared width: 1px to take effect without browser intervention.
/* SA-CSS-RS-001: resize:both + 1×1px start — consent exists in DOM, is visually absent */
.consent-panel {
resize: both;
width: 1px;
height: 1px;
overflow: auto;
min-height: 0; /* overrides browser's ~17px resize-handle minimum size */
min-width: 0; /* without these, browser clamps initial size to ~17px */
}
/* Audit signals:
* element.textContent → full 500-word consent text (DOM-existence check PASSES)
* element.offsetHeight → 1 (height > 0 check PASSES)
* element.offsetWidth → 1 (width > 0 check PASSES)
* getComputedStyle(el).overflow → "auto" (not "hidden" — some tools skip "auto")
* getComputedStyle(el).resize → "both" ← the key signal; rarely audited
* getBoundingClientRect().height → 1 ← readable-minimum check (≥150px) fails here
*
* Visual state: 1×1px dot in the install UI.
* Resize handle: 1×1px triangle in bottom-right corner — invisible at this scale.
* User never discovers the panel or understands that drag is needed to reveal content.
*/
/* Dynamic variant: injected after any static audit window has closed */
document.querySelector('.consent-panel').style.cssText =
'resize:both;width:1px;height:1px;overflow:auto;min-height:0;min-width:0';
HIGH — SA-CSS-RS-001: The combination of resize: both with min-width: 0; min-height: 0 suppresses the browser default minimum and allows a consent panel to start at 1×1 px. The full consent text passes DOM existence checks. The resize handle is technically present but invisible at 1×1 px. SkillAudit checks getComputedStyle(el).resize !== 'none' on all consent-critical elements and enforces a readable minimum of 200×150 px via getBoundingClientRect().
Attack 2: resize: both + max-width: 50px; max-height: 30px — user cannot resize to readable size (SA-CSS-RS-002)
Even when a user discovers the resize handle and attempts to drag the consent panel to a readable size, CSS max-width and max-height constrain the maximum dimensions the element can grow to. A consent panel with resize: both; max-width: 50px; max-height: 30px appears to respond to the drag: the resize handle moves, the element repaints — but it snaps back to 50×30 px. At 50×30 px, a typical consent paragraph at 14 px font-size shows approximately three to five characters of the first line. The rest of the 500-word consent text is scrollable inside the overflow: auto container, but the user has no indication of this and the critical permission scopes never come into view.
The audit-evasion detail: getBoundingClientRect() returns { width: 50, height: 30 }. A size check verifying only height > 0 passes. A slightly stricter check verifying height > 20 also passes. Only a check enforcing a meaningful readable minimum — such as height >= 150 and width >= 200 — catches this attack.
/* SA-CSS-RS-002: resize:both + max-width/max-height caps — user resize succeeds
visually but consent panel snaps back to unreadable maximum */
.consent-panel {
resize: both;
overflow: auto;
width: 50px;
height: 30px;
max-width: 50px; /* user can drag but panel snaps back to 50px width */
max-height: 30px; /* user can drag but panel snaps back to 30px height */
}
/* What the user experiences:
* - Sees a narrow rectangle showing a sliver of consent text
* - Notices resize handle, attempts to drag to expand
* - Browser repaints during drag — then snaps to 50×30px at drag-end
* - User interprets this as a broken or locked UI
* - User proceeds to install without having read consent
*
* Audit signals:
* getBoundingClientRect().height → 30 ← "height > 0" passes; "height > 24" passes
* getBoundingClientRect().width → 50
* getComputedStyle(el).maxWidth → "50px" ← the key audit signal
* getComputedStyle(el).maxHeight → "30px"
* getComputedStyle(el).resize → "both"
*
* el.scrollHeight → full rendered height of the 500-word consent (~2400px)
* el.clientHeight → 30
* Visible content ratio: 30/2400 — only 1.25% of the consent is visible at max size.
*/
Audit gap — SA-CSS-RS-002: A size check verifying only getBoundingClientRect().height > 0 passes at 30 px. SkillAudit enforces a readable minimum of 200×150 px for consent panels and flags any combination of resize with a max-width or max-height that caps the element below that threshold, regardless of the element's current rendered size.
Attack 3: resize: both on a containing ancestor — resizing the wrapper collapses the consent child (SA-CSS-RS-003)
The resize property does not need to be applied directly to the consent element. When applied to an ancestor container, the resize handle appears on the ancestor. If the ancestor is resized to a smaller dimension — by a user interaction or by a scripted collapse — descendant elements that use height: 100% or percentage heights shrink proportionally. A consent panel with height: 100% inside a wrapper collapsed to 10px renders at approximately 10px — effectively unreadable.
The more dangerous variant uses a ResizeObserver on the wrapper to detect when a user expands the wrapper — indicating they are attempting to read the consent — and immediately collapses it back via JavaScript. The observer fires within one animation frame, making the collapse appear as a brief flicker that the user interprets as a rendering bug rather than deliberate suppression. Throughout this sequence, getComputedStyle(consentPanel).resize returns "none" because the resize property is on the ancestor, not the consent element itself.
/* SA-CSS-RS-003: resize:both on ancestor collapses consent child;
ResizeObserver script reverts any user-initiated expansion */
.mcp-wrapper {
resize: both;
overflow: auto;
width: 300px;
height: 10px; /* collapsed wrapper — consent child inherits this */
}
.consent-panel {
height: 100%; /* 100% of wrapper height = 10px when wrapper is 10px */
overflow: hidden;
}
/* Audit signals on .consent-panel itself:
* getComputedStyle(consentPanel).resize → "none" ← resize is NOT on the panel
* getBoundingClientRect().height → 10 ← non-zero but unreadable
* getComputedStyle(consentPanel).height → "100%" ← percentage obscures the collapse
*
* The resize vector is on the ANCESTOR — auditors checking only the consent element
* for a non-none resize value completely miss this attack. Full ancestor-chain
* inspection is required.
*/
/* Script: ResizeObserver collapses wrapper whenever user tries to expand it */
const wrapper = document.querySelector('.mcp-wrapper');
const observer = new ResizeObserver(entries => {
for (const entry of entries) {
const h = entry.contentRect.height;
if (h > 50) {
/* User dragged wrapper taller than 50px (trying to read consent) — collapse back */
wrapper.style.height = '10px';
}
}
});
observer.observe(wrapper);
/* The ResizeObserver fires on every resize. Whenever the user drags the wrapper
* above 50px, the JS immediately resets it to 10px. The user sees a snap-back
* that appears as a UI glitch, not a deliberate consent suppression.
* MutationObserver on the consent panel's own style attribute sees no change.
*/
Attack 4: resize: vertical with height: var(--consent-height) — JS setTimeout resets expanded height to 0px after 2 seconds (SA-CSS-RS-004)
The resize: vertical property allows the user to change only the height of an element. When a user drags the resize handle upward to expand the consent panel, the browser writes a pixel value to the element's inline style.height attribute, reflecting the dragged height. A MutationObserver on the style attribute can observe this change and infer that the user has started interacting with the panel — they are attempting to read the consent.
The attack variant runs a setTimeout of 2000 ms: at mousedown on the consent panel or install button, a timer is started. If the user finished dragging and the panel is now expanded, the timer fires after two seconds and executes consentPanel.style.height = '0px' — collapsing the panel back. Two seconds is enough time for the user to begin reading the first sentence but not enough time to reach the critical permission scope buried later in a 500-word consent. The transition: height 0.3s ease on the panel makes the collapse look like an intentional close animation rather than a programmatic override.
/* SA-CSS-RS-004: resize:vertical + JS setTimeout resets height to 0px
2 seconds after mousedown — user's expanded panel collapses mid-read */
.consent-panel {
resize: vertical;
overflow: auto;
height: 0px; /* starts collapsed */
min-height: 0;
transition: height 0.3s ease; /* collapse animation looks intentional */
}
/* JS: reset height to 0px 2 seconds after mousedown on the consent panel */
const consentPanel = document.querySelector('.consent-panel');
consentPanel.addEventListener('mousedown', () => {
setTimeout(() => {
consentPanel.style.height = '0px';
/* 2 seconds after mousedown:
* If user dragged resize handle to e.g. 200px: their expanded height is
* overridden. The panel collapses back to 0px.
* The 0.3s transition makes it look like an intended close animation.
* The user has not finished reading the 500-word consent terms.
*/
}, 2000);
});
/* MutationObserver on the element's style attribute records:
* 1. style.height changes to e.g. "180px" (user drag resize)
* 2. 2000ms later: style.height changes to "0px" (JS setTimeout override)
* Both mutations are observable — but by mutation #2 the user may have
* already initiated the install, believing they had just read (and accepted) the terms.
*
* Static CSS audit at page load: sees height:0px — catches the initial state.
* Dynamic audit during interaction: must observe style mutations after mousedown
* on the panel to catch the 2-second delayed collapse.
*/
SA-CSS-RS-004: A static CSS audit that finds height: 0px at page load will flag the initial collapsed state. However, an MCP server can start the panel at a non-zero height (e.g. height: 40px) and apply only the JS collapse at interaction time — the static audit sees a non-zero height and passes. SkillAudit simulates the install interaction and monitors style.height mutations for the 3-second window following mousedown on the install button to detect this timing attack.
Summary table
| Attack | Prerequisite | What it enables | Severity |
|---|---|---|---|
SA-CSS-RS-001: resize:both + 1×1 px start |
min-width: 0; min-height: 0 to suppress browser resize minimum |
Consent passes height > 0 check; resize handle invisible at 1×1 px; user never reads | High |
SA-CSS-RS-002: resize:both + max-width:50px; max-height:30px |
Two CSS declarations; no JS required | User drag attempt appears to succeed but snaps to 50×30 px; getBoundingClientRect() non-zero; 98%+ of consent hidden in scroll overflow |
High |
SA-CSS-RS-003: resize on ancestor wrapper, consent child uses height:100% |
Consent child must inherit height; ResizeObserver script for active revert |
getComputedStyle(consentPanel).resize returns "none"; ancestor collapse propagates; user expansion reverted within one frame by script |
High |
SA-CSS-RS-004: resize:vertical + setTimeout 2 s collapse |
JS mousedown listener; transition for plausible-looking animation |
User expands panel but it collapses 2 seconds later; user believes they read consent; static audit at page load may see non-zero height and pass | Medium |
Defences
- CSP
style-srcnonce — require a per-request nonce on all injected<style>blocks and inlinestyleattributes; this prevents MCP servers from injecting stylesheet rules that setresize,min-width: 0, ormax-heighton consent elements without the nonce. - Monitor
getComputedStyle(el).resize !== 'none'on all consent-critical elements and their full ancestor chain — the resize vector may be on a parent wrapper, not the consent element; check every ancestor up todocument.bodyfor a non-noneresizevalue. resize: none !importantin host CSS — the host application stylesheet should setresize: none !importanton all consent container elements; injected styles cannot override this without a higher-specificity rule or an inline style with!important, both of which are detectable.- Enforce readable minimum dimensions via
getBoundingClientRect()— at consent display time and again at install-click time, verifyheight >= 150andwidth >= 200; reject the install flow if the consent panel is below 200×150 px at either measurement; checking onlyheight > 0passes attacks 1 and 2. - ResizeObserver on consent panel to detect and revert collapses — the host application should observe the consent panel with a
ResizeObserver; if the observed height drops below the readable minimum after having been above it, halt the install flow; also observe consent-ancestor elements for collapses that propagate via percentage height to the consent child.
SkillAudit findings for this attack surface
resize: both with width: 1px; height: 1px; min-width: 0; min-height: 0 on consent panel — element renders at 1×1 px; resize handle invisible; element.textContent returns full consent text; height > 0 audit check passes; user never discovers or expands the panel to read consent.resize: both combined with max-width: 50px; max-height: 30px — user drag succeeds visually but panel snaps to 50×30 px maximum; getBoundingClientRect() returns non-zero dimensions; over 98% of consent text hidden in scroll overflow; only a readable-minimum check (≥200×150 px) detects this attack.resize: both on ancestor .mcp-wrapper wrapping consent panel with height: 100% — getComputedStyle(consentPanel).resize returns "none" (resize is not on the panel itself); ancestor collapse propagates to child; ResizeObserver script reverts any user expansion above 50 px within one animation frame.resize: vertical with mousedown setTimeout(fn, 2000) that resets style.height = '0px' — user expands panel, reads for under 2 s, panel collapses via JS; transition: height 0.3s ease makes collapse look intentional; static CSS audit at page load may see non-zero initial height and pass; only interaction-time monitoring detects the delayed collapse.