@north-light/identity 0.3.758 → 0.3.760

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59,8 +59,9 @@ function parseSelector(value) {
59
59
  if (match)
60
60
  return { kind: 'peer', value };
61
61
  match = /^([^:]+):([^:]+)$/.exec(value);
62
- if (match && match[1] !== 'crtr' && id.test(match[1]) && id.test(match[2]))
63
- return { kind: 'provider', value };
62
+ // `<provider>:*` means every group of that provider the grant may hold; it covers each `<provider>:<group>`.
63
+ if (match && match[1] !== 'crtr' && id.test(match[1]) && (match[2] === '*' || id.test(match[2])))
64
+ return { kind: 'provider', value, provider: match[1], group: match[2] };
64
65
  throw new TypeError(`Unsupported scope: ${value}`);
65
66
  }
66
67
  export function parseScope(value, grantee) {
@@ -90,6 +91,8 @@ export function covers(held, requested) {
90
91
  return h.holder === r.holder && (h.access === 'rw' || r.access === 'read') &&
91
92
  (h.path === '.' || h.path === r.path || r.path.startsWith(`${h.path}/`));
92
93
  }
94
+ if (h.kind === 'provider' && r.kind === 'provider')
95
+ return h.provider === r.provider && (h.group === '*' || h.group === r.group);
93
96
  return held === requested;
94
97
  }
95
98
  /** A directory fetch ran past its deadline (or was aborted by its caller before that). `code` is `deadline_exceeded`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/identity",
3
- "version": "0.3.758",
3
+ "version": "0.3.760",
4
4
  "description": "Northlight access-token verification and scope rules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",