import { Card } from 'v1-check/components/Form/Card'; import Row, { Details } from 'v1-check/components/Form/Row'; import colors from 'v1-check/styles/colors'; const cardStyles = ` small { margin-top: 1rem; opacity: 0.5; display: block; a { color: ${colors.primary}; } } summary { padding: 0.5rem 0 0 0.5rem !important; cursor: pointer; font-weight: bold; } pre { background: ${colors.background}; padding: 0.5rem 0.25rem; border-radius: 4px; overflow: auto; } `; const getPagePath = (url: string): string => { try { return new URL(url).pathname; } catch (error) { return url; } } const SecurityTxtCard = (props: {data: any, title: string, actionButtons: any }): JSX.Element => { const securityTxt = props.data; return ( { securityTxt.isPresent && ( <> {securityTxt.fields && Object.keys(securityTxt.fields).map((field: string, index: number) => { if (securityTxt.fields[field].includes('http')) return ( {field} {getPagePath(securityTxt.fields[field])} ); return ( ); })}
View Full Policy
{securityTxt.content}
)} {!securityTxt.isPresent && ( Having a security.txt ensures security researchers know how and where to safely report vulnerabilities. )}
); } export default SecurityTxtCard;