import { schema , TypeOf } from '@kbn/config-schema' ; export const securityResponseHeadersSchema = schema . object ( { strictTransportSecurity : schema . oneOf ( [ schema . string ( ) , schema . literal ( null ) ] , { defaultValue : null , } ) , xContentTypeOptions : schema . oneOf ( [ schema . literal ( 'nosniff' ) , schema . literal ( null ) ] , { defaultValue : 'nosniff' , } ) , referrerPolicy : schema . oneOf ( [ schema . literal ( 'no-referrer' ) , schema . literal ( 'no-referrer-when-downgrade' ) , schema . literal ( 'origin' ) , schema . literal ( 'origin-when-cross-origin' ) , schema . literal ( 'same-origin' ) , schema . literal ( 'strict-origin' ) , schema . literal ( 'strict-origin-when-cross-origin' ) , schema . literal ( 'unsafe-url' ) , schema . literal ( null ) , ] , { defaultValue : 'no-referrer-when-downgrade' } ) , permissionsPolicy : schema . oneOf ( [ schema . string ( ) , schema . literal ( null ) ] , { defaultValue : null , } ) , disableEmbedding : schema . boolean ( { defaultValue : false } ) , } ) ; param raw internal export function parseRawSecurityResponseHeadersConfig ( raw ) { const securityResponseHeaders = { } ; const { disableEmbedding } = raw ; if ( raw . strictTransportSecurity ) { securityResponseHeaders [ 'Strict-Transport-Security' ] = raw . strictTransportSecurity ; } if ( raw . xContentTypeOptions ) { securityResponseHeaders [ 'X-Content-Type-Options' ] = raw . xContentTypeOptions ; } if ( raw . referrerPolicy ) { securityResponseHeaders [ 'Referrer-Policy' ] = raw . referrerPolicy ; } if ( raw . permissionsPolicy ) { securityResponseHeaders [ 'Permissions-Policy' ] = raw . permissionsPolicy ; } if ( disableEmbedding ) { securityResponseHeaders [ 'X-Frame-Options' ] = 'SAMEORIGIN' ; } return { securityResponseHeaders , disableEmbedding } ; }