Skip to content

system_settings_screensaver_password_enforce reports non-compliant on some machines in Tahoe #635

@jonbrown21

Description

@jonbrown21

Summary

Control 11.34 – Enforce Screen Saver Password (system_settings_screensaver_password_enforce) reports non-compliant on macOS Tahoe even when askForPassword is correctly enforced via a classic MDM configuration profile. Below is information from a failing computer with enforcement set correctly and correctly enforced and functional.

The control validates using:

NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver')

to read askForPassword.

On affected systems, this returns an empty suite dictionary and evaluates askForPassword as false, even though the managed preferences layer shows askForPassword = 1.

This results in a false-negative compliance failure.

Steps to reproduce

  1. Deploy a classic configuration profile targeting preference domain:
com.apple.screensaver

With the following keys:

  • askForPassword = true
  • askForPasswordDelay = 5
  • idleTime = 1200
  • moduleName = Tahoe
  1. Confirm the profile is installed and applied.

  2. Run the following commands and compare results.


Managed Preferences Layer (MDM materialization)

ls -l "/Library/Managed Preferences/com.apple.screensaver.plist"
defaults read "/Library/Managed Preferences/com.apple.screensaver.plist" askForPassword

Observed output:

-rw-r--r--  1 root  wheel  331 Feb 17 20:04 /Library/Managed Preferences/com.apple.screensaver.plist
1

User Defaults Layer

Non-host domain

defaults read com.apple.screensaver askForPassword 2>/dev/null || echo "Non-host unset"

Observed output:

Non-host unset

ByHost domain

defaults -currentHost read com.apple.screensaver askForPassword 2>/dev/null || echo "ByHost unset"

Observed output:

1

Compliance Validation Method (Current Rule Logic)

/usr/bin/osascript -l JavaScript << 'EOS'
ObjC.import('Foundation');
var d=$.NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver');
var v=d.objectForKey('askForPassword');
console.log("askForPassword_js:", v ? v.js : null);
console.log("suite_dictionary:", JSON.stringify(d.dictionaryRepresentation ? d.dictionaryRepresentation.js : null));
EOS

Observed output:

askForPassword_js: false
suite_dictionary: {}

Operating System version

ProductName: macOS
ProductVersion: 26.3
BuildVersion: 25D125
Platform: macOS Tahoe

Intel or Apple Silicon

Architecture: Apple Silicon

What is the current bug behavior?

Current Bug Behavior

Even when the setting is enforced via MDM and the managed preferences layer shows:

askForPassword = 1

…the compliance validation returns:

askForPassword_js: false
suite_dictionary: {}

Result: the control reports non-compliant despite correct enforcement.

Managed Preferences Layer (MDM materialization)

ls -l "/Library/Managed Preferences/com.apple.screensaver.plist"
defaults read "/Library/Managed Preferences/com.apple.screensaver.plist" askForPassword

Observed output:

-rw-r--r--  1 root  wheel  331 Feb 17 20:04 /Library/Managed Preferences/com.apple.screensaver.plist
1

User Defaults Layer

Non-host domain

defaults read com.apple.screensaver askForPassword 2>/dev/null || echo "Non-host unset"

Observed output:

Non-host unset

ByHost domain

defaults -currentHost read com.apple.screensaver askForPassword 2>/dev/null || echo "ByHost unset"

Observed output:

1

What is the expected correct behavior?

When askForPassword is enforced via an MDM configuration profile, the control should evaluate as compliant.

The validation method should correctly resolve the effective managed preference value for com.apple.screensaver on macOS Tahoe.

Relevant logs and/or screenshots

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)

Output of checks

Compliance Validation Method (Current Rule Logic)

/usr/bin/osascript -l JavaScript << 'EOS'
ObjC.import('Foundation');
var d=$.NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver');
var v=d.objectForKey('askForPassword');
console.log("askForPassword_js:", v ? v.js : null);
console.log("suite_dictionary:", JSON.stringify(d.dictionaryRepresentation ? d.dictionaryRepresentation.js : null));
EOS

Observed output:

askForPassword_js: false
suite_dictionary: {}

Possible fixes

The current validation logic relies on NSUserDefaults.initWithSuiteName('com.apple.screensaver'), which does not appear to consult the managed preferences domain for this setting on macOS Tahoe, resulting in an empty dictionary and false evaluation.

  1. Update the validation logic to consult the managed preferences layer for this control.
  2. Adjust the NSUserDefaults resolution logic to correctly resolve host-scoped and managed values.
  3. Add fallback logic: if the suite dictionary is empty, validate against the managed preference domain before reporting non-compliance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions