Skip to content

feat(web-security-review): sync semantic LWS web-security review skill - #333

Closed
rwaldron wants to merge 2 commits into
forcedotcom:mainfrom
rwaldron:rwaldron/sync-web-security-review-0.9.0
Closed

feat(web-security-review): sync semantic LWS web-security review skill#333
rwaldron wants to merge 2 commits into
forcedotcom:mainfrom
rwaldron:rwaldron/sync-web-security-review-0.9.0

Conversation

@rwaldron

Copy link
Copy Markdown

References: Contributing guide · Skill authoring guide · Agent Skills spec

What changed

Adds a single new Agent Skill, skills/web-security-review/, that performs semantic Lightning Web Security (LWS) review of JavaScript, TypeScript, and JSX/TSX source. The change is purely additive: no existing skills, scripts, or samples are modified.

New files:

  • SKILL.md: the reviewer procedure plus YAML frontmatter (name: web-security-review, metadata.version: "0.9"), well under the 500-line body limit.
  • references/lws-grounding.md: the complete LWS ruleset (the host-environment definitions and all 30 reviewer groundings, each a labeled security concern with BLOCKED / ALLOWED examples).
  • references/bundle-profile.md: maps framework-specific sinks (for example, React's raw-HTML prop) onto the DOM sinks the groundings already describe, so the same rules apply to React/JSX bundle source.
  • SYNCED-DO-NOT-EDIT.md: a provenance marker (see Notes).

Why

Lightning Web Security is Salesforce's platform-level UI security layer: the client-side model that isolates and constrains component code. This skill brings that same Trust-grade scrutiny to code review. It delivers Salesforce Trust-level security scanning of client source, evaluated against the LWS security model and layered on top of the platform's own UI security guarantees. The library has no equivalent today. dx-apexguru-scan covers Apex and server-side, and generic linters do not reason about client-side security, so this extends Salesforce Trust-level review to the client tier.

Its value comes from semantic analysis. Rather than matching patterns, it reasons about what the code means: the provenance of each value (is it attacker-controlled or an author constant?), host objects versus built-ins versus component-local objects, and HTML or URLs assembled dynamically from variables, template literals, concatenation, or unicode escapes. That semantic understanding is what separates a genuine security risk from a benign construct, across concerns such as code-evaluation sinks (eval, the Function constructor), DOM and HTML injection, script-element creation, iframe and URL-scheme misuse, document write and open, and unsafe global mutation. It applies to any application code, not only LWC, and it recommends fixes without editing code.

How this improves the library: it adds the first client-side, Trust-level security dimension to a catalog that today stops at Apex / server-side and generation-oriented skills, and because it follows the Agent Skills specification it is immediately usable from Agentforce Vibes, Claude Code, Codex, Cursor, and any other spec-compatible tool via npx skills add forcedotcom/sf-skills.

Notes

  • Background on Lightning Web Security, the sandbox model this skill reviews against: LWS: What Is Lightning Web Security and Lightning Web Security Architecture (official Salesforce developer docs).
  • Generated / auto-synced skill. These files are mirrored from the upstream lws-agent Claude Code plugin (the LWS team's source of truth) by that repo's sync-to-sf-skills generator, and SYNCED-DO-NOT-EDIT.md records this in-tree. Please do not hand-edit the copy here: edits are overwritten on the next sync. The intended change path is to edit the source plugin and re-run the sync. The ruleset in references/lws-grounding.md is itself generated from the LWS team's lws-knowledge repository.
  • CI: npm run validate:skills passes locally (139 of 139 skills checked). The only warning is the benign, non-blocking gerund-form name warning, which the Agent Skills spec documents as a warning that does not block merge. The name is kept as web-security-review (function-first) rather than a gerund form; happy to rename if maintainers prefer the gerund convention.
  • Scope: this skill reviews source and recommends fixes; it does not execute the code or apply changes. The source plugin additionally offers a separate dynamic sandbox verifier that confirms findings against a real LWS runtime, which is intentionally not part of this skill.
  • Follow-ups / open questions: (1) Naming: keep the function-first web-security-review, or rename to a gerund form to clear the non-blocking ⚠? Happy to follow the maintainers' convention. (2) Maintenance model: future updates arrive here as automated re-syncs from the source plugin (regenerated by the same generator, metadata.version bumped), not hand-edits, so expect periodic additive diffs to this one directory. (3) A dynamic LWS runtime verifier lives in the source plugin and is out of scope here; glad to contribute it as a separate runtime-verification skill if that's useful to the library.

Skills

Manual checklist

Description quality

  • Describes what the skill does and the expected output
  • Includes relevant Salesforce domain keywords (LWC, LWS, JavaScript / TypeScript, JSX/TSX, DOM sinks)
  • Trigger phrases are specific enough for Vibes to select this skill reliably

Instructions

  • Clear goal statement
  • Step-by-step workflow
  • Validation rules for generated output
  • Defined output / artifact

Context efficiency

  • Core instructions are concise; the full ruleset lives in references/
  • No unnecessary background explanation in the body

Bumps [tsx](https://github.com/privatenumber/tsx) from 4.21.0 to 4.23.12.
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](privatenumber/tsx@v4.21.0...v4.23.12)

---
updated-dependencies:
- dependency-name: tsx
  dependency-version: 4.23.12
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! It looks like @rwaldron is an internal user so signing the CLA is not required. However, we need to confirm this.

@rwaldron
rwaldron force-pushed the rwaldron/sync-web-security-review-0.9.0 branch from 8195047 to 09a2dbd Compare August 14, 2026 19:21
Generated from the lws-agent plugin at v0.9.0
(skill metadata.version = 0.9). Source of truth:
agents/lws-agent-reviewer.md + reference/lws-grounding.md.

@W-23864602
@rwaldron
rwaldron force-pushed the rwaldron/sync-web-security-review-0.9.0 branch from 09a2dbd to 56b31dc Compare August 14, 2026 19:23
@rwaldron

Copy link
Copy Markdown
Author

I have no idea why there is a commit from 7 hours before mine is here. I'm rebased to the upstream main

@rwaldron rwaldron closed this Aug 14, 2026
@rwaldron
rwaldron deleted the rwaldron/sync-web-security-review-0.9.0 branch August 14, 2026 19:26
@rwaldron
rwaldron restored the rwaldron/sync-web-security-review-0.9.0 branch August 14, 2026 19:26
@rwaldron rwaldron reopened this Aug 14, 2026
@rwaldron rwaldron closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant