Skip to content

21801: Fix pass/fail count in assessment - #1597

Open
Sandeep Jha (sandeepjha000) wants to merge 2 commits into
devfrom
bugfix-21801
Open

Sandeep Jha (sandeepjha000) wants to merge 2 commits into
devfrom
bugfix-21801

Conversation

@sandeepjha000

Copy link
Copy Markdown
Collaborator

Assessment 21801 used an undefined variable when counting users with phishing-resistant authentication methods. As a result, it could report failure even when all users had a qualifying method.

Use the existing $phishResistantUsers collection for the count, ensuring the assessment passes when every user is compliant and continues to fail when any users are not.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 04:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The targeted correction resolves the undefined-variable defect without changing assessment criteria; tests were not run.

0 open findings

What changed in this PR

Fixes assessment 21801’s pass/fail calculation for phishing-resistant authentication methods.

Changes:

  • Counts the existing $phishResistantUsers collection instead of an undefined variable.
  • Preserves the requirement that all assessed users must be compliant.
File Description
src/​powershell/​tests/​Test-Assessment.21801.ps1 Corrects the compliant-user count using @($phishResistantUsers).Count.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 05:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused change corrects the count comparison, with no blocking issues identified in static review.

0 open findings

🧠 Review effort: Balanced

@astaykov Anton Staykov (astaykov) left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM,

However this test is not limiting the results to a reasonable count. In case of a lot of users, this will generate large table and potentially breaking the generated report.
Please address that following the guidelines we took regarding "All guest must have a sponsor" assessment.

@alexandair

Copy link
Copy Markdown
Collaborator

Anton Staykov (@astaykov) Are you approving this PR as it is currently or are you asking for limiting the results?

@astaykov Anton Staykov (astaykov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This test is not limiting the results to a reasonable count. In case of a lot of users, this will generate large table and potentially breake the generated report.
Please address that following the guidelines we took regarding "All guest must have a sponsor" assessment.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Recommendation: calculate compliance over the complete result set, then limit only the displayed detail rows. Show total, compliant, and noncompliant counts; prioritize users who need remediation; disclose when detail rows are omitted. Do not add a SQL LIMIT before the pass/fail calculation, because that could hide noncompliant users. Using StringBuilder alone would not bound report size. Add a test with more rows than the chosen display limit and a noncompliant user beyond that limit.

Anton Staykov (@astaykov) 's review asks for this limit. The earlier approval does not mean that request is resolved. The guest-sponsor implementation in this exact base (Test-Assessment.21877.ps1#L96) also has an unbounded detail loop; do not assume that copying its current code supplies the requested cap.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review PR is ready for review and merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test 21801 always fails: counts undefined variable $phishResistantPrivUsers

4 participants