[{"data":1,"prerenderedAt":959,"buildId":960},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fsecurity":3},{"id":4,"title":5,"body":6,"description":941,"extension":942,"frontmatter":943,"heading":948,"meta":950,"navigation":952,"order":946,"path":953,"seo":954,"sitemap":955,"source":956,"stem":957,"__hash__":958},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fsecurity.md","Security - Which files and hosts Kubb may read",{"type":7,"value":8,"toc":928},"minimark",[9,37,200,203,223,234,239,245,318,322,336,414,439,443,452,557,564,567,574,686,689,695,709,713,716,820,823,830,847,851,911],[10,11,12,13,17,18,25,26,29,30,36],"p",{},"A spec can point at other files and URLs with ",[14,15,16],"code",{},"$ref",". The ",[19,20,22],"a",{"href":21},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#security",[14,23,24],{},"security"," option in ",[14,27,28],{},"kubb.config.ts"," sets which local files and hosts Kubb reads for them. A file or host the rules refuse fails the run with ",[19,31,33],{"href":32},"\u002Fdocs\u002F5.x\u002Freference\u002Fdiagnostics#kubb-access-refused",[14,34,35],{},"KUBB_ACCESS_REFUSED",".",[38,39,43],"pre",{"language":40,"filename":28,"code":41,"class":42},"ts","import { defineConfig } from 'kubb\u002Fconfig'\n\nexport default defineConfig({\n security: {\n read: { allow: ['..\u002Fshared-schemas'], deny: ['fixtures\u002Fprivate\u002F**'] },\n net: { allow: ['specs.corp.internal'], deny: ['*.example.org'] },\n },\n})","highlights",[14,44,46,73,74,73,76,73,91,73,104,73,149,73,186,73,195],{"class":45},"language-ts",[47,48,51,55,59,63,66,69],"span",{"class":49,"style":50},"line","display: inline",[47,52,54],{"style":53},"color:#d73a49;--hls-dark:#f97583","import ",[47,56,58],{"style":57},"color:#005cc5;--hls-dark:#79b8ff","{ ",[47,60,62],{"style":61},"color:#24292e;--hls-dark:#e1e4e8","defineConfig ",[47,64,65],{"style":57},"} ",[47,67,68],{"style":53},"from ",[47,70,72],{"style":71},"color:#032f62;--hls-dark:#9ecbff","'kubb\u002Fconfig'","\n",[47,75],{"class":49,"style":50},[47,77,78,81,84,88],{"class":49,"style":50},[47,79,80],{"style":53},"export ",[47,82,83],{"style":53},"default ",[47,85,87],{"style":86},"color:#6f42c1;--hls-dark:#b392f0","defineConfig",[47,89,90],{"style":57},"({",[47,92,93,96,98,101],{"class":49,"style":50},[47,94,95],{"style":57}," ",[47,97,24],{"style":57},[47,99,100],{"style":53},": ",[47,102,103],{"style":57},"{",[47,105,106,109,112,114,116,119,121,124,127,130,133,136,138,140,143,146],{"class":49,"style":50},[47,107,108],{"style":57}," ",[47,110,111],{"style":57},"read",[47,113,100],{"style":53},[47,115,58],{"style":57},[47,117,118],{"style":57},"allow",[47,120,100],{"style":53},[47,122,123],{"style":57},"[",[47,125,126],{"style":71},"'..\u002Fshared-schemas'",[47,128,129],{"style":57},"]",[47,131,132],{"style":53},", ",[47,134,135],{"style":57},"deny",[47,137,100],{"style":53},[47,139,123],{"style":57},[47,141,142],{"style":71},"'fixtures\u002Fprivate\u002F**'",[47,144,145],{"style":57},"] }",[47,147,148],{"style":53},",",[47,150,151,153,156,158,160,162,164,166,169,171,173,175,177,179,182,184],{"class":49,"style":50},[47,152,108],{"style":53},[47,154,155],{"style":57},"net",[47,157,100],{"style":53},[47,159,58],{"style":57},[47,161,118],{"style":57},[47,163,100],{"style":53},[47,165,123],{"style":57},[47,167,168],{"style":71},"'specs.corp.internal'",[47,170,129],{"style":57},[47,172,132],{"style":53},[47,174,135],{"style":57},[47,176,100],{"style":53},[47,178,123],{"style":57},[47,180,181],{"style":71},"'*.example.org'",[47,183,145],{"style":57},[47,185,148],{"style":53},[47,187,188,190,193],{"class":49,"style":50},[47,189,95],{"style":53},[47,191,192],{"style":57},"}",[47,194,148],{"style":53},[47,196,197],{"class":49,"style":50},[47,198,199],{"style":57},"})",[10,201,202],{},"The same rules apply wherever Kubb runs: on your machine, on a CI runner, in the MCP server, and on a Kubb Studio agent.",[10,204,205,206,132,208,132,211,214,215,218,219,36],{},"Without ",[14,207,24],{},[14,209,210],{},"kubb generate",[14,212,213],{},"kubb validate",", and ",[14,216,217],{},"unplugin-kubb"," read every file and host. The MCP server and a Kubb Studio agent always apply the ",[19,220,222],{"href":221},"#built-in","built-in rules",[10,224,225,229,230,36],{},[19,226,228],{"href":227},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes#security","Limit what a spec may read"," has a config for each common case. What Kubb Studio may do on your machine, such as writing files, is a separate topic: see ",[19,231,233],{"href":232},"\u002Fdocs\u002F5.x\u002Freference\u002Fpermissions","Permissions",[235,236,238],"h2",{"id":237},"built-in","The built-in rules",[10,240,241,242,244],{},"Once ",[14,243,24],{}," is set, Kubb starts from these rules and adds yours:",[246,247,248,261],"table",{},[249,250,251],"thead",{},[252,253,254,258],"tr",{},[255,256,257],"th",{},"Part",[255,259,260],{},"Built-in rule",[262,263,264,280,291,310],"tbody",{},[252,265,266,270],{},[267,268,269],"td",{},"Files",[267,271,272,273,276,277],{},"Inside the project ",[14,274,275],{},"root",", and in the folder of a file ",[14,278,279],{},"input",[252,281,282,285],{},[267,283,284],{},"Secret files",[267,286,287],{},[19,288,290],{"href":289},"#secret-files","Always refused",[252,292,293,296],{},[267,294,295],{},"File endings",[267,297,298,132,301,132,304,132,307],{},[14,299,300],{},".json",[14,302,303],{},".yaml",[14,305,306],{},".yml",[14,308,309],{},".md",[252,311,312,315],{},[267,313,314],{},"Hosts",[267,316,317],{},"Public hosts only",[235,319,320],{"id":111},[14,321,111],{},[10,323,324,325,327,328,331,332,335],{},"Which local files a ",[14,326,16],{}," may read. ",[14,329,330],{},"false"," reads none, and ",[14,333,334],{},"true"," reads any folder and skips the file ending check.",[246,337,338,351],{},[249,339,340],{},[252,341,342,345,348],{},[255,343,344],{},"Setting",[255,346,347],{},"Default",[255,349,350],{},"What it does",[262,352,353,374,391],{},[252,354,355,360,365],{},[267,356,357],{},[14,358,359],{},"read.allow",[267,361,362],{},[14,363,364],{},"['.']",[267,366,367,368,370,371,373],{},"Folders or globs a ",[14,369,16],{}," file must be inside, relative to ",[14,372,275],{},". Yours add to the project folder",[252,375,376,381,385],{},[267,377,378],{},[14,379,380],{},"read.deny",[267,382,383],{},[19,384,284],{"href":289},[267,386,387,388,390],{},"Globs that are refused inside ",[14,389,118],{}," too. Yours add to the secret list",[252,392,393,398,408],{},[267,394,395],{},[14,396,397],{},"read.extensions",[267,399,400,132,402,132,404,132,406],{},[14,401,300],{},[14,403,303],{},[14,405,306],{},[14,407,309],{},[267,409,410,411,413],{},"Endings a ",[14,412,16],{}," file must have. Yours add to the list",[10,415,416,417,132,420,132,423,426,427,430,431,434,435,438],{},"A glob takes ",[14,418,419],{},"*",[14,421,422],{},"**",[14,424,425],{},"?",", and one ",[14,428,429],{},"{a,b}"," group. It has no ",[14,432,433],{},"[abc]"," class and no ",[14,436,437],{},"!"," negation, and it matches upper and lower case as written. A pattern without a slash matches the file name in any folder.",[235,440,441],{"id":155},[14,442,155],{},[10,444,445,446,448,449,451],{},"Which hosts Kubb may request. ",[14,447,330],{}," reaches none, and ",[14,450,334],{}," reaches any host.",[246,453,454,464],{},[249,455,456],{},[252,457,458,460,462],{},[255,459,344],{},[255,461,347],{},[255,463,350],{},[262,465,466,485,510,524,542],{},[252,467,468,473,477],{},[267,469,470],{},[14,471,472],{},"net.public",[267,474,475],{},[14,476,334],{},[267,478,479,480,482,483],{},"Allows every host whose addresses are all public. Set ",[14,481,330],{}," to reach only the hosts in ",[14,484,118],{},[252,486,487,492,497],{},[267,488,489],{},[14,490,491],{},"net.allow",[267,493,494],{},[14,495,496],{},"[]",[267,498,499,500,132,503,132,506,509],{},"Hosts that are always allowed, private ones too: ",[14,501,502],{},"host",[14,504,505],{},"*.host",[14,507,508],{},"host:port",", or an IP address",[252,511,512,517,521],{},[267,513,514],{},[14,515,516],{},"net.deny",[267,518,519],{},[14,520,496],{},[267,522,523],{},"Hosts that are always refused. A deny wins over an allow",[252,525,526,531,535],{},[267,527,528],{},[14,529,530],{},"net.proxy",[267,532,533],{},[14,534,330],{},[267,536,537,538],{},"Sends requests through HTTP_PROXY or HTTPS_PROXY. See ",[19,539,541],{"href":540},"#proxy","Proxy",[252,543,544,549,554],{},[267,545,546],{},[14,547,548],{},"net.transport",[267,550,551],{},[14,552,553],{},"nodeTransport",[267,555,556],{},"The code that opens the connection",[10,558,559,560,563],{},"A host is not public when it is ",[14,561,562],{},"localhost",", a private network address, or a cloud metadata address. A redirect to such a host is refused too.",[235,565,284],{"id":566},"secret-files",[10,568,569,570,573],{},"Kubb refuses these files always, and ",[14,571,572],{},"read: true"," does not change that:",[575,576,577,587,611,628,642,650,661],"ul",{},[578,579,580,583,584],"li",{},[14,581,582],{},".env"," and ",[14,585,586],{},".env.*",[578,588,589,590,132,593,132,596,132,599,132,602,132,605,132,608],{},"Key and certificate files: ",[14,591,592],{},"*.crt",[14,594,595],{},"*.pem",[14,597,598],{},"*.key",[14,600,601],{},"*.p12",[14,603,604],{},"*.pfx",[14,606,607],{},"*.cer",[14,609,610],{},"*.der",[578,612,613,132,616,132,619,132,622,132,625],{},[14,614,615],{},".npmrc",[14,617,618],{},".netrc",[14,620,621],{},"auth.json",[14,623,624],{},"token.json",[14,626,627],{},"kubeconfig*",[578,629,630,132,633,132,636,132,639],{},[14,631,632],{},"credentials*.json",[14,634,635],{},"credentials*.yaml",[14,637,638],{},"credentials*.yml",[14,640,641],{},"service-account*.json",[578,643,644,583,647],{},[14,645,646],{},"secret.*",[14,648,649],{},"secrets.*",[578,651,652,132,655,214,658],{},[14,653,654],{},"*.tfstate",[14,656,657],{},"*.tfvars",[14,659,660],{},"*.tfvars.json",[578,662,663,664,132,667,132,670,132,673,132,676,132,679,682,683],{},"Anything under ",[14,665,666],{},".git",[14,668,669],{},".ssh",[14,671,672],{},".aws",[14,674,675],{},".kube",[14,677,678],{},".gnupg",[14,680,681],{},".docker",", or ",[14,684,685],{},".kubb",[235,687,688],{"id":279},"The input",[10,690,691,692,694],{},"The ",[14,693,279],{}," your config names is always read.",[575,696,697,700,703],{},[578,698,699],{},"The folder of a file input is readable.",[578,701,702],{},"Every URL on the origin of a URL input is allowed.",[578,704,705,706,708],{},"The host of a git input is allowed. A git repository on a host the ",[14,707,155],{}," rules refuse is not fetched.",[235,710,712],{"id":711},"environments","Different rules per environment",[10,714,715],{},"The config is TypeScript, so read the environment when one place needs another rule:",[38,717,719],{"language":40,"filename":28,"code":718,"class":42},"import { defineConfig } from 'kubb\u002Fconfig'\n\nexport default defineConfig({\n security: {\n \u002F\u002F No network on a CI runner.\n net: process.env.CI ? false : { allow: ['specs.corp.internal'] },\n },\n})",[14,720,721,73,735,73,737,73,747,73,757,73,765,73,808,73,816],{"class":45},[47,722,723,725,727,729,731,733],{"class":49,"style":50},[47,724,54],{"style":53},[47,726,58],{"style":57},[47,728,62],{"style":61},[47,730,65],{"style":57},[47,732,68],{"style":53},[47,734,72],{"style":71},[47,736],{"class":49,"style":50},[47,738,739,741,743,745],{"class":49,"style":50},[47,740,80],{"style":53},[47,742,83],{"style":53},[47,744,87],{"style":86},[47,746,90],{"style":57},[47,748,749,751,753,755],{"class":49,"style":50},[47,750,95],{"style":57},[47,752,24],{"style":57},[47,754,100],{"style":53},[47,756,103],{"style":57},[47,758,759,761],{"class":49,"style":50},[47,760,108],{"style":57},[47,762,764],{"style":763},"color:#6a737d;--hls-dark:#6a737d","\u002F\u002F No network on a CI runner.",[47,766,767,769,771,773,776,778,781,783,786,789,792,794,796,798,800,802,804,806],{"class":49,"style":50},[47,768,108],{"style":763},[47,770,155],{"style":57},[47,772,100],{"style":53},[47,774,775],{"style":61},"process",[47,777,36],{"style":53},[47,779,780],{"style":57},"env",[47,782,36],{"style":53},[47,784,785],{"style":57},"CI ",[47,787,788],{"style":53},"? ",[47,790,791],{"style":57},"false ",[47,793,100],{"style":53},[47,795,58],{"style":57},[47,797,118],{"style":57},[47,799,100],{"style":53},[47,801,123],{"style":57},[47,803,168],{"style":71},[47,805,145],{"style":57},[47,807,148],{"style":53},[47,809,810,812,814],{"class":49,"style":50},[47,811,95],{"style":53},[47,813,192],{"style":57},[47,815,148],{"style":53},[47,817,818],{"class":49,"style":50},[47,819,199],{"style":57},[235,821,541],{"id":822},"proxy",[10,824,825,826,829],{},"With ",[14,827,828],{},"net.proxy: true",", requests go through HTTP_PROXY or HTTPS_PROXY. Kubb then checks the hostname only, because the proxy makes the connection.",[10,831,832,833,132,835,132,838,682,840,842,843,846],{},"A host on NO_PROXY gets a direct connection, with the address check. An entry is ",[14,834,502],{},[14,836,837],{},".host",[14,839,508],{},[14,841,419],{},". An address range such as ",[14,844,845],{},"10.0.0.0\u002F8"," is not matched.",[235,848,850],{"id":849},"studio-and-mcp","Kubb Studio and the MCP server",[246,852,853,869],{},[249,854,855],{},[252,856,857,860,863],{},[255,858,859],{},"Run",[255,861,862],{},"Files it reads",[255,864,865,866,868],{},"What your ",[14,867,24],{}," can do",[262,870,871,881,890,901],{},[252,872,873,876,878],{},[267,874,875],{},"A Kubb Studio agent you host",[267,877,238],{},[267,879,880],{},"Open and close",[252,882,883,886,888],{},[267,884,885],{},"The MCP server",[267,887,238],{},[267,889,880],{},[252,891,892,895,898],{},[267,893,894],{},"A shared Kubb Studio agent",[267,896,897],{},"None",[267,899,900],{},"Only close",[252,902,903,906,909],{},[267,904,905],{},"A hosted Kubb Studio agent",[267,907,908],{},"Only the repository of a git input",[267,910,900],{},[575,912,913],{},[578,914,915,916,214,918,921,922,924,925,927],{},"\"Only close\" means a deny list, ",[14,917,330],{},[14,919,920],{},"net.public: false"," apply. An ",[14,923,118],{}," list and ",[14,926,334],{}," do not.",{"title":929,"searchDepth":930,"depth":930,"links":931},"",5,[932,934,935,936,937,938,939,940],{"id":237,"depth":933,"text":238},2,{"id":111,"depth":933,"text":111},{"id":155,"depth":933,"text":155},{"id":566,"depth":933,"text":284},{"id":279,"depth":933,"text":688},{"id":711,"depth":933,"text":712},{"id":822,"depth":933,"text":541},{"id":849,"depth":933,"text":850},"Reference for the security option in kubb.config.ts. The read and net rules, the files Kubb always refuses, the trusted input, the proxy, and what a Kubb Studio agent and the MCP server allow.","md",{"layout":944,"title":5,"description":941,"outline":945,"order":946,"navigation":947},"doc",[933,946],3,{"title":948,"icon":949},"Security","i-iconoir-shield-check",{"layout":944,"outline":951},[933,946],{"title":948,"icon":949},"\u002Fdocs\u002F5.x\u002Freference\u002Fsecurity",{"title":5,"description":941},{"loc":953},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fsecurity.md","docs\u002F5.x\u002Freference\u002Fsecurity","V0m85PL_8LfZuYewXVS3lfmn_RkpH8oYcVyh9qYW7ew",1795989034447,"2e8b4c62-5b8c-4587-97c0-530d08a9bd53"]