id: system_settings_screensaver_timeout_enforce
title: Enforce Screen Saver Timeout
discussion: |
  The screen saver timeout _MUST_ be set to $ODV seconds or a shorter length of time.

  This rule ensures that a full session lock is triggered within no more than $ODV seconds of inactivity.
check: |
  /usr/bin/osascript -l JavaScript << EOS
  function run() {
    let timeout = ObjC.unwrap($.NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver')\
  .objectForKey('idleTime'))
    if ( timeout <= $ODV ) {
      return("true")
    } else {
      return("false")
    }
  }
  EOS
result:
  string: 'true'
fix: |
  This is implemented by a Configuration Profile.
references:
  cce:
    - CCE-95397-6
  cci:
    - CCI-000057
  800-53r5:
    - AC-11
    - IA-11
  800-53r4:
    - AC-11
  srg:
    - SRG-OS-000029-GPOS-00010
  disa_stig:
    - APPL-26-000070
  800-171r3:
    - 03.01.10
    - 03.05.01
  cis:
    benchmark:
      - 2.11.1 (level 1)
    controls v8:
      - 4.3
  cmmc:
    - AC.L2-3.1.10
  bio:
    - 5.17.03
macOS:
  - '26.0'
odv:
  hint: Number of seconds.
  recommended: 1200
  cis_lvl1: 900
  cis_lvl2: 900
  stig: 900
  nlmapgov_plus: 300
tags:
  - 800-53r5_moderate
  - 800-53r5_high
  - 800-53r5_low
  - 800-53r4_moderate
  - 800-53r4_high
  - 800-171
  - cis_lvl1
  - cis_lvl2
  - cisv8
  - cnssi-1253_low
  - cnssi-1253_high
  - cmmc_lvl2
  - stig
  - cnssi-1253_moderate
  - nlmapgov_plus
severity: medium
mobileconfig: true
mobileconfig_info:
  com.apple.screensaver:
    idleTime: $ODV
