@produtype/core 0.85.0 → 0.86.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.
@@ -391,6 +391,26 @@ async function detectSecurity(ctx) {
391
391
  corsStrict.push(hit);
392
392
  break;
393
393
  }
394
+ /**
395
+ * ASP.NET Core's, which is a call to the framework's own builder.
396
+ *
397
+ * `AddCors()` registers the service and `UseCors()` puts it in the pipeline; both
398
+ * names belong to the framework. Jellyfin calls each of them and was told at `high`
399
+ * that it has no cross-origin configuration.
400
+ *
401
+ * Which policy it is comes from the builder: `AllowAnyOrigin()` is the wide-open
402
+ * one and `WithOrigins(...)` is a list somebody chose. Jellyfin has both — the
403
+ * first when no hosts are configured — and where both are shipped the open branch
404
+ * is the one worth reporting, because it is reachable.
405
+ */
406
+ const aspNetCors = await (0, textSearch_1.searchInFiles)(ctx.root, source.filter((f) => /\.cs$/i.test(f)), [/\.\s*AddCors\s*\(/, /\.\s*UseCors\s*\(/, /\bUseCors\s*\(/, /\bAddCors\s*\(/], 5);
407
+ if (aspNetCors.length > 0) {
408
+ const anyOrigin = await (0, textSearch_1.searchInFiles)(ctx.root, source.filter((f) => /\.cs$/i.test(f)), [/AllowAnyOrigin\s*\(/], 2);
409
+ const chosen = await (0, textSearch_1.searchInFiles)(ctx.root, source.filter((f) => /\.cs$/i.test(f)), [/WithOrigins\s*\(/, /SetIsOriginAllowed\s*\(/], 2);
410
+ const target = anyOrigin.length > 0 || chosen.length === 0 ? corsLoose : corsStrict;
411
+ const cited = anyOrigin[0] ?? chosen[0] ?? aspNetCors[0];
412
+ target.push({ file: cited.file, line: cited.line, snippet: cited.snippet.trim().slice(0, 200) });
413
+ }
394
414
  const django = await (0, djangoSettings_1.findDjangoSettings)(ctx);
395
415
  if (django) {
396
416
  const middlewareLine = django.text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@produtype/core",
3
- "version": "0.85.0",
3
+ "version": "0.86.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": {