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

[Identity] Allow Pii logging through MSAL #17321

Closed
wants to merge 6 commits into from

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant commented Aug 27, 2021

This PR makes it so all of the credentials now include enableUnsafeLogging on their constructor options. If set to true, Personal Identifiable Information (PII) will be displayed in trace logs.

Feedback appreciated!

Fixes #17281

@sadasant sadasant requested a review from g2vinay August 27, 2021 22:01
@sadasant sadasant self-assigned this Aug 27, 2021
@ghost ghost added the Azure.Identity label Aug 27, 2021
@@ -321,6 +321,7 @@ export { TokenCredential }
// @public
export interface TokenCredentialOptions extends CommonClientOptions {
allowMultiTenantAuthentication?: boolean;
allowPiiLogging?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

The name of this property is still being discussed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok ok thank you! I’ll move it to draft then

Copy link
Contributor Author

@sadasant sadasant Aug 31, 2021

Choose a reason for hiding this comment

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

If this name is not decided yet, giving that we’re about to reach code complete this Friday, should we push this to the next milestone?

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 PII is no longer used by any of our data standards. I believe "End User Identifiable Information" (EUII) is the new equivalent.

It also seems to fall under "Personal Data" in other places: https://www.microsoft.com/en-us/trust-center/privacy/customer-data-definitions

@sadasant sadasant marked this pull request as draft August 31, 2021 19:24
@@ -18,6 +18,7 @@ export interface MsalFlowOptions {
authorityHost?: string;
authenticationRecord?: AuthenticationRecord;
disableAutomaticAuthentication?: boolean;
allowPiiLogging?: boolean;
Copy link
Member

@g2vinay g2vinay Aug 31, 2021

Choose a reason for hiding this comment

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

where do we pass this on to the MSAL clients ?
Which part enables MSAL logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It’s a bit odd to track, but the MSAL client sends us whether a log line has PII or not through their log callbacks. We receive that parameter here: https://github.com/Azure/azure-sdk-for-js/pull/17321/files#diff-b4fea3e025941e1a4d4d02990dc8c9a31d77db91dec08c490f2cf818fee97111R94-R95 (it’s the one named “containsPii”). So, MSAL always sends us logs regardless of PII, we decide whether to log them or not.

@@ -4,6 +4,8 @@

### Features Added

- All of the credentials now include `allowPiiLogging` on their constructor options. If set to true, Personal Identifiable Information (PII) will be displayed in trace logs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is allowPiiLogging the agreed upon name in the feature crew? Am just curious about the PII becoming Pii

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It hasn’t been decided yet. Here’s Vinay saying that this hasn’t been decided yet: #17321 (comment)

@@ -85,12 +85,14 @@ export function getKnownAuthorities(tenantId: string, authorityHost: string): st
*/
export const defaultLoggerCallback: (
logger: CredentialLogger,
allowPiiLogging?: boolean,
platform?: "Node" | "Browser"
Copy link
Contributor

Choose a reason for hiding this comment

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

Having two optional parameters is something we try to avoid. If there are more than 1 optional parameter, we prefer to use the options bag to avoid the case of passing undefined to the first one when we don;t want to set anything there, but do want to pass something to the second parameter.

In this case, do we even need the platform parameter if we can determine that using the isNode property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh correct! I like how you think :) I’ll clean this up!

@@ -18,6 +18,7 @@ export interface MsalFlowOptions {
authorityHost?: string;
authenticationRecord?: AuthenticationRecord;
disableAutomaticAuthentication?: boolean;
allowPiiLogging?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: For ease of readability, I would recommend moving this up to appear right after the logger as the two are related

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Aug 31, 2021

What is the reason for this PR to be in draft mode? Are we waiting for something and this is not ready for merge?

@sadasant
Copy link
Contributor Author

@ramya-rao-a I moved it to draft because the name is not agreed upon. Once the name is agreed upon, I’ll update this and take it out of draft. This is mainly as a double assurance that nobody will merge this until we’ve agreed on the name (though the chances of this happening are extremely low)

@sadasant
Copy link
Contributor Author

Something to mention is that although this PR enables Pii logging, there’s nothing currently using Pii logging. I tried checking through our tests, and no codepaths are making use of Pii logs. Should we try to standardize what gets logged across languages? @g2vinay perhaps later, after this PR.

@sadasant
Copy link
Contributor Author

sadasant commented Sep 1, 2021

I just remembered that the latest name we picked on Monday’s meeting was enableUnsafeLogging. So, even though we still have to have one more meeting to define this name, I’ll do this change preemptively.

@sadasant
Copy link
Contributor Author

sadasant commented Sep 7, 2021

We’ve decided to close this for now, since currently there’s no use case for these logs on JS.

@sadasant sadasant closed this Sep 7, 2021
@sadasant sadasant deleted the identity/fix17281 branch September 7, 2021 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQ]Enable MSAL log and MSAL PII Logs
4 participants