Vue router navigation security review

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

Vue router navigation security review is an AI agent skill from the GitHub repository VincentChuWaiChow/vanguard-frontier-agentic. Statically review Vue Router navigation guards, redirect flows, and template bindings for client-side guards used as the sole authorization boundary, open redirects via route.query.redirect/returnUrl, javascript:/data: scheme injection through dynamic :to/:href bindings, route params/query reaching

How to use this skill

Skill file

Vue Router Navigation Security Review

Purpose

Review Vue Router navigation guards, redirect flows, dynamic link bindings, and route

configuration for the security-critical defect classes specific to *client-side routing as a

security surface* — not general route-tree architecture, not component design, and not the

state-store or SSR-hydration concerns owned by sibling skills. This skill exists to keep the

review anchored to five documented defect classes: (a) a beforeEach/beforeEnter guard used

as the sole authorization boundary with no server-side enforcement behind it, (b) open redirect

via route.query.redirect/returnUrl passed unvalidated into router.push()/

window.location, (c) javascript:/data: scheme injection via a dynamic :to/:href

binding, (d) route.params/route.query interpolated into v-html/innerHTML (reflected XSS

through the router), and (e) next(unvalidatedPath)/guard-returned redirects creating loops or

bypasses, overly-broad catch-all routes, and history-mode server misconfiguration. It does not

re-litigate general route-tree/code-splitting architecture, Pinia/Vuex store security, or SSR

cross-request pollution in every response.

When to use

Use this skill when the user asks to:

equivalent) that gates access to a route,

injection,

exploitable,

server-fallback exposure,

Do not use this skill for:

security angle — use routing-navigation-review instead (and note it targets React

Router/Next.js, not Vue Router),

hydration payloads, client-held role flags as an authorization source) — use

vue-state-store-security-review instead,

unrelated to router data — use vue-ssr-security-review instead; this skill's injection scope

is specifically route.params/route.query reaching a sink, not every v-html in the app,

mechanism in play — use frontend-auth-session-security-review instead; this skill covers

only the router-mediated open-redirect mechanism (route.query.redirect/returnUrl), not

session/token architecture generally,

live penetration testing, a captured attack) — static analysis proves the structural risk, not

that it has already been exploited.

Context7 Documentation Protocol

Vue Router's own source-and-docs repository) before citing any guard-mechanism, redirect-API,

or dynamic-matching claim.

(beforeEach/beforeEnter returning false/a location/undefined, and the legacy next

argument's call-exactly-once contract), the documented to.name !== 'Login' self-exclusion

pattern, redirect function shapes (redirect: to => ({ path, query })), route.params/

route.query exposure with no built-in escaping, router.push's acceptance of bare string

paths, createWebHistory()'s server-fallback requirement, and the /:pathMatch(.*)*

catch-all pattern. These are all repo evidence claims — cite the specific guide file

(navigation-guards, redirect-and-alias, dynamic-matching, history-mode) alongside the claim.

itself a Vue-Router API fact — Vue Router's docs describe guards strictly as navigation

control flow (cancel/redirect/proceed), never as an access-control mechanism. Label this

specific conclusion inference, grounded in general server-side-enforcement security practice

(documentation-based via OWASP), layered on the repo evidence fact that guards are

browser-executed callbacks.

template-compiler behavior, not a Vue-Router API — ground it in the Vue security guide

(documentation-based, listed in this skill's official_docs), not in /vuejs/router.

(return-value guards vs. the legacy next third argument), redirect object shape, and

catch-all syntax (/:pathMatch(.*)* in v4 vs. legacy * in v3) differ across majors; do not

apply v4 API names to a v3 codebase or vice versa.

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

Lean operating rules

control, open redirect, scheme injection, and reflected XSS are all directly exploitable

without further chaining. Do not downgrade to MEDIUM because "it hasn't been reported

exploited yet" — the risk is structural.

gap, or origin → sink hops for injection/redirect findings). A finding that says "this guard

might not be enough" or "this redirect might be exploitable" without the specific trace is a

guess, not a finding.

absence of confirmed server-side enforcement on the endpoint the protected route depends on

— look for evidence (a 401/403 check, a BFF layer, an API contract note) before concluding

it's missing, and state explicitly what you found or didn't find.

scheme-injection finding. The only acceptable control is an allowlist: same-origin/

relative-path validation for redirects, and an explicit protocol allowlist

(http:/https:/mailto:) for dynamic link bindings.

sanitizer call is visibly present on that exact traced path — a sanitizer existing elsewhere

in the codebase does not clear this bar.

pattern (to.name !== 'Login' or equivalent). Its absence is a HIGH redirect-loop finding, not

a style nit — Vue Router's docs treat it as required.

broad/catch-all pattern registered before a route that should require auth can shadow it.

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

References

Load these only when needed:

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

required output shape.

— load when reviewing a beforeEach/beforeEnter guard, a guard-returned redirect, a

catch-all route, or history-mode configuration.

— load when reviewing a post-login redirect flow, a dynamic :to/:href binding, or a

v-html/innerHTML sink fed by route.params/route.query.

Response minimum

Return, at minimum:

innerHTML sink(s) in scope,

(client-guard-as-sole-authz / open-redirect / scheme-injection / reflected-xss /

redirect-loop / catch-all-misconfig / history-mode-server-misconfig), the concrete

data-flow trace (the guard-to-endpoint gap, or the full origin-to-sink path naming every hop),

and a fix sketch matching Vue Router's documented pattern,

found and where — never infer it exists without evidence on the traced path,

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

rejects unauthorized requests requires a live request or reading server-side code outside this

diff's scope").

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.