bff-entry-points

Classify and protect browser-facing BFF HTTP, SSE, and WebSocket entry points with enforced access declarations.

723|93|Updated Nov 14, 2021
One-click install
npx skills add https://github.com/citypaul/.dotfiles --skill bff-entry-points
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bff-entry-points
Source: https://github.com/citypaul/.dotfiles/tree/main/claude/.claude/skills/bff-entry-points
Command: npx skills add https://github.com/citypaul/.dotfiles --skill bff-entry-points

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Browser-facing BFF endpoints often rely on implicit middleware ordering and hand-maintained route lists, so routes silently ship without authentication, CSRF, or Origin checks. This Skill makes every production entry point declare an explicit access classification and installs the correct protection chain by construction, with automated gates that fail the build on any bypass.

Core Features & Use Cases

  • Explicit Access Classification: Every route declares public, protected-read, protected-browser-mutation, or protected-upgrade; an unclassified route is a build failure, not a silent default.
  • Composition-Prepared Registrar: A deep module installs session resolution, Origin/Fetch Metadata/CSRF/content-type policy, and RFC 9457 error translation so endpoint owners cannot choose, order, or omit middleware.
  • Realtime and Session Coverage: Protected SSE streams, a sibling WebSocket upgrade registrar, a single browser authentication coordinator, and a derived entry catalog reconciled against the runtime route table and OpenAPI document.
  • Use Case: When adding a new POST endpoint to a Hono or Fastify BFF, use this Skill to declare its contract, let the registrar install the full browser-mutation chain, and add the hostile-matrix and provider-free authorization tests the enforcement gates require.

Quick Start

Use the bff-entry-points skill to classify every route in my BFF and design a registrar that enforces session, Origin, and CSRF policy by construction.

Frequently Asked Questions about bff-entry-points

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I protect BFF endpoints against missing authentication middleware?

Make every endpoint declare an explicit access classification and mount it only through a composition-prepared registrar that installs session, Origin, and CSRF checks by construction. A reconciliation gate comparing the runtime route table against the derived catalog fails the build on any route mounted around the registrar.

How do I secure WebSocket endpoints that bypass Express middleware?

Use a sibling upgrade registrar that owns the server's single 'upgrade' listener: it validates the exact Origin, resolves the session cookie, runs in-application authorization, and only then accepts the handshake. A restricted-import rule ensures no other module can attach upgrade listeners.

Does this approach work with Fastify or Express instead of Hono?

Yes, the model is framework-neutral; the references include a concrete Hono binding plus a mapping table for Fastify hooks, Express router walks, and Fetch-based routers. The invariants—exhaustive classification, prepared chains, derived catalog—stay identical across frameworks.

Why should authorization live in the application instead of HTTP middleware?

Middleware-only authorization is bypassed by any non-HTTP caller such as a CLI, job runner, or test harness. Each protected operation should authorize a provider-free principal before any effect, proven by a direct provider-free refusal test that asserts no side effects occurred.

When is global path-prefix middleware acceptable instead of a registrar?

A very small service with one authentication mode and no realtime endpoints may start with prefix middleware plus an enumerate-all-routes audit test. Adopt the registrar before adding a second authentication mode or the first SSE or WebSocket endpoint, migrating brownfield routes leaf by leaf.