Vue state store security review

From Raishin/vanguard-frontier-agentic · View interactive version

Vue state store security review is an AI agent skill from the GitHub repository Raishin/vanguard-frontier-agentic. Statically review Pinia and legacy Vuex state stores for sensitive data persisted to localStorage/sessionStorage without scoping, untrusted server-payload hydration (window.__pinia/__INITIAL_STATE__) with un-escaped state serialization, SSR store-singleton cross-request pollution, store plugins/$sub

How to use this skill

Skill file

Vue State Store Security Review

Purpose

Review Pinia and legacy Vuex state-store code for the security-critical defect classes that

are specific to state stores as a component — not general Vue architecture, not composable

design, and not SSR hydration/injection issues that belong to vue-ssr-security-review. This

skill exists to keep the review anchored to five documented defect classes: (a) sensitive data

persisted client-side without scoping, (b) store hydration from an untrusted server payload

with un-escaped serialization, (c) SSR store-singleton cross-request pollution, (d) store

plugins/hooks acting on untrusted payloads and client-held flags used as an authorization

source of truth, and (e) devtools state exposure in production. It does not re-litigate

general reactivity/composable architecture, v-html/URL-injection review (covered by

vue-ssr-security-review), or Composition API design quality (covered by

vue-composition-api-architecture-review) in every response.

When to use

Use this skill when the user asks to:

issues,

(what gets persisted, and where),

Express/Node handler that constructs createPinia()/createStore()) for cross-request

pollution risk,

mutation/action payloads,

as an authorization boundary,

Do not use this skill for:

vue-ssr-security-review for those; this skill covers the store specifically, not the

broader SSR rendering surface (load both skills together if the review spans both),

vue-composition-api-architecture-review instead,

security defect in scope — use state-management-decision-review instead,

screen-recording of production, live token exfiltration) to confirm exploitation — static

analysis proves the structural risk, not that it has already been exploited.

Context7 Documentation Protocol

skill's three grounding libraries: /vuejs/pinia (Pinia core — SSR hydration, plugins,

$subscribe/$onAction), /prazdevs/pinia-plugin-persistedstate (persistence defaults and

pick/storage config), /vuejs/vuex (legacy Vuex — state as function, devtools

option, plugin/module API).

defaults before flagging a persistence config: storage defaults to localStorage when

unset; pick (an array of dotted state-path strings) restricts persistence to named paths;

with no pick, the entire state is persisted. Cite these as documentation-based.

hydration finding: the documented client-side pattern is

pinia.state.value = JSON.parse(window.__pinia), and Pinia's own SSR guide states escaping

the serialized state is "VERY important if the content of the state can be changed by

the user, which is almost always the case," recommending devalue (or equivalent) over naive

JSON.stringify. Cite as documentation-based.

(mutation object with type/storeId/payload; action object with name/store/args/

after/onError) before describing a plugin-hook finding — do not invent a hook name or

argument Context7 does not confirm.

(module reusability without shared state) and the devtools: boolean store option before

citing either — do not assume Pinia has an equivalent devtools boolean on defineStore/

createPinia; Context7 does not confirm that API surface for Pinia, so any Pinia-devtools

concern must be scoped to "a build-time devtools plugin explicitly force-enabled in

production," not a Pinia store option, and labeled inference unless a repo-specific config

is found.

pinia-plugin-persistedstate, vuex, vuex-persistedstate) and its major version — API

names and defaults differ between Pinia and Vuex and across Vuex 3/4; do not apply one

library's API names to the other.

metadata.json and label the claim `documentation-based, unverified against current

release`.

Lean operating rules

persistence, untrusted/un-escaped state hydration, SSR store-singleton pollution, untrusted

payload handling in store plugins/hooks, client-side-flag-as-authorization, and production

devtools exposure. Do not downgrade a structural finding to MEDIUM because it has not been

observed exploited — the risk is in the structure.

leak sensitive data" or "this hydration looks risky" without naming the specific

persist/pick/storage config, the specific module-scope createPinia()/createStore()

declaration, or the specific untraced payload sink is not a valid finding — it is a guess.

config together. A persist: true (or persist: {}) with no pick/paths array persists

the entire state — treat every sensitive field in that state as persisted unless a pick

list demonstrably excludes it. A pick list that omits the sensitive field(s) clears the

finding for those fields specifically (not for the whole store, if other sensitive fields

remain unscoped).

the same way vue-ssr-security-review requires for app instances: is the createPinia()/

createStore() call inside the per-request handler, and does that handler close over any

module-scope mutable/reactive reference? An immutable module-scope constant (a frozen config

object, a static route table) is not the risk; a store instance or mutable cache is.

authorization boundary for a mutating action unless the review also confirms (via visible

server-side code, or an explicit statement that server-side authorization is out of scope for

this static review) that the actual mutation is re-checked server-side. A store flag gating

only UI visibility (hiding a button) is not itself a finding; a store flag gating whether a

mutating network call is made is a finding regardless of UI-layer intent, because the flag

is client-writable.

the payload with a side effect (write, external call, log of sensitive data, mutate another

store) and lack payload validation are findings; read-only observation (e.g., analytics event

naming) is not.

review; this is a static-review skill (Read/Grep/Glob only).

References

Load these only when needed:

step-by-step review procedure, the decision tree across all five defect classes, and the

required output shape.

reviewing pinia-plugin-persistedstate/vuex-persistedstate configuration, SSR store

creation/singleton risk, or server-payload hydration (window.__pinia/__INITIAL_STATE__).

load when reviewing $subscribe/$onAction/Vuex-plugin hooks, client-held role/permission

flags used for access control, or devtools production exposure.

list this skill's rules were authored against; load if you need the underlying catch list

rather than the operating rules derived from it.

Response minimum

Return, at minimum:

scope,

ssr-pollution, untrusted-payload, client-auth-flag, or devtools-exposure), the

concrete data-flow trace (state field → persist config, or server payload → hydration call,

or module-scope declaration → per-request reachability, or payload → sink), and a fix sketch

matching the grounding library's documented pattern,

pick/paths (if any) and which are not,

authorization re-check was found, not found, or is out of scope for this static review,

structural risk findings explicitly labeled as structural risk, not as confirmed-exploited,

leakage requires concurrent-request load testing," or "v-html/URL-injection review of this

same app is out of scope for this skill — see vue-ssr-security-review").

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.