HelloZeroNet/ZeroNet · error · Exception

This site has no permission to access site %s

Error message

This site has no permission to access site %s

What it means

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.

Source

Thrown at plugins/Cors/CorsPlugin.py:25

from Plugin import PluginManager
from Translate import Translate


plugin_dir = os.path.dirname(__file__)

if "_" not in locals():
    _ = Translate(plugin_dir + "/languages/")


def getCorsPath(site, inner_path):
    match = re.match("^cors-([A-Za-z0-9]{26,35})/(.*)", inner_path)
    if not match:
        raise Exception("Invalid cors path: %s" % inner_path)
    cors_address = match.group(1)
    cors_inner_path = match.group(2)

    if not "Cors:%s" % cors_address in site.settings["permissions"]:
        raise Exception("This site has no permission to access site %s" % cors_address)

    return cors_address, cors_inner_path


@PluginManager.registerTo("UiWebsocket")
class UiWebsocketPlugin(object):
    def hasSitePermission(self, address, cmd=None):
        if super(UiWebsocketPlugin, self).hasSitePermission(address, cmd=cmd):
            return True

        allowed_commands = [
            "fileGet", "fileList", "dirList", "fileRules", "optionalFileInfo",
            "fileQuery", "dbQuery", "userGetSettings", "siteInfo"
        ]
        if not "Cors:%s" % address in self.site.settings["permissions"] or cmd not in allowed_commands:
            return False
        else:
            return True

View on GitHub (pinned to 454c0b2e7e)

Solutions

  1. Have the site request the permission via the standard permission prompt (cert_select/ui) so 'Cors:<address>' is added to settings['permissions']
  2. Catch the exception and inform the user which site needs permission granted
  3. Check site.settings['permissions'] before issuing the cors request to avoid the error
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugins/Cors/CorsPlugin.py:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HelloZeroNet/ZeroNet@454c0b2e7e (2026-09-02). Data as JSON: /api/errors/c3254a6b45e1d2ac. Report an issue: GitHub.