passflow 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +67 -2
- package/dist/cli.mjs +1755 -0
- package/package.json +42 -3
- package/skills/REVISION +1 -0
- package/skills/index.json +405 -0
- package/skills/passflow-nextjs/SKILL.md +205 -0
- package/skills/passflow-nextjs/assets/.env.example +5 -0
- package/skills/passflow-nextjs/assets/app/account/page.tsx +29 -0
- package/skills/passflow-nextjs/assets/app/actions.example.ts +21 -0
- package/skills/passflow-nextjs/assets/app/api/me/route.ts +22 -0
- package/skills/passflow-nextjs/assets/components/auth-links.tsx +11 -0
- package/skills/passflow-nextjs/assets/lib/call-api.example.ts +15 -0
- package/skills/passflow-nextjs/assets/lib/passflow.ts +4 -0
- package/skills/passflow-nextjs/assets/proxy.ts +10 -0
- package/skills/passflow-nextjs/references/guardrails.md +87 -0
- package/skills/passflow-nextjs/scripts/index.json +405 -0
- package/skills/passflow-nextjs/scripts/lib.sh +1069 -0
- package/skills/passflow-nextjs/scripts/verify.sh +467 -0
- package/skills/passflow-node-api/SKILL.md +188 -0
- package/skills/passflow-node-api/assets/examples/explain-rejection.ts +22 -0
- package/skills/passflow-node-api/assets/examples/express-routes.ts +22 -0
- package/skills/passflow-node-api/assets/examples/fastify-routes.ts +28 -0
- package/skills/passflow-node-api/assets/examples/hono-routes.ts +19 -0
- package/skills/passflow-node-api/assets/src/express-cors.ts +11 -0
- package/skills/passflow-node-api/assets/src/express.ts +13 -0
- package/skills/passflow-node-api/assets/src/fastify-cors.ts +11 -0
- package/skills/passflow-node-api/assets/src/fastify.ts +14 -0
- package/skills/passflow-node-api/assets/src/fetch-handler.ts +13 -0
- package/skills/passflow-node-api/assets/src/hono-cors.ts +11 -0
- package/skills/passflow-node-api/assets/src/hono.ts +16 -0
- package/skills/passflow-node-api/assets/src/passflow.ts +10 -0
- package/skills/passflow-node-api/references/guardrails.md +66 -0
- package/skills/passflow-node-api/scripts/index.json +405 -0
- package/skills/passflow-node-api/scripts/lib.sh +1069 -0
- package/skills/passflow-node-api/scripts/verify.sh +283 -0
- package/skills/passflow-react-vite/SKILL.md +224 -0
- package/skills/passflow-react-vite/assets/server/express-cors.ts +9 -0
- package/skills/passflow-react-vite/assets/server/express.ts +14 -0
- package/skills/passflow-react-vite/assets/server/fastify-cors.ts +11 -0
- package/skills/passflow-react-vite/assets/server/fastify.ts +15 -0
- package/skills/passflow-react-vite/assets/server/hono-cors.ts +8 -0
- package/skills/passflow-react-vite/assets/server/hono.ts +17 -0
- package/skills/passflow-react-vite/assets/server/passflow.ts +19 -0
- package/skills/passflow-react-vite/assets/server/tsconfig.json +14 -0
- package/skills/passflow-react-vite/assets/src/passflow.tsx +28 -0
- package/skills/passflow-react-vite/assets/src/require-sign-in.tsx +35 -0
- package/skills/passflow-react-vite/assets/src/use-api.ts +23 -0
- package/skills/passflow-react-vite/references/guardrails.md +82 -0
- package/skills/passflow-react-vite/scripts/index.json +405 -0
- package/skills/passflow-react-vite/scripts/lib.sh +1069 -0
- package/skills/passflow-react-vite/scripts/verify.sh +678 -0
- package/skills/passflow-tanstack-start/SKILL.md +182 -0
- package/skills/passflow-tanstack-start/assets/.env.example +5 -0
- package/skills/passflow-tanstack-start/assets/src/components/auth-links.tsx +10 -0
- package/skills/passflow-tanstack-start/assets/src/lib/call-api.example.ts +14 -0
- package/skills/passflow-tanstack-start/assets/src/lib/passflow.ts +14 -0
- package/skills/passflow-tanstack-start/assets/src/lib/server-functions.example.ts +20 -0
- package/skills/passflow-tanstack-start/assets/src/routes/account.tsx +25 -0
- package/skills/passflow-tanstack-start/assets/src/routes/api/me.ts +25 -0
- package/skills/passflow-tanstack-start/assets/src/start.ts +14 -0
- package/skills/passflow-tanstack-start/references/guardrails.md +73 -0
- package/skills/passflow-tanstack-start/scripts/index.json +405 -0
- package/skills/passflow-tanstack-start/scripts/lib.sh +1069 -0
- package/skills/passflow-tanstack-start/scripts/verify.sh +470 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { extractBearer, isPassflowAuthError } from '@passflow/node';
|
|
2
|
+
import { verifier } from './passflow.js';
|
|
3
|
+
|
|
4
|
+
// Why a token is refused, for debugging only. Logs the error's code and reason, never the token or the
|
|
5
|
+
// header. Call it from a temporary debug route or a script, and remove it afterwards.
|
|
6
|
+
export async function explainRejection(authorization: string | undefined): Promise<void> {
|
|
7
|
+
const token = extractBearer(authorization);
|
|
8
|
+
if (token === undefined) {
|
|
9
|
+
console.log('passflow: no bearer token');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
await verifier.verify(token);
|
|
14
|
+
console.log('passflow: token accepted');
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (isPassflowAuthError(error)) {
|
|
17
|
+
console.log('passflow:', error.code, error.reason ?? '');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AAL2 } from '@passflow/node';
|
|
2
|
+
import { getAuth } from '@passflow/node/express';
|
|
3
|
+
import type { Express } from 'express';
|
|
4
|
+
import { passflow } from './passflow-express.js';
|
|
5
|
+
|
|
6
|
+
// How the app's own routes take each check. Copy the line that fits a route into the app's route file.
|
|
7
|
+
export function protectRoutes(app: Express): void {
|
|
8
|
+
// Any valid access token. Signed out or invalid: 401 with WWW-Authenticate: Bearer.
|
|
9
|
+
app.get('/api/orders', passflow.authenticate, (req, res) => {
|
|
10
|
+
res.set('Cache-Control', 'no-store').json({ owner: getAuth(req).sub });
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// A second factor in this sign-in. Without one: 401 with acr_values="2".
|
|
14
|
+
app.post('/api/payouts', passflow.requireACR(AAL2), (_req, res) => {
|
|
15
|
+
res.status(204).end();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// A sign-in within the last 300 seconds. Older: 401 with max_age=300.
|
|
19
|
+
app.delete('/api/account', passflow.requireFresh(300), (_req, res) => {
|
|
20
|
+
res.status(204).end();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AAL2 } from '@passflow/node';
|
|
2
|
+
import { createFastifyHooks, getAuth } from '@passflow/node/fastify';
|
|
3
|
+
import type { FastifyInstance } from 'fastify';
|
|
4
|
+
import { verifier } from './passflow.js';
|
|
5
|
+
|
|
6
|
+
// How the app's own routes take each check, after passflowPlugin(app) has run. Copy the preHandler that
|
|
7
|
+
// fits a route into the app's route file.
|
|
8
|
+
export async function protectRoutes(app: FastifyInstance): Promise<void> {
|
|
9
|
+
// Any valid access token. Signed out or invalid: 401 with WWW-Authenticate: Bearer.
|
|
10
|
+
app.get('/api/orders', { preHandler: app.passflow.authenticate }, async (request, reply) => {
|
|
11
|
+
reply.header('Cache-Control', 'no-store');
|
|
12
|
+
return { owner: getAuth(request).sub };
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// A second factor in this sign-in. Without one: 401 with acr_values="2".
|
|
16
|
+
app.post('/api/payouts', { preHandler: app.passflow.requireACR(AAL2) }, async (_request, reply) => {
|
|
17
|
+
return reply.code(204).send();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// A sign-in within the last 300 seconds. Older: 401 with max_age=300.
|
|
21
|
+
app.delete('/api/account', { preHandler: app.passflow.requireFresh(300) }, async (_request, reply) => {
|
|
22
|
+
return reply.code(204).send();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// The same hooks without decorating the instance: for a plugin scope where passflowPlugin is not
|
|
27
|
+
// registered. passflowPlugin itself can be registered only once per instance.
|
|
28
|
+
export const passflowHooks = createFastifyHooks(verifier);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AAL2 } from '@passflow/node';
|
|
2
|
+
import { getAuth } from '@passflow/node/hono';
|
|
3
|
+
import type { Hono } from 'hono';
|
|
4
|
+
import { type PassflowEnv, passflow } from './passflow-hono.js';
|
|
5
|
+
|
|
6
|
+
// How the app's own routes take each check. Copy the line that fits a route into the app's route file.
|
|
7
|
+
export function protectRoutes(app: Hono<PassflowEnv>): void {
|
|
8
|
+
// Any valid access token. Signed out or invalid: 401 with WWW-Authenticate: Bearer.
|
|
9
|
+
app.get('/api/orders', passflow.authenticate, (c) => {
|
|
10
|
+
c.header('Cache-Control', 'no-store');
|
|
11
|
+
return c.json({ owner: getAuth(c).sub });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// A second factor in this sign-in. Without one: 401 with acr_values="2".
|
|
15
|
+
app.post('/api/payouts', passflow.requireACR(AAL2), (c) => c.body(null, 204));
|
|
16
|
+
|
|
17
|
+
// A sign-in within the last 300 seconds. Older: 401 with max_age=300.
|
|
18
|
+
app.delete('/api/account', passflow.requireFresh(300), (c) => c.body(null, 204));
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { exposeChallengeHeader } from '@passflow/node/express';
|
|
2
|
+
import cors, { type CorsOptions } from 'cors';
|
|
3
|
+
import type { RequestHandler } from 'express';
|
|
4
|
+
|
|
5
|
+
// For an app that already depends on cors and is called by a browser page on another origin. Mount it
|
|
6
|
+
// before every route, so a preflight never reaches authentication and a 401 still carries the CORS
|
|
7
|
+
// headers. Pass the options the API already uses; exposeChallengeHeader adds WWW-Authenticate to the
|
|
8
|
+
// exposed headers and keeps the rest.
|
|
9
|
+
export function passflowCors(options: CorsOptions): RequestHandler {
|
|
10
|
+
return cors(exposeChallengeHeader(options));
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getAuth, passflowExpress } from '@passflow/node/express';
|
|
2
|
+
import { Router } from 'express';
|
|
3
|
+
import { verifier } from './passflow.js';
|
|
4
|
+
|
|
5
|
+
// authenticate: a verified access token. requireACR(AAL2): a second factor. requireFresh(300): a recent sign-in.
|
|
6
|
+
export const passflow = passflowExpress(verifier);
|
|
7
|
+
|
|
8
|
+
// A protected route: `app.use(passflowRoutes)`.
|
|
9
|
+
export const passflowRoutes = Router();
|
|
10
|
+
|
|
11
|
+
passflowRoutes.get('/api/me', passflow.authenticate, (req, res) => {
|
|
12
|
+
res.set('Cache-Control', 'no-store').json({ sub: getAuth(req).sub });
|
|
13
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import cors, { type FastifyCorsOptions } from '@fastify/cors';
|
|
2
|
+
import { exposeChallengeHeader } from '@passflow/node/fastify';
|
|
3
|
+
import type { FastifyInstance } from 'fastify';
|
|
4
|
+
|
|
5
|
+
// For an app that already depends on @fastify/cors and is called by a browser page on another origin.
|
|
6
|
+
// Register it before passflowPlugin, so a preflight never reaches authentication and a 401 still carries
|
|
7
|
+
// the CORS headers. Pass the options the API already uses; exposeChallengeHeader adds WWW-Authenticate to
|
|
8
|
+
// the exposed headers and keeps the rest.
|
|
9
|
+
export async function passflowCors(app: FastifyInstance, options: FastifyCorsOptions): Promise<void> {
|
|
10
|
+
await app.register(cors, exposeChallengeHeader(options));
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getAuth, passflowFastify } from '@passflow/node/fastify';
|
|
2
|
+
import type { FastifyInstance } from 'fastify';
|
|
3
|
+
import { verifier } from './passflow.js';
|
|
4
|
+
|
|
5
|
+
// Decorates the instance with app.passflow: authenticate, requireACR(level) and requireFresh(seconds).
|
|
6
|
+
// It registers no hook, so each route opts in with a preHandler. Register it once per instance.
|
|
7
|
+
export async function passflowPlugin(app: FastifyInstance): Promise<void> {
|
|
8
|
+
await app.register(passflowFastify, { verifier });
|
|
9
|
+
|
|
10
|
+
app.get('/api/me', { preHandler: app.passflow.authenticate }, async (request, reply) => {
|
|
11
|
+
reply.header('Cache-Control', 'no-store');
|
|
12
|
+
return { sub: getAuth(request).sub };
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { authenticateRequest } from '@passflow/node';
|
|
2
|
+
import { verifier } from './passflow.js';
|
|
3
|
+
|
|
4
|
+
// For a handler that receives a web Request and returns a Response (in Hono, `(c) => handleMe(c.req.raw)`).
|
|
5
|
+
// A rejection is a complete Response: 401 with WWW-Authenticate, or 503 when the key set is unavailable,
|
|
6
|
+
// each with Cache-Control: no-store. Return it unchanged.
|
|
7
|
+
export async function handleMe(request: Request): Promise<Response> {
|
|
8
|
+
const result = await authenticateRequest(verifier, request);
|
|
9
|
+
if ('response' in result) {
|
|
10
|
+
return result.response;
|
|
11
|
+
}
|
|
12
|
+
return Response.json({ sub: result.claims.sub }, { headers: { 'Cache-Control': 'no-store' } });
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { exposeChallengeHeader } from '@passflow/node/hono';
|
|
2
|
+
import type { MiddlewareHandler } from 'hono';
|
|
3
|
+
import { cors } from 'hono/cors';
|
|
4
|
+
|
|
5
|
+
// For an app called by a browser page on another origin; hono/cors ships with hono. Mount it before every
|
|
6
|
+
// route, so a preflight never reaches authentication and a 401 still carries the CORS headers. Pass the
|
|
7
|
+
// options the API already uses; exposeChallengeHeader adds WWW-Authenticate to the exposed headers and
|
|
8
|
+
// keeps the rest.
|
|
9
|
+
export function passflowCors(options: NonNullable<Parameters<typeof cors>[0]>): MiddlewareHandler {
|
|
10
|
+
return cors(exposeChallengeHeader(options));
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getAuth, type PassflowVariables, passflowHono } from '@passflow/node/hono';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
import { verifier } from './passflow.js';
|
|
4
|
+
|
|
5
|
+
export type PassflowEnv = { Variables: PassflowVariables };
|
|
6
|
+
|
|
7
|
+
// authenticate: a verified access token. requireACR(AAL2): a second factor. requireFresh(300): a recent sign-in.
|
|
8
|
+
export const passflow = passflowHono(verifier);
|
|
9
|
+
|
|
10
|
+
// A protected route: `app.route('/', passflowRoutes)`.
|
|
11
|
+
export const passflowRoutes = new Hono<PassflowEnv>();
|
|
12
|
+
|
|
13
|
+
passflowRoutes.get('/api/me', passflow.authenticate, (c) => {
|
|
14
|
+
c.header('Cache-Control', 'no-store');
|
|
15
|
+
return c.json({ sub: getAuth(c).sub });
|
|
16
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createVerifier } from '@passflow/node';
|
|
2
|
+
|
|
3
|
+
// One verifier per trust policy, built once at startup. It owns the key cache.
|
|
4
|
+
// PASSFLOW_ISSUER is matched exactly against the token's `iss`.
|
|
5
|
+
// PASSFLOW_AUDIENCE is the client ID of the Passflow app whose access tokens this API accepts.
|
|
6
|
+
// A missing value throws a TypeError when this module loads.
|
|
7
|
+
export const verifier = createVerifier({
|
|
8
|
+
issuer: process.env.PASSFLOW_ISSUER,
|
|
9
|
+
audience: process.env.PASSFLOW_AUDIENCE,
|
|
10
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Guardrails: Node API
|
|
2
|
+
|
|
3
|
+
Read this before you edit any auth code in the API. Each rule says what to do, why, what to do instead, and whether `scripts/verify.sh` checks it.
|
|
4
|
+
|
|
5
|
+
## 1. Verify tokens with `createVerifier`, never by hand
|
|
6
|
+
|
|
7
|
+
- **Rule:** every access token is checked by a verifier from `createVerifier`, through an adapter (`passflowExpress`, `passflowFastify`, `passflowHono`) or `authenticateRequest`.
|
|
8
|
+
- **Why:** decoding a token is not verifying it. A hand-decoded token has no signature check, no issuer or audience check and no expiry check. Anyone can write a token that decodes.
|
|
9
|
+
- **Instead:** no `jwt-decode`, no `jsonwebtoken`, no `atob(...)` or `Buffer.from(..., 'base64')` on a token. Read claims with `getAuth(...)` after the middleware ran, or from `result.claims` of `authenticateRequest`.
|
|
10
|
+
- **Checked:** `verify.sh static` (guardrails) fails on `jwt-decode`, `jsonwebtoken`, `jwtDecode(`, and on `atob(` or a base64 `Buffer.from` in files that handle tokens.
|
|
11
|
+
|
|
12
|
+
## 2. Check the token on every protected route, on the server
|
|
13
|
+
|
|
14
|
+
- **Rule:** each route that returns or changes private data has `authenticate`, `requireACR(...)` or `requireFresh(...)` on it, or calls `authenticateRequest` first.
|
|
15
|
+
- **Why:** hiding a button in the browser protects nothing. The API is reachable without the browser.
|
|
16
|
+
- **Instead:** put the middleware on the route itself, or on a router or Fastify scope that holds only protected routes. A public route stays outside that scope.
|
|
17
|
+
- **Checked:** `verify.sh run` calls the protected route with no token and with an invalid token, and expects 401 both times.
|
|
18
|
+
|
|
19
|
+
## 3. Return the library's rejection unchanged
|
|
20
|
+
|
|
21
|
+
- **Rule:** a 401 or 503 from the adapter goes to the client as it is: status, `WWW-Authenticate` and `Cache-Control: no-store`.
|
|
22
|
+
- **Why:** the browser SDK starts a step-up only from the exact challenge. A custom error handler or a rewritten body drops it.
|
|
23
|
+
- **Instead:** do not wrap the middleware in `try`/`catch`, do not call `next(err)` with it, and return `result.response` from `authenticateRequest` as it is. A missing role is your decision: answer 403 with no `WWW-Authenticate`.
|
|
24
|
+
- **Checked:** `verify.sh run` reads `WWW-Authenticate` and `Cache-Control` on the 401.
|
|
25
|
+
|
|
26
|
+
## 4. Expose `WWW-Authenticate` when a browser calls the API
|
|
27
|
+
|
|
28
|
+
- **Rule:** when a page on another origin calls the API, CORS is mounted before every route and its options are wrapped in `exposeChallengeHeader`.
|
|
29
|
+
- **Why:** a browser hides `WWW-Authenticate` from a cross-origin page unless `Access-Control-Expose-Headers` names it. `*` does not count on a credentialed request.
|
|
30
|
+
- **Instead:** wrap the existing CORS options in `exposeChallengeHeader`, or use `passflowCors(...)` from the CORS asset when the CORS package is already a dependency, with the origins the API already allows. Do not hard-code a new origin. Keep the existing `credentials` setting and never turn it on: a bearer token needs no credentials, and credentials with an origin that reflects every site lets any site read the answers.
|
|
31
|
+
- **Checked:** `verify.sh run --origin <origin>` checks that the 401 carries `Access-Control-Allow-Origin` for that origin and `Access-Control-Expose-Headers` with `WWW-Authenticate`.
|
|
32
|
+
|
|
33
|
+
## 5. Configuration comes from the environment
|
|
34
|
+
|
|
35
|
+
- **Rule:** the issuer and the audience come from `PASSFLOW_ISSUER` and `PASSFLOW_AUDIENCE`. Nothing Passflow-specific is hard-coded.
|
|
36
|
+
- **Why:** each environment (local, staging, production) has its own issuer and app. A hard-coded value ships the wrong one, or mixes them.
|
|
37
|
+
- **Instead:** keep `src/passflow.ts` as the asset has it. Build one verifier at startup and share it.
|
|
38
|
+
- **Checked:** no.
|
|
39
|
+
|
|
40
|
+
## 6. Copy SDK calls from `assets/`, never from memory
|
|
41
|
+
|
|
42
|
+
- **Rule:** every `@passflow/node` import and call in the app matches an asset file.
|
|
43
|
+
- **Why:** the package has a small, exact surface. A remembered name, option or import path from another library compiles badly or, worse, compiles and checks nothing.
|
|
44
|
+
- **Instead:** copy the asset, then adapt only what its comment allows (file location, import style, the route list). For the app's own routes, copy the lines in `assets/examples/`.
|
|
45
|
+
- **Checked:** `verify.sh static` type-checks and builds the app.
|
|
46
|
+
|
|
47
|
+
## 7. Never print or log a token
|
|
48
|
+
|
|
49
|
+
- **Rule:** no `console.log`, logger call, error message or response body contains a token, an `Authorization` header or an env value.
|
|
50
|
+
- **Why:** logs are copied, shipped and kept. A logged token is a stolen session.
|
|
51
|
+
- **Instead:** to debug a rejection, log `error.code` and `error.reason` of a `PassflowAuthError`, nothing else, as `assets/examples/explain-rejection.ts` does.
|
|
52
|
+
- **Checked:** no.
|
|
53
|
+
|
|
54
|
+
## 8. Add only `@passflow/node`; leave scripts and env files alone
|
|
55
|
+
|
|
56
|
+
- **Rule:** the only dependency you add is `@passflow/node`. You never edit `package.json` scripts and never create or edit a `.env*` file, `.env.example` included.
|
|
57
|
+
- **Why:** the choice of server packages belongs to the project, and a change through the Passflow service that adds another dependency, touches a script or writes an env file is refused as a whole. The CLI and the service write the env files themselves.
|
|
58
|
+
- **Instead:** when the project needs another package (a CORS package), a script change (`--env-file=.env`) or env values, list the exact command or line in the final message to the developer.
|
|
59
|
+
- **Checked:** no.
|
|
60
|
+
|
|
61
|
+
## 9. The env file stays out of git
|
|
62
|
+
|
|
63
|
+
- **Rule:** `.env` holds the real values and is never committed. On the developer's machine, if `git ls-files --error-unmatch .env` succeeds, stop and tell the user. A Passflow GitHub App run never starts on such a repository: the service refuses a committed `.env`, `.env.local` or `.env.*.local` before the agent runs.
|
|
64
|
+
- **Why:** a `.gitignore` line does not cover a file git already tracks.
|
|
65
|
+
- **Instead:** tell the user to run `git rm --cached .env`, commit, and add `.env` to `.gitignore`. Do not edit `.env` yourself.
|
|
66
|
+
- **Checked:** no.
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"package_managers": {
|
|
4
|
+
"supported": [
|
|
5
|
+
"npm",
|
|
6
|
+
"pnpm",
|
|
7
|
+
"yarn-classic"
|
|
8
|
+
],
|
|
9
|
+
"refused": [
|
|
10
|
+
"yarn-berry",
|
|
11
|
+
"bun"
|
|
12
|
+
],
|
|
13
|
+
"detect": [
|
|
14
|
+
{
|
|
15
|
+
"file": "pnpm-lock.yaml",
|
|
16
|
+
"manager": "pnpm"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"file": "package-lock.json",
|
|
20
|
+
"manager": "npm"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"file": "yarn.lock",
|
|
24
|
+
"manager": "yarn-classic"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"file": ".yarnrc.yml",
|
|
28
|
+
"manager": "yarn-berry"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"file": "bun.lock",
|
|
32
|
+
"manager": "bun"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"file": "bun.lockb",
|
|
36
|
+
"manager": "bun"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"stacks": [
|
|
41
|
+
{
|
|
42
|
+
"id": "tanstack-start",
|
|
43
|
+
"skill": "passflow-tanstack-start",
|
|
44
|
+
"detect": {
|
|
45
|
+
"all": [
|
|
46
|
+
{
|
|
47
|
+
"package": "@tanstack/react-start",
|
|
48
|
+
"range": ">=1.169.5"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"package": "@tanstack/react-router",
|
|
52
|
+
"range": ">=1.170.46"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"app_type": "bff",
|
|
57
|
+
"default_base_url": "http://localhost:3000",
|
|
58
|
+
"env_file": ".env.local",
|
|
59
|
+
"env_keys": [
|
|
60
|
+
"PASSFLOW_ISSUER",
|
|
61
|
+
"PASSFLOW_CLIENT_ID",
|
|
62
|
+
"PASSFLOW_CLIENT_SECRET",
|
|
63
|
+
"PASSFLOW_SECRET",
|
|
64
|
+
"APP_BASE_URL"
|
|
65
|
+
],
|
|
66
|
+
"secret_env_keys": [
|
|
67
|
+
"PASSFLOW_CLIENT_SECRET",
|
|
68
|
+
"PASSFLOW_SECRET"
|
|
69
|
+
],
|
|
70
|
+
"not_provisioned_env_keys": [],
|
|
71
|
+
"packages": [
|
|
72
|
+
{
|
|
73
|
+
"name": "@passflow/tanstack-react-start",
|
|
74
|
+
"version_env": "PASSFLOW_TANSTACK_REACT_START_VERSION",
|
|
75
|
+
"env_keys": [
|
|
76
|
+
"PASSFLOW_ISSUER",
|
|
77
|
+
"PASSFLOW_CLIENT_ID",
|
|
78
|
+
"PASSFLOW_CLIENT_SECRET",
|
|
79
|
+
"PASSFLOW_SECRET",
|
|
80
|
+
"APP_BASE_URL"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"allowed_paths": [
|
|
85
|
+
"src/**",
|
|
86
|
+
"app/**",
|
|
87
|
+
".gitignore",
|
|
88
|
+
"package.json",
|
|
89
|
+
"package-lock.json",
|
|
90
|
+
"pnpm-lock.yaml",
|
|
91
|
+
"yarn.lock"
|
|
92
|
+
],
|
|
93
|
+
"denied_paths": [
|
|
94
|
+
"next.config.*",
|
|
95
|
+
"vite.config.*",
|
|
96
|
+
"vitest.config.*",
|
|
97
|
+
"app.config.*",
|
|
98
|
+
"tsconfig*.json",
|
|
99
|
+
"jsconfig*.json",
|
|
100
|
+
"postcss.config.*",
|
|
101
|
+
"tailwind.config.*",
|
|
102
|
+
"eslint.config.*",
|
|
103
|
+
".eslintrc*",
|
|
104
|
+
"babel.config.*",
|
|
105
|
+
".babelrc*",
|
|
106
|
+
"turbo.json",
|
|
107
|
+
"nx.json",
|
|
108
|
+
"Dockerfile*",
|
|
109
|
+
"docker-compose*",
|
|
110
|
+
".github/**",
|
|
111
|
+
".env*",
|
|
112
|
+
"**/.env*",
|
|
113
|
+
"scripts/**",
|
|
114
|
+
".npmrc",
|
|
115
|
+
"**/.npmrc",
|
|
116
|
+
".yarnrc",
|
|
117
|
+
".yarnrc.yml",
|
|
118
|
+
".yarn/**",
|
|
119
|
+
".pnp.cjs",
|
|
120
|
+
".pnp.loader.mjs",
|
|
121
|
+
"pnpm-workspace.yaml",
|
|
122
|
+
"npm-shrinkwrap.json",
|
|
123
|
+
"bun.lock",
|
|
124
|
+
"bun.lockb"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "nextjs",
|
|
129
|
+
"skill": "passflow-nextjs",
|
|
130
|
+
"detect": {
|
|
131
|
+
"all": [
|
|
132
|
+
{
|
|
133
|
+
"package": "next",
|
|
134
|
+
"range": ">=16"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"app_type": "bff",
|
|
139
|
+
"default_base_url": "http://localhost:3000",
|
|
140
|
+
"env_file": ".env.local",
|
|
141
|
+
"env_keys": [
|
|
142
|
+
"PASSFLOW_ISSUER",
|
|
143
|
+
"PASSFLOW_CLIENT_ID",
|
|
144
|
+
"PASSFLOW_CLIENT_SECRET",
|
|
145
|
+
"PASSFLOW_SECRET",
|
|
146
|
+
"APP_BASE_URL"
|
|
147
|
+
],
|
|
148
|
+
"secret_env_keys": [
|
|
149
|
+
"PASSFLOW_CLIENT_SECRET",
|
|
150
|
+
"PASSFLOW_SECRET"
|
|
151
|
+
],
|
|
152
|
+
"not_provisioned_env_keys": [],
|
|
153
|
+
"packages": [
|
|
154
|
+
{
|
|
155
|
+
"name": "@passflow/nextjs",
|
|
156
|
+
"version_env": "PASSFLOW_NEXTJS_VERSION",
|
|
157
|
+
"env_keys": [
|
|
158
|
+
"PASSFLOW_ISSUER",
|
|
159
|
+
"PASSFLOW_CLIENT_ID",
|
|
160
|
+
"PASSFLOW_CLIENT_SECRET",
|
|
161
|
+
"PASSFLOW_SECRET",
|
|
162
|
+
"APP_BASE_URL"
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"allowed_paths": [
|
|
167
|
+
"app/**",
|
|
168
|
+
"src/**",
|
|
169
|
+
"lib/**",
|
|
170
|
+
"components/**",
|
|
171
|
+
"proxy.ts",
|
|
172
|
+
"proxy.js",
|
|
173
|
+
"middleware.ts",
|
|
174
|
+
"middleware.js",
|
|
175
|
+
"src/proxy.ts",
|
|
176
|
+
"src/proxy.js",
|
|
177
|
+
"src/middleware.ts",
|
|
178
|
+
"src/middleware.js",
|
|
179
|
+
".gitignore",
|
|
180
|
+
"package.json",
|
|
181
|
+
"package-lock.json",
|
|
182
|
+
"pnpm-lock.yaml",
|
|
183
|
+
"yarn.lock"
|
|
184
|
+
],
|
|
185
|
+
"denied_paths": [
|
|
186
|
+
"next.config.*",
|
|
187
|
+
"vite.config.*",
|
|
188
|
+
"vitest.config.*",
|
|
189
|
+
"app.config.*",
|
|
190
|
+
"tsconfig*.json",
|
|
191
|
+
"jsconfig*.json",
|
|
192
|
+
"postcss.config.*",
|
|
193
|
+
"tailwind.config.*",
|
|
194
|
+
"eslint.config.*",
|
|
195
|
+
".eslintrc*",
|
|
196
|
+
"babel.config.*",
|
|
197
|
+
".babelrc*",
|
|
198
|
+
"turbo.json",
|
|
199
|
+
"nx.json",
|
|
200
|
+
"Dockerfile*",
|
|
201
|
+
"docker-compose*",
|
|
202
|
+
".github/**",
|
|
203
|
+
".env*",
|
|
204
|
+
"**/.env*",
|
|
205
|
+
"scripts/**",
|
|
206
|
+
".npmrc",
|
|
207
|
+
"**/.npmrc",
|
|
208
|
+
".yarnrc",
|
|
209
|
+
".yarnrc.yml",
|
|
210
|
+
".yarn/**",
|
|
211
|
+
".pnp.cjs",
|
|
212
|
+
".pnp.loader.mjs",
|
|
213
|
+
"pnpm-workspace.yaml",
|
|
214
|
+
"npm-shrinkwrap.json",
|
|
215
|
+
"bun.lock",
|
|
216
|
+
"bun.lockb"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"id": "react-vite",
|
|
221
|
+
"skill": "passflow-react-vite",
|
|
222
|
+
"detect": {
|
|
223
|
+
"all": [
|
|
224
|
+
{
|
|
225
|
+
"package": "vite"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"package": "react"
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
"app_type": "spa",
|
|
233
|
+
"default_base_url": "http://localhost:5173",
|
|
234
|
+
"env_file": ".env.local",
|
|
235
|
+
"env_keys": [
|
|
236
|
+
"VITE_PASSFLOW_URL",
|
|
237
|
+
"VITE_PASSFLOW_APP_ID",
|
|
238
|
+
"VITE_API_URL",
|
|
239
|
+
"PASSFLOW_ISSUER",
|
|
240
|
+
"PASSFLOW_AUDIENCE",
|
|
241
|
+
"APP_BASE_URL"
|
|
242
|
+
],
|
|
243
|
+
"secret_env_keys": [],
|
|
244
|
+
"not_provisioned_env_keys": [
|
|
245
|
+
"VITE_API_URL"
|
|
246
|
+
],
|
|
247
|
+
"packages": [
|
|
248
|
+
{
|
|
249
|
+
"name": "@passflow/react",
|
|
250
|
+
"version_env": "PASSFLOW_REACT_VERSION",
|
|
251
|
+
"env_keys": [
|
|
252
|
+
"VITE_PASSFLOW_URL",
|
|
253
|
+
"VITE_PASSFLOW_APP_ID",
|
|
254
|
+
"VITE_API_URL"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "@passflow/node",
|
|
259
|
+
"version_env": "PASSFLOW_NODE_VERSION",
|
|
260
|
+
"env_keys": [
|
|
261
|
+
"PASSFLOW_ISSUER",
|
|
262
|
+
"PASSFLOW_AUDIENCE",
|
|
263
|
+
"APP_BASE_URL"
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"allowed_paths": [
|
|
268
|
+
"src/**",
|
|
269
|
+
"server/**",
|
|
270
|
+
"api/**",
|
|
271
|
+
".gitignore",
|
|
272
|
+
"package.json",
|
|
273
|
+
"package-lock.json",
|
|
274
|
+
"pnpm-lock.yaml",
|
|
275
|
+
"yarn.lock"
|
|
276
|
+
],
|
|
277
|
+
"denied_paths": [
|
|
278
|
+
"next.config.*",
|
|
279
|
+
"vite.config.*",
|
|
280
|
+
"vitest.config.*",
|
|
281
|
+
"app.config.*",
|
|
282
|
+
"tsconfig*.json",
|
|
283
|
+
"jsconfig*.json",
|
|
284
|
+
"postcss.config.*",
|
|
285
|
+
"tailwind.config.*",
|
|
286
|
+
"eslint.config.*",
|
|
287
|
+
".eslintrc*",
|
|
288
|
+
"babel.config.*",
|
|
289
|
+
".babelrc*",
|
|
290
|
+
"turbo.json",
|
|
291
|
+
"nx.json",
|
|
292
|
+
"Dockerfile*",
|
|
293
|
+
"docker-compose*",
|
|
294
|
+
".github/**",
|
|
295
|
+
".env*",
|
|
296
|
+
"**/.env*",
|
|
297
|
+
"scripts/**",
|
|
298
|
+
".npmrc",
|
|
299
|
+
"**/.npmrc",
|
|
300
|
+
".yarnrc",
|
|
301
|
+
".yarnrc.yml",
|
|
302
|
+
".yarn/**",
|
|
303
|
+
".pnp.cjs",
|
|
304
|
+
".pnp.loader.mjs",
|
|
305
|
+
"pnpm-workspace.yaml",
|
|
306
|
+
"npm-shrinkwrap.json",
|
|
307
|
+
"bun.lock",
|
|
308
|
+
"bun.lockb",
|
|
309
|
+
"index.html"
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"id": "node-api",
|
|
314
|
+
"skill": "passflow-node-api",
|
|
315
|
+
"detect": {
|
|
316
|
+
"any": [
|
|
317
|
+
{
|
|
318
|
+
"package": "express"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"package": "fastify"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"package": "hono"
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
"app_type": null,
|
|
329
|
+
"default_base_url": null,
|
|
330
|
+
"env_file": ".env",
|
|
331
|
+
"env_keys": [
|
|
332
|
+
"PASSFLOW_ISSUER",
|
|
333
|
+
"PASSFLOW_AUDIENCE"
|
|
334
|
+
],
|
|
335
|
+
"secret_env_keys": [],
|
|
336
|
+
"not_provisioned_env_keys": [],
|
|
337
|
+
"packages": [
|
|
338
|
+
{
|
|
339
|
+
"name": "@passflow/node",
|
|
340
|
+
"version_env": "PASSFLOW_NODE_VERSION",
|
|
341
|
+
"env_keys": [
|
|
342
|
+
"PASSFLOW_ISSUER",
|
|
343
|
+
"PASSFLOW_AUDIENCE"
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
"allowed_paths": [
|
|
348
|
+
"src/**",
|
|
349
|
+
"server/**",
|
|
350
|
+
"lib/**",
|
|
351
|
+
"routes/**",
|
|
352
|
+
"index.ts",
|
|
353
|
+
"index.js",
|
|
354
|
+
"index.mjs",
|
|
355
|
+
"server.ts",
|
|
356
|
+
"server.js",
|
|
357
|
+
"server.mjs",
|
|
358
|
+
"app.ts",
|
|
359
|
+
"app.js",
|
|
360
|
+
"app.mjs",
|
|
361
|
+
"main.ts",
|
|
362
|
+
"main.js",
|
|
363
|
+
"main.mjs",
|
|
364
|
+
".gitignore",
|
|
365
|
+
"package.json",
|
|
366
|
+
"package-lock.json",
|
|
367
|
+
"pnpm-lock.yaml",
|
|
368
|
+
"yarn.lock"
|
|
369
|
+
],
|
|
370
|
+
"denied_paths": [
|
|
371
|
+
"next.config.*",
|
|
372
|
+
"vite.config.*",
|
|
373
|
+
"vitest.config.*",
|
|
374
|
+
"app.config.*",
|
|
375
|
+
"tsconfig*.json",
|
|
376
|
+
"jsconfig*.json",
|
|
377
|
+
"postcss.config.*",
|
|
378
|
+
"tailwind.config.*",
|
|
379
|
+
"eslint.config.*",
|
|
380
|
+
".eslintrc*",
|
|
381
|
+
"babel.config.*",
|
|
382
|
+
".babelrc*",
|
|
383
|
+
"turbo.json",
|
|
384
|
+
"nx.json",
|
|
385
|
+
"Dockerfile*",
|
|
386
|
+
"docker-compose*",
|
|
387
|
+
".github/**",
|
|
388
|
+
".env*",
|
|
389
|
+
"**/.env*",
|
|
390
|
+
"scripts/**",
|
|
391
|
+
".npmrc",
|
|
392
|
+
"**/.npmrc",
|
|
393
|
+
".yarnrc",
|
|
394
|
+
".yarnrc.yml",
|
|
395
|
+
".yarn/**",
|
|
396
|
+
".pnp.cjs",
|
|
397
|
+
".pnp.loader.mjs",
|
|
398
|
+
"pnpm-workspace.yaml",
|
|
399
|
+
"npm-shrinkwrap.json",
|
|
400
|
+
"bun.lock",
|
|
401
|
+
"bun.lockb"
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
}
|