@dalgo/bigquery 0.2.0 → 0.3.1
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/README.md
CHANGED
|
@@ -179,6 +179,18 @@ Cancellation consent uses `googleAuthorizationScopes({ cancellation: true })`;
|
|
|
179
179
|
it grants the broader BigQuery scope and requires an explicit product action.
|
|
180
180
|
OAuth client setup and deployed-origin/CORS acceptance remain required.
|
|
181
181
|
|
|
182
|
+
For a metadata pilot requiring only `openid` and BigQuery read-only, construct
|
|
183
|
+
`new GoogleTokenIdentityProvider({ scopePolicy: "exact-readonly" })`. This opt-in
|
|
184
|
+
rejects missing or extra grants (including email, writable BigQuery and
|
|
185
|
+
cloud-platform) from the actual GIS callback before identity requests, and
|
|
186
|
+
invalidates any earlier authorization. Pass `googleAuthorizationScopes()` and
|
|
187
|
+
`include_granted_scopes: false` to GIS `initTokenClient`; never replace callback
|
|
188
|
+
scope metadata with the requested scopes. The default `"compatible"` policy
|
|
189
|
+
preserves the optional email and cancellation behavior above. Exact-scope mode
|
|
190
|
+
retains the same-token UserInfo check, memory-only token and explicit expiry
|
|
191
|
+
handling; client registration and a live browser acceptance receipt are separate.
|
|
192
|
+
|
|
193
|
+
|
|
182
194
|
Google's [token model](https://developers.google.com/identity/oauth2/web/guides/use-token-model)
|
|
183
195
|
defines user-triggered consent and expiry recovery; its [discovery document](https://accounts.google.com/.well-known/openid-configuration)
|
|
184
196
|
pins the UserInfo endpoint used here.
|
|
@@ -25,6 +25,8 @@ export interface GoogleIdentityConfig {
|
|
|
25
25
|
readonly fetch?: SafeFetch;
|
|
26
26
|
readonly now?: () => number;
|
|
27
27
|
readonly timeoutMs?: number;
|
|
28
|
+
/** Metadata pilots may accept only the exact openid + BigQuery readonly grant set. */
|
|
29
|
+
readonly scopePolicy?: "compatible" | "exact-readonly";
|
|
28
30
|
}
|
|
29
31
|
/** Memory-only GIS token provider. It never prompts, refreshes, links Firebase
|
|
30
32
|
* accounts or chooses a project. Connect only from the real GIS callback; call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-identity.d.ts","sourceRoot":"","sources":["../../src/analytical/google-identity.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAa,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQxG,wFAAwF;AACxF,wBAAgB,yBAAyB,CAAC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAE3G;AAED,8EAA8E;AAC9E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"google-identity.d.ts","sourceRoot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BAQ/C,MAAM,GAAE,oBAAyB;IAQ7C,UAAU,IAAI,IAAI;IAMZ,OAAO,CAAC,QAAQ,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAoF5F,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;CAOtE"}
|
|
@@ -19,6 +19,7 @@ export class GoogleTokenIdentityProvider {
|
|
|
19
19
|
#fetch;
|
|
20
20
|
#now;
|
|
21
21
|
#timeout;
|
|
22
|
+
#scopePolicy;
|
|
22
23
|
#revision = 0;
|
|
23
24
|
#identity;
|
|
24
25
|
#pending;
|
|
@@ -26,6 +27,9 @@ export class GoogleTokenIdentityProvider {
|
|
|
26
27
|
this.#fetch = config.fetch ?? ((url, init) => globalThis.fetch(url, init));
|
|
27
28
|
this.#now = config.now ?? Date.now;
|
|
28
29
|
this.#timeout = config.timeoutMs ?? 15000;
|
|
30
|
+
this.#scopePolicy = config.scopePolicy ?? "compatible";
|
|
31
|
+
if (this.#scopePolicy !== "compatible" && this.#scopePolicy !== "exact-readonly")
|
|
32
|
+
fail("invalid_input");
|
|
29
33
|
if (!Number.isSafeInteger(this.#timeout) || this.#timeout < 1 || this.#timeout > 15000)
|
|
30
34
|
fail("invalid_input");
|
|
31
35
|
}
|
|
@@ -58,6 +62,9 @@ export class GoogleTokenIdentityProvider {
|
|
|
58
62
|
const grants = new Set(response.scope.split(/\s+/u));
|
|
59
63
|
if (!grants.has("openid") || !(grants.has(readonlyScope) || grants.has(cancelScope)))
|
|
60
64
|
fail("scope_missing");
|
|
65
|
+
if (this.#scopePolicy === "exact-readonly" &&
|
|
66
|
+
(grants.size !== 2 || !grants.has(readonlyScope)))
|
|
67
|
+
fail("scope_missing");
|
|
61
68
|
const controller = new AbortController();
|
|
62
69
|
this.#pending = controller;
|
|
63
70
|
const abort = () => controller.abort();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalgo/bigquery",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "BigQuery REST API adapter for DALgo TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.20.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "27aa1d2010b2efff50f1ae7f7151bdbdf76b5bf1"
|
|
60
60
|
}
|