Skip to content

Conversation

@vverman
Copy link
Contributor

@vverman vverman commented Dec 2, 2025

This feature implements the ability for agentic identities to authenticate themselves via X509 cert bound tokens. We are limiting the scope here to only cloud run based agentic workloads.

Please refer this design doc for more information on this feature

@vverman vverman requested a review from a team as a code owner December 2, 2025 21:57
@vverman vverman requested review from feywind and nbayati February 2, 2026 21:37
Copy link
Contributor

@feywind feywind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few suggestions in here, but it looks fine! If you want to make changes, I'll have to re-approve due to new GitHub rules.

* Helper function to delay execution.
* @param ms Time to sleep in milliseconds.
*/
async function sleep(ms: number): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been doing it like this for a while now too, but out of curiosity, I looked it up, and there's an official alternative now:

https://nodejs.org/docs/latest-v18.x/api/timers.html#timerspromisessettimeoutdelay-value-options

@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-checking, this isn't something that's going to leak info for being in the repo?

}
}
} catch (error) {
// Ignore errors during polling, will retry.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to put a log (log.debug?) of some kind here so users can see the retries if they want.

await sleep(interval);
}

throw new Error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to dump this out to log.error too.

> {
// Check opt-out.
if (process.env[PREVENT_SHARING_ENV_VAR]?.toLowerCase() === 'false') {
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially a good place for a log.info or log.debug to confirm for users.

if (!certConfigPath) {
return null;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a nice place for a log.debug, telling the user the library has picked up their env var.

import * as fs from 'fs';
import {log as makeLog} from 'google-logging-utils';

const log = makeLog('google-auth-library:agentidentity');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! I'm putting a few suggested places below that we might want more logging.


beforeEach(async () => {
sandbox = sinon.createSandbox();
clock = TestUtils.useFakeTimers(sandbox);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno if you've hit this, but I've run into several problems lately where sinon is actually hooking a lot more than it used to in useFakeTimers (stuff like process.nextTick). You can turn off the ones you don't want here. It may not affect this, but FYI to keep in mind.

@@ -0,0 +1,193 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not necessary, but if you wanted to check any of the log lines coming out of agentidentity.ts I can provide examples of how to hook that stuff during tests.

@feywind feywind changed the title feat: Agentic Identities in Cloudrun. feat: Agentic Identities in Cloudrun Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants