Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(auth): add warning about externally-provided credentials #11462

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

quartzmo
Copy link
Member

No description provided.

@quartzmo quartzmo requested a review from a team as a code owner January 16, 2025 23:20
@quartzmo quartzmo added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 17, 2025
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

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

Approving, but consider the comment.

@@ -109,18 +109,50 @@ type CredentialSource struct {
// File is the location for file sourced credentials.
// One field amongst File, URL, Executable, or EnvironmentID should be
// provided, depending on the kind of credential in question.
//
// Important: If you accept a credential configuration (credential
Copy link
Member

Choose a reason for hiding this comment

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

At least for this package we have a security considerations section in the godoc -- perhaps this should be added there. This actually sounds pretty similar to that disclaimer. Wonder if we should just have that sort of message in each of the credential packages instead of putting this on the field docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sai-sunder-s PTAL at Cody's comment above.

Choose a reason for hiding this comment

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

We mainly need it for the method that loads any arbitrary json. This is what we are doing in other languages.

@codyoss what do you mean by "each credential package"? I thought go doesn't expose per credential type methods?

Choose a reason for hiding this comment

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

The existing warning is in external account specific section. Do you mean put the warning in the documentation of each cred?

If so, that is not of much use for the issue we are dealing with now. The issue is specifically when a developer accepts cred config from external sources and builds a cred out of it. They expect only certain type like Service Account but they end up accepting other cred types.

So the warning needs to be in a central place like the method used to load arbitrary creds. Maybe it can go at the top of the detect method as well?

Copy link
Member

Choose a reason for hiding this comment

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

I think what I was aiming for was having a central section to put such information. I don't love having to maintain the same docs in N places. Would prefer to have it in a single place. I was wondering if having a security section in the package docs would suffice.

Choose a reason for hiding this comment

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

I think it needs to be there for the detect method. Additionally can be put in central place as well. We can remove other places added in this PR.
Does that sound ok?

Choose a reason for hiding this comment

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

we can remove the warnings added to this file

Copy link
Member Author

@quartzmo quartzmo Jan 22, 2025

Choose a reason for hiding this comment

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

We can remove other places added in this PR.

Please directly note on this PR which warnings to keep and which to remove.

auth/credentials/detect.go Show resolved Hide resolved
@@ -109,18 +109,50 @@ type CredentialSource struct {
// File is the location for file sourced credentials.
// One field amongst File, URL, Executable, or EnvironmentID should be
// provided, depending on the kind of credential in question.
//
// Important: If you accept a credential configuration (credential

Choose a reason for hiding this comment

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

we can remove the warnings added to this file

auth/credentials/idtoken/idtoken.go Show resolved Hide resolved
@quartzmo quartzmo removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 23, 2025
@quartzmo quartzmo enabled auto-merge (squash) January 23, 2025 17:33
@quartzmo quartzmo merged commit 49fb6ff into googleapis:main Jan 23, 2025
8 checks passed
@quartzmo quartzmo deleted the auth-warning branch January 23, 2025 17:39
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.

3 participants