Skip to main content

scalio-connect

Signed calls between the Scalio apps and Compass. One format ("v2", header Scalio-Signature) for every direction:

  • Compass -> app: control key K3 on /api/provision/* (replaced the old X-Provision-Control-Signature, which is refused since 0.13.0)
  • app -> Compass: instance key on the support intake /api/support/v1/* (scalio_connect.support)

Contract: scalio-docs interfaces/signed-request-v2.md. Decision: scalio-docs ADR 0020.

What is signed

Scalio-Signature: v=2,kid=k3,ts=1793131200,nonce=vector-nonce-0000000001,sig=<base64 Ed25519>

scalio-sig-v2
<kid>
<METHOD>
<audience = receiver origin, e.g. https://acme.eu.scalionexus.com>
<path and query as sent, e.g. /api/provision/admin>
<ts>
<nonce>
<sha256 of the raw body, hex>

Lines joined by \n, no line break at the end. Time window +-300 s, each (kid, nonce) once. Because receiver and path are signed, a captured request does not work on another instance or another endpoint (security review H9).

Usage

from scalio_connect import sign, verify, SignatureError
from scalio_connect.nonces import use_nonce

# sender
headers = sign(private_key, "k3", "POST", "https://acme.eu.scalionexus.com/api/provision/admin", body)

# receiver (raw body bytes, path with query as received)
try:
    v = verify(request.headers["Scalio-Signature"], request.method, path_with_query, body,
               audiences=["https://acme.eu.scalionexus.com"], keys_for=lambda kid: k3_keys if kid == "k3" else [])
except SignatureError:
    raise HTTPException(401)
if not await use_nonce(db, v.kid, v.nonce):
    raise HTTPException(401)

audiences are the receiver's own public origins from its configuration. Do not take them from the Host header.

K3 (Compass -> app)

from scalio_connect.k3 import K3Error, audiences_from_env, check_request

try:
    await check_request(db, request.headers, request.method, path_with_query, body,
                        keys=k3_public_keys, audiences=audiences_from_env())
except K3Error as e:
    raise HTTPException(401, str(e))

Accepts only format v2 (since 0.13.0, security review M13). The old X-Provision-* headers are ignored and a call with only those is refused. The call must be signed for one of the instance's public URLs (SCALIO_PUBLIC_URLS, APP_PUBLIC_URL, FRONTEND_URL, PUBLIC_URL; http and https of the same host both match); without a public URL the provisioning API stays closed.

Development

pip install -e ".[dev]"
ruff check . && pytest -q

tests/vector.json is the shared test vector (throwaway seed). Compass and every app test against the same file. Release: bump pyproject.toml, a scalio-docs PR with python3 tools/changelog.py --repo scalio-connect release <version> (changelog in scalio-docs changelog/scalio-connect/, ADR 0066), merge, then "Publish" (cockpit or Actions) with the version, no v.

Support connection (app -> Compass)

pip install "scalio-connect[support]". Decision: scalio-docs ADR 0022, contract interfaces/support-intake.md.

from scalio_connect.support import SupportClient, cipher_from_secret, build_diagnostics
from scalio_connect.support import connection, outbox

cipher = cipher_from_secret(os.environ["JWT_SECRET"])          # any app secret of 16+ characters
conn = await connection.load(db, cipher) or await connection.create(db, cipher, "nexus", portal_url)
client = SupportClient(conn)
await client.pair(app="nexus", version=VERSION, mode="saas", code=one_time_code)   # SaaS / dev / test
await connection.set_status(db, "active")

item = await outbox.enqueue(db, "ticket", {"subject": ..., "description": ..., "reporter": {...},
                                           "diagnostics": build_diagnostics(app="nexus", ...)},
                            reporter_email=user_email)
await outbox.flush(db, client if conn.usable else None)       # again when the drawer opens

Ready-made routers for a FastAPI app (pip install "scalio-connect[support-web]"):

from scalio_connect.support.service import SupportService
from scalio_connect.support.web import provision_support_router, support_router
from scalio_license.web import require_provision

support = SupportService("citadel", lambda: db, mode=mode, app_url=app_url, build_info=build_info,
                         license_info=lambda: {"edition": ..., "valid": ...}, stage=stage,
                         portal=lambda: licensing.runtime.state.get("portal"))
app.include_router(support_router(support, current_user=get_current_user, require_admin=require_admin,
                                  enabled=lambda: features()["support"], audit=audit), prefix="/api")
app.include_router(provision_support_router(support, require_provision(lambda: db), audit), prefix="/api")
# startup: await support.ensure_indexes(); asyncio.create_task(support.loop())

AppSupport (from 0.11.0) builds the service with the parts every app had the same: mode, public address, license block, portal claim and maintenance flag.

from scalio_connect.support.app import AppSupport

app_support = AppSupport("citadel", lambda: db, saas_mode=saas_mode, stage=stage,
                         license_state=lambda: licensing.runtime.state, build_info=build_info)
support = app_support.service   # app_support.mode(), .app_url(), .maintenance_active()

From 0.15.0 it also answers enabled() (support on: SaaS, dev, test, or self-hosted with maintenance; never demo) and shown() (enabled and not hidden by an admin), and routers(...) wires all four routers with the app's own dependencies, so an app's support.py holds only its audit function and its admin check:

router, provision_router, ideas, updates = app_support.routers(
    current_user=get_current_user, require_admin=require_admin, is_admin=lambda u: u.get("role") == "admin",
    provision=require_provision(lambda: db), audit=audit, errors=error_report.errors_for_support)

Portal per stage (support.portals): an instance on stage dev connects only to portaldev.scaliocloud.com, test only to portaltest.scaliocloud.com, everything else (production, demo, SaaS, self-hosted customers) to portal.scaliocloud.com by default and never to the dev or test portal. Without an address the admin form uses the stage's portal (default_portal in GET /support/connection). stage is optional; without it the stage follows mode(). POST /provision/support skips the check: the call comes from the Compass that created the instance.

Self-hosted (ADR 0022, T11/T12): in production portal() (the license's issuing portal, scalio-license portal) is the default. A self-hosted instance without a connection takes no tickets; GET /support/status tells the drawer to link to <portal>/support instead (link_only). The admin can hide the button (PUT /support/connection/button); the app reads await support.button_hidden() for its features().

Scalio Ideen (ADR 0050, from 0.8.0): the same connection carries feature requests, votes and comments to Compass (/api/ideas/v1/*, contract in scalio-docs interfaces/ideas-intake.md):

from scalio_connect.support.ideas_web import ideas_router
app.include_router(ideas_router(support, current_user=get_current_user, enabled=lambda: features()["support"],
                                audit=audit), prefix="/api")

GET /ideas/status tells the drawer whether it can list ideas (connected) or only link to the public page (link_only, page = <portal>/ideen?product=<app>). New ideas belong to the app itself or to compass.

The instance key never leaves the instance. If the app secret changes, the key cannot be decrypted any more and the admin connects again.

SaaS updates (ADR 0074, from 0.14.0): the same connection reads the update offer Compass made for this instance and passes on the customer's choice (/api/updates/v1/{state,now,postpone,mode,window}, contract in scalio-docs interfaces/saas-updates.md). Compass runs the update itself; the app only shows it:

from scalio_connect.support.updates_web import saas_updates_router
app.include_router(saas_updates_router(support, current_user=get_current_user, require_admin=require_admin,
                                       saas=lambda: SAAS_MODE, is_admin=lambda u: u["role"] == "admin",
                                       audit=audit), prefix="/api")

GET /saas-updates/banner (everyone: version, planned time, deadline), GET /saas-updates (admin, cached 15 minutes, ?refresh=1), POST /saas-updates/{now,postpone,mode,window} (admin). Self-hosted answers {"saas": false}. The UI blocks are UpdateBanner and SaasUpdatesPanel in @scalio-cloud/ui 0.30.0.

E-mail default (ADR 0090, from 0.16.0): the organisation's mail settings from Compass for scalio_platform.mail (/api/mail/v1/{config,send}, contract in scalio-docs interfaces/mail-defaults.md). config gives the way, the tenant and the sending mailbox the customer set in Compass, never a secret; send is «Über Scalio», which Compass only takes when the super admin allowed it for the customer. AppSupport.mail is a CompassMail:

mailer = mail.Mailer(..., defaults=mail.first_default(mail.env_defaults, app_support.mail.defaults),
                     relay=app_support.mail.relay)

defaults() asks Compass at most every 5 minutes and keeps the last answer for a day when Compass is down.

From 0.18.0 relay() also takes cc, reply_to and attachments (objects with filename, content, content_type, like scalio_platform.mail.Attachment; at most 10 MB together, e.g. an invoice PDF). Attachments only go when Compass says it takes them (attachments in the default); an older Compass gets no mail whose PDF it would drop.

Other apps of the customer (ADR 0092, from 0.17.0): AppSupport.apps is a CompassApps. links() answers {app: https origin} of every other running instance of the same organisation and mode (/api/apps/v1/links, contract in scalio-docs interfaces/app-links.md), for the product switcher (scalio_platform.app_links(compass=...)) and the Beacon suggestion. same_customer(url, app) is the host side of pairing without a code (tenants/v1/peer).

return app_links(support=await support.shown(), compass=await app_support.apps.links())

«Fehler an Scalio melden» (decision M4, from 0.19.0): a self-hosted installation sends its error reports to Scalio Monitor only after an admin switches them on. AppSupport.monitor is a CompassMonitor; with AppSupport(..., on_monitor=scalio_platform.error_report.configure) the routes GET/PUT /support/error-reports (admin, {"on": true|false}) fetch a token for this installation from Compass (/api/monitor/v1/token), keep it encrypted in scalio_support and hand it to the reporter; switching off drops it and sends release (again on the next start when Compass was down). Call await app_support.monitor.apply() at the start of the API and the worker. Refusals answer 409 {"code", "message"} with code not_connected, saas, blocked, unavailable or compass.

«Scalio KI» (ADR 0111 K2, from 0.20.0): SupportClient.ai("status") and SupportClient.ai("complete", body) call the KI relay of Compass (/api/ai/v1) with the instance key. The app passes relay=lambda body: app_support.service.ai("complete", body) to scalio_platform.ai.Assistant; the body is ai.relay_request(...) (already filtered, no key). Compass checks licence and credits of the organisation and stores only counts. Refusals raise SupportError 402 (credits used up), 403 (not in the licence), 429 (free «Frag Scalio» questions used up), 503 (relay off). Contract: scalio-docs interfaces/ai-relay.md.

Pairing with Beacon (app <-> Beacon, from 0.9.0)

Without a code (ADR 0092, from 0.17.0): AppPeers(..., suggest=app_support.apps.links) offers the customer's Beacon (GET /peers/suggestion) and POST /peers with an empty code pairs with it. Beacon passes confirm_member=app_support.apps.same_customer to pairing.accept; it then checks back at the app's own address (GET /api/peers/v1/proof/<kid>, answered only while the pairing runs) before it stores the key. A host without confirm_member keeps asking for a code.

scalio_connect.peers pairs an app (Citadel, Rosetta, Foundry, Nexus) with a Scalio Beacon instance (decisions itsm/P3-1, P3-2 in scalio-docs concepts/beacon-suite.md; contract interfaces/peer-findings.md).

  • The Beacon admin creates a one-time code bpc_… (24 hours, Beacon stores only its sha256). The app admin enters the Beacon address and the code. The app makes a key for this pairing and signs the pair call with it; Beacon answers with its own new public key. From then on both sides call each other signed (format v2, kid = the key id of the pairing): the app sends findings, Beacon calls actions.
  • Keys are stored encrypted in scalio_peers (Fernet from a random secret in scalio_peer_secret, like the support key; never part of an export). Removing a pairing deletes the key.
  • findings.report(...) sends the state of one source for one tenant after each check, only when it changed or once a day; findings.event(...) sends single run events. Texts are scrubbed. outbox.flush sends with retries.
from scalio_connect.peers import findings
from scalio_connect.peers.web import PeerService, admin_router, peer_router

peers = PeerService(get_db=lambda: db, app="citadel", own_url=lambda: PUBLIC_URL, version=VERSION)
app.include_router(admin_router(peers, require_admin=require_admin, audit=audit), prefix="/api")  # /api/peers
app.include_router(peer_router(peers), prefix="/api")                                             # /api/peers/v1/ping

# after a check
await findings.report(db, source="citadel.conformity", tenant_id=tid, tenant_name=name, items=[...])
# periodic job
await peers.flush()

AppPeers (from 0.15.0, scalio_connect.peers.app) is the same wiring in one object for an app: service, both routers, report/event that only log errors (a check never breaks because of Beacon), flush, loop, paired() and link(path) (https only). The app keeps only how its results become items.

from scalio_connect.peers.app import AppPeers

beacon = AppPeers("citadel", "Scalio Citadel", get_db=lambda: db, own_url=support.app_url, version=VERSION,
                  require_admin=require_admin, audit=support.audit)
await beacon.report(db, source="citadel.conformity", tenant_id=tid, tenant_name=name, items=[...])

Beacon (host) uses codes.create, pairing.accept and auth.fastapi_dependency for its own /api/peers/v1/* routes and checks every snapshot again with findings.snapshot(...).

Metadata

Release files for scalio-connect 0.20.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scalio-connect 0.20.0
File Size Uploaded Provenance Actions
scalio_connect-0.20.0.tar.gz 74.8 kB With provenance Details for scalio_connect-0.20.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scalio-connect 0.20.0
File Interpreter ABI Platform Actions
scalio_connect-0.20.0-py3-none-any.whl Python 3 none any Details for scalio_connect-0.20.0-py3-none-any.whl

Total release size: 135.5 kB

Release files / scalio_connect-0.20.0.tar.gz

Download URL scalio_connect-0.20.0.tar.gz
Size 74.8 kB
Tags Source
SHA-256 checksum
How to use checksums
938cd0a70e79613c6e6fb1d08a4b5357a308888cd302652fb0bdb525941cc167
BLAKE2b-256 checksum
How to use checksums
27009f321e0529ffe5c1c60bfff7d368b2964f02a1a384f4e688f38e50185bfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / scalio_connect-0.20.0-py3-none-any.whl

Download URL scalio_connect-0.20.0-py3-none-any.whl
Size 60.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa049d8cbd0ea0b44dc69426c32069c8cfc0701b42c2dc7ce6b0094e044ddfd1
BLAKE2b-256 checksum
How to use checksums
8cffdcf0a951161d53cdce5d98381b67b73cdd02ffee297675a8d250c351b537
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for scalio-connect 0.20.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for scalio_connect-0.20.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page