@produtype/core 0.58.0 → 0.59.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/dist/analyzer/detectAuth.js +17 -4
- package/package.json +1 -1
|
@@ -204,9 +204,20 @@ async function detectAuth(ctx) {
|
|
|
204
204
|
const roleSignals = [...unambiguousRoles, ...comparedRoles].slice(0, 20);
|
|
205
205
|
const permissionSignals = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, [/requirePermission/i, /permission_classes/i, /permissions\.py/i, /authorize\(/i, /\bcan\(/i], 20);
|
|
206
206
|
const resourceLevelSignals = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, [
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Per-record, which is what this capability claims.
|
|
209
|
+
*
|
|
210
|
+
* `requirePermission` and `permission_classes` were in this list, and they are
|
|
211
|
+
* checks on a route: the capability's own description is "per-record checks that
|
|
212
|
+
* a caller may act on the specific resource, **not just the route**". Three
|
|
213
|
+
* projects were credited with protection against reading another user's rows —
|
|
214
|
+
* one of them on the strength of `permission_classes = [AllowAny]`, a line that
|
|
215
|
+
* says the opposite. They belong to `authz.permissions`, where they already are.
|
|
216
|
+
*
|
|
217
|
+
* `authorize(` keeps its place but needs an argument. `google_calendar.authorize()`
|
|
218
|
+
* is an OAuth handshake, and it was standing in for an ownership check.
|
|
219
|
+
*/
|
|
220
|
+
/\bauthorize\(\s*[^)\s]/i,
|
|
210
221
|
/\bcanAccess\(/i,
|
|
211
222
|
/\bhasAccessTo\(/i,
|
|
212
223
|
/ownerId/i,
|
|
@@ -375,7 +386,9 @@ async function detectAuth(ctx) {
|
|
|
375
386
|
},
|
|
376
387
|
{
|
|
377
388
|
key: 'authz.resourceLevel',
|
|
378
|
-
|
|
389
|
+
// Route-level permission checks no longer stand in for per-record ones: with the
|
|
390
|
+
// needles above narrowed, this clause could only reintroduce what they removed.
|
|
391
|
+
present: resourceLevelSignals.length > 0,
|
|
379
392
|
evidence: (0, absenceEvidence_1.evidenceOrSearch)(snippetEvidence(resourceLevelSignals), 'a check that the row belongs to the caller', ['requirePermission', 'permission_classes', 'authorize(', 'canAccess(', 'hasAccessTo(', 'ownerId', 'createdBy', 'req.user.id', 'userId ===']),
|
|
380
393
|
},
|
|
381
394
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@produtype/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.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": {
|