@webpieces/http-routing 0.3.353 → 0.3.354
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-routing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.354",
|
|
4
4
|
"description": "Decorator-based routing with auto-wiring for WebPieces",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@inversifyjs/binding-decorators": "1.1.5",
|
|
25
|
-
"@webpieces/core-context": "0.3.
|
|
26
|
-
"@webpieces/core-util": "0.3.
|
|
27
|
-
"@webpieces/gcp-identity": "0.3.
|
|
25
|
+
"@webpieces/core-context": "0.3.354",
|
|
26
|
+
"@webpieces/core-util": "0.3.354",
|
|
27
|
+
"@webpieces/gcp-identity": "0.3.354",
|
|
28
28
|
"inversify": "7.10.4",
|
|
29
29
|
"jsonwebtoken": "9.0.2",
|
|
30
30
|
"minimatch": "10.0.1"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GcpOidc } from '@webpieces/gcp-identity';
|
|
1
2
|
/**
|
|
2
3
|
* DefaultOidcVerifier - the framework's built-in Google OIDC verifier, injected into
|
|
3
4
|
* {@link AuthFilter} and run directly whenever no app {@link OidcHook} is bound. It is what makes
|
|
@@ -14,5 +15,7 @@
|
|
|
14
15
|
* parallel-safe.
|
|
15
16
|
*/
|
|
16
17
|
export declare class DefaultOidcVerifier {
|
|
18
|
+
private readonly gcpOidc;
|
|
19
|
+
constructor(gcpOidc: GcpOidc);
|
|
17
20
|
verify(token: string, callers: string[]): Promise<void>;
|
|
18
21
|
}
|
|
@@ -22,11 +22,15 @@ const gcp_identity_1 = require("@webpieces/gcp-identity");
|
|
|
22
22
|
* parallel-safe.
|
|
23
23
|
*/
|
|
24
24
|
let DefaultOidcVerifier = class DefaultOidcVerifier {
|
|
25
|
+
gcpOidc;
|
|
26
|
+
constructor(gcpOidc) {
|
|
27
|
+
this.gcpOidc = gcpOidc;
|
|
28
|
+
}
|
|
25
29
|
async verify(token, callers) {
|
|
26
30
|
// callers pass straight through: EMPTY (@AuthOidc() with no callers) = TRUST THE EDGE, a
|
|
27
31
|
// non-empty list enforces the explicit allow-list. Do NOT inject a ['self'] default — that
|
|
28
32
|
// would reject a legitimate cross-SA caller the edge already admitted.
|
|
29
|
-
const result = await
|
|
33
|
+
const result = await this.gcpOidc.verifyFromCallers(token, callers);
|
|
30
34
|
if (!result.ok) {
|
|
31
35
|
throw new core_util_1.HttpUnauthorizedError(`OIDC rejected: ${result.reason ?? 'not an allowed caller'}`);
|
|
32
36
|
}
|
|
@@ -35,6 +39,8 @@ let DefaultOidcVerifier = class DefaultOidcVerifier {
|
|
|
35
39
|
exports.DefaultOidcVerifier = DefaultOidcVerifier;
|
|
36
40
|
exports.DefaultOidcVerifier = DefaultOidcVerifier = tslib_1.__decorate([
|
|
37
41
|
(0, core_context_1.provideFrameworkSingleton)(),
|
|
38
|
-
(0, inversify_1.injectable)()
|
|
42
|
+
(0, inversify_1.injectable)(),
|
|
43
|
+
tslib_1.__param(0, (0, inversify_1.inject)(gcp_identity_1.GcpOidc)),
|
|
44
|
+
tslib_1.__metadata("design:paramtypes", [gcp_identity_1.GcpOidc])
|
|
39
45
|
], DefaultOidcVerifier);
|
|
40
46
|
//# sourceMappingURL=DefaultOidcVerifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultOidcVerifier.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/DefaultOidcVerifier.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"DefaultOidcVerifier.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/DefaultOidcVerifier.ts"],"names":[],"mappings":";;;;AAAA,yCAA+C;AAC/C,0DAAoE;AACpE,oDAA6D;AAC7D,0DAAkD;AAElD;;;;;;;;;;;;;;GAcG;AAGI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGU;IAFtC,YAEsC,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IACnD,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,OAAiB;QACzC,yFAAyF;QACzF,2FAA2F;QAC3F,uEAAuE;QACvE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACpE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACb,MAAM,IAAI,iCAAqB,CAAC,kBAAkB,MAAM,CAAC,MAAM,IAAI,uBAAuB,EAAE,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;CACJ,CAAA;AAfY,kDAAmB;8BAAnB,mBAAmB;IAF/B,IAAA,wCAAyB,GAAE;IAC3B,IAAA,sBAAU,GAAE;IAIJ,mBAAA,IAAA,kBAAM,EAAC,sBAAO,CAAC,CAAA;6CAA2B,sBAAO;GAH7C,mBAAmB,CAe/B","sourcesContent":["import { inject, injectable } from 'inversify';\nimport { provideFrameworkSingleton } from '@webpieces/core-context';\nimport { HttpUnauthorizedError } from '@webpieces/core-util';\nimport { GcpOidc } from '@webpieces/gcp-identity';\n\n/**\n * DefaultOidcVerifier - the framework's built-in Google OIDC verifier, injected into\n * {@link AuthFilter} and run directly whenever no app {@link OidcHook} is bound. It is what makes\n * OIDC \"just work\" with ZERO wiring: http-routing depends on @webpieces/gcp-identity ON PURPOSE so a\n * server that binds nothing still verifies service-to-service OIDC.\n *\n * `verify` honors the endpoint's `@AuthOidc(...callers)` contract exactly: EMPTY (a bare `@AuthOidc()`)\n * = TRUST THE EDGE — verify the token is genuinely Google-signed and let the deployment's `run.invoker`\n * IAM restrict WHO (gcp-identity warns loudly, once, if the service is actually public and thus the\n * edge is NOT the gate). A non-empty list (`@AuthOidc('svc-a')`) enforces that explicit app-level\n * allow-list as defense-in-depth. Off-GCP, gcp-identity mints + accepts a dev token so local dev needs\n * no GCP. Framework code reads NO process.env — an app that wants an env-driven allow-list binds an\n * {@link OidcHook} instead (env read at its composition root), keeping this default env-free and tests\n * parallel-safe.\n */\n@provideFrameworkSingleton()\n@injectable()\nexport class DefaultOidcVerifier {\n constructor(\n // webpieces-disable inject-annotation-not-needed-for-concrete-class -- DI-resolved param; the esbuild/vitest path elides type-only imports (no design:paramtypes), so the explicit token is required\n @inject(GcpOidc) private readonly gcpOidc: GcpOidc,\n ) {}\n\n async verify(token: string, callers: string[]): Promise<void> {\n // callers pass straight through: EMPTY (@AuthOidc() with no callers) = TRUST THE EDGE, a\n // non-empty list enforces the explicit allow-list. Do NOT inject a ['self'] default — that\n // would reject a legitimate cross-SA caller the edge already admitted.\n const result = await this.gcpOidc.verifyFromCallers(token, callers);\n if (!result.ok) {\n throw new HttpUnauthorizedError(`OIDC rejected: ${result.reason ?? 'not an allowed caller'}`);\n }\n }\n}\n"]}
|