{"record":{"id":"c3254a6b45e1d2ac","repo":"HelloZeroNet/ZeroNet","slug":"this-site-has-no-permission-to-access-site-s","errorCode":null,"errorMessage":"This site has no permission to access site %s","messagePattern":"This site has no permission to access site (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugins/Cors/CorsPlugin.py","lineNumber":25,"sourceCode":"from Plugin import PluginManager\nfrom Translate import Translate\n\n\nplugin_dir = os.path.dirname(__file__)\n\nif \"_\" not in locals():\n    _ = Translate(plugin_dir + \"/languages/\")\n\n\ndef getCorsPath(site, inner_path):\n    match = re.match(\"^cors-([A-Za-z0-9]{26,35})/(.*)\", inner_path)\n    if not match:\n        raise Exception(\"Invalid cors path: %s\" % inner_path)\n    cors_address = match.group(1)\n    cors_inner_path = match.group(2)\n\n    if not \"Cors:%s\" % cors_address in site.settings[\"permissions\"]:\n        raise Exception(\"This site has no permission to access site %s\" % cors_address)\n\n    return cors_address, cors_inner_path\n\n\n@PluginManager.registerTo(\"UiWebsocket\")\nclass UiWebsocketPlugin(object):\n    def hasSitePermission(self, address, cmd=None):\n        if super(UiWebsocketPlugin, self).hasSitePermission(address, cmd=cmd):\n            return True\n\n        allowed_commands = [\n            \"fileGet\", \"fileList\", \"dirList\", \"fileRules\", \"optionalFileInfo\",\n            \"fileQuery\", \"dbQuery\", \"userGetSettings\", \"siteInfo\"\n        ]\n        if not \"Cors:%s\" % address in self.site.settings[\"permissions\"] or cmd not in allowed_commands:\n            return False\n        else:\n            return True","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/HelloZeroNet/ZeroNet/blob/454c0b2e7e000fda7000cba49027541fbf327b96/plugins/Cors/CorsPlugin.py#L7-L43","documentation":"Permission guard in getCorsPath: the parsed cors address exists syntactically, but 'Cors:<address>' is absent from site.settings['permissions'], meaning the user never granted the current site access to the target site. It fires on unauthorized cross-site resource requests.","triggerScenarios":"Thrown at plugins/Cors/CorsPlugin.py:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the site request the permission via the standard permission prompt (cert_select/ui) so 'Cors:<address>' is added to settings['permissions']","Catch the exception and inform the user which site needs permission granted","Check site.settings['permissions'] before issuing the cors request to avoid the error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"454c0b2e7e000fda7000cba49027541fbf327b96","analyzedAt":"2026-09-02T19:46:57.278Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}