Repository navigation
Harden deployment identity, emergency access, evidence, and Graph boundaries - #8
Merged
Merged
Conversation
…ndaries Return verified emergency exclusions in memory rather than trusting diagnostic JSON. Add synthetic module/orchestrator regressions and operator recovery guidance. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
A critical standalone Conditional Access path can bypass verified emergency-access authorization, and release validation remains outstanding.
Review effort: Lite
Findings: 1
What changed in this PR
Hardens Entra emergency access, Intune Graph boundaries, Defender evidence handling, and offline regression coverage.
Changes:
- Enforces verified in-memory emergency-access authorization.
- Validates Graph endpoints, paging links, and operator identities.
- Improves Defender comparisons, evidence exports, and cleanup.
Review identified a critical standalone Conditional Access bypass, a malformed regression-test fault injection, and contradictory operator documentation.
| File | Reviewed changes |
|---|---|
scripts/Test-DeploymentSafeguards.ps1 |
Adds safeguard regression scenarios; one malformed-result test requires correction. |
scripts/Test-DefenderComparableValues.ps1 |
Tests Defender value comparisons. |
Products/Intune/README.md |
Documents identity and endpoint safeguards. |
Products/Intune/Modules/Setup-EnrollmentRestrictions.ps1 |
Applies shared paging validation. |
Products/Intune/Modules/Setup-DeviceConditionalAccess.ps1 |
Validates CA paging and endpoint construction. |
Products/Intune/Modules/Setup-DeviceCompliancePolicies.ps1 |
Applies compliance paging validation. |
Products/Intune/Modules/Setup-AppProtectionPolicies.ps1 |
Validates Graph bases and paging. |
Products/Intune/Modules/Setup-AppDeployment.ps1 |
Validates app Graph access and paging. |
Products/Intune/Modules/IntuneGraphClient.ps1 |
Adds shared Graph URI validation. |
Products/Intune/Modules/Connect-IntuneServices.ps1 |
Verifies the actual signed-in account. |
Products/Intune/docs/Evidence-Troubleshooting.md |
Documents identity and endpoint failures. |
Products/Intune/docs/Configuration-Reference.md |
Defines Graph endpoint contracts. |
Products/Intune/Deploy-IntuneBestPractice.ps1 |
Validates Graph configuration before authentication. |
Products/Entra/README.md |
Documents emergency-access and identity behavior. |
Products/Entra/Modules/Setup-EmergencyAccess.ps1 |
Implements safe account creation and verification results. |
Products/Entra/Modules/Connect-EntraServices.ps1 |
Verifies the actual signed-in account. |
Products/Entra/docs/Scenarios.md |
Updates emergency-access workflows. |
Products/Entra/docs/Operator-Guide.md |
Documents operator safeguards; report wording remains contradictory. |
Products/Entra/docs/Evidence-Troubleshooting.md |
Documents evidence boundaries. |
Products/Entra/docs/Break-Glass-Guide.md |
Documents manual account handoff. |
Products/Entra/Deploy-EntraBestPractice.ps1 |
Gates orchestrated CA deployment, but standalone CA invocation remains unprotected. |
Products/Entra/Config/EntraConfig.psd1 |
Clarifies account-creation configuration. |
Products/Defender/README.md |
Documents evidence export behavior. |
Products/Defender/Modules/DefenderStateManagement.ps1 |
Restores ordered comparable-value handling. |
Products/Defender/Modules/DefenderRunLog.ps1 |
Surfaces JSON export warnings. |
Products/Defender/docs/troubleshooting.md |
Documents report-export troubleshooting. |
Products/Defender/docs/evidence.md |
Documents evidence failure semantics. |
Products/Defender/Deploy-DefenderBestPractice.ps1 |
Preserves errors and guarantees log cleanup. |
docs/Responsible-AI-Review.md |
Records safeguard scope and residual risks. |
docs/conventions.md |
Adds offline validation commands. |
CHANGELOG.md |
Records remediation changes. |
AGENTS.md |
Updates responsible-review guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…daries Share read-only principal verification and validate the actual operator and intended tenant before each create or adoption write. Preserve assessment, WhatIf, customer exclusions, and existing enforcement state; add 96 offline standalone boundary scenarios. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Implements the five confirmed deployment-safeguard remediation groups identified after PR #7, the independent follow-up finding that editable emergency-access evidence could substitute unverified principals, and the subsequently confirmed inherited standalone Conditional Access verification gap. Based on merged PR #7 at
24ee35c08cb0847de5b563d4122164bc298e85ab.All agreed, confirmed defects in this remediation scope are addressed, including the standalone follow-up in
ee2ea452ea6780d2ef963e15596df5c20cca8138(a new commit, not an amendment). This is not a claim that every repository finding is a defect, that all repository bugs are fixed, or that the deployment is certified for production. No tenant authentication, deployment, live token-forwarding test, or pilot validation was performed. Release readiness remains blocked pending approved pilot validation and maintainer review.Behavior changes
Context.TenantIdGUID andContext.TenantAdminUpn. Assessment, WhatIf, both blocker lists, Security Defaults and manual migration remain supported; no verification flag bypass, account creation, automatic role grant or extra scope was added.Get-MgContext.Accountafter fresh connection and before successful connection evidence/setup. Reject missing/wrong accounts; retain case-insensitive correct accounts, valid cached sessions, tenant checks and GDAP targeting. Disconnect invalid contexts without masking the identity failure. No added scopes.WarningPreference=Stop. Missing reports remain missing evidence, not proof of successful deployment./v1.0or/beta; reject unapproved hosts, nondefault ports, userinfo, fragments, queries/additional or ambiguous base components. Collection paging requires the same authority and exact collection path, rejects malformed links/cycles before SDK dispatch, and retains legitimate paging queries/opaque IDs. Compliance/enrollment readers share the same boundary.Report-only defaults,
ShouldProcess/WhatIf, approval and recovery gates, documented role/guest/application targeting, exact readback, unmanaged collision guards, and manualReviewExistingOnlymigration are preserved. There is no automatic privilege grant or phishing-resistant policy adoption. File substitution is closed; arbitrary code compromise inside the PowerShell process is not addressed by an in-memory contract. Fresh directory verification and a subsequent CA write are not an atomic transaction against concurrent directory/session changes. A later-policy failure does not roll back earlier successful writes.The standalone finding is a MEDIUM operational verification risk with potentially high enforcement/lockout impact, depending on policy state and scope—not demonstrated privilege escalation. In particular, report-only configuration does not neutralize adoption of an already enabled policy because adoption preserves its state. The reproduction used mocked SDK requests; acceptance of fake IDs by the live API was not proven.
Validation performed
Windows, PowerShell 7.6.6. All regression execution used synthetic SDK responses and invented identities, without tenant authentication/network calls. Fixtures and logs were retained outside the repository under
C:\temp\deployment-safeguard-remediation. All listed suites were rerun for this follow-up; the final orchestrator run completed successfully before committing/pushing.pwsh -NoProfile -File .\scripts\verify.ps1pwsh -NoProfile -File .\scripts\Test-IdentityReviewFixes.ps1pwsh -NoProfile -File .\scripts\Test-IntuneReviewFixes.ps1pwsh -NoProfile -File .\scripts\Test-DefenderConnectionGuards.ps1pwsh -NoProfile -File .\scripts\Test-DefenderComparableValues.ps1pwsh -NoProfile -File .\scripts\Test-DeploymentSafeguards.ps1pwsh -NoProfile -File .\scripts\Test-EntraStandaloneWriteGuards.ps1git diff --checkand staged diff check-BaseRef origin/main-AllFilesThe standalone suite asserts actual SDK write-request counts, fresh context/organization/principal/role reads per write, user/group response consistency (hashtable and PSCustomObject), permanent direct/group-mediated recovery, malformed/missing/wrong identity and tenant, unreadable directory/roles, disabled principals/members, temporary/expiring/scoped roles, fabricated markers, copied-array isolation, configured enabled creation, enabled adoption with default report-only configuration, retained customer exclusions, and revocation between writes. Invalid verification yields zero POST/PATCH; revocation after a successful first write blocks the second. WhatIf, both blocker lists, Security Defaults and empty-exclusion handling remain covered.
The broader safeguards suite executes actual modules/orchestrators. Coverage includes created/disabled/roleless/unreadable emergency accounts, skipped verification, rerun duplicate prevention, valid apply/WhatIf, post-verification JSON user/group replacement/addition/removal and stale/malformed markers, 14 malformed in-memory result contracts, copied arrays, fresh/cached identity and tenant mismatch, independent report-failure combinations, and valid/invalid paging before mocked dispatch. URI tests do not demonstrate live bearer-token forwarding or exfiltration.
Changed-scope gate warning disposition: 13 generic
Add-RunLogEntryspelling checks are covered by product-specific loggers or pure helpers whose callers own evidence; 3 product-navigation warnings do not apply because no product inventory/navigation/common prerequisite changed; 1 missing pilot-evidence warning is a real outstanding release gate. These explanations do not suppress gate output or waive whole-repository findings. Compared with the initial PR version, the two additional scoped logger warnings come from the newly touched shared directory helper and public CA module; the whole-repository baseline findings remain unchanged.Findings not changed / deferred
This table intentionally distinguishes rejected claims, behavior already guarded/fixed, qualified impact claims, and genuinely pending validation. Review links refer to the original discussions, not an assertion that every original comment was correct. The newly confirmed standalone defect is fixed, as recorded above; no newly confirmed code defect in the agreed scope is being deferred.
User.Readforid,displayName,verifiedDomains. NoOrganization.Read.Allexpansion is needed for these reads.ConvertFrom-Json -AsHashtablereturnsOrderedHashtable, whose base isHashtable;-is [hashtable]is true.Update-MgDeviceManagement -Settings-Settings <IMicrosoftGraphDeviceManagementSettings>.6fbfdc7already countsUnmanagedSameNamePolicyCountand blocks create-only deployment rather than adopting/overwriting the object.ReviewExistingOnlybranch for existing policies and requires human review rather than PATCH/adoption, including withAdoptExisting.deviceEnrollmentPlatformRestrictionConfigurationis a valid singular beta resource..ShouldProcesserrors are in untouched read-only/guided modules: DefenderSetup-DefenderForCloudApps,Setup-DefenderPreflight,Setup-MdeAdvanced; IntuneSetup-EnrollmentPrerequisites,Setup-EnterpriseStateRoaming,Setup-IntunePreflight. The 47 warnings use the generic evidence-logger heuristic. These are not automatically proven unsafe writes, but the baseline gate remains blocked.Documentation and review boundaries
Updated all three affected product READMEs, Entra break-glass/operator/scenario/evidence guides, Intune configuration/evidence guides, Defender evidence/troubleshooting guides, changelog and regression commands. The standalone follow-up also updates module help, the operator's intended-tenant prerequisite, write-boundary failure recovery, and shared verification documentation. A separate deployment-safeguard review in
docs/Responsible-AI-Review.mdrecords Secure by Design/Default/Operations controls, AI-assisted engineering accountability, synthetic evaluation limits and release owners. No rich HTML companions exist for these affected guides. No new AI runtime/model behavior, secrets, customer evidence or credentials are added.