/wings-authoring:sec-wasm-gofrom WINGS Authoring
Covers Go-to-WASM security in the browser: syscall/js trust boundary, panic-as-total-loss, innerHTML/XSS, secrets in memory, single-thread concurrency, and GOOS=js tooling gaps. Use when writing or reviewing GOOS=js code or DOM interop.
Ships in WINGS Authoring. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Your components are Go compiled to WASM running in the browser. Classic secure-coding advice assumes processes, a kernel, and an OS user model — none of that exists here. Some defenses become impossible and must be replaced by others, and Go-specific traps appear. WINGS handles its own internals safely; this is what you still own.
log/println output lands in the browser console under wasm);
panicking at top level is a deliberate "the app cannot continue" decision,
not an error path.//go:embed *.pub + wi18n.SetCatalogPublicKey is the correct pattern.
Anything secret stays on your server, reached over an authenticated fetch.crypto/subtle timing is best-effort at most. Don't hand-roll crypto in the
app. Verification of public data (ed25519.Verify) is fine; secret-key
operations belong on the server or in Web Crypto.Every js.Value arriving from the DOM, fetch, events, postMessage, or
localStorage is hostile input (see sec-hostile-input). Check .Type()
before calling .String() / .Int() / .Bool() — a wrong-type access
panics, and a panic is total (fact 1).
A call made with foreign data needs a recover. Type-checking covers a
wrong-type access, but not a method that THROWS: el.matches(sel) on a
selector that came from a document, new Intl.NumberFormat(locale, …) on a
locale from a catalog, a method the browser version does not have. A JS
exception arrives in Go as a panic, and a panic is total (fact 1). Wrap the
call — not every call, only the ones whose input you did not author — in a
small guard, and give it a real fallback:
func matches(el js.Value, sel string) (ok bool) {
defer func() { if recover() != nil { ok = false } }()
return el.Call("matches", sel).Bool()
}
Guard a BLOCK when the operations fail as a unit (building a formatter is a dozen JS calls). And log it: a guard that silently returns a zero value turns a browser refusal into a mystery — formatting that quietly comes out wrong with nothing anywhere to say why.
innerHTML invariant. In your components you normally never touch the DOM
directly — you drive it through obj.This.Set and let WINGS render. The
danger is reaching around that: someEl.Set("innerHTML", fetchedString) or
insertAdjacentHTML with any value that came from a user, a URL, or a
backend is an XSS hole. Put untrusted runtime data in via textContent or an
attribute setter, or (better) through obj.This. Grep your code for
innerHTML / outerHTML / insertAdjacentHTML before shipping.
js.FuncOf callbacks pin JS objects and keep the DOM alive. WINGS frees these
for you on disconnect — its own (two-way &attr bindings, the render
goroutine) and the listeners you register with dom.AddEvent and the
MutationObservers you register with dom.Observe under the element. Never
build a MutationObserver by hand (js.Global().Get("MutationObserver")) —
its js.FuncOf pins the Go closure forever; use dom.Observe. What WINGS
cannot reach into is a goroutine loop you launched — see the teardown caveat
below.
Add an origin check to any postMessage/cross-window listener you
register before trusting event.data.
select{} / "call go SetLang(...), never block on it" lesson). Never block
the event loop waiting on JS.PranaMod has only InitData and
Render; PranaObj hands you no cancellation context. On disconnect WINGS
cleans up the state it can see — cancels the render goroutine, releases
two-way bindings, and frees the listeners you registered with dom.AddEvent
under the element — but it can't interrupt a goroutine you launched. The
practical consequences:
Render) needs no guard — it
completes; a late obj.This.Set on a detached element is harmless.obj.Element.Get("isConnected").Bool() and exit when false (see
wings-component) — that poll is the only disconnect signal you get.dom.AddEvent listeners and dom.Observe observers are freed
for you on disconnect, so a component created and destroyed repeatedly
won't leak them. You may still dom.RmEvent / dom.RmObserver early if
you like — both are idempotent.golint/go vet and Go Report Card skip //go:build js
files; govulncheck's native pass misses js-only imports. Compensate: run
GOOS=js GOARCH=wasm go vet ./..., scan with the js imports mode too (see
sec-supply-chain), and keep pure logic (parsing, validation, math) in
packages that build everywhere so native linters and fuzzers can see them.prana_helper.js, wasm_exec.js) are served files: put SRI
(integrity=) on your <script> tags, sign catalogs you fetch at runtime,
and serve dev builds with Cache-Control: no-store so a stale binary never
masquerades as a fix.js.Value type-checked firstinnerHTML/outerHTML/insertAdjacentHTMLisConnected (bindings,
dom.AddEvent listeners and dom.Observe observers are freed for you
on disconnect)<script> tags carry SRI; runtime-fetched JSON is signedSibling skills: sec-hostile-input, sec-fail-operational,
sec-supply-chain. Component lifecycle detail: wings-component.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub luisfurquim/wings --plugin wings-authoring11 skills in this plugin
/sec-fail-operationalApollo AGC fail-operational design (priority shedding, bounded everything, restart protection, NASA Power of 10) applied to YOUR WINGS app — loops, goroutines, timers, fetch error paths, recovery. Use when writing component effects, background goroutines, polling/retry, or any code that must keep the app rendering when one part fails./sec-fuzzingContinuous fuzzing with Go native fuzzing for any parser/decoder YOU add to a WINGS app — keeping parseable logic in portable (non-js) packages so it's fuzzable, writing targets, the properties to assert, corpus management. Use when you add or change any string/byte parser, custom wire format, or decoder in your app./sec-hostile-inputInput validation and parsing discipline for WINGS apps (djb "don't parse" + Margaret Hamilton's defensive design) — applied to YOUR boundaries — fetch/API responses, form fields, URL hash/query, postMessage, localStorage, and js.Values. Use when writing or changing any code in your app that reads data from outside the wasm module./sec-minimal-trusted-codedjb's trusted-code minimization applied to YOUR WINGS app — keep parsing at build time, design misuse-resistant APIs, add the fewest deps and config knobs, don't evaluate user strings at runtime. Use when designing a new component/package/public helper, adding a dependency or config option, or reviewing a diff that grows your app./sec-supply-chainDependency and artifact integrity for YOUR WINGS app — adding/updating Go modules, pinning the wings version, govulncheck (native + GOOS=js passes), SRI on served scripts, signing the catalogs you ship, Docker FROM wings, never baking secrets into images. Use whenever your go.mod/go.sum changes, you prepare a release, or you serve/fetch an artifact./wings-buildSet up, build, and serve a WINGS app — Go module setup, the WASM build (GOOS=js), copying the JS runtime helpers, a static dev server, and the cross-platform cmd/build orchestrator (targets + the camelCase binding lint + rebuild-on-save dev mode). Use when scaffolding a new WINGS project, configuring its build, wiring main.go, or setting up a dev server / dev loop.Other plugins' skills for the same job