Skip to content
Back to skills

Clickjack And Frame Protection

ASecurity

Configure clickjack protection headers and frame-ancestors for VF pages, LWR sites, and Aura apps. NOT for CSP or Trusted URL configuration.

  • 15 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 1, 2026
ai-agentsrustgospringgitapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned June 1, 2026

npx -y skills add PranavNagrecha/AwesomeSalesforceSkills --skill clickjack-and-frame-protection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clickjack And Frame Protection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clickjack And Frame Protection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/pranavnagrecha-clickjack-and-frame-protection/badge)](https://www.skillsdirectory.com/skills/pranavnagrecha-clickjack-and-frame-protection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clickjack-and-frame-protection
description: "Configure clickjack protection headers and frame-ancestors for VF pages, LWR sites, and Aura apps. NOT for CSP or Trusted URL configuration."
category: security
salesforce-version: "Spring '25+"
well-architected-pillars:
  - Security
triggers:
  - "clickjack protection salesforce"
  - "x frame options visualforce"
  - "lwr site embedded in iframe"
  - "frame ancestors experience cloud"
tags:
  - clickjack
  - frame
  - csp
inputs:
  - "Custom VF pages"
  - "Experience Cloud sites"
  - "intended embedding parents"
outputs:
  - "Frame policy settings per page/site"
dependencies: []
version: 1.0.0
author: Pranav Nagrecha
updated: 2026-04-28
---

# Clickjack and Frame Protection

Clickjacking embeds a target page in an invisible iframe and tricks users into clicking hidden controls. Salesforce offers per-page clickjack settings and site-level frame-ancestor allow-lists.

## Recommended Workflow

1. Inventory custom VF pages and Experience Cloud sites.
2. For VF: Setup → Session Settings → 'Clickjack protection' options. Default to 'Enable for non-Setup Salesforce pages'.
3. For LWR/Aura sites: Setup → Digital Experiences → Security → Clickjack Protection. Set to 'Allow framing by the same origin only' or 'Allow framing by specific external domains'.
4. If external embedding is required, add only the specific https origin — never '*'.
5. Verify with browser devtools that X-Frame-Options or frame-ancestors header is present.

## Key Considerations

- Modern frame-ancestors (CSP) supersedes X-Frame-Options on browsers that support both.
- Sites embedded in Lightning Out require the parent domain on the allow-list.
- Community pages served over Visualforce Override have separate settings.
- Don't allow '*' — it defeats the protection.

## Worked Examples (see `references/examples.md`)

- *Partner portal embedded in partner site* — Customer portal iframe'd by dealer.com.
- *Visualforce page invoked by a canvas app* — Canvas app frames the VF.

## Common Gotchas (see `references/gotchas.md`)

- **Wildcard * allow-list** — Any attacker origin can frame the site.
- **Preview mode bypass** — Experience Builder preview frames work, production doesn't.
- **Legacy VF without CSP** — Attack via old VF page on force.com domain.

## Top LLM Anti-Patterns (full list in `references/llm-anti-patterns.md`)

- Using '*' in frame-ancestors
- Disabling clickjack protection to make something 'just work'
- Leaving legacy VF pages deployed

## Official Sources Used

- Apex Developer Guide — Sharing — https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_understanding.htm
- Salesforce Security Guide — https://help.salesforce.com/s/articleView?id=sf.security.htm
- Shield Platform Encryption — https://help.salesforce.com/s/articleView?id=sf.security_pe_overview.htm
- Session Security Levels — https://help.salesforce.com/s/articleView?id=sf.security_hap_session.htm
- CSP and Trusted URLs — https://help.salesforce.com/s/articleView?id=sf.security_csp_overview.htm
- API Only User Profile — https://help.salesforce.com/s/articleView?id=sf.users_profiles_api_only.htm
- Privacy Center and DSR — https://help.salesforce.com/s/articleView?id=sf.privacy_center_overview.htm

Files in this skill

  • SKILL.md3.2 KB
  • references/examples.md801 B
  • references/gotchas.md729 B
  • references/llm-anti-patterns.md304 B
  • references/well-architected.md922 B
  • scripts/check_clickjack_and_frame_protection.py953 B
  • templates/clickjack-and-frame-protection-template.md562 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.