Skip to content

fix(analysis): refuse a Severity setting that is not a hashtable - #107

Open
fadwen-ai wants to merge 1 commit into
refactor/helpers-win32from
fix/settings-severity-table
Open

fadwen-ai wants to merge 1 commit into
refactor/helpers-win32from
fix/settings-severity-table

Conversation

@fadwen-ai

@fadwen-ai fadwen-ai commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A settings table whose Severity value is not a hashtable, such as Severity = 'Error' in an IntuneScriptLab.settings.psd1 file or in -Settings, ended Test-IntuneScript with the strict-mode error PropertyNotFoundStrict, which named neither the source nor the setting. It now ends with SettingsInvalid and the message <source>: Severity must be a hashtable of rule names and severities, as every other value outside its set does.

Closes #105

Changes

  • ConvertTo-IslSettingsObject checks that Severity is a dictionary after the other values and before its entries, and reads its keys only then. The help lists the check in its order.
  • Tests: two cases in the helper's SettingsInvalid table, a string and a list, and a test of Test-IntuneScript with a settings file that sets Severity = 'Error', which reports one SettingsInvalid error naming the file.
  • CHANGELOG: an entry under Fixed.

Verification

  • Every suite on the top of the stack (fix/filter-version-overflow, which holds both fixes), ./Tests/Invoke-Tests.ps1 under PowerShell 7: 1,349 passed, 3 failed, 7 skipped. The unit suites under Windows PowerShell 5.1: 1,262 passed, 2 failed, 37 skipped. The failures are the host-dependent tests of Repair-IntuneScript corrupts an ANSI script on a host with a UTF-8 system code page #75 and In-box module table does not list UOPProviders, present on Windows 11 26H2 #76, on a host whose system code pages are UTF-8; they pass in CI.
  • The tests this change touches, on both versions: all passed.
  • PSScriptAnalyzer with CI's settings: 0 findings. No line over 115 characters in a changed .ps1 file.
  • ./Build/Publish-Module.ps1 -WhatIf: the staged module imports, exports its commands, analyzes a sample and serves its help; nothing published.
  • quality-gates.yml, started by hand on this branch because the pull request is not based on main: run 45521792628, which passed all five jobs.

Notes

🤖 Generated with Claude Code

The settings conversion read the Keys of the Severity value without
checking that it was a dictionary. Under strict mode a string or a list
ended Test-IntuneScript with PropertyNotFoundStrict, which named
neither the settings source nor the setting. Such a value now fails the
checks like any other value outside its set, with SettingsInvalid.

Closes #105
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.

2 participants