.env holds secrets, so treat the file itself as a secret:
Never check it into version control — add .env to .gitignore.
Limit who you share it with; don’t paste it into Slack, tickets, or screenshots.
Prefer generating it on the target host. If you generate it elsewhere, transfer it over an authenticated channel and wipe the source copy.
If your organization uses a secrets manager, fetch .env at deploy time rather than storing it on disk long-term. The stack does not integrate with these, so that is your responsibility.
pg_trgm is a trusted extension, so a role with CREATE ON DATABASE control can create it. Otherwise, have an administrator run CREATE EXTENSION pg_trgm once before the first start.
The simplest arrangement is a single role that owns each database’s objects.
Deploy the stack to a trusted environment and ensure the exposed network ports (see Installation → Networking) are only reachable by authorized clients.
Every outbound integration is off by default (see Installation → Optional features to enable them). The ones that connect outbound are Slack alert delivery, EDR device detection, and LLM alert assessment. For LLM assessment, ANTHROPIC_BASE_URL routes requests through an Anthropic-compatible in-network gateway instead of calling Anthropic directly.
Session cookies carry the Secure flag, so plain-HTTP logins work only on localhost. Serve every other host over HTTPS through your load balancer. When the public URL changes, update the redirect URI registered at your IdP to match the new public URL.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Oso Cloud Documentation","colors":{"primary":"#392396","light":"#A78BFA","dark":"#392396"},"logo":{"light":"https://mintcdn.com/osoinc/IZptQQUcDTzNnhFZ/logo/logo_black.svg?fit=max\u0026auto=format\u0026n=IZptQQUcDTzNnhFZ\u0026q=85\u0026s=a23ba87f23f09fee12a107724078979d","dark":"https://mintcdn.com/osoinc/IZptQQUcDTzNnhFZ/logo/logo_white.svg?fit=max\u0026auto=format\u0026n=IZptQQUcDTzNnhFZ\u0026q=85\u0026s=f243e8e50bd0474e6481419e6c602335"},"favicon":"https://mintcdn.com/osoinc/HuMviHxd0NHscL55/favicon.png?fit=max\u0026auto=format\u0026n=HuMviHxd0NHscL55\u0026q=85\u0026s=462aeacb44be5e00705afebb98f0ea1b","api":{"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["curl","python","javascript","go","java","ruby","csharp"]}},"navbar":{"links":[{"href":"https://www.osohq.com/meet-oso","label":"Meet an Engineer"}],"primary":{"type":"button","label":"Try Oso for free","href":"https://ui.osohq.com/"}},"footer":{"socials":{"x":"https://x.com/osohq","github":"https://github.com/osohq","linkedin":"https://www.linkedin.com/company/osohq","slack":"https://join-slack.osohq.com/","youtube":"https://www.youtube.com/@oso-authorization"}},"fonts":{"family":"Inter"},"integrations":{"gtm":{"tagId":"GTM-MK29QFG"}},"banner":{"content":"**AI agents are everywhere.** [See what yours are doing →](https://www.osohq.com/post/introducing-oso-for-coding-agents)","dismissible":true},"contextual":{"options":["copy","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Blog","icon":"newspaper","href":"https://osohq.com/blog"},{"anchor":"Status Page","icon":"wifi","href":"https://oso.statuspage.io/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"osoinc","hasAudioNarration":false,"actualSubdomain":"osoinc","customDomains":["www.osohq.com"],"gitSource":{"type":"github","owner":"osohq","repo":"oso-cloud-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adf92850461319c0aa1df69","collectionId":"41c75d83-80b3-44ae-9561-b735be5940e9","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adf92850461319c0aa1df69"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6adf92850461319c0aa1df69","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"Oso for Apps","count":123},{"language":"default","tag":"Reference","count":71},{"language":"default","tag":"Docs","count":43},{"language":"default","tag":"HTTP API","count":40},{"language":"default","tag":"Develop","count":34},{"language":"default","tag":"Oso for Agents","count":30},{"language":"default","tag":"SDKs","count":20},{"language":"default","tag":"Write Policies","count":16},{"language":"default","tag":"Learn","count":11},{"language":"default","tag":"Changelog","count":11}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"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":"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":"byok-sep-25","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":"billing-updated-9-15","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}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"oso-for-agents/self-hosting/security","slug":"/oso-for-agents/self-hosting/security","pageMetadata":{"title":"Security","description":"Harden a self-hosted Oso for Agents deployment.","href":"/oso-for-agents/self-hosting/security"},"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: \"Harden a self-hosted Oso for Agents deployment.\"\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`,code:`code`,li:`li`,p:`p`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Note}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);return _jsxs(_Fragment,{children:[_jsxs(Heading,{level:`2`,id:`protecting-the-env-file`,children:[`Protecting the `,_jsx(_components.code,{children:`.env`}),` file`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`.env`}),` holds secrets, so treat the file itself as a secret:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Never check it into version control — add `,_jsx(_components.code,{children:`.env`}),` to `,_jsx(_components.code,{children:`.gitignore`}),`.`]}),`\n`,_jsx(_components.li,{children:`Limit who you share it with; don’t paste it into Slack, tickets, or screenshots.`}),`\n`,_jsx(_components.li,{children:`Prefer generating it on the target host. If you generate it elsewhere, transfer it over an authenticated channel and wipe the source copy.`}),`\n`,_jsxs(_components.li,{children:[`If your organization uses a secrets manager, fetch `,_jsx(_components.code,{children:`.env`}),` at deploy time rather than storing it on disk long-term. The stack does not integrate with these, so that is your responsibility.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`database-least-privilege`,children:`Database least privilege`}),`\n`,_jsx(_components.p,{children:`Give each database a dedicated role with:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`USAGE, CREATE ON SCHEMA public`})}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`SELECT, INSERT, UPDATE, DELETE`}),` on its tables`]}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public`})}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`control`}),` also needs the `,_jsx(_components.code,{children:`pg_trgm`}),` extension:`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`pg_trgm`}),` is a trusted extension, so a role with `,_jsx(_components.code,{children:`CREATE ON DATABASE control`}),` can create it. Otherwise, have an administrator run `,_jsx(_components.code,{children:`CREATE EXTENSION pg_trgm`}),` once before the first start.`]})}),`\n`,_jsx(_components.p,{children:`The simplest arrangement is a single role that owns each database’s objects.`}),`\n`,_jsx(Heading,{level:`2`,id:`network-exposure`,children:`Network exposure`}),`\n`,_jsxs(_components.p,{children:[`Deploy the stack to a trusted environment and ensure the exposed network ports (see `,_jsx(_components.a,{href:`/oso-for-agents/self-hosting/installation#networking`,children:`Installation → Networking`}),`) are only reachable by authorized clients.`]}),`\n`,_jsx(Heading,{level:`2`,id:`egress`,children:`Egress`}),`\n`,_jsxs(_components.p,{children:[`Every outbound integration is off by default (see `,_jsx(_components.a,{href:`/oso-for-agents/self-hosting/installation#optional-features`,children:`Installation → Optional features`}),` to enable them). The ones that connect outbound are Slack alert delivery, EDR device detection, and LLM alert assessment. For LLM assessment, `,_jsx(_components.code,{children:`ANTHROPIC_BASE_URL`}),` routes requests through an Anthropic-compatible in-network gateway instead of calling Anthropic directly.`]}),`\n`,_jsx(Heading,{level:`2`,id:`encryption-in-transit`,children:`Encryption in transit`}),`\n`,_jsxs(_components.p,{children:[`Session cookies carry the `,_jsx(_components.code,{children:`Secure`}),` flag, so plain-HTTP logins work only on `,_jsx(_components.code,{children:`localhost`}),`. Serve every other host over HTTPS through your load balancer. When the public URL changes, update the redirect URI registered at your IdP to match the new public URL.`]}),`\n`,_jsx(Heading,{level:`2`,id:`encryption-at-rest`,children:`Encryption at rest`}),`\n`,_jsx(_components.p,{children:`Deploy the stack to infrastructure with encrypted disks so local state is encrypted on disk.`}),`\n`,_jsx(Heading,{level:`2`,id:`reporting-vulnerabilities`,children:`Reporting vulnerabilities`}),`\n`,_jsxs(_components.p,{children:[`Report suspected security issues to `,_jsx(_components.a,{href:`mailto:security@osohq.com`,children:`security@osohq.com`}),`.`]})]})}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":"Security","description":"Harden a self-hosted Oso for Agents deployment.","href":"/oso-for-agents/self-hosting/security"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Protecting the .env file","slug":"protecting-the-env-file","depth":2,"children":[]},{"title":"Database least privilege","slug":"database-least-privilege","depth":2,"children":[]},{"title":"Network exposure","slug":"network-exposure","depth":2,"children":[]},{"title":"Egress","slug":"egress","depth":2,"children":[]},{"title":"Encryption in transit","slug":"encryption-in-transit","depth":2,"children":[]},{"title":"Encryption at rest","slug":"encryption-at-rest","depth":2,"children":[]},{"title":"Reporting vulnerabilities","slug":"reporting-vulnerabilities","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/osoinc/1de558d9e172e6f8/_nav-example.js"],"subdomain":"osoinc","siteName":"Oso Cloud Documentation","title":"Security - Oso Cloud Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-04T20:14:17.918Z","originalFileLocation":"oso-for-agents/self-hosting/security.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=\"system\"}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=\"Harden a self-hosted Oso for Agents deployment.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Oso Cloud Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_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=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Security - Oso Cloud Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Harden a self-hosted Oso for Agents deployment.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Oso Cloud Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://osoinc.mintlify.app/_mintlify/api/og/v2?division=Self-Hosting\u0026amp;title=Security\u0026amp;description=Harden+a+self-hosted+Oso+for+Agents+deployment.\u0026amp;theme=eb85f6ae82e81d3487978aff\u0026amp;signature=87a817a0b267304ceed1e4f12110f8f8358435bd1e91604cb51c0dd00f3875b5\">\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=\"Security - Oso Cloud Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Harden a self-hosted Oso for Agents deployment.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://osoinc.mintlify.app/_mintlify/api/og/v2?division=Self-Hosting\u0026amp;title=Security\u0026amp;description=Harden+a+self-hosted+Oso+for+Agents+deployment.\u0026amp;theme=eb85f6ae82e81d3487978aff\u0026amp;signature=87a817a0b267304ceed1e4f12110f8f8358435bd1e91604cb51c0dd00f3875b5\">\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=\"/docs/mintlify-assets/_mintlify/favicons/osoinc/RDBykkEzsN_rr7aZ/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Oso Cloud Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#392396\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/oso-for-agents/self-hosting/security.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.osohq.com/#organization\",\"name\":\"Oso Cloud Documentation\",\"url\":\"https://www.osohq.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/osoinc/IZptQQUcDTzNnhFZ/logo/logo_black.svg?fit=max\u0026auto=format\u0026n=IZptQQUcDTzNnhFZ\u0026q=85\u0026s=a23ba87f23f09fee12a107724078979d\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.osohq.com/docs#website\",\"name\":\"Oso Cloud Documentation\",\"url\":\"https://www.osohq.com/docs\",\"publisher\":{\"@id\":\"https://www.osohq.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security#webpage\",\"url\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security\",\"name\":\"Security\",\"description\":\"Harden a self-hosted Oso for Agents deployment.\",\"dateModified\":\"2026-08-04T20:14:17.918Z\",\"isPartOf\":{\"@id\":\"https://www.osohq.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Self-Hosting\",\"item\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Security\",\"item\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security#article\",\"headline\":\"Security\",\"name\":\"Security\",\"description\":\"Harden a self-hosted Oso for Agents deployment.\",\"url\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security\",\"mainEntityOfPage\":{\"@id\":\"https://www.osohq.com/docs/oso-for-agents/self-hosting/security#webpage\"},\"dateModified\":\"2026-08-04T20:14:17.918Z\",\"publisher\":{\"@id\":\"https://www.osohq.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.osohq.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Oso Cloud Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Oso Cloud Documentation","nav":{"global":{"anchors":[{"anchor":"Blog","icon":"newspaper","href":"https://osohq.com/blog"},{"anchor":"Status Page","icon":"wifi","href":"https://oso.statuspage.io/"}]},"tabs":[{"tab":"Oso for Agents","groups":[{"group":"Get Started","pages":[{"title":"Overview","href":"/oso-for-agents/overview"},{"title":"How It Works","href":"/oso-for-agents/how-it-works"},{"title":"Quickstart: Oso for Agents","sidebarTitle":"Quickstart","href":"/oso-for-agents/quickstart-coding-agents"}]},{"group":"Capabilities","pages":[{"title":"Shadow AI","href":"/oso-for-agents/shadow-ai"},{"title":"Connectors","href":"/oso-for-agents/connectors"},{"title":"Identity Sync","href":"/oso-for-agents/identity-sync"},{"title":"Session Monitoring","href":"/oso-for-agents/session-monitoring"},{"title":"Alerts","href":"/oso-for-agents/alerts"},{"title":"Content Tags","href":"/oso-for-agents/content-tags"},{"title":"Policies","href":"/oso-for-agents/policies"}]},{"group":"Deployment Models","pages":[{"title":"Edge Proxy","href":"/oso-for-agents/integrations/edge-proxy"},{"title":"Browser Extension","href":"/oso-for-agents/integrations/browser-extension"},{"title":"Tailscale Aperture","href":"/oso-for-agents/integrations/tailscale-aperture"},{"group":"Managed Deployment","pages":[{"title":"Overview","href":"/oso-for-agents/integrations/managed-deployment"},{"title":"Jamf","href":"/oso-for-agents/integrations/managed-deployment/jamf"},{"title":"Iru","href":"/oso-for-agents/integrations/managed-deployment/iru"},{"title":"Rippling","href":"/oso-for-agents/integrations/managed-deployment/rippling"}]}]},{"group":"Integrations \u0026 Connections","pages":[{"group":"EDR","pages":[{"title":"EDR","sidebarTitle":"Overview","href":"/oso-for-agents/integrations/edr"},{"title":"CrowdStrike","href":"/oso-for-agents/integrations/edr/crowdstrike"},{"title":"SentinelOne","href":"/oso-for-agents/integrations/edr/sentinelone"}]},{"title":"Slack","href":"/oso-for-agents/integrations/slack"},{"title":"SIEM export","href":"/oso-for-agents/integrations/siem-export"},{"group":"Identity Providers","pages":[{"title":"Okta","href":"/okta"}]}]},{"group":"Self-Hosting","pages":[{"title":"Overview","href":"/oso-for-agents/self-hosting/overview"},{"title":"Requirements","href":"/oso-for-agents/self-hosting/requirements"},{"title":"Installation","href":"/oso-for-agents/self-hosting/installation"},{"title":"Operations","description":"Run and maintain a self-hosted Oso for Agents deployment.","href":"/oso-for-agents/self-hosting/operations"},{"title":"Security","href":"/oso-for-agents/self-hosting/security"}]},{"group":"Reference","pages":[{"title":"Supported Agents","description":"Coverage levels for AI agents that Oso discovers and monitors.","href":"/oso-for-agents/supported-agents"},{"title":"Data Privacy","href":"/oso-for-agents/data-privacy"}]}]},{"tab":"Oso for Apps","dropdowns":[{"dropdown":"Docs","icon":"book-open","groups":[{"group":"Get Started","pages":[{"title":"An Introduction to Oso Cloud","sidebarTitle":"Introduction","href":"/get-started/introduction"},{"title":"Oso Cloud Quickstart","sidebarTitle":"Quickstart","href":"/get-started/quickstart"}]},{"group":"Develop","pages":[{"group":"Local Development","pages":[{"title":"Environment Setup","sidebarTitle":"Environment setup","href":"/develop/local-dev/env-setup"},{"title":"Oso Dev Server","sidebarTitle":"Oso Dev Server","href":"/develop/local-dev/oso-dev-server"},{"title":"Oso Migrate (Beta)","sidebarTitle":"Oso Migrate","href":"/develop/local-dev/oso-migrate"},{"title":"Oso MCP Server","sidebarTitle":"Oso MCP Server","href":"/develop/local-dev/mcp"}]},{"group":"Write Policies","pages":[{"title":"Overview of Polar Language and Syntax","sidebarTitle":"Overview","href":"/develop/policies/overview"},{"title":"Model Role-Based Access Control (RBAC)","sidebarTitle":"RBAC","href":"/develop/policies/rbac"},{"title":"Model Relationship-Based Access Control (ReBAC)","sidebarTitle":"ReBAC","href":"/develop/policies/rebac"},{"title":"Model Attribute-Based Access Control (ABAC)","sidebarTitle":"ABAC","href":"/develop/policies/abac"},{"title":"Fine-grained Authorization (FGA)","sidebarTitle":"FGA","href":"/develop/policies/fga"},{"title":"Model Field-Level Authorization","sidebarTitle":"Field-Level Authorization","href":"/develop/policies/field-level-authorization"},{"title":"Policy Preview","href":"/develop/policies/policy-preview"},{"group":"Patterns","pages":[{"title":"Resource Creation","sidebarTitle":"Resource Creation","href":"/develop/policies/patterns/resource-creation"},{"title":"Conditional Roles","sidebarTitle":"Conditional Roles","href":"/develop/policies/patterns/conditional-roles"},{"title":"Custom Roles","sidebarTitle":"Custom Roles","href":"/develop/policies/patterns/custom-roles"},{"title":"Entitlements","sidebarTitle":"Entitlements","href":"/develop/policies/patterns/entitlements"},{"title":"Impersonation","sidebarTitle":"Impersonation","href":"/develop/policies/patterns/impersonation"},{"title":"Organization Hierarchies","sidebarTitle":"Organization Hierarchies","href":"/develop/policies/patterns/organizational-hierarchy"},{"title":"Resource Sharing","sidebarTitle":"Resource Sharing","href":"/develop/policies/patterns/resource-sharing"},{"title":"Time-based Checks","sidebarTitle":"Time-based Checks","href":"/develop/policies/patterns/time-based-checks"},{"title":"User Groups","sidebarTitle":"User Groups","href":"/develop/policies/patterns/user-groups"}]}]},{"group":"Manage Facts","pages":[{"title":"Overview of Facts","sidebarTitle":"Overview","href":"/develop/facts/overview"},{"title":"Insert facts","sidebarTitle":"Insert facts","href":"/develop/facts/insert-facts"},{"title":"Update facts","sidebarTitle":"Update facts","href":"/develop/facts/update-facts"},{"title":"Sync facts","sidebarTitle":"Sync facts","href":"/develop/facts/sync-facts"},{"title":"Export Facts","sidebarTitle":"Export facts","href":"/develop/facts/export-facts"},{"title":"Context Facts","sidebarTitle":"Context facts","href":"/develop/facts/context-facts"},{"title":"Local Authorization","sidebarTitle":"Local Authorization","href":"/develop/facts/local-authorization"}]},{"group":"Enforce Permissions","pages":[{"title":"Authorize Requests","sidebarTitle":"Authorize requests","href":"/develop/enforce/authorize-requests"},{"title":"Enforcement strategies","sidebarTitle":"Enforcement strategies","href":"/develop/enforce/enforcement-strategies"},{"title":"Query Oso Cloud","sidebarTitle":"Query Oso Cloud","href":"/develop/enforce/query-facts"},{"title":"List filtering","sidebarTitle":"List filtering","href":"/develop/enforce/list-filtering"}]},{"group":"Troubleshooting","pages":[{"title":"Logs and auditing","sidebarTitle":"Logs","href":"/develop/troubleshooting/logs"},{"title":"Debugging a Policy","sidebarTitle":"Debugging","href":"/develop/troubleshooting/debugging"},{"title":"Query performance","sidebarTitle":"Query performance","href":"/develop/troubleshooting/query-performance"}]}]},{"group":"Deploy and Manage","pages":[{"title":"Deployment models","sidebarTitle":"Deployment models","href":"/deploy/deployment-models"},{"title":"Oso Fallback - Hybrid Deployment","sidebarTitle":"Fallback nodes","href":"/deploy/fallback-nodes"},{"title":"Backup \u0026 Point-in-time Recovery","sidebarTitle":"Backups and recovery","href":"/deploy/backups-and-recovery"},{"title":"CI/CD with Oso Cloud","sidebarTitle":"CI/CD","href":"/deploy/ci-cd"},{"group":"Account Management","pages":[{"title":"Configuring your account","sidebarTitle":"Account configuration","href":"/deploy/account-management/configuration"},{"title":"Service limits","sidebarTitle":"Service limits","href":"/deploy/account-management/rate-limits"},{"title":"Single Sign-On (SSO) Configuration","sidebarTitle":"SSO","href":"/deploy/account-management/sso"}]}]}]},{"dropdown":"Reference","icon":"square-terminal","groups":[{"group":"Polar","pages":[{"title":"The Polar Language in Oso Cloud","sidebarTitle":"Introduction","href":"/reference/polar/introduction"},{"title":"Polar Rules and Facts","sidebarTitle":"Rules and Facts","href":"/reference/polar/rules-and-facts"},{"title":"Facts as Data","sidebarTitle":"Facts as Data","href":"/reference/polar/facts-as-data"},{"title":"Polar Built-In Types","sidebarTitle":"Types","href":"/reference/polar/types"},{"title":"Polar Operators","sidebarTitle":"Operators","href":"/reference/polar/operators"},{"title":"Resource Blocks","sidebarTitle":"Resource Blocks","href":"/reference/polar/resource-blocks"},{"title":"Polar Polymorphism","sidebarTitle":"Extends","href":"/reference/polar/extends"},{"title":"Polar Built-In Constants","sidebarTitle":"Constants","href":"/reference/polar/constants"},{"title":"Polar Tests","sidebarTitle":"Tests","href":"/reference/polar/tests"}]},{"group":"HTTP API","pages":[{"group":"Policies","pages":[{"openapi":"get /policy","title":null,"href":"/reference/api/policy/get-policy"},{"openapi":"get /policy_metadata","title":null,"href":"/reference/api/policy/get-policy_metadata"},{"openapi":"post /policy","title":null,"href":"/reference/api/policy/post-policy"}]},{"group":"Facts","pages":[{"openapi":"post /batch","title":null,"href":"/reference/api/centralized-authorization-data/post-batch"},{"openapi":"post /clear_data","title":null,"href":"/reference/api/centralized-authorization-data/post-clear_data"},{"openapi":"post /facts","deprecated":true,"title":null,"href":"/reference/api/centralized-authorization-data/post-facts"},{"openapi":"post /bulk","deprecated":true,"title":null,"href":"/reference/api/centralized-authorization-data/post-bulk"},{"openapi":"post /bulk_load","deprecated":true,"title":null,"href":"/reference/api/centralized-authorization-data/post-bulk_load"},{"openapi":"post /bulk_delete","deprecated":true,"title":null,"href":"/reference/api/centralized-authorization-data/post-bulk_delete"},{"openapi":"delete /facts","deprecated":true,"title":null,"href":"/reference/api/centralized-authorization-data/delete-facts"}]},{"group":"Authorization Check","pages":[{"openapi":"post /actions","title":null,"href":"/reference/api/check-api/post-actions"},{"openapi":"post /authorize_resources","title":null,"href":"/reference/api/check-api/post-authorize_resources"},{"openapi":"post /authorize","title":null,"href":"/reference/api/check-api/post-authorize"},{"openapi":"post /evaluate_query","title":null,"href":"/reference/api/check-api/post-evaluate_query"},{"openapi":"post /list","title":null,"href":"/reference/api/check-api/post-list"},{"openapi":"post /query","deprecated":true,"title":null,"href":"/reference/api/check-api/post-query"}]},{"group":"Local Authorization Check","pages":[{"openapi":"post /actions_query","title":null,"href":"/reference/api/local-check-api/post-actions_query"},{"openapi":"post /authorize_query","title":null,"href":"/reference/api/local-check-api/post-authorize_query"},{"openapi":"post /evaluate_query_local","title":null,"href":"/reference/api/local-check-api/post-evaluate_query_local"},{"openapi":"post /list_query","title":null,"href":"/reference/api/local-check-api/post-list_query"}]},{"group":"Policy","pages":[{"title":"Get policy","deprecated":null,"version":null,"openapi":"/reference/openapi.json get /policy","href":"/api-reference/policy/get-policy"},{"title":"Post policy","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /policy","href":"/api-reference/policy/post-policy"},{"title":"Get policy metadata","deprecated":null,"version":null,"openapi":"/reference/openapi.json get /policy_metadata","href":"/api-reference/policy/get-policy_metadata"}]},{"group":"Centralized Authorization Data","pages":[{"title":"Post facts","deprecated":true,"version":null,"openapi":"/reference/openapi.json post /facts","href":"/api-reference/centralized-authorization-data/post-facts"},{"title":"Delete facts","deprecated":true,"version":null,"openapi":"/reference/openapi.json delete /facts","href":"/api-reference/centralized-authorization-data/delete-facts"},{"title":"Post bulk load","deprecated":true,"version":null,"openapi":"/reference/openapi.json post /bulk_load","href":"/api-reference/centralized-authorization-data/post-bulk_load"},{"title":"Post bulk delete","deprecated":true,"version":null,"openapi":"/reference/openapi.json post /bulk_delete","href":"/api-reference/centralized-authorization-data/post-bulk_delete"},{"title":"Post bulk","deprecated":true,"version":null,"openapi":"/reference/openapi.json post /bulk","href":"/api-reference/centralized-authorization-data/post-bulk"},{"title":"Post batch","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /batch","href":"/api-reference/centralized-authorization-data/post-batch"},{"title":"Post clear data","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /clear_data","href":"/api-reference/centralized-authorization-data/post-clear_data"}]},{"group":"Check API","pages":[{"title":"Post authorize","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /authorize","href":"/api-reference/check-api/post-authorize"},{"title":"Post authorize resources","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /authorize_resources","href":"/api-reference/check-api/post-authorize_resources"},{"title":"Post list","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /list","href":"/api-reference/check-api/post-list"},{"title":"Post actions","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /actions","href":"/api-reference/check-api/post-actions"},{"title":"Post query","deprecated":true,"version":null,"openapi":"/reference/openapi.json post /query","href":"/api-reference/check-api/post-query"},{"title":"Post evaluate query","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /evaluate_query","href":"/api-reference/check-api/post-evaluate_query"}]},{"group":"Local Check API","pages":[{"title":"Post actions query","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /actions_query","href":"/api-reference/local-check-api/post-actions_query"},{"title":"Post authorize query","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /authorize_query","href":"/api-reference/local-check-api/post-authorize_query"},{"title":"Post list query","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /list_query","href":"/api-reference/local-check-api/post-list_query"},{"title":"Post evaluate query local","deprecated":null,"version":null,"openapi":"/reference/openapi.json post /evaluate_query_local","href":"/api-reference/local-check-api/post-evaluate_query_local"}]}]},{"group":"SDKs","pages":[{"title":"Oso Cloud SDKs","sidebarTitle":"Overview","href":"/reference/sdks/overview"},{"title":"Installation and Setup","sidebarTitle":"Install","href":"/reference/sdks/install"},{"title":"Policy Management","sidebarTitle":"Policies","href":"/reference/sdks/policies"},{"title":"Facts Management","sidebarTitle":"Facts","href":"/reference/sdks/facts"},{"title":"Authorization Checks","sidebarTitle":"Authorization Checks","href":"/reference/sdks/authorization-checks"},{"title":"Local Authorization","sidebarTitle":"Local Authorization","href":"/reference/sdks/local-authorization"},{"title":"Migration Guide","sidebarTitle":"Migration Guide","href":"/reference/sdks/migration-guide"},{"title":"SDK Specific Guidance","sidebarTitle":"SDK Specific Guidance","href":"/reference/sdks/sdk-specific-guidance"},{"group":"Integrations","pages":[{"title":"SQLAlchemy Local Authorization Integration","sidebarTitle":"SQLAlchemy","href":"/reference/sdks/integrations/sqlalchemy"},{"title":"Mcp","href":"/reference/sdks/integrations/mcp"}]},{"group":"Changelog","pages":[{"title":"What's New in Oso Cloud","sidebarTitle":"What's New","href":"/reference/sdks/changelog/whats-new"},{"title":"CLI Changelog","sidebarTitle":"CLI","href":"/reference/sdks/changelog/oso-cloud-cli"},{"title":"Node.js SDK Changelog","sidebarTitle":"Node.js","href":"/reference/sdks/changelog/nodejs"},{"title":"Python SDK Changelog","sidebarTitle":"Python","href":"/reference/sdks/changelog/python"},{"title":"Ruby SDK Changelog","sidebarTitle":"Ruby","href":"/reference/sdks/changelog/ruby"},{"title":"Java SDK Changelog","sidebarTitle":"Java","href":"/reference/sdks/changelog/java"},{"title":"Go SDK Changelog","sidebarTitle":"Go","href":"/reference/sdks/changelog/go"},{"title":".NET SDK Changelog","sidebarTitle":".NET","href":"/reference/sdks/changelog/dotnet"},{"title":"Fallback Node Changelog","sidebarTitle":"Fallback Node","href":"/reference/sdks/changelog/fallback"},{"title":"Dev Server Changelog","sidebarTitle":"Dev Server","href":"/reference/sdks/changelog/oso-dev-server"},{"title":"VSCode Extension Changelog","sidebarTitle":"VSCode Extension","href":"/reference/sdks/changelog/vscode-extension"}]}]}]},{"dropdown":"Learn","icon":"graduation-cap","groups":[{"group":"Tutorials","pages":[{"title":"An End-to-End Example Securing a Real World App with Oso Cloud","sidebarTitle":"End-to-End Example","href":"/learn/tutorials/end-to-end-example"},{"title":"An illustration of a local development workflow for Oso Cloud","sidebarTitle":"Workflow Walkthrough","href":"/learn/tutorials/workflow-walkthrough"}]},{"group":"Guides","pages":[{"group":"Adopt Local Authorization","pages":[{"title":"Getting started","href":"/learn/guides/adopt-local-authorization/getting-started"},{"title":"Extract authorization logic","href":"/learn/guides/adopt-local-authorization/extract-logic"},{"title":"Implement in Oso Cloud","href":"/learn/guides/adopt-local-authorization/implement-in-oso-cloud"},{"title":"Send data as context facts","href":"/learn/guides/adopt-local-authorization/data-as-context-facts"},{"title":"Replace Context Facts with Local Authorization","sidebarTitle":"Replace with local authorization","href":"/learn/guides/adopt-local-authorization/replace-with-local-authorization"},{"title":"Authorize with Oso Cloud","href":"/learn/guides/adopt-local-authorization/authorize-with-oso-cloud"}]},{"title":"How to map relational data to facts","sidebarTitle":"Map Relational Data to Facts","href":"/learn/guides/map-relational-data-to-facts"},{"title":"Best Practices for Frontend Authorization","sidebarTitle":"Frontend (UI)","href":"/learn/guides/ui"},{"title":"Integrating Authentication (Identity) Data","sidebarTitle":"Authentication","href":"/learn/guides/authentication"}]}]}]}]},"basePath":"","title":"Security - Oso Cloud Documentation","buildId":"dpl_6cCEiK8XNNvaLBBkWzcBhdE9QfLC","deploymentId":"dpl_6cCEiK8XNNvaLBBkWzcBhdE9QfLC","dynamics":["10e4515597"],"chunks":["BannerMarkdown-CGuHEvQW.js","dist-B66mVNPp.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-BcghKhHb.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}