[{"data":1,"prerenderedAt":2309},["ShallowReactive",2],{"navigation_docs":3,"-developers-network":613,"-developers-network-surround":2306},[4,39,101,378,540,562,584,606],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":38},"Start","i-lucide-rocket","\u002Fstart","1.start",[10,14,18,22,26,30,34],{"title":11,"path":12,"stem":13},"Our approach","\u002Fstart\u002Four-approach","1.start\u002F0.our-approach",{"title":15,"path":16,"stem":17},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":19,"path":20,"stem":21},"Concepts","\u002Fstart\u002Fconcepts","1.start\u002F2.concepts",{"title":23,"path":24,"stem":25},"Glossary","\u002Fstart\u002Fglossary","1.start\u002F3.glossary",{"title":27,"path":28,"stem":29},"Try it locally","\u002Fstart\u002Ftry-it-locally","1.start\u002F4.try-it-locally",{"title":31,"path":32,"stem":33},"Features","\u002Fstart\u002Ffeatures","1.start\u002F5.features",{"title":35,"path":36,"stem":37},"Questions","\u002Fstart\u002Ffaq","1.start\u002F6.faq",false,{"title":40,"icon":41,"path":42,"stem":43,"children":44,"page":38},"Run SHADE","i-lucide-server","\u002Frun","2.run",[45,49,53,57,61,65,69,73,77,81,85,89,93,97],{"title":46,"path":47,"stem":48},"Setting up an instance (Coolify)","\u002Frun\u002Fcoolify","2.run\u002F1.coolify",{"title":50,"path":51,"stem":52},"Console commands","\u002Frun\u002Fconsole","2.run\u002F10.console",{"title":54,"path":55,"stem":56},"Rotating APP_SECRET","\u002Frun\u002Frotating-app-secret","2.run\u002F11.rotating-app-secret",{"title":58,"path":59,"stem":60},"Checking an instance","\u002Frun\u002Fdoctor","2.run\u002F12.doctor",{"title":62,"path":63,"stem":64},"Self-hosting by hand","\u002Frun\u002Fown-server-by-hand","2.run\u002F13.own-server-by-hand",{"title":66,"path":67,"stem":68},"NixOS (experimental)","\u002Frun\u002Fnixos","2.run\u002F14.nixos",{"title":70,"path":71,"stem":72},"Self-hosting without Coolify","\u002Frun\u002Fown-server","2.run\u002F2.own-server",{"title":74,"path":75,"stem":76},"Hosting the site on a static host","\u002Frun\u002Fstatic-hosts","2.run\u002F3.static-hosts",{"title":78,"path":79,"stem":80},"Licence","\u002Frun\u002Flicence","2.run\u002F4.licence",{"title":82,"path":83,"stem":84},"Updating and backups","\u002Frun\u002Fupdating-and-backups","2.run\u002F5.updating-and-backups",{"title":86,"path":87,"stem":88},"Troubleshooting","\u002Frun\u002Ftroubleshooting","2.run\u002F6.troubleshooting",{"title":90,"path":91,"stem":92},"Logs, request ids, traces and metrics","\u002Frun\u002Flogs","2.run\u002F7.logs",{"title":94,"path":95,"stem":96},"Maintenance mode","\u002Frun\u002Fmaintenance-mode","2.run\u002F8.maintenance-mode",{"title":98,"path":99,"stem":100},"Usage limits","\u002Frun\u002Fusage-limits","2.run\u002F9.usage-limits",{"title":102,"icon":103,"path":104,"stem":105,"children":106},"Guide","i-lucide-book-open","\u002Fguide","3.guide",[107,109,147,192,210,280,310,364],{"title":102,"path":104,"stem":108},"3.guide\u002Findex",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":38},"Content","i-lucide-file-text","\u002Fguide\u002Fcontent","3.guide\u002F1.content",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Collections and entries","\u002Fguide\u002Fcontent\u002Fcollections","3.guide\u002F1.content\u002F1.collections",{"title":120,"path":121,"stem":122},"Field types","\u002Fguide\u002Fcontent\u002Ffields","3.guide\u002F1.content\u002F2.fields",{"title":124,"path":125,"stem":126},"Drafts, publishing and version history","\u002Fguide\u002Fcontent\u002Fversions","3.guide\u002F1.content\u002F3.versions",{"title":128,"path":129,"stem":130},"Languages","\u002Fguide\u002Fcontent\u002Flanguages","3.guide\u002F1.content\u002F4.languages",{"title":132,"path":133,"stem":134},"Data sources","\u002Fguide\u002Fcontent\u002Fdata-sources","3.guide\u002F1.content\u002F5.data-sources",{"title":136,"path":137,"stem":138},"Media","\u002Fguide\u002Fcontent\u002Fmedia","3.guide\u002F1.content\u002F6.media",{"title":140,"path":141,"stem":142},"Search","\u002Fguide\u002Fcontent\u002Fsearch","3.guide\u002F1.content\u002F7.search",{"title":144,"path":145,"stem":146},"Trash","\u002Fguide\u002Fcontent\u002Ftrash","3.guide\u002F1.content\u002F8.trash",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":38},"Website","i-lucide-globe","\u002Fguide\u002Fwebsite","3.guide\u002F2.website",[153,156,160,164,168,172,176,180,184,188],{"title":148,"path":154,"stem":155},"\u002Fguide\u002Fwebsite\u002Fwebsite","3.guide\u002F2.website\u002F1.website",{"title":157,"path":158,"stem":159},"Scroll scenes","\u002Fguide\u002Fwebsite\u002Fscroll-scenes","3.guide\u002F2.website\u002F10.scroll-scenes",{"title":161,"path":162,"stem":163},"Pages and posts","\u002Fguide\u002Fwebsite\u002Fpages","3.guide\u002F2.website\u002F2.pages",{"title":165,"path":166,"stem":167},"The visual editor","\u002Fguide\u002Fwebsite\u002Fvisual-editor","3.guide\u002F2.website\u002F3.visual-editor",{"title":169,"path":170,"stem":171},"Roles and locks","\u002Fguide\u002Fwebsite\u002Froles-and-locks","3.guide\u002F2.website\u002F4.roles-and-locks",{"title":173,"path":174,"stem":175},"Header and footer","\u002Fguide\u002Fwebsite\u002Fheader-and-footer","3.guide\u002F2.website\u002F5.header-and-footer",{"title":177,"path":178,"stem":179},"Theme","\u002Fguide\u002Fwebsite\u002Ftheme","3.guide\u002F2.website\u002F6.theme",{"title":181,"path":182,"stem":183},"Redirects","\u002Fguide\u002Fwebsite\u002Fredirects","3.guide\u002F2.website\u002F7.redirects",{"title":185,"path":186,"stem":187},"Site settings","\u002Fguide\u002Fwebsite\u002Fsite-settings","3.guide\u002F2.website\u002F8.site-settings",{"title":189,"path":190,"stem":191},"The site","\u002Fguide\u002Fwebsite\u002Fthe-site","3.guide\u002F2.website\u002F9.the-site",{"title":193,"icon":194,"path":195,"stem":196,"children":197,"page":38},"Publishing","i-lucide-send","\u002Fguide\u002Fpublishing","3.guide\u002F3.publishing",[198,202,206],{"title":199,"path":200,"stem":201},"Publishing and preview","\u002Fguide\u002Fpublishing\u002Fpublishing","3.guide\u002F3.publishing\u002F1.publishing",{"title":203,"path":204,"stem":205},"Builds","\u002Fguide\u002Fpublishing\u002Fbuilds","3.guide\u002F3.publishing\u002F2.builds",{"title":207,"path":208,"stem":209},"CDN caches","\u002Fguide\u002Fpublishing\u002Fcaches","3.guide\u002F3.publishing\u002F3.caches",{"title":211,"icon":212,"path":213,"stem":214,"children":215,"page":38},"People, security and privacy","i-lucide-shield","\u002Fguide\u002Fpeople-and-security","3.guide\u002F4.people-and-security",[216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276],{"title":217,"path":218,"stem":219},"People in SHADE","\u002Fguide\u002Fpeople-and-security\u002Fpeople-in-shade","3.guide\u002F4.people-and-security\u002F0.people-in-shade",{"title":221,"path":222,"stem":223},"Team and roles","\u002Fguide\u002Fpeople-and-security\u002Fteam","3.guide\u002F4.people-and-security\u002F1.team",{"title":225,"path":226,"stem":227},"Errors and security alerts","\u002Fguide\u002Fpeople-and-security\u002Ferrors","3.guide\u002F4.people-and-security\u002F10.errors",{"title":229,"path":230,"stem":231},"Exporting an instance","\u002Fguide\u002Fpeople-and-security\u002Fexporting","3.guide\u002F4.people-and-security\u002F11.exporting",{"title":233,"path":234,"stem":235},"Organisations","\u002Fguide\u002Fpeople-and-security\u002Forganisations","3.guide\u002F4.people-and-security\u002F12.organisations",{"title":237,"path":238,"stem":239},"Signing in through an identity provider (team)","\u002Fguide\u002Fpeople-and-security\u002Fidentity-providers","3.guide\u002F4.people-and-security\u002F13.identity-providers",{"title":241,"path":242,"stem":243},"System status","\u002Fguide\u002Fpeople-and-security\u002Fsystem-status","3.guide\u002F4.people-and-security\u002F14.system-status",{"title":245,"path":246,"stem":247},"Appearance","\u002Fguide\u002Fpeople-and-security\u002Fappearance","3.guide\u002F4.people-and-security\u002F15.appearance",{"title":249,"path":250,"stem":251},"Accounts and personal pages","\u002Fguide\u002Fpeople-and-security\u002Faccounts","3.guide\u002F4.people-and-security\u002F2.accounts",{"title":253,"path":254,"stem":255},"Signing in (team)","\u002Fguide\u002Fpeople-and-security\u002Fsign-in","3.guide\u002F4.people-and-security\u002F3.sign-in",{"title":257,"path":258,"stem":259},"API tokens","\u002Fguide\u002Fpeople-and-security\u002Fapi-tokens","3.guide\u002F4.people-and-security\u002F4.api-tokens",{"title":261,"path":262,"stem":263},"Audit log","\u002Fguide\u002Fpeople-and-security\u002Faudit","3.guide\u002F4.people-and-security\u002F5.audit",{"title":265,"path":266,"stem":267},"Request protection","\u002Fguide\u002Fpeople-and-security\u002Fprotection","3.guide\u002F4.people-and-security\u002F6.protection",{"title":269,"path":270,"stem":271},"Personal data per person","\u002Fguide\u002Fpeople-and-security\u002Fprivacy","3.guide\u002F4.people-and-security\u002F7.privacy",{"title":273,"path":274,"stem":275},"Data retention","\u002Fguide\u002Fpeople-and-security\u002Fretention","3.guide\u002F4.people-and-security\u002F8.retention",{"title":277,"path":278,"stem":279},"Consent banner","\u002Fguide\u002Fpeople-and-security\u002Fconsent","3.guide\u002F4.people-and-security\u002F9.consent",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":38},"Services","i-lucide-plug","\u002Fguide\u002Fservices","3.guide\u002F5.services",[286,290,294,298,302,306],{"title":287,"path":288,"stem":289},"Email","\u002Fguide\u002Fservices\u002Femail","3.guide\u002F5.services\u002F1.email",{"title":291,"path":292,"stem":293},"Opening hours","\u002Fguide\u002Fservices\u002Fopening-hours","3.guide\u002F5.services\u002F4.opening-hours",{"title":295,"path":296,"stem":297},"Webhooks","\u002Fguide\u002Fservices\u002Fwebhooks","3.guide\u002F5.services\u002F5.webhooks",{"title":299,"path":300,"stem":301},"Locations","\u002Fguide\u002Fservices\u002Flocations","3.guide\u002F5.services\u002F6.locations",{"title":303,"path":304,"stem":305},"VAT rates","\u002Fguide\u002Fservices\u002Fvat-rates","3.guide\u002F5.services\u002F7.vat-rates",{"title":307,"path":308,"stem":309},"Channels","\u002Fguide\u002Fservices\u002Fchannels","3.guide\u002F5.services\u002F8.channels",{"title":311,"icon":312,"path":313,"stem":314,"children":315,"page":38},"InstalledModules","i-lucide-puzzle","\u002Fguide\u002Fmodules","3.guide\u002F6.modules",[316,320,324,328,332,336,340,344,348,352,356,360],{"title":317,"path":318,"stem":319},"Modules","\u002Fguide\u002Fmodules\u002Fmanaging","3.guide\u002F6.modules\u002F1.managing",{"title":321,"path":322,"stem":323},"Dutch services (module)","\u002Fguide\u002Fmodules\u002Fnl","3.guide\u002F6.modules\u002F10.nl",{"title":325,"path":326,"stem":327},"Editorial (module)","\u002Fguide\u002Fmodules\u002Feditorial","3.guide\u002F6.modules\u002F11.editorial",{"title":329,"path":330,"stem":331},"Appointments (module)","\u002Fguide\u002Fmodules\u002Fappointments","3.guide\u002F6.modules\u002F2.appointments",{"title":333,"path":334,"stem":335},"Shop (the commerce module)","\u002Fguide\u002Fmodules\u002Fshop","3.guide\u002F6.modules\u002F3.shop",{"title":337,"path":338,"stem":339},"Untrusted modules","\u002Fguide\u002Fmodules\u002Funtrusted","3.guide\u002F6.modules\u002F4.untrusted",{"title":341,"path":342,"stem":343},"Analytics (module)","\u002Fguide\u002Fmodules\u002Fanalytics","3.guide\u002F6.modules\u002F5.analytics",{"title":345,"path":346,"stem":347},"Error forwarding (module)","\u002Fguide\u002Fmodules\u002Ferror-forwarding","3.guide\u002F6.modules\u002F6.error-forwarding",{"title":349,"path":350,"stem":351},"Client programs","\u002Fguide\u002Fmodules\u002Fprograms","3.guide\u002F6.modules\u002F7.programs",{"title":353,"path":354,"stem":355},"Import and export (module)","\u002Fguide\u002Fmodules\u002Fimport","3.guide\u002F6.modules\u002F8.import",{"title":357,"path":358,"stem":359},"Payments (module)","\u002Fguide\u002Fmodules\u002Fpayments","3.guide\u002F6.modules\u002F8.payments",{"title":361,"path":362,"stem":363},"Forms (module)","\u002Fguide\u002Fmodules\u002Fforms","3.guide\u002F6.modules\u002F9.forms",{"title":365,"icon":366,"path":367,"stem":368,"children":369,"page":38},"AI assistants","i-lucide-bot","\u002Fguide\u002Fai","3.guide\u002F7.ai",[370,374],{"title":371,"path":372,"stem":373},"AI assistants (MCP)","\u002Fguide\u002Fai\u002Fassistants","3.guide\u002F7.ai\u002F1.assistants",{"title":375,"path":376,"stem":377},"Connecting an AI assistant","\u002Fguide\u002Fai\u002Fconnecting","3.guide\u002F7.ai\u002F2.connecting",{"title":379,"icon":380,"path":381,"stem":382,"children":383,"page":38},"Developers","i-lucide-code","\u002Fdevelopers","4.developers",[384,388,392,396,400,404,408,412,416,420,424,428,432,435,489,493,497,501,536],{"title":385,"path":386,"stem":387},"Architecture","\u002Fdevelopers\u002Farchitecture","4.developers\u002F1.architecture",{"title":389,"path":390,"stem":391},"Capabilities","\u002Fdevelopers\u002Fcapabilities","4.developers\u002F10.capabilities",{"title":393,"path":394,"stem":395},"Trust","\u002Fdevelopers\u002Ftrust","4.developers\u002F11.trust",{"title":397,"path":398,"stem":399},"Redis and the ports","\u002Fdevelopers\u002Fredis","4.developers\u002F12.redis",{"title":401,"path":402,"stem":403},"The worker container role","\u002Fdevelopers\u002Fworker","4.developers\u002F13.worker",{"title":405,"path":406,"stem":407},"kv: a module's own key-value storage","\u002Fdevelopers\u002Fkv","4.developers\u002F14.kv",{"title":409,"path":410,"stem":411},"Processes: long-running work on the worker","\u002Fdevelopers\u002Fprocesses","4.developers\u002F15.processes",{"title":413,"path":414,"stem":415},"Network: a module's outgoing calls","\u002Fdevelopers\u002Fnetwork","4.developers\u002F16.network",{"title":417,"path":418,"stem":419},"Realtime","\u002Fdevelopers\u002Frealtime","4.developers\u002F17.realtime",{"title":421,"path":422,"stem":423},"Private files","\u002Fdevelopers\u002Ffiles","4.developers\u002F18.files",{"title":425,"path":426,"stem":427},"Notify","\u002Fdevelopers\u002Fnotify","4.developers\u002F19.notify",{"title":429,"path":430,"stem":431},"Collections","\u002Fdevelopers\u002Fcollections","4.developers\u002F2.collections",{"title":337,"path":433,"stem":434},"\u002Fdevelopers\u002Funtrusted","4.developers\u002F20.untrusted",{"title":436,"icon":312,"path":437,"stem":438,"children":439},"Writing a plugin","\u002Fdevelopers\u002Fmodules","4.developers\u002F3.modules\u002Findex",[440,442,446,450,454,458,462,466,470,473,477,481,485],{"title":441,"path":437,"stem":438},"Writing a module",{"title":443,"path":444,"stem":445},"Module SDK and tooling","\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling","4.developers\u002F3.modules\u002F1.sdk-and-tooling",{"title":447,"path":448,"stem":449},"Connecting accounts with OAuth2","\u002Fdevelopers\u002Fmodules\u002Foauth","4.developers\u002F3.modules\u002F10.oauth",{"title":451,"path":452,"stem":453},"Calls between modules","\u002Fdevelopers\u002Fmodules\u002Fcalls-between-modules","4.developers\u002F3.modules\u002F11.calls-between-modules",{"title":455,"path":456,"stem":457},"Experimental parts","\u002Fdevelopers\u002Fmodules\u002Fexperimental-parts","4.developers\u002F3.modules\u002F12.experimental-parts",{"title":459,"path":460,"stem":461},"The manifest","\u002Fdevelopers\u002Fmodules\u002Fmanifest","4.developers\u002F3.modules\u002F2.manifest",{"title":463,"path":464,"stem":465},"Routes","\u002Fdevelopers\u002Fmodules\u002Froutes","4.developers\u002F3.modules\u002F3.routes",{"title":467,"path":468,"stem":469},"Admin screens and the site part","\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site","4.developers\u002F3.modules\u002F4.admin-and-site",{"title":110,"path":471,"stem":472},"\u002Fdevelopers\u002Fmodules\u002Fcontent","4.developers\u002F3.modules\u002F5.content",{"title":474,"path":475,"stem":476},"Background work and services","\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services","4.developers\u002F3.modules\u002F6.background-and-services",{"title":478,"path":479,"stem":480},"SDK reference","\u002Fdevelopers\u002Fmodules\u002Fsdk-reference","4.developers\u002F3.modules\u002F7.sdk-reference",{"title":482,"path":483,"stem":484},"The website module's SDK","\u002Fdevelopers\u002Fmodules\u002Fwebsite-sdk","4.developers\u002F3.modules\u002F8.website-sdk",{"title":486,"path":487,"stem":488},"Incoming webhooks","\u002Fdevelopers\u002Fmodules\u002Fincoming-webhooks","4.developers\u002F3.modules\u002F9.incoming-webhooks",{"title":490,"path":491,"stem":492},"Core and the website module","\u002Fdevelopers\u002Fcore-and-website-module","4.developers\u002F4.core-and-website-module",{"title":494,"path":495,"stem":496},"The API","\u002Fdevelopers\u002Fapi","4.developers\u002F6.api",{"title":498,"path":499,"stem":500},"API reference","\u002Fdevelopers\u002Fapi-reference","4.developers\u002F6.api-reference",{"title":502,"icon":503,"path":504,"stem":505,"children":506},"Sites in other frameworks","i-lucide-layout-template","\u002Fdevelopers\u002Fframeworks","4.developers\u002F7.frameworks\u002Findex",[507,508,512,516,520,524,528,532],{"title":502,"path":504,"stem":505},{"title":509,"path":510,"stem":511},"Accounts: sign-in and modules' routes","\u002Fdevelopers\u002Fframeworks\u002Faccounts","4.developers\u002F7.frameworks\u002F1.accounts",{"title":513,"path":514,"stem":515},"`@shadestack\u002Ftree`","\u002Fdevelopers\u002Fframeworks\u002Ftree","4.developers\u002F7.frameworks\u002F2.tree",{"title":517,"path":518,"stem":519},"Expressions and styles","\u002Fdevelopers\u002Fframeworks\u002Fexpressions-and-styles","4.developers\u002F7.frameworks\u002F3.expressions-and-styles",{"title":521,"path":522,"stem":523},"`@shadestack\u002Frender`","\u002Fdevelopers\u002Fframeworks\u002Frender","4.developers\u002F7.frameworks\u002F4.render",{"title":525,"path":526,"stem":527},"`@shadestack\u002Finteractions`","\u002Fdevelopers\u002Fframeworks\u002Finteractions","4.developers\u002F7.frameworks\u002F5.interactions",{"title":529,"path":530,"stem":531},"`@shadestack\u002Fa11y`","\u002Fdevelopers\u002Fframeworks\u002Fa11y","4.developers\u002F7.frameworks\u002F6.a11y",{"title":533,"path":534,"stem":535},"Your own page for SHADE's links","\u002Fdevelopers\u002Fframeworks\u002Flinks","4.developers\u002F7.frameworks\u002F7.links",{"title":537,"path":538,"stem":539},"Build a client module","\u002Fdevelopers\u002Fclient-module","4.developers\u002F9.client-module",{"title":541,"icon":542,"path":543,"stem":544,"children":545,"page":38},"Security","i-lucide-shield-check","\u002Fsecurity","5.security",[546,550,554,558],{"title":547,"path":548,"stem":549},"Reporting a vulnerability","\u002Fsecurity\u002Freporting","5.security\u002F0.reporting",{"title":551,"path":552,"stem":553},"Security testing","\u002Fsecurity\u002Ftesting","5.security\u002F1.testing",{"title":555,"path":556,"stem":557},"Hardening a production instance","\u002Fsecurity\u002Fhardening","5.security\u002F2.hardening",{"title":559,"path":560,"stem":561},"Manual testing with Kali Linux","\u002Fsecurity\u002Fmanual-testing","5.security\u002F3.manual-testing",{"title":563,"icon":564,"path":565,"stem":566,"children":567,"page":38},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","6.contributing",[568,572,576,580],{"title":569,"path":570,"stem":571},"Reading the code","\u002Fcontributing\u002Freading-the-code","6.contributing\u002F1.reading-the-code",{"title":573,"path":574,"stem":575},"Docs site","\u002Fcontributing\u002Fdocs-site","6.contributing\u002F2.docs-site",{"title":577,"path":578,"stem":579},"Releases","\u002Fcontributing\u002Freleases","6.contributing\u002F3.releases",{"title":581,"path":582,"stem":583},"Load tests","\u002Fcontributing\u002Fload-tests","6.contributing\u002F4.load-tests",{"title":585,"icon":586,"path":587,"stem":588,"children":589,"page":38},"Project","i-lucide-map","\u002Fproject","7.project",[590,594,598,602],{"title":591,"path":592,"stem":593},"Roadmap","\u002Fproject\u002Froadmap","7.project\u002F1.roadmap",{"title":595,"path":596,"stem":597},"Known issues","\u002Fproject\u002Fknown-issues","7.project\u002F2.known-issues",{"title":599,"path":600,"stem":601},"Changelog","\u002Fproject\u002Fchangelog","7.project\u002F3.changelog",{"title":603,"path":604,"stem":605},"Decisions","\u002Fproject\u002Fdecisions","7.project\u002F4.decisions",{"title":607,"path":608,"stem":609,"children":610,"icon":612},"Community","\u002Fcommunity","8.community\u002Findex",[611],{"title":607,"path":608,"stem":609},"i-lucide-users",{"id":614,"title":413,"body":615,"description":686,"extension":2301,"links":2302,"meta":2303,"navigation":1053,"path":414,"seo":2304,"stem":415,"__hash__":2305},"docs\u002F4.developers\u002F16.network.md",{"type":616,"value":617,"toc":2288},"minimark",[618,643,667,672,680,946,1010,1016,1294,1304,1458,1586,1594,1604,1666,1683,1720,1724,1734,1972,1990,1997,2009,2038,2042,2099,2105,2176,2182,2185,2284],[619,620,621,622,626,627,630,631,634,635,638,639,642],"p",{},"A module that calls another service declares the hosts in its ",[623,624,625],"code",{},"network"," capability. A trusted\nmodule calls out with ",[623,628,629],{},"moduleFetch(ctx, url, init)"," from the module SDK; an untrusted module calls ",[623,632,633],{},"fetch"," in the\nsandbox, which goes through the bridge's ",[623,636,637],{},"\u002Fegress",". Both are held to one set of rules in core\n(",[623,640,641],{},"shade\u002Fkernel\u002Foutbound.ts","), so neither can reach the server's own network: the database, Redis, the other containers\nor a cloud's metadata service.",[619,644,645,646,649,650,653,654,657,658,660,661,666],{},"A call that answers in seconds is ",[623,647,648],{},"moduleFetch",". A connection that stays open (a WebSocket, an event stream) is a trusted module's process holding ",[623,651,652],{},"ctx.connections",", under the ",[623,655,656],{},"streams"," of the same ",[623,659,625],{}," capability and the same address rules: see ",[662,663,665],"a",{"href":664},"\u002Fdevelopers\u002Fprocesses#long-lived-connections","Long-lived connections",".",[668,669,671],"h2",{"id":670},"declaring-it","Declaring it",[619,673,674,676,677,679],{},[623,675,625],{}," is a capability (see ",[662,678,389],{"href":390},"):",[681,682,687],"pre",{"className":683,"code":684,"language":685,"meta":686,"style":686},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineModule({\n  name: 'weather',\n  \u002F\u002F …\n  settings: { fields: [{ kind: 'text', name: 'hookUrl', label: 'weather.settings.hookUrl' }], secrets: ['hookUrl'] },\n  capabilities: {\n    network: {\n      hosts: ['api.weather.example', '*.tiles.weather.example'],  \u002F\u002F public names; a wildcard for trusted modules only\n      fromSettings: ['hookUrl'],                                   \u002F\u002F trusted only: the address an admin sets\n      callsPerMinute: 30                                           \u002F\u002F optional: fewer calls a minute to each host than the default\n    }\n  }\n})\n","ts","",[623,688,689,713,736,743,833,844,854,887,910,925,931,937],{"__ignoreMap":686},[690,691,694,698,701,705,709],"span",{"class":692,"line":693},"line",1,[690,695,697],{"class":696},"s7zQu","export",[690,699,700],{"class":696}," default",[690,702,704],{"class":703},"s2Zo4"," defineModule",[690,706,708],{"class":707},"sTEyZ","(",[690,710,712],{"class":711},"sMK4o","{\n",[690,714,716,720,723,726,730,733],{"class":692,"line":715},2,[690,717,719],{"class":718},"swJcz","  name",[690,721,722],{"class":711},":",[690,724,725],{"class":711}," '",[690,727,729],{"class":728},"sfazB","weather",[690,731,732],{"class":711},"'",[690,734,735],{"class":711},",\n",[690,737,739],{"class":692,"line":738},3,[690,740,742],{"class":741},"sHwdD","  \u002F\u002F …\n",[690,744,746,749,751,754,757,759,762,765,768,770,772,775,777,780,783,785,787,790,792,794,797,799,801,804,806,809,812,814,817,819,821,823,825,827,830],{"class":692,"line":745},4,[690,747,748],{"class":718},"  settings",[690,750,722],{"class":711},[690,752,753],{"class":711}," {",[690,755,756],{"class":718}," fields",[690,758,722],{"class":711},[690,760,761],{"class":707}," [",[690,763,764],{"class":711},"{",[690,766,767],{"class":718}," kind",[690,769,722],{"class":711},[690,771,725],{"class":711},[690,773,774],{"class":728},"text",[690,776,732],{"class":711},[690,778,779],{"class":711},",",[690,781,782],{"class":718}," name",[690,784,722],{"class":711},[690,786,725],{"class":711},[690,788,789],{"class":728},"hookUrl",[690,791,732],{"class":711},[690,793,779],{"class":711},[690,795,796],{"class":718}," label",[690,798,722],{"class":711},[690,800,725],{"class":711},[690,802,803],{"class":728},"weather.settings.hookUrl",[690,805,732],{"class":711},[690,807,808],{"class":711}," }",[690,810,811],{"class":707},"]",[690,813,779],{"class":711},[690,815,816],{"class":718}," secrets",[690,818,722],{"class":711},[690,820,761],{"class":707},[690,822,732],{"class":711},[690,824,789],{"class":728},[690,826,732],{"class":711},[690,828,829],{"class":707},"] ",[690,831,832],{"class":711},"},\n",[690,834,836,839,841],{"class":692,"line":835},5,[690,837,838],{"class":718},"  capabilities",[690,840,722],{"class":711},[690,842,843],{"class":711}," {\n",[690,845,847,850,852],{"class":692,"line":846},6,[690,848,849],{"class":718},"    network",[690,851,722],{"class":711},[690,853,843],{"class":711},[690,855,857,860,862,864,866,869,871,873,875,878,880,882,884],{"class":692,"line":856},7,[690,858,859],{"class":718},"      hosts",[690,861,722],{"class":711},[690,863,761],{"class":707},[690,865,732],{"class":711},[690,867,868],{"class":728},"api.weather.example",[690,870,732],{"class":711},[690,872,779],{"class":711},[690,874,725],{"class":711},[690,876,877],{"class":728},"*.tiles.weather.example",[690,879,732],{"class":711},[690,881,811],{"class":707},[690,883,779],{"class":711},[690,885,886],{"class":741},"  \u002F\u002F public names; a wildcard for trusted modules only\n",[690,888,890,893,895,897,899,901,903,905,907],{"class":692,"line":889},8,[690,891,892],{"class":718},"      fromSettings",[690,894,722],{"class":711},[690,896,761],{"class":707},[690,898,732],{"class":711},[690,900,789],{"class":728},[690,902,732],{"class":711},[690,904,811],{"class":707},[690,906,779],{"class":711},[690,908,909],{"class":741},"                                   \u002F\u002F trusted only: the address an admin sets\n",[690,911,913,916,918,922],{"class":692,"line":912},9,[690,914,915],{"class":718},"      callsPerMinute",[690,917,722],{"class":711},[690,919,921],{"class":920},"sbssI"," 30",[690,923,924],{"class":741},"                                           \u002F\u002F optional: fewer calls a minute to each host than the default\n",[690,926,928],{"class":692,"line":927},10,[690,929,930],{"class":711},"    }\n",[690,932,934],{"class":692,"line":933},11,[690,935,936],{"class":711},"  }\n",[690,938,940,943],{"class":692,"line":939},12,[690,941,942],{"class":711},"}",[690,944,945],{"class":707},")\n",[947,948,949,985,991,997,1004],"ul",{},[950,951,952,955,956,959,960,963,964,963,967,735,970,973,974,977,978,981,982,984],"li",{},[623,953,954],{},"hosts"," are public host names: never an IP address, ",[623,957,958],{},"localhost"," or a local name (",[623,961,962],{},".local",", ",[623,965,966],{},".internal",[623,968,969],{},".lan",[623,971,972],{},".home.arpa","). ",[623,975,976],{},"*.example.com"," covers every name under ",[623,979,980],{},"example.com",", not ",[623,983,980],{}," itself; only trusted modules\nmay use it.",[950,986,987,990],{},[623,988,989],{},"fromSettings"," names settings of the module's own whose current value is an address it may call: the origin of that\naddress (scheme, host and port), read again at every call. An admin who changes the setting changes where the module\nmay go, at once. Only trusted modules have it.",[950,992,993,996],{},[623,994,995],{},"callsPerMinute"," (1 to 120, optional) asks for a lower limit than the default on your calls to each host (see below). A\nhigher number is refused. It is no consent line: it only lowers what the module may do.",[950,998,999,1000,1003],{},"The consent lists each host and ",[623,1001,1002],{},"from setting \u003Cname>","; an update that adds one asks again.",[950,1005,1006,1009],{},[623,1007,1008],{},"need: 'optional'"," makes it a switch an admin turns on; until then every call is refused.",[668,1011,1013,1014],{"id":1012},"a-trusted-module-modulefetch","A trusted module: ",[623,1015,648],{},[681,1017,1019],{"className":683,"code":1018,"language":685,"meta":686,"style":686},"import { OutboundFailure, moduleFetch } from '@shadestack\u002Fmodule-sdk\u002Fserver'\n\n\u002F\u002F In a route, hook, schedule or process: the context SHADE gave the module's code.\nconst answer = await moduleFetch(ctx, 'https:\u002F\u002Fapi.weather.example\u002Fv1\u002Fnow?city=Utrecht', {\n  headers: { authorization: `Bearer ${settings.apiKey}` }\n})\nif (!answer.ok) throw new Error(`The weather service answered ${answer.status}`)\nconst now = await answer.json()\n\n\u002F\u002F POST to the address an admin set (fromSettings), without following a redirect.\nawait moduleFetch(ctx, settings.hookUrl as string, { method: 'POST', body: JSON.stringify(event), redirect: 'manual' })\n",[623,1020,1021,1049,1055,1060,1093,1130,1136,1185,1207,1211,1216],{"__ignoreMap":686},[690,1022,1023,1026,1028,1031,1033,1036,1038,1041,1043,1046],{"class":692,"line":693},[690,1024,1025],{"class":696},"import",[690,1027,753],{"class":711},[690,1029,1030],{"class":707}," OutboundFailure",[690,1032,779],{"class":711},[690,1034,1035],{"class":707}," moduleFetch",[690,1037,808],{"class":711},[690,1039,1040],{"class":696}," from",[690,1042,725],{"class":711},[690,1044,1045],{"class":728},"@shadestack\u002Fmodule-sdk\u002Fserver",[690,1047,1048],{"class":711},"'\n",[690,1050,1051],{"class":692,"line":715},[690,1052,1054],{"emptyLinePlaceholder":1053},true,"\n",[690,1056,1057],{"class":692,"line":738},[690,1058,1059],{"class":741},"\u002F\u002F In a route, hook, schedule or process: the context SHADE gave the module's code.\n",[690,1061,1062,1066,1069,1072,1075,1077,1080,1082,1084,1087,1089,1091],{"class":692,"line":745},[690,1063,1065],{"class":1064},"spNyl","const",[690,1067,1068],{"class":707}," answer ",[690,1070,1071],{"class":711},"=",[690,1073,1074],{"class":696}," await",[690,1076,1035],{"class":703},[690,1078,1079],{"class":707},"(ctx",[690,1081,779],{"class":711},[690,1083,725],{"class":711},[690,1085,1086],{"class":728},"https:\u002F\u002Fapi.weather.example\u002Fv1\u002Fnow?city=Utrecht",[690,1088,732],{"class":711},[690,1090,779],{"class":711},[690,1092,843],{"class":711},[690,1094,1095,1098,1100,1102,1105,1107,1110,1113,1116,1119,1121,1124,1127],{"class":692,"line":835},[690,1096,1097],{"class":718},"  headers",[690,1099,722],{"class":711},[690,1101,753],{"class":711},[690,1103,1104],{"class":718}," authorization",[690,1106,722],{"class":711},[690,1108,1109],{"class":711}," `",[690,1111,1112],{"class":728},"Bearer ",[690,1114,1115],{"class":711},"${",[690,1117,1118],{"class":707},"settings",[690,1120,666],{"class":711},[690,1122,1123],{"class":707},"apiKey",[690,1125,1126],{"class":711},"}`",[690,1128,1129],{"class":711}," }\n",[690,1131,1132,1134],{"class":692,"line":846},[690,1133,942],{"class":711},[690,1135,945],{"class":707},[690,1137,1138,1141,1144,1147,1150,1152,1155,1158,1161,1164,1166,1169,1172,1174,1176,1178,1181,1183],{"class":692,"line":856},[690,1139,1140],{"class":696},"if",[690,1142,1143],{"class":707}," (",[690,1145,1146],{"class":711},"!",[690,1148,1149],{"class":707},"answer",[690,1151,666],{"class":711},[690,1153,1154],{"class":707},"ok) ",[690,1156,1157],{"class":696},"throw",[690,1159,1160],{"class":711}," new",[690,1162,1163],{"class":703}," Error",[690,1165,708],{"class":707},[690,1167,1168],{"class":711},"`",[690,1170,1171],{"class":728},"The weather service answered ",[690,1173,1115],{"class":711},[690,1175,1149],{"class":707},[690,1177,666],{"class":711},[690,1179,1180],{"class":707},"status",[690,1182,1126],{"class":711},[690,1184,945],{"class":707},[690,1186,1187,1189,1192,1194,1196,1199,1201,1204],{"class":692,"line":889},[690,1188,1065],{"class":1064},[690,1190,1191],{"class":707}," now ",[690,1193,1071],{"class":711},[690,1195,1074],{"class":696},[690,1197,1198],{"class":707}," answer",[690,1200,666],{"class":711},[690,1202,1203],{"class":703},"json",[690,1205,1206],{"class":707},"()\n",[690,1208,1209],{"class":692,"line":912},[690,1210,1054],{"emptyLinePlaceholder":1053},[690,1212,1213],{"class":692,"line":927},[690,1214,1215],{"class":741},"\u002F\u002F POST to the address an admin set (fromSettings), without following a redirect.\n",[690,1217,1218,1221,1223,1225,1227,1230,1232,1235,1238,1242,1244,1246,1249,1251,1253,1256,1258,1260,1263,1265,1268,1270,1273,1276,1278,1281,1283,1285,1288,1290,1292],{"class":692,"line":933},[690,1219,1220],{"class":696},"await",[690,1222,1035],{"class":703},[690,1224,1079],{"class":707},[690,1226,779],{"class":711},[690,1228,1229],{"class":707}," settings",[690,1231,666],{"class":711},[690,1233,1234],{"class":707},"hookUrl ",[690,1236,1237],{"class":696},"as",[690,1239,1241],{"class":1240},"sBMFI"," string",[690,1243,779],{"class":711},[690,1245,753],{"class":711},[690,1247,1248],{"class":718}," method",[690,1250,722],{"class":711},[690,1252,725],{"class":711},[690,1254,1255],{"class":728},"POST",[690,1257,732],{"class":711},[690,1259,779],{"class":711},[690,1261,1262],{"class":718}," body",[690,1264,722],{"class":711},[690,1266,1267],{"class":707}," JSON",[690,1269,666],{"class":711},[690,1271,1272],{"class":703},"stringify",[690,1274,1275],{"class":707},"(event)",[690,1277,779],{"class":711},[690,1279,1280],{"class":718}," redirect",[690,1282,722],{"class":711},[690,1284,725],{"class":711},[690,1286,1287],{"class":728},"manual",[690,1289,732],{"class":711},[690,1291,808],{"class":711},[690,1293,945],{"class":707},[619,1295,1296,1297,1299,1300,1303],{},"It takes ",[623,1298,633],{},"'s arguments and gives a ",[623,1301,1302],{},"Response",". What it adds:",[1305,1306,1307,1320],"table",{},[1308,1309,1310],"thead",{},[1311,1312,1313,1317],"tr",{},[1314,1315,1316],"th",{},"Rule",[1314,1318,1319],{},"What it means",[1321,1322,1323,1335,1349,1405,1413,1439,1447],"tbody",{},[1311,1324,1325,1329],{},[1326,1327,1328],"td",{},"https only",[1326,1330,1331,1334],{},[623,1332,1333],{},"http:"," and every other scheme are refused. The one exception is below.",[1311,1336,1337,1340],{},[1326,1338,1339],{},"Declared hosts",[1326,1341,1342,1343,1345,1346,1348],{},"The host is in ",[623,1344,954],{}," (on the default port, 443), or the address has the origin of a ",[623,1347,989],{}," setting's current value.",[1311,1350,1351,1354],{},[1326,1352,1353],{},"Public addresses only",[1326,1355,1356,1357,963,1360,963,1363,1366,1367,1370,1371,1374,1375,1378,1379,1382,1383,1386,1387,1390,1391,963,1394,963,1397,1400,1401,1404],{},"The host is resolved, and every address it gives must be public: no private (",[623,1358,1359],{},"10\u002F8",[623,1361,1362],{},"172.16\u002F12",[623,1364,1365],{},"192.168\u002F16","), loopback, link-local (",[623,1368,1369],{},"169.254\u002F16",", the cloud metadata service), carrier-grade NAT (",[623,1372,1373],{},"100.64\u002F10","), \"this network\" (",[623,1376,1377],{},"0\u002F8","), multicast or reserved address, nor IPv6's loopback, unique-local (",[623,1380,1381],{},"fc00::\u002F7","), link-local, multicast, NAT64, 6to4 or Teredo ranges. An IPv6 address carrying an IPv4 one (",[623,1384,1385],{},"::ffff:127.0.0.1",", also written ",[623,1388,1389],{},"::ffff:7f00:1",") is judged by that IPv4 address. A literal address is judged the same way, in any form the URL parser accepts (",[623,1392,1393],{},"2130706433",[623,1395,1396],{},"0177.0.0.1",[623,1398,1399],{},"0x7f.1"," are all ",[623,1402,1403],{},"127.0.0.1","). One internal address among public ones refuses the call.",[1311,1406,1407,1410],{},[1326,1408,1409],{},"Pinned",[1326,1411,1412],{},"The connection goes to the address that was checked. The name is not looked up again, so a DNS answer that changes between the check and the call (DNS rebinding) can't send it inside. TLS still checks the certificate against the host's name.",[1311,1414,1415,1417],{},[1326,1416,181],{},[1326,1418,1419,1420,1422,1423,1426,1427,1430,1431,1434,1435,1438],{},"Followed by SHADE, at most five, each hop checked by the same rules. A redirect to an undeclared host, to ",[623,1421,1333],{}," or to an internal address is refused. An ",[623,1424,1425],{},"Authorization"," or ",[623,1428,1429],{},"Cookie"," header goes no further than its own origin. ",[623,1432,1433],{},"redirect: 'manual'"," returns the redirect as the answer; ",[623,1436,1437],{},"'error'"," refuses it.",[1311,1440,1441,1444],{},[1326,1442,1443],{},"10 seconds",[1326,1445,1446],{},"For the whole call: the lookup, redirects and reading the answer.",[1311,1448,1449,1452],{},[1326,1450,1451],{},"5 MB",[1326,1453,1454,1455,1457],{},"Of answer, after decompression (gzip, deflate and brotli are unpacked). The answer is read in full before ",[623,1456,648],{}," returns.",[947,1459,1460,1477,1490,1516,1540,1557,1577],{},[950,1461,1462,1466,1467,1472,1473,1476],{},[1463,1464,1465],"strong",{},"Refusals"," are FORBIDDEN, in the capability refusal's words: \"The weather module does not have the network\ncapability for ",[662,1468,1469],{"href":1469,"rel":1470},"https:\u002F\u002Fevil.example",[1471],"nofollow"," (not a declared host)\", or \"(https only)\", \"(only the default port of a\ndeclared host)\", \"(it points into the server's own network)\", \"(more than 5 redirects, or one it may not follow)\";\nin Dutch \"De module weather heeft de mogelijkheid network niet voor ",[662,1474,1469],{"href":1469,"rel":1475},[1471]," (geen opgegeven host)\". The\naddress is named by its scheme and host only: its path and query can hold a token. A module without the capability,\nor with an optional one switched off, gets the usual refusal: \"The weather module does not have the network\ncapability (not declared)\".",[950,1478,1479,1143,1482,1485,1486,1489],{},[1463,1480,1481],{},"Every refusal is counted for the module",[623,1483,1484],{},"module_refusals",", as ",[623,1487,1488],{},"capability.network",") where it happens, so the\nmodule refusal alert sees it even when the module's code catches it.",[950,1491,1492,1495,1496,1499,1500,1143,1503,963,1506,963,1509,963,1512,1515],{},[1463,1493,1494],{},"Failures are not refusals."," A timeout, an answer over 5 MB, a host that is not found or a connection that fails\nthrows an ",[623,1497,1498],{},"OutboundFailure"," with its ",[623,1501,1502],{},"reason",[623,1504,1505],{},"timeout",[623,1507,1508],{},"size",[623,1510,1511],{},"unresolved",[623,1513,1514],{},"connection","), counted nowhere.",[950,1517,1518,1521,1522,1525,1526,1528,1529,1531,1532,1535,1536,1539],{},[1463,1519,1520],{},"A host that keeps failing is not called for a while"," (a circuit breaker, decision 0018 point 13). After five or more of them in a minute, at least half of its calls (a timeout, no connection, a host not found, a 5xx answer or a 429),\nSHADE stops calling that host for your module for 30 seconds, then lets one call through to see whether it is back;\neach time it is not, the wait doubles, up to 5 minutes. A 429's ",[623,1523,1524],{},"Retry-After"," is honoured, up to 5 minutes. Meanwhile\n",[623,1527,648],{}," throws at once, without calling, an ",[623,1530,1498],{}," with reason ",[623,1533,1534],{},"open"," and ",[623,1537,1538],{},"retryAt"," (milliseconds):\n\"SHADE stopped calling api.example.com after repeated failures; it tries again at 14:32 UTC\". A 4xx answer never\ncounts, so a wrong id or key never stops your calls. Each module's breakers are its own (one per host, at most 50),\napart from core's and other modules'; the state is shared by every container of the instance.",[950,1541,1542,1545,1546,1549,1550,1554,1555,666],{},[1463,1543,1544],{},"Work that meets one waits."," A queued job or a schedule run that throws that failure (or an error with it as its\n",[623,1547,1548],{},"cause",") is not a failure: the job comes back when the breaker lets calls through again, its try not counted (for up\nto a day; after that tries count again), and the run counts as ",[1551,1552,1553],"em",{},"waited",". Nothing goes to the error log, and your\nmodule's health is not touched. A route that throws it answers 503 with ",[623,1556,1524],{},[950,1558,1559,1562,1563,1565,1566,1568,1569,1531,1571,1535,1574,1576],{},[1463,1560,1561],{},"Too many calls to one host are refused at once"," (the outbound limit, decision 0011 point 13; experimental until a\nsecond module has adopted it). Your module may make at most 120 calls a minute to each host, trusted or untrusted, and every attempt to open a connection (a socket's first and each reconnect) counts as a call;\nyou may declare fewer with ",[623,1564,995],{},", and an admin may set fewer for your module on the Modules page; the lowest\nholds and nothing raises it. A call over the limit is not sent and not queued: ",[623,1567,648],{}," throws at once an\n",[623,1570,1498],{},[623,1572,1573],{},"throttled",[623,1575,1538],{}," (milliseconds, when the minute ends), which is no refusal and\nis not counted against the module. Handle it as you would a failing host: keep the work and try again later, or leave\nit out. The count is per host with its port, never the path, and shared by every container. The breaker never sees a\nthrottled call. The Modules page shows each host's calls in the last minute and the calls refused in the last hour.",[950,1578,1579,1143,1582,1585],{},[1463,1580,1581],{},"The module is the one SHADE made the context for",[623,1583,1584],{},"moduleOfContext","): a copied context or a context the module\nmade itself is refused.",[1587,1588,1590,1591],"h3",{"id":1589},"the-site-runners-rebuild","The site runner's ",[623,1592,1593],{},"\u002Frebuild",[619,1595,1596,1597,1599,1600,1603],{},"A build hook usually is a public https address. The site runner of SHADE's own site listens on the instance's own\nnetwork, over http, at ",[623,1598,1593],{},". ",[623,1601,1602],{},"allowInternal: 'rebuild'"," lets exactly that through:",[681,1605,1607],{"className":683,"code":1606,"language":685,"meta":686,"style":686},"await moduleFetch(ctx, buildHookUrl, { method: 'POST', redirect: 'manual', allowInternal: 'rebuild' })\n",[623,1608,1609],{"__ignoreMap":686},[690,1610,1611,1613,1615,1617,1619,1622,1624,1626,1628,1630,1632,1634,1636,1638,1640,1642,1644,1646,1648,1650,1653,1655,1657,1660,1662,1664],{"class":692,"line":693},[690,1612,1220],{"class":696},[690,1614,1035],{"class":703},[690,1616,1079],{"class":707},[690,1618,779],{"class":711},[690,1620,1621],{"class":707}," buildHookUrl",[690,1623,779],{"class":711},[690,1625,753],{"class":711},[690,1627,1248],{"class":718},[690,1629,722],{"class":711},[690,1631,725],{"class":711},[690,1633,1255],{"class":728},[690,1635,732],{"class":711},[690,1637,779],{"class":711},[690,1639,1280],{"class":718},[690,1641,722],{"class":711},[690,1643,725],{"class":711},[690,1645,1287],{"class":728},[690,1647,732],{"class":711},[690,1649,779],{"class":711},[690,1651,1652],{"class":718}," allowInternal",[690,1654,722],{"class":711},[690,1656,725],{"class":711},[690,1658,1659],{"class":728},"rebuild",[690,1661,732],{"class":711},[690,1663,808],{"class":711},[690,1665,945],{"class":707},[947,1667,1668,1674,1680],{},[950,1669,1670,1671,1673],{},"only for an address from a ",[623,1672,989],{}," setting, never a declared host;",[950,1675,1676,1677,1679],{},"only when its path is exactly ",[623,1678,1593],{},";",[950,1681,1682],{},"only for the address asked for: a redirect from it is never followed into the network.",[619,1684,1685,1686,963,1689,1692,1693,1696,1697,1535,1700,1703,1704,1707,1708,1710,1711,1535,1714,1143,1717,1719],{},"Core's own webhooks (",[623,1687,1688],{},"postWebhook",[623,1690,1691],{},"shade\u002Fkernel\u002Fpost-webhook.ts",", the frontends' build hooks) go out through the same\n",[623,1694,1695],{},"guardedFetch",", with breakers of their own (owners ",[623,1698,1699],{},"webhooks",[623,1701,1702],{},"content-delivery","), and with no such exception: strictly https (",[623,1705,1706],{},"buildHookProblem",", which the frontends' form and input schema\nsave by), every address public, pinned to the address checked, and a redirect is never followed. The website module\ncalls its build hook, the site runner, through ",[623,1709,648],{}," as above, and downloads a Google font an admin imports\nfrom its two declared hosts, ",[623,1712,1713],{},"fonts.googleapis.com",[623,1715,1716],{},"fonts.gstatic.com",[662,1718,177],{"href":178},").",[1587,1721,1723],{"id":1722},"tests","Tests",[619,1725,1726,1727,1730,1731,1733],{},"A module's tests never call the internet. ",[623,1728,1729],{},"stubModuleNetwork"," from the testing entry gives ",[623,1732,648],{}," a stand-in\nresolver and connection, and returns the function that puts the real ones back:",[681,1735,1737],{"className":683,"code":1736,"language":685,"meta":686,"style":686},"import { stubModuleNetwork } from '@shadestack\u002Fmodule-sdk\u002Ftesting'\n\nconst calls: string[] = []\nconst restore = stubModuleNetwork({\n  resolve: async () => ['203.0.113.10'],                 \u002F\u002F what host names resolve to (a public test address)\n  send: async (url, request) => {                        \u002F\u002F the connection: given the checked address\n    calls.push(`${request.method} ${url.href}`)\n    return new Response('{\"ok\":true}', { headers: { 'content-type': 'application\u002Fjson' } })\n  }\n})\n\u002F\u002F … the test …\nrestore()\n",[623,1738,1739,1759,1763,1782,1797,1829,1859,1898,1950,1954,1960,1965],{"__ignoreMap":686},[690,1740,1741,1743,1745,1748,1750,1752,1754,1757],{"class":692,"line":693},[690,1742,1025],{"class":696},[690,1744,753],{"class":711},[690,1746,1747],{"class":707}," stubModuleNetwork",[690,1749,808],{"class":711},[690,1751,1040],{"class":696},[690,1753,725],{"class":711},[690,1755,1756],{"class":728},"@shadestack\u002Fmodule-sdk\u002Ftesting",[690,1758,1048],{"class":711},[690,1760,1761],{"class":692,"line":715},[690,1762,1054],{"emptyLinePlaceholder":1053},[690,1764,1765,1767,1770,1772,1774,1777,1779],{"class":692,"line":738},[690,1766,1065],{"class":1064},[690,1768,1769],{"class":707}," calls",[690,1771,722],{"class":711},[690,1773,1241],{"class":1240},[690,1775,1776],{"class":707},"[] ",[690,1778,1071],{"class":711},[690,1780,1781],{"class":707}," []\n",[690,1783,1784,1786,1789,1791,1793,1795],{"class":692,"line":745},[690,1785,1065],{"class":1064},[690,1787,1788],{"class":707}," restore ",[690,1790,1071],{"class":711},[690,1792,1747],{"class":703},[690,1794,708],{"class":707},[690,1796,712],{"class":711},[690,1798,1799,1802,1804,1807,1810,1813,1815,1817,1820,1822,1824,1826],{"class":692,"line":835},[690,1800,1801],{"class":703},"  resolve",[690,1803,722],{"class":711},[690,1805,1806],{"class":1064}," async",[690,1808,1809],{"class":711}," ()",[690,1811,1812],{"class":1064}," =>",[690,1814,761],{"class":707},[690,1816,732],{"class":711},[690,1818,1819],{"class":728},"203.0.113.10",[690,1821,732],{"class":711},[690,1823,811],{"class":707},[690,1825,779],{"class":711},[690,1827,1828],{"class":741},"                 \u002F\u002F what host names resolve to (a public test address)\n",[690,1830,1831,1834,1836,1838,1840,1844,1846,1849,1852,1854,1856],{"class":692,"line":846},[690,1832,1833],{"class":703},"  send",[690,1835,722],{"class":711},[690,1837,1806],{"class":1064},[690,1839,1143],{"class":711},[690,1841,1843],{"class":1842},"sHdIc","url",[690,1845,779],{"class":711},[690,1847,1848],{"class":1842}," request",[690,1850,1851],{"class":711},")",[690,1853,1812],{"class":1064},[690,1855,753],{"class":711},[690,1857,1858],{"class":741},"                        \u002F\u002F the connection: given the checked address\n",[690,1860,1861,1864,1866,1869,1871,1874,1877,1879,1882,1884,1887,1889,1891,1894,1896],{"class":692,"line":856},[690,1862,1863],{"class":707},"    calls",[690,1865,666],{"class":711},[690,1867,1868],{"class":703},"push",[690,1870,708],{"class":718},[690,1872,1873],{"class":711},"`${",[690,1875,1876],{"class":707},"request",[690,1878,666],{"class":711},[690,1880,1881],{"class":707},"method",[690,1883,942],{"class":711},[690,1885,1886],{"class":711}," ${",[690,1888,1843],{"class":707},[690,1890,666],{"class":711},[690,1892,1893],{"class":707},"href",[690,1895,1126],{"class":711},[690,1897,945],{"class":718},[690,1899,1900,1903,1905,1908,1910,1912,1915,1917,1919,1921,1924,1926,1928,1930,1933,1935,1937,1939,1942,1944,1946,1948],{"class":692,"line":889},[690,1901,1902],{"class":696},"    return",[690,1904,1160],{"class":711},[690,1906,1907],{"class":703}," Response",[690,1909,708],{"class":718},[690,1911,732],{"class":711},[690,1913,1914],{"class":728},"{\"ok\":true}",[690,1916,732],{"class":711},[690,1918,779],{"class":711},[690,1920,753],{"class":711},[690,1922,1923],{"class":718}," headers",[690,1925,722],{"class":711},[690,1927,753],{"class":711},[690,1929,725],{"class":711},[690,1931,1932],{"class":718},"content-type",[690,1934,732],{"class":711},[690,1936,722],{"class":711},[690,1938,725],{"class":711},[690,1940,1941],{"class":728},"application\u002Fjson",[690,1943,732],{"class":711},[690,1945,808],{"class":711},[690,1947,808],{"class":711},[690,1949,945],{"class":718},[690,1951,1952],{"class":692,"line":912},[690,1953,936],{"class":711},[690,1955,1956,1958],{"class":692,"line":927},[690,1957,942],{"class":711},[690,1959,945],{"class":707},[690,1961,1962],{"class":692,"line":933},[690,1963,1964],{"class":741},"\u002F\u002F … the test …\n",[690,1966,1967,1970],{"class":692,"line":939},[690,1968,1969],{"class":703},"restore",[690,1971,1206],{"class":707},[619,1973,1974,1975,1978,1979,1982,1983,1986,1987,666],{},"The rules still run: a host the module doesn't declare, or a resolver answering ",[623,1976,1977],{},"10.0.0.5",", is refused as on an\ninstance. To test against a local https server instead, give ",[623,1980,1981],{},"dial"," (where a checked address really connects) and ",[623,1984,1985],{},"ca","\n(the server's certificate) in place of ",[623,1988,1989],{},"send",[668,1991,1993,1994,1996],{"id":1992},"an-untrusted-module-fetch-in-the-sandbox","An untrusted module: ",[623,1995,633],{}," in the sandbox",[619,1998,1999,2000,2002,2003,2005,2006,2008],{},"The sandbox's ",[623,2001,633],{}," reaches nothing directly: the gate sends it to the bridge's ",[623,2004,637],{},", which calls out under the\nsame rules as ",[623,2007,648],{},", with the narrower policy untrusted modules have:",[947,2010,2011,2020,2023,2026,2029,2032],{},[950,2012,2013,2014,2016,2017,2019],{},"only the exact names in ",[623,2015,954],{},", over https, on the default port; no wildcards, no ",[623,2018,989],{},", no exceptions;",[950,2021,2022],{},"every address the name resolves to public, and the connection pinned to the one checked;",[950,2024,2025],{},"redirects followed by the bridge, at most five, each hop checked; the module sees the final answer;",[950,2027,2028],{},"at most 10 seconds and 5 MB;",[950,2030,2031],{},"a refusal is a 403 with the same words, counted for the module;",[950,2033,2034,2035,2037],{},"the same limit of calls a minute to each host: over it, a 429 with ",[623,2036,1524],{},", no refusal counted.",[668,2039,2041],{"id":2040},"what-is-enforced-and-what-is-a-convention","What is enforced, and what is a convention",[1305,2043,2044,2056],{},[1308,2045,2046],{},[1311,2047,2048,2050,2053],{},[1314,2049],{},[1314,2051,2052],{},"Untrusted module",[1314,2054,2055],{},"Trusted module",[1321,2057,2058,2074],{},[1311,2059,2060,2068,2071],{},[1326,2061,2062,2063,2065,2066,1851],{},"Calls through SHADE (",[623,2064,633],{}," in the sandbox, ",[623,2067,648],{},[1326,2069,2070],{},"Enforced: there is no other way out of the sandbox.",[1326,2072,2073],{},"Enforced, on every call.",[1311,2075,2076,2090,2093],{},[1326,2077,2078,2079,963,2081,963,2084,963,2087,1851],{},"Calls past SHADE (Node's ",[623,2080,633],{},[623,2082,2083],{},"node:https",[623,2085,2086],{},"node:net",[623,2088,2089],{},"undici",[1326,2091,2092],{},"Impossible: the sandbox has none.",[1326,2094,2095,2098],{},[1463,2096,2097],{},"Not stopped."," A trusted module runs inside the API's process and can do anything it can.",[619,2100,2101,2102,2104],{},"So for a trusted module, ",[623,2103,648],{}," is the documented and required way, and the rest is made visible rather than\nblocked:",[947,2106,2107,2145,2170],{},[950,2108,2109,2112,2113,2115,2116,963,2119,735,2121,963,2124,963,2126,963,2129,1426,2132,2134,2135,2138,2139,2141,2142,2144],{},[623,2110,2111],{},"shade-module build"," warns when the module's own code calls the global ",[623,2114,633],{}," or imports ",[623,2117,2118],{},"node:http",[623,2120,2083],{},[623,2122,2123],{},"node:http2",[623,2125,2086],{},[623,2127,2128],{},"node:tls",[623,2130,2131],{},"node:dgram",[623,2133,2089],{},". With ",[623,2136,2137],{},"--release",", which the release job of the official\ncatalogue uses, the same calls refuse the build instead. A function that is only named ",[623,2140,633],{}," counts as the global one,\nso a function that sends the request through ",[623,2143,648],{}," is better called something else.",[950,2146,2147,2148,2150,2151,1535,2154,2157,2158,963,2161,963,2164,963,2167,1719],{},"The approval checks show an admin how often a server package calls the global ",[623,2149,633],{}," (its dependencies included),\nand flag ",[623,2152,2153],{},"tls",[623,2155,2156],{},"http2"," with the other risky imports (",[623,2159,2160],{},"net",[623,2162,2163],{},"http",[623,2165,2166],{},"https",[623,2168,2169],{},"dgram",[950,2171,2172,2173,2175],{},"The defence against trusted code that sets out to call around ",[623,2174,648],{}," is who may sign or approve it, and the\nreview before.",[619,2177,2178,2179,2181],{},"The official modules call out only through ",[623,2180,648],{},"; core's own calls (email, its build hook) are\ncore's, not a module's.",[668,2183,2184],{"id":623},"Code",[947,2186,2187,2207,2232,2248,2257,2267],{},[950,2188,2189,2191,2192,2195,2196,735,2199,2201,2202,1535,2204,2206],{},[623,2190,641],{},": ",[623,2193,2194],{},"guardedFetch(url, init, policy, options)",", the rules; ",[623,2197,2198],{},"OutboundRefusal",[623,2200,1498],{},"; the connection over ",[623,2203,2118],{},[623,2205,2083],{}," to the checked address.",[950,2208,2209,2191,2212,2215,2216,2219,2220,2223,2224,2227,2228,2231],{},[623,2210,2211],{},"shade\u002Fkernel\u002Finternal-networks.ts",[623,2213,2214],{},"isInternalAddress(ip)",", every address that is not the public internet\n(",[623,2217,2218],{},"INTERNAL_NETWORKS"," beside it stays the list of our own proxies, which Better Auth's ",[623,2221,2222],{},"trustedProxies"," and the rate\nlimits' ",[623,2225,2226],{},"clientIp"," both read, through ",[623,2229,2230],{},"isOwnNetwork(ip)"," for the latter).",[950,2233,2234,2191,2237,963,2239,2242,2243,963,2246,666],{},[623,2235,2236],{},"shade\u002Ffeatures\u002Fpackages\u002Fserver\u002Fnetwork.ts",[623,2238,648],{},[623,2240,2241],{},"networkVerdict"," (a module's policy),\n",[623,2244,2245],{},"isDeclaredHost",[623,2247,1729],{},[950,2249,2250,2191,2253,2256],{},[623,2251,2252],{},"shade\u002Fkernel\u002Fmodules\u002Fcapabilities.ts",[623,2254,2255],{},"networkRefusal(plugin, target, why)",", the refusal's words.",[950,2258,2259,2191,2262,1535,2264,666],{},[623,2260,2261],{},"apps\u002Fapi\u002Fsrc\u002Fsandbox\u002Fbridge.ts",[623,2263,637],{},[623,2265,2266],{},"egressVerdict",[950,2268,2269,2270,2273,2274,2277,2278,963,2281,666],{},"Tests: ",[623,2271,2272],{},"shade\u002Ftest\u002Fkernel\u002Foutbound.test.ts"," (a local https server with a test certificate for ",[623,2275,2276],{},"*.example.test","),\n",[623,2279,2280],{},"shade\u002Ftest\u002Ffeatures\u002Fpackages\u002Fserver\u002Fnetwork.test.ts",[623,2282,2283],{},"apps\u002Fapi\u002Ftest\u002Fsandbox\u002Fbridge.test.ts",[2285,2286,2287],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}",{"title":686,"searchDepth":715,"depth":715,"links":2289},[2290,2291,2297,2299,2300],{"id":670,"depth":715,"text":671},{"id":1012,"depth":715,"text":2292,"children":2293},"A trusted module: moduleFetch",[2294,2296],{"id":1589,"depth":738,"text":2295},"The site runner's \u002Frebuild",{"id":1722,"depth":738,"text":1723},{"id":1992,"depth":715,"text":2298},"An untrusted module: fetch in the sandbox",{"id":2040,"depth":715,"text":2041},{"id":623,"depth":715,"text":2184},"md",null,{},{"title":413,"description":686},"GGircXQH2NZqxEqJcRaCwYXlxy1qXZANu-E-hpAxb6k",[2307,2308],{"title":409,"path":410,"stem":411,"description":686,"children":-1},{"title":417,"path":418,"stem":419,"description":686,"children":-1},1796500154830]