/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.securitySolution_bundle_jsonpfunction=window.securitySolution_bundle_jsonpfunction||[]).push([[40],{1495:function(e,t,s){"use strict";s.d(t,"a",(function(){return T}));var n=s(2),i=s.n(n),o=s(40),a=s(44),l=s(102),c=s(132),r=s(46),p=s(215),d=s(41),u=s.n(d),y=s(185),g=s(0),_=s.n(g),f=s(5);const m=Object.freeze(new Map([["logging",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.logging",{defaultMessage:"Logging"})],["streaming",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.streaming",{defaultMessage:"Streaming"})],["malware",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.malware",{defaultMessage:"Malware"})],["events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.events",{defaultMessage:"Events"})],["memory_protection",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.memory_protection",{defaultMessage:"Memory Threat"})],["behavior_protection",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.behavior_protection",{defaultMessage:"Malicious Behavior"})]])),h=Object.freeze(new Map([["configure_dns_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_dns_events",{defaultMessage:"Configure DNS Events"})],["configure_elasticsearch_connection",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_elasticsearch_connection",{defaultMessage:"Configure Elasticsearch Connection"})],["configure_file_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_file_events",{defaultMessage:"Configure File Events"})],["configure_imageload_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_imageload_events",{defaultMessage:"Configure Image Load Events"})],["configure_kernel",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_kernel",{defaultMessage:"Configure Kernel"})],["configure_logging",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_logging",{defaultMessage:"Configure Logging"})],["configure_malware",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_malware",{defaultMessage:"Configure Malware"})],["configure_network_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_network_events",{defaultMessage:"Configure Network Events"})],["configure_process_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_process_events",{defaultMessage:"Configure Process Events"})],["configure_registry_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_registry_events",{defaultMessage:"Configure Registry Events"})],["configure_security_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.configure_security_events",{defaultMessage:"Configure Security Events"})],["connect_kernel",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.connect_kernel",{defaultMessage:"Connect Kernel"})],["detect_async_image_load_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_async_image_load_events",{defaultMessage:"Detect Async Image Load Events"})],["detect_file_open_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_file_open_events",{defaultMessage:"Detect File Open Events"})],["detect_file_write_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_file_write_events",{defaultMessage:"Detect File Write Events"})],["detect_network_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_network_events",{defaultMessage:"Detect Network Events"})],["detect_process_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_process_events",{defaultMessage:"Detect Process Events"})],["detect_registry_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_registry_events",{defaultMessage:"Detect Registry Events"})],["detect_sync_image_load_events",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.detect_sync_image_load_events",{defaultMessage:"Detect Sync Image Load Events"})],["download_global_artifacts",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.download_global_artifacts",{defaultMessage:"Download Global Artifacts"})],["download_user_artifacts",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.download_user_artifacts",{defaultMessage:"Download User Artifacts"})],["load_config",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.load_config",{defaultMessage:"Load Config"})],["load_malware_model",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.load_malware_model",{defaultMessage:"Load Malware Model"})],["read_elasticsearch_config",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.read_elasticsearch_config",{defaultMessage:"Read Elasticsearch Config"})],["read_events_config",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.read_events_config",{defaultMessage:"Read Events Config"})],["read_kernel_config",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.read_kernel_config",{defaultMessage:"Read Kernel Config"})],["read_logging_config",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.read_logging_config",{defaultMessage:"Read Logging Config"})],["read_malware_config",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.read_malware_config",{defaultMessage:"Read Malware Config"})],["workflow",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.workflow",{defaultMessage:"Workflow"})],["full_disk_access",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.full_disk_access",{defaultMessage:"Full Disk Access"})],["macos_system_ext",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.macos_system_ext",{defaultMessage:"Permissions required"})],["linux_deadlock",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.linux_deadlock",{defaultMessage:"Disabled to avoid potential system deadlock"})]])),k=Object.freeze(new Map([[y.b.success,f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.success",{defaultMessage:"Success"})],[y.b.warning,f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.warning",{defaultMessage:"Warning"})],[y.b.failure,f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.failed",{defaultMessage:"Failed"})],[y.b.unsupported,f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.unsupported",{defaultMessage:"Unsupported"})]])),v=Object.freeze(new Map([["full_disk_access",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.description.full_disk_access",{defaultMessage:"You must enable full disk access for Elastic Endpoint on your machine."})],["macos_system_ext",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.description.macos_system_ext",{defaultMessage:"You must enable the Mac system extension for Elastic Endpoint on your machine."})],["linux_deadlock",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.description.linux_deadlock",{defaultMessage:"Malware protection was disabled to avoid a potential system deadlock. To resolve this issue, the file systems causing this need to be identified in integration policy advanced settings (linux.advanced.fanotify.ignored_filesystems). Learn more in our"})]])),R=Object.freeze(new Map([["full_disk_access",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.link.text.full_disk_access",{defaultMessage:" Learn more."})],["macos_system_ext",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.link.text.macos_system_ext",{defaultMessage:" Learn more."})],["linux_deadlock",f.i18n.translate("xpack.securitySolution.endpoint.details.policyResponse.link.text.linux_deadlock",{defaultMessage:" troubleshooting docs."})]])),x="Disabled due to potential system deadlock",E=new Set(["load_malware_model","configure_malware"]);function S(e,t){return"macos"===e&&"connect_kernel"===t.name&&t.status===y.b.failure}function b(e,t){return"linux"===e&&E.has(t.name)&&t.message===x}class policy_response_friendly_names_PolicyResponseActionFormatter{constructor(e,t,s=""){var n;_()(this,"key",void 0),_()(this,"title",void 0),_()(this,"description",void 0),_()(this,"hasError",void 0),_()(this,"errorTitle",void 0),_()(this,"errorDescription",void 0),_()(this,"status",void 0),_()(this,"linkText",void 0),this.policyResponseAppliedAction=e,this.docLinks=t,this.os=s,this.key=e.name,this.title=null!==(n=h.get(this.errorKey||this.key))&&void 0!==n?n:this.key.replace(/_/g," ").replace(/\b(\w)/g,(e=>e.toUpperCase())),this.hasError=e.status===y.b.failure||e.status===y.b.warning,this.description=v.get(this.key)||e.message,this.errorDescription=v.get(this.errorKey||this.key)||this.policyResponseAppliedAction.message,this.errorTitle=this.errorDescription?this.title:e.name,this.status=k.get(e.status),this.linkText=R.get(this.errorKey||this.key)}get linkUrl(){return this.docLinks[this.errorKey]}get isGeneric(){return e=this.os,t=this.policyResponseAppliedAction,!!("macos"===e&&"full_disk_access"===t.name||S(this.os,this.policyResponseAppliedAction)||b(this.os,this.policyResponseAppliedAction));var e,t}get errorKey(){return S(this.os,this.policyResponseAppliedAction)?"macos_system_ext":b(this.os,this.policyResponseAppliedAction)?"linux_deadlock":this.policyResponseAppliedAction.name}}const w=u()(o.EuiCallOut).withConfig({displayName:"StyledEuiCallout",componentId:"sc-1hzi5tn-0"})(["padding:",";"],(({theme:e})=>e.eui.euiSizeS)),M=u()(o.EuiText).withConfig({displayName:"StyledEuiText",componentId:"sc-1hzi5tn-1"})(["white-space:break-spaces;text-align:left;line-height:inherit;"]),j=Object(n.memo)((({policyResponseActionFormatter:e})=>e.hasError?i.a.createElement(w,{title:e.errorTitle,color:"danger",iconType:"warning","data-test-subj":"endpointPolicyResponseErrorCallOut"},i.a.createElement(M,{size:"s","data-test-subj":"endpointPolicyResponseMessage"},e.errorDescription,e.linkText&&e.linkUrl&&i.a.createElement(o.EuiLink,{target:"_blank",href:e.linkUrl,"data-test-subj":"endpointPolicyResponseErrorCallOutLink"},e.linkText))):i.a.createElement(M,{size:"xs","data-test-subj":"endpointPolicyResponseMessage"},e.description||e.title)));j.displayName="PolicyResponseActionItem";const C=u()(o.EuiTreeView).withConfig({displayName:"StyledEuiTreeView",componentId:"sc-1krv2vw-0"})([".policy-response-action-item-expanded{height:auto;padding-top:",";padding-bottom:",";.euiTreeView__nodeLabel{width:100%;}}.policyResponseStatusHealth{padding-top:5px;}.euiTreeView__node--expanded{max-height:none !important;.policy-response-action-expanded + div{.euiTreeView__node{max-height:none !important;}}}.euiTreeView__node{max-height:none !important;.euiNotificationBadge{margin-right:5px;}.euiTreeView__nodeLabel{.euiText{font-size:",";}}}"],(({theme:e})=>e.eui.euiSizeS),(({theme:e})=>e.eui.euiSizeS),(({theme:e})=>e.eui.euiFontSize)),A=Object(n.memo)((({hostOs:e,policyResponseConfig:t,policyResponseActions:s,policyResponseAttentionCount:c})=>{const{docLinks:r}=Object(l.j)().services,p=Object(n.useCallback)(((e,t)=>e===y.b.success?i.a.createElement(o.EuiHealth,{color:"success","data-test-subj":"endpointPolicyResponseStatusSuccessHealth",className:"policyResponseStatusHealth"}):e===y.b.unsupported?i.a.createElement(o.EuiHealth,{color:"subdued","data-test-subj":"endpointPolicyResponseStatusSuccessHealth",className:"policyResponseStatusHealth"}):i.a.createElement(o.EuiNotificationBadge,{"data-test-subj":"endpointPolicyResponseStatusAttentionHealth"},t)),[]),d=Object(n.useCallback)((t=>t.map((t=>{const n=s.find((e=>e.name===t)),a=new policy_response_friendly_names_PolicyResponseActionFormatter(n||{},r.links.securitySolution.policyResponseTroubleshooting,e);return{label:i.a.createElement(o.EuiText,{color:n.status!==y.b.success&&n.status!==y.b.unsupported?"danger":"default","data-test-subj":"endpointPolicyResponseAction"},a.title),id:t,className:n.status!==y.b.success&&n.status!==y.b.unsupported?"policy-response-action-expanded":"",icon:p(n.status,n.status!==y.b.success?1:0),children:[{label:i.a.createElement(j,{policyResponseActionFormatter:a}),id:`action_message_${t}`,isExpanded:!0,className:"policy-response-action-item-expanded"}]}}))),[r.links.securitySolution.policyResponseTroubleshooting,p,s,e]),u=Object(n.useCallback)((()=>Object.entries(t).map((([e,t])=>{const s=c.get(e);return{label:i.a.createElement(o.EuiText,{color:s?"danger":"default",size:"s","data-test-subj":"endpointPolicyResponseConfig"},(n=e,m.has(n)||m.set(n,n.replace(/_/g," ").replace(/\b(\w)/g,(e=>e.toUpperCase()))),m.get(n))),id:e,icon:s?i.a.createElement(o.EuiNotificationBadge,{"data-test-subj":"endpointPolicyResponseStatusAttentionHealth"},s):i.a.createElement(o.EuiHealth,{color:"success","data-test-subj":"endpointPolicyResponseStatusSuccessHealth",className:"policyResponseStatusHealth"}),children:d(t.concerned_actions)};var n}))),[d,c,t]),g=Object(n.useCallback)((()=>{let e=0;for(const t of c.values())e+=t;return[{label:i.a.createElement(o.EuiText,{color:e?"danger":"default",size:"s","data-test-subj":"endpointPolicyResponseTitle"},i.a.createElement(a.FormattedMessage,{id:"xpack.securitySolution.endpoint.policyResponse.title",defaultMessage:"Policy Response"})),id:"policyResponse",icon:e?i.a.createElement(o.EuiNotificationBadge,{"data-test-subj":"endpointPolicyResponseStatusHealth"},e):void 0,children:u()}]}),[u,c])();return i.a.createElement(C,{items:g,showExpansionArrows:!0,"aria-label":"policyResponseTreeView","aria-labelledby":"policyResponseTreeView"})}));A.displayName="PolicyResponse";var O=s(693);const T=Object(n.memo)((({endpointId:e,showRevisionMessage:t=!0,onShowNeedsAttentionBadge:s})=>{var d,u,g;const{data:_,isLoading:f,isFetching:m,isError:h}=function(e,t){const s=Object(l.i)();return Object(r.useQuery)(["getEndpointPolicyResponse",e],(()=>s.get(p.g,{version:"2023-10-31",query:{agentId:e}})),void 0)}(e),{data:k}=Object(O.c)(e),{docLinks:v}=Object(l.j)().services,[R,x]=Object(n.useState)(),[E,S]=Object(n.useState)(),[b,w]=Object(n.useState)(new Map);Object(n.useEffect)((()=>{!_||f||m||h||(x(_.policy_response.Endpoint.policy.applied.response.configurations),S(_.policy_response.Endpoint.policy.applied.actions),w((e=>{var t;const s=new Map;return void 0!==(null==e||null===(t=e.response)||void 0===t?void 0:t.configurations)&&void 0!==(null==e?void 0:e.actions)&&Object.entries(e.response.configurations).map((([t,n])=>{let i=0;for(const t of n.concerned_actions){var o;const s=null===(o=e.actions.find((e=>e.name===t)))||void 0===o?void 0:o.status;s!==y.b.failure&&s!==y.b.warning||(i+=1)}return s.set(t,i)})),s})(_.policy_response.Endpoint.policy.applied)))}),[_,f,m,h]),Object(n.useEffect)((()=>{if(s)for(const e of b.values())if(e)return void s(!0)}),[b,s]);const M=Object(n.useMemo)((()=>R||E?null==E?void 0:E.reduce(((e,t)=>{const s=new policy_response_friendly_names_PolicyResponseActionFormatter(t,v.links.securitySolution.policyResponseTroubleshooting,null==k?void 0:k.metadata.host.os.name.toLowerCase());return s.isGeneric&&s.hasError&&e.push(s),e}),[]):[]),[v.links.securitySolution.policyResponseTroubleshooting,E,R,null==k?void 0:k.metadata.host.os.name]);return i.a.createElement(i.a.Fragment,null,t&&i.a.createElement(i.a.Fragment,null,i.a.createElement(o.EuiText,{size:"xs",color:"subdued","data-test-subj":"endpointPolicyResponseTimestamp"},i.a.createElement(a.FormattedMessage,{id:"xpack.securitySolution.endpoint.policyResponse.appliedOn",defaultMessage:"Revision {rev} applied on {date}",values:{rev:null!==(d=null==_?void 0:_.policy_response.Endpoint.policy.applied.endpoint_policy_version)&&void 0!==d?d:"",date:i.a.createElement(c.d,{value:null!==(u=null==_?void 0:_.policy_response["@timestamp"])&&void 0!==u?u:""})}})),i.a.createElement(o.EuiSpacer,{size:"s"})),h&&i.a.createElement(o.EuiEmptyPrompt,{title:i.a.createElement(a.FormattedMessage,{id:"xpack.securitySolution.endpoint.details.noPolicyResponse",defaultMessage:"No policy response available"})}),f&&i.a.createElement(o.EuiLoadingSpinner,{size:"m"}),void 0!==R&&void 0!==E&&i.a.createElement(i.a.Fragment,null,i.a.createElement(A,{hostOs:null!==(g=null==k?void 0:k.metadata.host.os.name.toLowerCase())&&void 0!==g?g:"",policyResponseConfig:R,policyResponseActions:E,policyResponseAttentionCount:b}),i.a.createElement(o.EuiSpacer,{size:"m"}),null==M?void 0:M.map((e=>i.a.createElement(i.a.Fragment,{key:e.key},i.a.createElement(j,{policyResponseActionFormatter:e}),i.a.createElement(o.EuiSpacer,{size:"m"}))))))}));T.displayName="PolicyResponse"},1647:function(e,t,s){"use strict";s.r(t),s.d(t,"EndpointPolicyResponseExtension",(function(){return a}));var n=s(2),i=s.n(n),o=s(1495);const a=Object(n.memo)((({agent:e,onShowNeedsAttentionBadge:t})=>i.a.createElement(o.a,{endpointId:e.id,onShowNeedsAttentionBadge:t,showRevisionMessage:!1})));a.displayName="EndpointPolicyResponseExtension"}}]);