You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: `getAllExtensionDiscoveryPaths` to prevent external mutation of paths.
The `getAllExtensionDiscoveryPaths` method signature has always been typed as returning a readonly Map, but that's just for compile-time. For run-time it was still returning the actual Map which could be mutated externally.
- Fixed `getAllExtensionDiscoveryPaths` ExtensionData method to return a new Map of the `extensionDiscoveryPaths` Map, to prevent external mutation of the paths.
* feat: redact username in logging output
- Implemented `redactUsername` utility function to sanitise logs by removing the OS username.
- Updated logging statements to use the new redaction utility in:
- `logDebugInfo` method in `Configuration` class.
- `getAllExtensionDiscoveryPaths` and `prepareForLogging` methods in `ExtensionData` class.
* refactor: `redactUsername` to be directly implemented into the Logger.
- Moved `redactUsername` function from utils into Logger, simplifying the new method, and adding it's call into the `formatMeta` method after it's transformed the data into a string.
By implementing the `redactUsername` method directly into Logger, we can ensure that any calls to logger with additional meta data, will have the username automatically redacted. So even if more logs are added in future, we don't forget to redact the usernames before Logger gets it.
This also fixes various copilot review comments on the previous implementation because its no longer recursing into objects or arrays, it's just replacing directly on the string immediately before logging to output.
- Updated logging statements to remove the old redaction utility in:
- `logDebugInfo` method in `Configuration` class.
- `getAllExtensionDiscoveryPaths` and `prepareForLogging` methods in `ExtensionData` class.
* fix: missing node `os` import.
* feat: add `warn` log level and add `warnOnRedactionFailure` method.
- Introduced new `warn` log level.
- Added `warn` enum option to the `logLevel` user setting and adjusted all the options descriptions.
- Implemented `warn` method in `Logger` class to handle warning messages.
- Updated `logLevels` in the `utils` interface to include `warn`.
- Added `warn` level in `shouldLog` method in `Logger` and adjusted all the weights.
- Added new `hasWarnedAboutRedactionFailure` property to determine whether the user has already been warned about a redaction failure.
- Added new `warnOnRedactionFailure` method in Logger to warn users when the username couldn't be determined and redaction failed. This method uses the new `hasWarnedAboutRedactionFailure` property to check if it's already been outputted, as this is a once per session warning. It also uses the new `warn` logger method.
* refactor: move `warn` method to below the `error method in Logger.
* fix: wording of the redaction failure warning
* fix: log messages that could have usernames weren't being redacted.
- Added the `redactUsername` method call in the `logMessage` method to redact usernames from the log messages, as they could have them too.
- Moved the method call to redact the meta data from `formatMeta` method into the `logMessage` method, so that the log message and data are both redacted from the same centralised method.
* feat: skip username redaction if previous attempt failed.
- Added a `hasWarnedAboutRedactionFailure` guard conditional at the top of the `redactUsername` method to skip redaction if a previous redact attempt failed.
* refactor: `hasWarnedAboutRedactionFailure` property into a new name.
- Changed the `hasWarnedAboutRedactionFailure` property flag to `skipRedaction` to better describe it's actual job of skipping redaction attempts after failure.
- Changed references to the old `hasWarnedAboutRedactionFailure` property to use the new `skipRedaction` property in the `redactUsername` and `warnOnRedactionFailure` methods.
- Removed the old `hasWarnedAboutRedactionFailure` guard conditional from the `warnOnRedactionFailure` method.
This is because the method will only run when the new `skipRedaction` flag is false thanks to the guard at the top of `redactUsername` method. So the extra guard is now redundant.
- Revised docblocks and code comments for clarity on the redaction behaviour.
0 commit comments