google-auth-library
Advanced tools
| import { GaxiosOptions } from 'gaxios'; | ||
| import { AuthClient } from './authclient'; | ||
| import { GetAccessTokenResponse, Headers } from './oauth2client'; | ||
| /** | ||
| * An AuthClient without any Authentication information. Useful for: | ||
| * - Anonymous access | ||
| * - Local Emulators | ||
| * - Testing Environments | ||
| * | ||
| */ | ||
| export declare class PassThroughClient extends AuthClient { | ||
| /** | ||
| * Creates a request without any authentication headers or checks. | ||
| * | ||
| * @remarks | ||
| * | ||
| * In testing environments it may be useful to change the provided | ||
| * {@link AuthClient.transporter} for any desired request overrides/handling. | ||
| * | ||
| * @param opts | ||
| * @returns The response of the request. | ||
| */ | ||
| request<T>(opts: GaxiosOptions): Promise<import("gaxios").GaxiosResponse<T>>; | ||
| /** | ||
| * A required method of the base class. | ||
| * Always will return an empty object. | ||
| * | ||
| * @returns {} | ||
| */ | ||
| getAccessToken(): Promise<GetAccessTokenResponse>; | ||
| /** | ||
| * A required method of the base class. | ||
| * Always will return an empty object. | ||
| * | ||
| * @returns {} | ||
| */ | ||
| getRequestHeaders(): Promise<Headers>; | ||
| } |
| "use strict"; | ||
| // Copyright 2024 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.PassThroughClient = void 0; | ||
| const authclient_1 = require("./authclient"); | ||
| /** | ||
| * An AuthClient without any Authentication information. Useful for: | ||
| * - Anonymous access | ||
| * - Local Emulators | ||
| * - Testing Environments | ||
| * | ||
| */ | ||
| class PassThroughClient extends authclient_1.AuthClient { | ||
| /** | ||
| * Creates a request without any authentication headers or checks. | ||
| * | ||
| * @remarks | ||
| * | ||
| * In testing environments it may be useful to change the provided | ||
| * {@link AuthClient.transporter} for any desired request overrides/handling. | ||
| * | ||
| * @param opts | ||
| * @returns The response of the request. | ||
| */ | ||
| async request(opts) { | ||
| return this.transporter.request(opts); | ||
| } | ||
| /** | ||
| * A required method of the base class. | ||
| * Always will return an empty object. | ||
| * | ||
| * @returns {} | ||
| */ | ||
| async getAccessToken() { | ||
| return {}; | ||
| } | ||
| /** | ||
| * A required method of the base class. | ||
| * Always will return an empty object. | ||
| * | ||
| * @returns {} | ||
| */ | ||
| async getRequestHeaders() { | ||
| return {}; | ||
| } | ||
| } | ||
| exports.PassThroughClient = PassThroughClient; | ||
| const a = new PassThroughClient(); | ||
| a.getAccessToken(); |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
| import { Credentials } from './credentials'; | ||
| import { Headers } from './oauth2client'; | ||
| import { GetAccessTokenResponse, Headers } from './oauth2client'; | ||
| import { OriginalAndCamel } from '../util'; | ||
@@ -99,6 +99,3 @@ /** | ||
| */ | ||
| getAccessToken(): Promise<{ | ||
| token?: string | null; | ||
| res?: GaxiosResponse | null; | ||
| }>; | ||
| getAccessToken(): Promise<GetAccessTokenResponse>; | ||
| /** | ||
@@ -105,0 +102,0 @@ * The main authentication interface. It takes an optional url which when |
@@ -92,5 +92,4 @@ import { BaseExternalAccountClient, BaseExternalAccountClientOptions } from './baseexternalclient'; | ||
| private getAwsSecurityCredentials; | ||
| private shouldUseMetadataServer; | ||
| private get regionFromEnv(); | ||
| private get securityCredentialsFromEnv(); | ||
| } |
@@ -98,3 +98,3 @@ "use strict"; | ||
| // Removing this check may break them. | ||
| if (this.shouldUseMetadataServer() && this.imdsV2SessionTokenUrl) { | ||
| if (!this.regionFromEnv && this.imdsV2SessionTokenUrl) { | ||
| metadataHeaders['x-aws-ec2-metadata-token'] = | ||
@@ -110,2 +110,6 @@ await this.getImdsV2SessionToken(); | ||
| } | ||
| if (this.imdsV2SessionTokenUrl) { | ||
| metadataHeaders['x-aws-ec2-metadata-token'] = | ||
| await this.getImdsV2SessionToken(); | ||
| } | ||
| // Since the role on a VM can change, we don't need to cache it. | ||
@@ -238,7 +242,2 @@ const roleName = await this.getAwsRoleName(metadataHeaders); | ||
| } | ||
| shouldUseMetadataServer() { | ||
| // The metadata server must be used when either the AWS region or AWS security | ||
| // credentials cannot be retrieved through their defined environment variables. | ||
| return !this.regionFromEnv || !this.securityCredentialsFromEnv; | ||
| } | ||
| get regionFromEnv() { | ||
@@ -245,0 +244,0 @@ // The AWS region can be provided through AWS_REGION or AWS_DEFAULT_REGION. |
@@ -464,3 +464,3 @@ /// <reference types="node" /> | ||
| getRequestHeaders(url?: string): Promise<Headers>; | ||
| protected getRequestMetadataAsync(url?: string | null): Promise<RequestMetadataResponse>; | ||
| protected getRequestMetadataAsync(url?: string | URL | null): Promise<RequestMetadataResponse>; | ||
| /** | ||
@@ -467,0 +467,0 @@ * Generates an URL to revoke the given token. |
@@ -22,4 +22,5 @@ import { GoogleAuth } from './auth/googleauth'; | ||
| export { PluggableAuthClient, PluggableAuthClientOptions, } from './auth/pluggable-auth-client'; | ||
| export { PassThroughClient } from './auth/passthrough'; | ||
| export { DefaultTransporter } from './transporters'; | ||
| declare const auth: GoogleAuth<import("./auth/googleauth").JSONClient>; | ||
| export { auth, GoogleAuth }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.GoogleAuth = exports.auth = exports.DefaultTransporter = exports.PluggableAuthClient = exports.DownscopedClient = exports.BaseExternalAccountClient = exports.ExternalAccountClient = exports.IdentityPoolClient = exports.AwsClient = exports.UserRefreshClient = exports.LoginTicket = exports.OAuth2Client = exports.CodeChallengeMethod = exports.Impersonated = exports.JWT = exports.JWTAccess = exports.IdTokenClient = exports.IAMAuth = exports.GCPEnv = exports.Compute = exports.DEFAULT_UNIVERSE = exports.AuthClient = exports.gcpMetadata = void 0; | ||
| exports.GoogleAuth = exports.auth = exports.DefaultTransporter = exports.PassThroughClient = exports.PluggableAuthClient = exports.DownscopedClient = exports.BaseExternalAccountClient = exports.ExternalAccountClient = exports.IdentityPoolClient = exports.AwsClient = exports.UserRefreshClient = exports.LoginTicket = exports.OAuth2Client = exports.CodeChallengeMethod = exports.Impersonated = exports.JWT = exports.JWTAccess = exports.IdTokenClient = exports.IAMAuth = exports.GCPEnv = exports.Compute = exports.DEFAULT_UNIVERSE = exports.AuthClient = exports.gcpMetadata = void 0; | ||
| // Copyright 2017 Google LLC | ||
@@ -56,2 +56,4 @@ // | ||
| Object.defineProperty(exports, "PluggableAuthClient", { enumerable: true, get: function () { return pluggable_auth_client_1.PluggableAuthClient; } }); | ||
| var passthrough_1 = require("./auth/passthrough"); | ||
| Object.defineProperty(exports, "PassThroughClient", { enumerable: true, get: function () { return passthrough_1.PassThroughClient; } }); | ||
| var transporters_1 = require("./transporters"); | ||
@@ -58,0 +60,0 @@ Object.defineProperty(exports, "DefaultTransporter", { enumerable: true, get: function () { return transporters_1.DefaultTransporter; } }); |
+1
-1
| { | ||
| "name": "google-auth-library", | ||
| "version": "9.6.3", | ||
| "version": "9.7.0", | ||
| "author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Authentication Client Library for Node.js", |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 20 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 20 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
553606
0.73%72
2.86%9232
1.07%