# SPDX-License-Identifier: GPL-3.0-or-later """Closed public-app link policy shared by both publication checkers. An organization name is not proof of repository visibility. This inventory records the specific external app repository reviewed for public references. No network lookup or permission change occurs during publication checks. """ import re from urllib.parse import unquote, urlsplit PUBLIC_HOST = 'vccplus-git.brianholman.com' APPS_NAMESPACE = '/VCCPlus' + 'Apps/' PUBLIC_APP_REPOSITORIES = frozenset({'cococapitalquiz'}) def unapproved_app_links(text): problems = [] for match in re.finditer(r'https?://[^\s<>"`\)\]]+', text): value = match.group(0) parsed = urlsplit(value) if parsed.hostname != PUBLIC_HOST: continue path = unquote(parsed.path) if not path.lower().startswith(APPS_NAMESPACE.lower()): continue rest = path[len(APPS_NAMESPACE):] name = rest.split('/', 1)[0].lower() if name not in PUBLIC_APP_REPOSITORIES or '..' in path.split('/'): problems.append(value) return problems