pub fn parse_and_check(
        program: &fdata::Dictionary,
        checker: &ScopedPolicyChecker,
        url: &str,
    ) -> Result<Self, ElfRunnerError> {
        let notify_lifecycle_stop =
            match runner::get_enum(program, STOP_EVENT_KEY, &STOP_EVENT_VARIANTS)
                .map_err(|_err| ElfRunnerError::program_dictionary_error(STOP_EVENT_KEY, url))?
            {
                Some("notify") => true,
                _ => false,
            };

        let ambient_mark_vmo_exec = runner::get_bool(program, VMEX_KEY)
            .map_err(|_err| ElfRunnerError::program_dictionary_error(VMEX_KEY, url))?;
        if ambient_mark_vmo_exec {
            checker.ambient_mark_vmo_exec_allowed()?;
        }

        let main_process_critical = runner::get_bool(program, CRITICAL_KEY)
            .map_err(|_err| ElfRunnerError::program_dictionary_error(CRITICAL_KEY, url))?;
        if main_process_critical {
            checker.main_process_critical_allowed()?;
        }

        let create_raw_processes =
            runner::get_bool(program, CREATE_RAW_PROCESSES_KEY).map_err(|_err| {
                ElfRunnerError::program_dictionary_error(CREATE_RAW_PROCESSES_KEY, url)
            })?;
        if create_raw_processes {
            checker.create_raw_processes_allowed()?;
        }

        let stdout_sink = get_stream_sink(&program, FORWARD_STDOUT_KEY, url)?;
        let stderr_sink = get_stream_sink(&program, FORWARD_STDERR_KEY, url)?;

        Ok(ElfProgramConfig {
            notify_lifecycle_stop,
            ambient_mark_vmo_exec,
            main_process_critical,
            create_raw_processes,
            stdout_sink,
            stderr_sink,
        })
    }
/// Parse the given dictionary into an ElfProgramConfig, checking it against security policy as
/// needed.
///
/// Checking against security policy is intentionally combined with parsing here, so that policy
/// enforcement is as close to the point of parsing as possible and can't be inadvertently skipped.
Parse the given dictionary into an ElfProgramConfig, checking it against security policy as
needed.

Checking against security policy is intentionally combined with parsing here, so that policy
enforcement is as close to the point of parsing as possible and can't be inadvertently skipped.
Parse the given dictionary into an ElfProgramConfig checking it against security policy as needed . Checking against security policy is intentionally combined with parsing here so that policy enforcement is as close to the point of parsing as possible and can ' t be inadvertently skipped .
pub fn parse_and_check(
        program: &fdata::Dictionary,
        checker: &ScopedPolicyChecker,
        url: &str,
    ) -> Result<Self, ElfRunnerError> {
        let notify_lifecycle_stop =
            match runner::get_enum(program, STOP_EVENT_KEY, &STOP_EVENT_VARIANTS)
                .map_err(|_err| ElfRunnerError::program_dictionary_error(STOP_EVENT_KEY, url))?
            {
                Some("notify") => true,
                _ => false,
            };
        let ambient_mark_vmo_exec = runner::get_bool(program, VMEX_KEY)
            .map_err(|_err| ElfRunnerError::program_dictionary_error(VMEX_KEY, url))?;
        if ambient_mark_vmo_exec {
            checker.ambient_mark_vmo_exec_allowed()?;
        }
        let main_process_critical = runner::get_bool(program, CRITICAL_KEY)
            .map_err(|_err| ElfRunnerError::program_dictionary_error(CRITICAL_KEY, url))?;
        if main_process_critical {
            checker.main_process_critical_allowed()?;
        }
        let create_raw_processes =
            runner::get_bool(program, CREATE_RAW_PROCESSES_KEY).map_err(|_err| {
                ElfRunnerError::program_dictionary_error(CREATE_RAW_PROCESSES_KEY, url)
            })?;
        if create_raw_processes {
            checker.create_raw_processes_allowed()?;
        }
        let stdout_sink = get_stream_sink(&program, FORWARD_STDOUT_KEY, url)?;
        let stderr_sink = get_stream_sink(&program, FORWARD_STDERR_KEY, url)?;
        Ok(ElfProgramConfig {
            notify_lifecycle_stop,
            ambient_mark_vmo_exec,
            main_process_critical,
            create_raw_processes,
            stdout_sink,
            stderr_sink,
        })
    }
pub fn parse_and_check ( program : & fdata :: Dictionary , checker : & ScopedPolicyChecker , url : & str , ) -> Result < Self , ElfRunnerError > { let notify_lifecycle_stop = match runner :: get_enum ( program , STOP_EVENT_KEY , & STOP_EVENT_VARIANTS ) . map_err ( | _err | ElfRunnerError :: program_dictionary_error ( STOP_EVENT_KEY , url ) ) ? { Some ( " " ) => true , _ => false , } ; let ambient_mark_vmo_exec = runner :: get_bool ( program , VMEX_KEY ) . map_err ( | _err | ElfRunnerError :: program_dictionary_error ( VMEX_KEY , url ) ) ? ; if ambient_mark_vmo_exec { checker . ambient_mark_vmo_exec_allowed ( ) ? ; } let main_process_critical = runner :: get_bool ( program , CRITICAL_KEY ) . map_err ( | _err | ElfRunnerError :: program_dictionary_error ( CRITICAL_KEY , url ) ) ? ; if main_process_critical { checker . main_process_critical_allowed ( ) ? ; } let create_raw_processes = runner :: get_bool ( program , CREATE_RAW_PROCESSES_KEY ) . map_err ( | _err | { ElfRunnerError :: program_dictionary_error ( CREATE_RAW_PROCESSES_KEY , url ) } ) ? ; if create_raw_processes { checker . create_raw_processes_allowed ( ) ? ; } let stdout_sink = get_stream_sink ( & program , FORWARD_STDOUT_KEY , url ) ? ; let stderr_sink = get_stream_sink ( & program , FORWARD_STDERR_KEY , url ) ? ; Ok ( ElfProgramConfig { notify_lifecycle_stop , ambient_mark_vmo_exec , main_process_critical , create_raw_processes , stdout_sink , stderr_sink , } ) }
Parse the given dictionary into an ElfProgramConfig, checking it against security policy as
needed.
Parse the given dictionary into an ElfProgramConfig checking it against security policy as needed .
program
&fdata::Dictionary
checker
&ScopedPolicyChecker
url
&str
program
&fdata::Dictionary
checker
&ScopedPolicyChecker
url
&str