@produtype/core 1.4.0 → 1.5.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.
@@ -141,6 +141,35 @@ async function detectAuth(ctx) {
141
141
  /createServerClient/,
142
142
  /\[\.\.\.nextauth\]/i,
143
143
  ], 30);
144
+ /**
145
+ * Identity the platform supplies, under a name the author did not choose.
146
+ *
147
+ * Cloudflare Access sits in front of Orange Meets and puts a signed JWT on every
148
+ * request as the `CF_Authorization` cookie; `app/root.tsx` decodes it, checks its
149
+ * expiry and redirects when it is about to lapse. There is no auth package in the
150
+ * manifest and no `/login` route, because signing in happens before the request
151
+ * reaches the application at all — so the report told a product behind an identity
152
+ * proxy that "anyone who finds a URL can use the product and read whatever it
153
+ * exposes".
154
+ *
155
+ * The same arrangement has a name on every platform: Google IAP, an AWS ALB with
156
+ * OIDC, Azure App Service's Easy Auth. Each one publishes a fixed header or cookie,
157
+ * and reading it is how an application asks who is calling. Those names are the
158
+ * anchor — nobody in the repository invented `x-amzn-oidc-data`.
159
+ *
160
+ * It says the request is authenticated, not that the application authorizes
161
+ * anything: `hasAuthz` is decided separately and stays untouched.
162
+ */
163
+ const PLATFORM_IDENTITY = [
164
+ /\bCF_Authorization\b/,
165
+ /\bCf-Access-Jwt-Assertion\b/i,
166
+ /\bcf-access-authenticated-user-email\b/i,
167
+ /\bx-goog-iap-jwt-assertion\b/i,
168
+ /\bx-goog-authenticated-user-email\b/i,
169
+ /\bx-amzn-oidc-(?:data|identity|accesstoken)\b/i,
170
+ /\bX-MS-CLIENT-PRINCIPAL(?:-NAME|-ID)?\b/i,
171
+ ];
172
+ const platformIdentity = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, PLATFORM_IDENTITY, 10);
144
173
  /**
145
174
  * `otp` as a word, not as three letters inside another one.
146
175
  *
@@ -394,7 +423,7 @@ async function detectAuth(ctx) {
394
423
  */
395
424
  const structuralOwnership = await (0, ownershipChecks_1.readOwnershipChecks)(ctx.root, sourceFiles);
396
425
  const ownershipUnasked = (0, readingDepth_1.wentUnasked)(structuralOwnership, sourceFiles) && (await (0, ownershipChecks_1.anyFileImportsExpress)(ctx.root, sourceFiles));
397
- const hasAuth = authDeps.length > 0 || routeSignals.length > 0;
426
+ const hasAuth = authDeps.length > 0 || routeSignals.length > 0 || platformIdentity.length > 0;
398
427
  const hasAuthz = permissionSignals.length > 0 || roleSignals.length > 0;
399
428
  const b2bHint = b2bSignals.length > 0;
400
429
  const hasOrganization = organizationSignals.length > 0;
@@ -403,7 +432,7 @@ async function detectAuth(ctx) {
403
432
  key: 'auth.core',
404
433
  present: hasAuth,
405
434
  complete: hasAuth && hasAuthz,
406
- evidence: (0, absenceEvidence_1.evidenceOrSearch)([...depEvidence(authDeps), ...authUseEvidence, ...snippetEvidence(routeSignals)], 'a way for somebody to sign in', ['next-auth', 'passport', 'lucia', '@clerk/', '@supabase/auth', 'django.contrib.auth', 'devise', 'jsonwebtoken', 'a /login or /signin route', 'signIn(', 'authenticate(']),
435
+ evidence: (0, absenceEvidence_1.evidenceOrSearch)([...depEvidence(authDeps), ...authUseEvidence, ...snippetEvidence(routeSignals), ...snippetEvidence(platformIdentity)], 'a way for somebody to sign in', ['next-auth', 'passport', 'lucia', '@clerk/', '@supabase/auth', 'django.contrib.auth', 'devise', 'jsonwebtoken', 'a /login or /signin route', 'signIn(', 'authenticate(', 'a Cloudflare Access, Google IAP, AWS ALB or Azure Easy Auth identity header']),
407
436
  details: {
408
437
  hasAuth,
409
438
  hasAuthz,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@produtype/core",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Deterministic CLI and library that analyzes a web application repository and reports how far it is from production-ready for the kind of product it is meant to be.",
5
5
  "license": "MIT",
6
6
  "bin": {