44 lines
2.4 KiB
Python
44 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
||
"""Static SYS.API security, branding and rollout contract."""
|
||
from pathlib import Path
|
||
root=Path(__file__).resolve().parents[2]
|
||
read=lambda p:(root/p).read_text(encoding="utf-8")
|
||
api=read("addons/SysApi/SysApiHost.cs")
|
||
auth=read("addons/SysApi/SysApiConnector.cs")
|
||
secret=read("addons/SysApi/PortalSecretStore.cs")
|
||
js=read("addons/SysApi/www/app.js")
|
||
web=read("addons/SysApi/www/index.html")
|
||
project=read("addons/SysApi/sys.api.csproj")
|
||
for needle in ("sys.api", "www/ogl-mascot.webp", "OpenSim.Server.Handlers.csproj"):
|
||
assert needle in project,needle
|
||
for needle in ('UserLevel < 200', 'Access Denied – Keine Berechtigung',
|
||
'Authenticate(account.PrincipalID', 'GetUserAccount(UUID.Zero',
|
||
'CryptographicOperations.FixedTimeEquals', 'HttpOnly; SameSite=Strict',
|
||
'X-OGL-CSRF', 'IsTrustedProxy', 'Content-Security-Policy',
|
||
'127.0.0.1:', '/api/v1/portal/ping', '/api/v1/portal/capabilities',
|
||
'/api/admin/overview'):
|
||
assert needle in api,needle
|
||
for needle in ('GetBoolean("Enabled", false)', 'IUserAccountService',
|
||
'IAuthenticationService', 'PortalSecretStore.OpenOrCreate'):
|
||
assert needle in auth,needle
|
||
for needle in ('FileMode.CreateNew', 'RandomNumberGenerator.GetBytes(64)',
|
||
'UnixFileMode.UserRead | UnixFileMode.UserWrite'):
|
||
assert needle in secret,needle
|
||
assert "innerHTML" not in js
|
||
assert "ogl-mascot.webp" in web
|
||
assert (root/"addons/SysApi/www/ogl-mascot.webp").stat().st_size > 60000
|
||
for p in ("bin/Robust.HG.ini","bin/Robust.HG.ini.example","bin/Robust.ini.example",
|
||
"bin/Robust.HG.OGLAsset.ini.example"):
|
||
contents=read(p)
|
||
assert 'SysApiConnector = "SysApi@' in contents, p
|
||
assert "[SysApi]" in contents and "Enabled = false" in contents.split("[SysApi]")[1],p
|
||
assert "os_webinterface" in read("OpenSim.sln")
|
||
assert "sys.api" in read("OpenSim.sln")
|
||
assert "sys.api" in read("runprebuild.sh") and "sys.api.dll" in read("compile.sh")
|
||
assert "NexVerseWorldApiConnector" in read("bin/Robust.HG.ini"),"Legacy World API removed"
|
||
assert "ssl_certificate" in read("tools/ops/sys-api-nginx-8850.conf.example")
|
||
installer=read("tools/ops/sys-api-tls-install.sh")
|
||
for marker in ("certbot certonly", "certbot.timer", "nginx -t", "renewal-hooks/deploy", "/.well-known/acme-challenge/"):
|
||
assert marker in installer, marker
|
||
print("SYS.API independent DLL, UserLevel 200, persistent token, TLS proxy, legacy API and OGL mascot: PASS")
|