microsoft / microsoft/vscode

[Microsoft Authentication] Native broker logs full account PII at warning level during account discovery

Open
#329,175 0 comments 0 reactions 1 assignee Claimed by @TylerLeonhardt View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Not yet verified. The emitter is the built-in `vscode.microsoft-authentication` extension. It was observed when Azure DevOps authentication sessions were requested.

- VS Code Version: 1.131.0
- Commit: e4c7e7b1d6d060162f4aa7f8225271b67ce1df75
- OS Version: Windows 10.0.26200.8894
- Environment: WSL2 remote workspace
- `@azure/msal-node-extensions`: 5.3.2
- `@azure/msal-node-runtime`: 0.20.1
- Native broker: enabled

## Steps to reproduce

1. Have one or more Microsoft accounts available through the Windows native broker/WAM.
2. Use the default Microsoft Authentication implementation (`msal`).
3. Start or reload VS Code and trigger a Microsoft authentication-session lookup, such as an Azure DevOps session request.
4. Open **Output > Microsoft Authentication**, or run **Developer: Open Logs Folder**.
5. Inspect the Microsoft Authentication log.

## Expected behavior

Normal account discovery should not write full account objects containing PII to the default log.

PII-bearing diagnostics should be disabled by default, redacted, or limited to an explicitly enabled diagnostic mode.

## Actual behavior

During normal native-broker initialization, the output channel writes the full MSAL account object in multiple warning-level lines:

```text
[info] [...] Native Broker enabled: true
[warning] ... LogAccountInfoNoThrow:90 Log MSAL Account:
[warning] ... LogAccountInfoNoThrow:100 MSAL Account JSON chunk 1/N: [PII REDACTED]
...
[info] [getSessions] [...] returned 0 session(s)
```

The account JSON contains fields such as:

- name and email address
- birth date
- tenant, object, account, and device identifiers
- login hints
- WAM account mappings
- ID-token claims and opaque identity values

No access token or refresh token was observed.

In one complete log, all 52 warning entries were account-dump lines. There were zero error entries and zero unrelated warnings.

## Source-level observation

`CachedPublicClientApplication` configures MSAL with trace logging and `piiLoggingEnabled: true`:

https://github.com/microsoft/vscode/blob/e4c7e7b1d6d060162f4aa7f8225271b67ce1df75/extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts#L130-L139

The logger callback ignores the `containsPii` argument and maps MSAL Warning directly to the VS Code warning output:

https://github.com/microsoft/vscode/blob/e4c7e7b1d6d060162f4aa7f8225271b67ce1df75/extensions/microsoft-authentication/src/common/loggerOptions.ts#L22-L45

The latest 1.133.0-insider source currently retains both behaviors:

https://github.com/microsoft/vscode/blob/d90b90332515fe87d3ea344cbd4b0ae405128e9a/extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts#L66-L75

A possible fix would be to honor `containsPii` and skip or redact those messages, disable PII logging by default, or prevent normal account discovery from being persisted at Warning severity.

## Related issue

Issue #291738 contains similar account-dump lines, but it also reports `ReadAccountById`, `StatusInternal::Unexpected`, and explicit authentication errors. None of those errors are present here:

https://github.com/microsoft/vscode/issues/291738

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.