diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000000..034e8480320 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. diff --git a/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx b/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx index ac759a49730..c25dfd164ee 100644 --- a/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx +++ b/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx @@ -219,16 +219,24 @@ export const EmbedSetup: React.FC = ({ }); const createKeyMutation = useCreateApiKey(); - const validApiKey = (apiKeys.data || []).find( - (apiKey) => - (apiKey.domains.includes("*") || - apiKey.domains.includes("embed.ipfscdn.io") || - apiKey.domains.includes("*.ipfscdn.io")) && + const validApiKey = (apiKeys.data || []).find((apiKey) => { + const allowedHosts = ["embed.ipfscdn.io", "*.ipfscdn.io"]; + const isValidDomain = apiKey.domains.includes("*") || apiKey.domains.some((domain) => { + try { + const url = new URL(domain); + return allowedHosts.includes(url.host); + } catch (e) { + return false; + } + }); + return ( + isValidDomain && (apiKey.services || []) .find((service) => service.name === "storage") ?.actions.includes("read") && - !!(apiKey.services || []).find((service) => service.name === "rpc"), - ); + !!(apiKey.services || []).find((service) => service.name === "rpc") + ); + }); const chainId = contract.chain.id; const { idToChain } = useAllChainsData();