Skip to content

Bringing DEV to the new report works - #1460

Closed
Anton Staykov (astaykov) wants to merge 62 commits into
astaykov/preview-reportfrom
dev
Closed

Bringing DEV to the new report works#1460
Anton Staykov (astaykov) wants to merge 62 commits into
astaykov/preview-reportfrom
dev

Conversation

@astaykov

Copy link
Copy Markdown
Collaborator

No description provided.

Manoj Kesana (Manoj-Kesana) and others added 30 commits July 2, 2026 17:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fix #1422 

This pull request introduces a comprehensive overhaul of error
sanitization for PowerShell test diagnostics to prevent sensitive
credential data from being persisted in logs, reports, or error records.
The main improvements include a new defense-in-depth sanitization
function, safe error record/message generation, and updated error
formatting and logging logic to ensure only allow-listed diagnostic
fields are exposed. Extensive tests are added to validate these
protections.

**Error sanitization and redaction:**

* Added `Protect-ZtReportText` function to redact credential-bearing
HTTP headers and sensitive values from report content before
persistence, and integrated it into `Add-ZtTestResultDetail`.
* Updated test result persistence and logging to always sanitize error
details, including at the TestResult persistence boundary and in
optional test logs.

**Safe error record and message generation:**

* Introduced `New-ZtSafeErrorRecord` to create sanitized error records
with only allow-listed diagnostic fields and without unsafe TargetObject
data. This prevents request/response objects containing bearer tokens
from being retained in test statistics or passed into logging.
* Added `Get-ZtSafeErrorMessage` to extract safe, structured diagnostic
summaries (request method/path, HTTP status, Graph error code, and
correlation IDs) from error records, omitting unstructured exception
messages, headers, and response bodies.

**Error formatting and reporting:**

* Implemented `Format-ZtTestErrorDetail` to generate markdown-formatted
error summaries using only sanitized fields for failed tests. It adds
bounded metadata such as exception type, error ID, HTTP status, and
source location.
* Refactored error handling in `Invoke-ZtTest.ps1` and
`Write-ZtTestError.ps1` to use the new safe error record/message
pipeline, ensuring all error reporting is sanitized and consistent.

**Testing:**

* Added `ErrorSanitization.Tests.ps1` with comprehensive tests to verify
that credentials and sensitive values are never persisted in logs or
reports, and that only safe diagnostic information is exposed.
ashwinikarke and others added 29 commits July 23, 2026 16:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ice 365 are configured with impersonation and spoof protection (#1397)
…o block malicious messages, links, and attachments (#1398)
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.

7 participants