Subresource Integrity (SRI) enables browsers to verify that resources they fetch are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that the fetched resource must match.SRI matters because it offers protection against malicious tampering.
If an attacker exploited a content delivery network (CDN) and modified the contents of JavaScript libraries hosted on that CDN, it would create vulnerabilities in all websites that use those libraries.SRI helps prevent attacks like cross-site scripting (XSS) by ensuring that the resources delivered to your site are exactly what they should be.
SRI provides cryptographic protection against man-in-the-middle attacks:
Hash verification - The browser computes a SHA384 hash of the downloaded script
Integrity check - If the hash doesn’t match the integrity attribute, the browser refuses to execute the script
Tamper detection - Any modification in transit (MITM) or at rest (CDN compromise) is detected
If someone intercepts the script during transit and modifies it, the hash will not match and the browser will block execution entirely. This is the same protection mechanism used by major CDNs like cdnjs and unpkg.
Formo supports SRI integration, providing an additional layer of security for your data and users.
Enable SRI on the browser install snippet by updating the src and integrity fields:
The hash in the integrity attribute within the Formo install script works with SRI to lock an external JavaScript resource to its known contents at a specific point in time. This is verified by a base64-encoded cryptographic hash.If the file is modified after this point, the hash won’t match, and supporting web browsers will refuse to load it. This ensures that the script you’re running is exactly the one provided by Formo, without any hidden changes or malicious code.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Formo Docs","description":"Guides and API documentation for Formo, the analytics and attribution platform for onchain apps.","colors":{"primary":"#0D9373","light":"#07C983","dark":"#0D9373"},"logo":{"light":"https://mintcdn.com/formo/Tkq8h2U3p6xcPPy8/logo/light.svg?fit=max\u0026auto=format\u0026n=Tkq8h2U3p6xcPPy8\u0026q=85\u0026s=44c0ee89d6c69a17e7599ec5db01b800","dark":"https://mintcdn.com/formo/Tkq8h2U3p6xcPPy8/logo/dark.svg?fit=max\u0026auto=format\u0026n=Tkq8h2U3p6xcPPy8\u0026q=85\u0026s=53db8fc67b12290b243ff6e94ecb9de4"},"favicon":"https://mintcdn.com/formo/Tkq8h2U3p6xcPPy8/favicon.svg?fit=max\u0026auto=format\u0026n=Tkq8h2U3p6xcPPy8\u0026q=85\u0026s=d395f9e73ddb75a465b56c9c9713e29e","api":{},"appearance":{"default":"light"},"background":{"decoration":"gradient"},"navbar":{"links":[{"href":"https://cal.com/formo/demo","label":"Book a demo"}],"primary":{"type":"button","label":"Sign in","href":"https://app.formo.so"}},"footer":{"socials":{"website":"https://formo.so","x":"https://x.com/getformo","linkedin":"https://linkedin.com/company/getformo","github":"https://github.com/getformo","youtube":"https://www.youtube.com/@getformo"}},"seo":{"metatags":{"msvalidate.01":"71E42B1EAE01EE25D08368832DB15087"}},"integrations":{"ga4":{"measurementId":"G-ZKSZ6S9EWJ"},"intercom":{"appId":"pggy8kos"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Changelog","icon":"map","href":"https://formo.so/changelog"},{"anchor":"Support","icon":"headset","href":"https://formo.so/support"},{"anchor":"Status","icon":"square-check","href":"https://status.formo.so"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"formo","hasAudioNarration":false,"actualSubdomain":"formo","customDomains":["docs.formo.so"],"gitSource":{"type":"github","owner":"getformo","repo":"docs.formo.so","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae43b9694210ab8c5fb0a8b","collectionId":"fe7910fc-5892-4fc7-b138-ce1087876e8f","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae43b9694210ab8c5fb0a8b"},"feedback":{"thumbs":false,"edits":true,"issues":true,"agentFeedback":true},"entitlements":{},"buildId":"6ae43b9694210ab8c5fb0a8b","clientVersion":"0.0.4074","searchFilterCounts":[{"language":"default","tag":"API","count":60},{"language":"default","tag":"Overview","count":33},{"language":"default","tag":"Features","count":30},{"language":"default","tag":"Query API","count":18},{"language":"default","tag":"Data","count":17},{"language":"default","tag":"Charts API","count":14},{"language":"default","tag":"Data catalog","count":14},{"language":"default","tag":"Analytics","count":14},{"language":"default","tag":"CLI","count":12},{"language":"default","tag":"Events","count":12}],"searchSettings":{"maxResults":6}},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"security/sri","slug":"/security/sri","pageMetadata":{"title":"Subresource Integrity (SRI)","description":"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.","icon":"file-shield","href":"/security/sri"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,blockquote:`blockquote`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`3`,id:`overview`,children:`Overview`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/SRI`,children:`Subresource Integrity (SRI)`}),` enables browsers to verify that resources they fetch are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that the fetched resource must match.`]}),`\n`,_jsxs(_components.p,{children:[`SRI matters because it offers `,_jsx(_components.strong,{children:`protection against malicious tampering`}),`.\nIf an attacker exploited a content delivery network (CDN) and modified the contents of JavaScript libraries hosted on that CDN, it would create vulnerabilities in all websites that use those libraries.`]}),`\n`,_jsx(_components.p,{children:`SRI helps prevent attacks like cross-site scripting (XSS) by ensuring that the resources delivered to your site are exactly what they should be.`}),`\n`,_jsx(Heading,{level:`3`,id:`how-sri-prevents-mitm-attacks`,children:`How SRI Prevents MITM Attacks`}),`\n`,_jsx(_components.p,{children:`SRI provides cryptographic protection against man-in-the-middle attacks:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Hash verification`}),` - The browser computes a SHA384 hash of the downloaded script`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Integrity check`}),` - If the hash doesn’t match the `,_jsx(_components.code,{children:`integrity`}),` attribute, the browser `,_jsx(_components.strong,{children:`refuses to execute the script`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Tamper detection`}),` - Any modification in transit (MITM) or at rest (CDN compromise) is detected`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`If someone intercepts the script during transit and modifies it, the hash will not match and the browser will block execution entirely. This is the same protection mechanism used by major CDNs like cdnjs and unpkg.`})}),`\n`,_jsx(Heading,{level:`3`,id:`how-to-enable-sri`,children:`How to Enable SRI`}),`\n`,_jsxs(_components.p,{children:[`Formo supports SRI integration, providing an additional layer of security for your data and users.\nEnable SRI on the browser `,_jsx(_components.a,{href:`/install`,children:`install`}),` snippet by updating the `,_jsx(_components.code,{children:`src`}),` and `,_jsx(_components.code,{children:`integrity`}),` fields:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`html`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`html`,children:_jsxs(_components.code,{language:`html`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://cdn.formo.so/analytics@1.42.1\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` integrity`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sha384-fJhcjBbJD9oUsqdbjp2zpVxkjv/TatW8DHN0b3BFt9F3k3hkGAlnLCQhIF/gWMrT\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` crossorigin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anonymous\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` defer`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` onload`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`window`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`formofy`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`('\u003cYOUR_WRITE_KEY>');\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`]})})}),`\n`,_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://github.com/getformo/sdk/releases`,children:`Get the latest version number and integrity hash on GitHub`}),`.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The hash in the integrity attribute within the Formo install script works with SRI to lock an external JavaScript resource to its known contents at a specific point in time. This is verified by a base64-encoded cryptographic hash.`}),`\n`,_jsx(_components.p,{children:`If the file is modified after this point, the hash won’t match, and supporting web browsers will refuse to load it. This ensures that the script you’re running is exactly the one provided by Formo, without any hidden changes or malicious code.`}),`\n`,_jsx(Heading,{level:`3`,id:`verifying-the-integrity-hash`,children:`Verifying the Integrity Hash`}),`\n`,_jsx(_components.p,{children:`You can independently verify the SRI hash using the following methods:`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Using OpenSSL (macOS/Linux):`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://cdn.formo.so/analytics@1.42.1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dgst`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -sha384`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -binary`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` base64`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -A`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Using Node.js:`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` crypto`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'crypto'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` https`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`https`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://cdn.formo.so/analytics@1.42.1'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` hash`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` crypto`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'sha384'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'data'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` hash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`update`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'end'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'sha384-'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` hash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`digest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'base64'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)));`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The output should match the integrity hash published in our `,_jsx(_components.a,{href:`https://github.com/getformo/sdk/releases`,children:`GitHub releases`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`combined-protection-with-csp`,children:`Combined Protection with CSP`}),`\n`,_jsxs(_components.p,{children:[`For maximum security, combine SRI with `,_jsx(_components.a,{href:`/security/csp`,children:`Content Security Policy`}),`. When both are enabled:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`CSP`}),` restricts where scripts can load from and where data can be sent`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`SRI`}),` ensures the loaded script hasn’t been tampered with`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`TLS 1.2+`}),` encrypts all traffic in transit`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`This defense-in-depth approach makes it effectively impossible for an attacker to compromise the Formo SDK through MITM attacks.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Subresource Integrity (SRI)","description":"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.","icon":"file-shield","href":"/security/sri"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Overview","slug":"overview","depth":3,"children":[]},{"title":"How SRI Prevents MITM Attacks","slug":"how-sri-prevents-mitm-attacks","depth":3,"children":[]},{"title":"How to Enable SRI","slug":"how-to-enable-sri","depth":3,"children":[]},{"title":"Verifying the Integrity Hash","slug":"verifying-the-integrity-hash","depth":3,"children":[]},{"title":"Combined Protection with CSP","slug":"combined-protection-with-csp","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"formo","siteName":"Formo Docs","title":"Subresource Integrity (SRI) - Formo Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-30T06:39:23.763Z","originalFileLocation":"security/sri.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Formo Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Subresource Integrity (SRI) - Formo Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Formo Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.formo.so/security/sri\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://formo.mintlify.site/_mintlify/api/og/v2?division=Security\u0026amp;title=Subresource+Integrity+%28SRI%29\u0026amp;description=Learn+how+Formo+uses+Subresource+Integrity+to+verify+fetched+resources+and+protect+against+XSS%2C+NPM+hijacking%2C+and+man-in-the-middle+attacks.\u0026amp;theme=88189b71ebb8a1c71f9b558e\u0026amp;signature=b4e43c32026ba928e75f04d28d66b4e471e36ff7748b83a5453f32775b668637\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Subresource Integrity (SRI) - Formo Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://formo.mintlify.site/_mintlify/api/og/v2?division=Security\u0026amp;title=Subresource+Integrity+%28SRI%29\u0026amp;description=Learn+how+Formo+uses+Subresource+Integrity+to+verify+fetched+resources+and+protect+against+XSS%2C+NPM+hijacking%2C+and+man-in-the-middle+attacks.\u0026amp;theme=88189b71ebb8a1c71f9b558e\u0026amp;signature=b4e43c32026ba928e75f04d28d66b4e471e36ff7748b83a5453f32775b668637\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/formo/wOme_sxFSkOvt-zW/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Formo Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003cmeta data-mint-head name=\"msvalidate.01\" content=\"71E42B1EAE01EE25D08368832DB15087\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.formo.so/security/sri\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/security/sri.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.formo.so/#organization\",\"name\":\"Formo Docs\",\"url\":\"https://docs.formo.so\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/formo/Tkq8h2U3p6xcPPy8/logo/light.svg?fit=max\u0026auto=format\u0026n=Tkq8h2U3p6xcPPy8\u0026q=85\u0026s=44c0ee89d6c69a17e7599ec5db01b800\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.formo.so#website\",\"name\":\"Formo Docs\",\"url\":\"https://docs.formo.so\",\"publisher\":{\"@id\":\"https://docs.formo.so/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.formo.so/security/sri#webpage\",\"url\":\"https://docs.formo.so/security/sri\",\"name\":\"Subresource Integrity (SRI)\",\"description\":\"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.\",\"dateModified\":\"2026-10-30T06:39:23.763Z\",\"isPartOf\":{\"@id\":\"https://docs.formo.so#website\"},\"breadcrumb\":{\"@id\":\"https://docs.formo.so/security/sri#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.formo.so/security/sri#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Security\",\"item\":\"https://docs.formo.so/security/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Subresource Integrity (SRI)\",\"item\":\"https://docs.formo.so/security/sri\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.formo.so/security/sri#article\",\"headline\":\"Subresource Integrity (SRI)\",\"name\":\"Subresource Integrity (SRI)\",\"description\":\"Learn how Formo uses Subresource Integrity to verify fetched resources and protect against XSS, NPM hijacking, and man-in-the-middle attacks.\",\"url\":\"https://docs.formo.so/security/sri\",\"mainEntityOfPage\":{\"@id\":\"https://docs.formo.so/security/sri#webpage\"},\"dateModified\":\"2026-10-30T06:39:23.763Z\",\"publisher\":{\"@id\":\"https://docs.formo.so/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.formo.so#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Formo Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Formo Docs","nav":{"global":{"anchors":[{"anchor":"Changelog","icon":"map","href":"https://formo.so/changelog"},{"anchor":"Support","icon":"headset","href":"https://formo.so/support"},{"anchor":"Status","icon":"square-check","href":"https://status.formo.so"}]},"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/intro"}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/onchain-attribution"}]},{"tab":"Data","pages":[{"title":"Data","href":"/data/what-we-collect"}]},{"tab":"SDK","pages":[{"title":"SDK","href":"/sdks/web"}]},{"tab":"API","pages":[{"title":"API","href":"/api/overview"}]},{"tab":"MCP","pages":[{"title":"MCP","href":"/mcp/overview"}]},{"tab":"CLI","pages":[{"title":"CLI","href":"/cli/overview"}]},{"tab":"Security","groups":[{"group":"Security","pages":[{"title":"Security Best Practices","icon":"shield-check","href":"/security/overview"},{"title":"Single Sign-On (SSO)","icon":"key","href":"/security/sso"},{"title":"Multi-Factor Authentication (MFA)","icon":"mobile","href":"/security/mfa"},{"title":"Role Based Access Control (RBAC)","description":"Manage team permissions with role-based access control. Assign Owner, Admin, Editor, or Viewer roles to enforce least-privilege access across your workspace.","icon":"users","href":"/security/roles"},{"title":"Subresource Integrity (SRI)","icon":"file-shield","href":"/security/sri"},{"title":"Content Security Policy (CSP)","description":"Configure Content Security Policy headers to protect your site from XSS, data injection, and man-in-the-middle attacks when using Formo.","icon":"lock","href":"/security/csp"}]}]}]},"basePath":"","title":"Subresource Integrity (SRI) - Formo Docs","buildId":"dpl_BLQvU86QFwq3AhPofSTw6q8dGWKm","deploymentId":"dpl_BLQvU86QFwq3AhPofSTw6q8dGWKm","dynamics":[],"chunks":[]}