chore(compiler): Enable strict property access TS compiler flag. (#6255)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Richie Foreman
2025-08-17 12:43:21 -04:00
committed by GitHub
parent ec1fa954d1
commit 2998f27f70
75 changed files with 495 additions and 483 deletions

View File

@@ -81,11 +81,11 @@ async function initOauthClient(
});
if (
process.env.GOOGLE_GENAI_USE_GCA &&
process.env.GOOGLE_CLOUD_ACCESS_TOKEN
process.env['GOOGLE_GENAI_USE_GCA'] &&
process.env['GOOGLE_CLOUD_ACCESS_TOKEN']
) {
client.setCredentials({
access_token: process.env.GOOGLE_CLOUD_ACCESS_TOKEN,
access_token: process.env['GOOGLE_CLOUD_ACCESS_TOKEN'],
});
await fetchAndCacheUserInfo(client);
return client;
@@ -248,7 +248,7 @@ async function authWithUserCode(client: OAuth2Client): Promise<boolean> {
async function authWithWeb(client: OAuth2Client): Promise<OauthWebLogin> {
const port = await getAvailablePort();
// The hostname used for the HTTP server binding (e.g., '0.0.0.0' in Docker).
const host = process.env.OAUTH_CALLBACK_HOST || 'localhost';
const host = process.env['OAUTH_CALLBACK_HOST'] || 'localhost';
// The `redirectUri` sent to Google's authorization server MUST use a loopback IP literal
// (i.e., 'localhost' or '127.0.0.1'). This is a strict security policy for credentials of
// type 'Desktop app' or 'Web application' (when using loopback flow) to mitigate
@@ -323,7 +323,7 @@ export function getAvailablePort(): Promise<number> {
return new Promise((resolve, reject) => {
let port = 0;
try {
const portStr = process.env.OAUTH_CALLBACK_PORT;
const portStr = process.env['OAUTH_CALLBACK_PORT'];
if (portStr) {
port = parseInt(portStr, 10);
if (isNaN(port) || port <= 0 || port > 65535) {
@@ -353,7 +353,8 @@ export function getAvailablePort(): Promise<number> {
async function loadCachedCredentials(client: OAuth2Client): Promise<boolean> {
try {
const keyFile =
process.env.GOOGLE_APPLICATION_CREDENTIALS || getCachedCredentialPath();
process.env['GOOGLE_APPLICATION_CREDENTIALS'] ||
getCachedCredentialPath();
const creds = await fs.readFile(keyFile, 'utf-8');
client.setCredentials(JSON.parse(creds));