queryapigate 0.51.0__tar.gz → 0.52.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {queryapigate-0.51.0/queryapigate.egg-info → queryapigate-0.52.0}/PKG-INFO +1 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/__init__.py +1 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/admins.py +20 -3
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/apikeys.py +2 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/app.py +9 -4
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/cli.py +11 -3
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/config.py +12 -2
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/dataplane.py +4 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/destinations.py +4 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/engine.py +26 -7
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/events.py +13 -3
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/jwtauth.py +13 -10
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/metrics.py +4 -2
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/schema.py +1 -2
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/secretrefs.py +46 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/connections.py +13 -4
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/destinations.py +2 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/mcp.py +2 -2
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/workspaces.py +1 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/sso.py +22 -14
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/store.py +5 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/workspaces.py +23 -8
- {queryapigate-0.51.0 → queryapigate-0.52.0/queryapigate.egg-info}/PKG-INFO +1 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate.egg-info/SOURCES.txt +2 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_agent_writes.py +11 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_dataplane.py +21 -4
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_descriptions.py +11 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_events_server.py +3 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_mcp_oauth.py +57 -1
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_queryapigate.py +36 -2
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_runstore.py +13 -2
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_settings.py +1 -1
- queryapigate-0.52.0/tests/test_shutdown.py +142 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_sso.py +28 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_workspace_isolation.py +40 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_workspace_local_files.py +51 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_workspace_observability.py +21 -0
- queryapigate-0.52.0/tests/test_workspace_secret_refs.py +90 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/LICENSE +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/NOTICE +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/README.md +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/pyproject.toml +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/__main__.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/accesslog.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/adminroles.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/agentwrites.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/alerts.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/auditchain.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/auditstream.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/aws.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/broadcast.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/bundle.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/cache.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/cdcsources.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/collection_admin.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/configcode.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/AccessMapPage-BLTtrvV7.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/AdministratorsPage-gWX1epBr.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/AgentsPage-CQCw6zsv.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/AlertsPage-Dcs615rM.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/ApiKeyDetailPage-CTdAD9mo.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/ApiKeysPage-DrydnYjp.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/ApprovalsPage-0cJWRfX2.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/AuditLogPage-BKUfkk9p.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/CachingPage-D9z2sT0j.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/CdcSourcesPage-ColAZA6a.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/CodeBox-Cwh5KHLp.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/ConnectionsPage-DDzYECYe.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/DesignerPage-CUtj9F6J.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/DestinationsPage-jEO9uCHi.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/Experimental-B3dnaeV7.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/ExportsPage-B1BcJ83k.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/HelpPage-BKnEzwAb.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/HomePage-CU0QeQNe.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/KeyActivity-BhV8qZ-p.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/Managed-C6wP4b1l.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/McpPage-CvjuiKZV.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/MetricsPage-Cv2y-OBV.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/QueryInfo--z9ZqXkQ.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/RepositoryPage-Dx-NdAHu.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/Results-CxkMrmv4.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/RolesPage-BwJqzmix.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/SchemaBrowser-C-910PNM.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/SettingsPage-CahRTpCG.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/StatTile-Cft4kJPH.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/Time-1LzS0WOr.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/WorkspacesPage-QhgHD8D7.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/api-Culg17uJ.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/client-ZHNiMG8H.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/forms-CietEOlU.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/forms-Daj5x4ru.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/icons-CFXE8hAz.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/index-Cv64XKNs.css +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/index-zWukbTre.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/maskRules-CvKQIPgN.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/reach-BAOLd75Y.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/shared-DZEj-9yA.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/state-O13cl7cO.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/assets/useMutation-kSEF_Amb.js +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/favicon.svg +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/console_dist/index.html +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/cors.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/databases.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/db.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/definitions.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/deprecations.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/descriptions.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/duckfiles.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/embeddings.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/errors.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/examples.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/experimental.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/exporting.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/exports.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/formats.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/governance.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/gunicorn_conf.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/history.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/instances.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/lib/h2-2.2.224.jar +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/limits.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/live.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/logging_setup.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/masking.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/mcp_server.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/metacache.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/mongodocs.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/mongotools.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/oidc.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/openapi.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/params.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/parquet.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/pool.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/postman.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/quotas.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/ratelimit.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/rediscache.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/rekey.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/runners.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/runstore.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/scope.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/secheaders.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/__init__.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/access.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/administrators.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/audit.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/cdc_sources.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/collections.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/descriptions.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/exports.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/services/queries.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/sqlflow.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/sqltools.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/tableguard.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/tracing.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/usage.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/v1.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/v1_spec.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate/vault.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate.egg-info/dependency_links.txt +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate.egg-info/entry_points.txt +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate.egg-info/requires.txt +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/queryapigate.egg-info/top_level.txt +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/setup.cfg +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_adhoc_history.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_adminroles.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_admins.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_alerts.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_api_administrators.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_api_keys.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_api_v1.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_audit_chain.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_audit_log.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_audit_siem.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_audit_stream.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_aws.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_backup_restore.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_broadcast.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_cdc_sources.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_cli.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_collection_bundle.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_collection_postman.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_collections.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_configcode.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_connection_encryption.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_console.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_cors_and_rate_limit.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_data_protection.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_databases.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_db.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_dependency_floors.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_deprecations.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_destinations.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_docs_site.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_duckdb.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_duckdb_files.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_embeddings.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_errors.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_events.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_examples.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_experimental.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_export_security.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_exporting.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_exports.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_fips.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_helm.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_history.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_howto.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_instances.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_integration.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_jdbc.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_jwt.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_key_rotation.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_limits.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_live.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_live_cache.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_live_debezium.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_masking.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_masking_requests.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_mcp.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_mcp_keycloak.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_metacache.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_mongo_streaming.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_mongotools.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_multinode.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_observability.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_oidc.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_params.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_parquet.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_pool.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_publishing.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_query_window.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_quotas.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_rekey.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_release_check.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_response_cache.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_roles.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_rolling_upgrade.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_runstore_differential.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_secretrefs.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_security_headers.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_shared_rate_limit.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_sql_guard_fuzz.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_sql_guard_writes.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_sqlflow.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_sso_keycloak.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_supply_chain.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_tableguard.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_tracing.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_upgrades.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_usage.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_vault.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_workspace_config_cli.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_workspace_store.py +0 -0
- {queryapigate-0.51.0 → queryapigate-0.52.0}/tests/test_workspaces_api.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: queryapigate
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.52.0
|
|
4
4
|
Summary: Turn SQL into governed REST APIs over MySQL, PostgreSQL, ClickHouse, SQLite, DuckDB, H2, MongoDB, and Parquet/CSV/JSON files - JSON, CSV, Parquet or Excel out, with scoped keys, an admin Console and MCP for AI agents.
|
|
5
5
|
Author-email: Anantha Raju C <arcswdev@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -394,12 +394,26 @@ def _free_name(conn, wanted):
|
|
|
394
394
|
raise ApiError('Could not find a free administrator name', 409, code='admin_exists')
|
|
395
395
|
|
|
396
396
|
|
|
397
|
-
def sign_in_sso(issuer, subject,
|
|
397
|
+
def sign_in_sso(issuer, subject, group_role, default_role, wanted_name, email):
|
|
398
398
|
"""The administrator for someone who just signed in through SSO, created on first sign-in - (admin, change)
|
|
399
399
|
where change is 'created', 'linked' (an administrator waiting for this verified email, now bound - 'linked_role'
|
|
400
400
|
when their groups also gave them a new role), 'role' (their groups gave a new role) or None. The provider decides
|
|
401
|
-
the role:
|
|
402
|
-
group.
|
|
401
|
+
the role: the one their groups map to (`group_role`), else the default role (`default_role`, anyone with a verified
|
|
402
|
+
email at an allowed domain) - one moved out of the owners' group is no longer an owner, last one or not.
|
|
403
|
+
|
|
404
|
+
Except for an administrator whose roles are all workspace memberships (ADR 0023 - no server-wide role): the
|
|
405
|
+
default role doesn't make them server-wide. Their invitation to a workspace is what lets them in, so they sign in
|
|
406
|
+
with no group too; only a group the provider puts them in gives them a server-wide role. Before, an invitation to
|
|
407
|
+
one workspace became a server-wide role - a data role in every workspace - at the first sign-in."""
|
|
408
|
+
def role_for(admin):
|
|
409
|
+
if admin is not None and admin['role'] is None and group_role is None:
|
|
410
|
+
return None
|
|
411
|
+
role = group_role or default_role
|
|
412
|
+
if role is None:
|
|
413
|
+
from .sso import NO_ROLE
|
|
414
|
+
raise ApiError(NO_ROLE, 403, code='sso_no_role')
|
|
415
|
+
return role
|
|
416
|
+
|
|
403
417
|
with db.transaction() as conn:
|
|
404
418
|
found = find_by_sso(issuer, subject)
|
|
405
419
|
if found is None and email:
|
|
@@ -409,17 +423,20 @@ def sign_in_sso(issuer, subject, role, wanted_name, email):
|
|
|
409
423
|
raise ApiError(f'More than one administrator waits for an SSO sign-in as {email}', 409,
|
|
410
424
|
code='sso_ambiguous')
|
|
411
425
|
if waiting:
|
|
426
|
+
role = role_for(waiting[0])
|
|
412
427
|
found = {**waiting[0], 'sso': {'issuer': issuer, 'subject': subject}}
|
|
413
428
|
change = 'linked' if found['role'] == role else 'linked_role'
|
|
414
429
|
found['role'] = role
|
|
415
430
|
_write_admin(conn, found)
|
|
416
431
|
return found, change
|
|
417
432
|
if found is not None:
|
|
433
|
+
role = role_for(found)
|
|
418
434
|
if found['role'] == role:
|
|
419
435
|
return found, None
|
|
420
436
|
found = {**found, 'role': role}
|
|
421
437
|
_write_admin(conn, found)
|
|
422
438
|
return found, 'role'
|
|
439
|
+
role = role_for(None)
|
|
423
440
|
admin = {'name': _free_name(conn, wanted_name), 'role': role, 'active': True, 'created_at': store.now(),
|
|
424
441
|
'email': email if email and _EMAIL_RE.match(email) else None, 'created_by': 'sso',
|
|
425
442
|
'last_seen_at': None, 'sso': {'issuer': issuer, 'subject': subject}}
|
|
@@ -541,6 +541,8 @@ def create_key(name, connections=None, allow_writes=None, queries=None, expires_
|
|
|
541
541
|
example=False, mask=None, max_concurrent=None, query_timeout=None, max_rows=None, quota=None):
|
|
542
542
|
if not isinstance(name, str) or not _NAME_RE.match(name):
|
|
543
543
|
raise ApiError("API key name may only contain letters, digits, spaces, '.', '_' and '-'", code='invalid_name')
|
|
544
|
+
if name in admins.RESERVED_NAMES: # `admin` is every administrator's label in /metrics, `-` no caller's
|
|
545
|
+
raise ApiError(f"'{name}' is reserved - choose another name", code='invalid_name')
|
|
544
546
|
admins.refuse_taken_name(name)
|
|
545
547
|
if role is None:
|
|
546
548
|
collections = _normalize_collections(collections)
|
|
@@ -182,8 +182,10 @@ class _CapturePeer:
|
|
|
182
182
|
server sees the request as if the client had connected directly, ProxyFix and QUERYAPIGATE_TRUST_PROXY included.
|
|
183
183
|
A peer that isn't an IP address counts as remote, as a Unix socket does. A data plane from another release
|
|
184
184
|
(X-QAG-Dataplane-Version) is still the data plane, but is given no plan (dataplane.paired()). The rate-limit buckets
|
|
185
|
-
it counted a call in before forwarding it (X-QAG-Rate-Counted, ADR 0032) are taken from it alone. Its
|
|
186
|
-
|
|
185
|
+
it counted a call in before forwarding it (X-QAG-Rate-Counted, ADR 0032) are taken from it alone. Its own calls to
|
|
186
|
+
/internal/dataplane/* carry X-QAG-Own as well, which it takes off every request it relays: the secret alone means
|
|
187
|
+
"came through the data plane", which every client's call does. Its headers are removed here, so nothing after this
|
|
188
|
+
layer reads, logs or passes on the secret."""
|
|
187
189
|
|
|
188
190
|
def __init__(self, app):
|
|
189
191
|
self.app = app
|
|
@@ -194,7 +196,9 @@ class _CapturePeer:
|
|
|
194
196
|
wanted = environ.pop(dataplane.WANTED_ENVIRON, None)
|
|
195
197
|
version = environ.pop(dataplane.VERSION_ENVIRON, None)
|
|
196
198
|
rate_counted = environ.pop(dataplane.COUNTED_ENVIRON, None)
|
|
199
|
+
own = environ.pop(dataplane.OWN_ENVIRON, None)
|
|
197
200
|
if supplied is not None and dataplane.matches(supplied):
|
|
201
|
+
environ['queryapigate.dataplane_own'] = own == '1'
|
|
198
202
|
is_paired = dataplane.paired(version)
|
|
199
203
|
environ['queryapigate.dataplane'] = 'plan' if wanted == '1' and is_paired else True
|
|
200
204
|
environ['queryapigate.dataplane_paired'] = is_paired
|
|
@@ -336,7 +340,8 @@ def create_app():
|
|
|
336
340
|
g.request_id = new_request_id(request.headers.get('X-Request-Id'))
|
|
337
341
|
g.request_started = time.monotonic()
|
|
338
342
|
if request.endpoint in DATAPLANE_ENDPOINTS: # the data plane's own calls: nothing else applies to them
|
|
339
|
-
|
|
343
|
+
# Its own - not merely through it: every client's call through the data plane carries the secret too
|
|
344
|
+
if request.environ.get('queryapigate.dataplane_own'):
|
|
340
345
|
return None
|
|
341
346
|
return jsonify(error_body('Not Found', 404)), 404
|
|
342
347
|
if request.environ.get('queryapigate.dataplane') == 'plan': # before the key is read: a plan names its row
|
|
@@ -672,7 +677,7 @@ def stream_sql_response(sql, connection_name, params, timeout, output_format, fi
|
|
|
672
677
|
raise ApiError('stream=true exports the whole result and does not accept page/page_size', code='invalid_stream')
|
|
673
678
|
key_name = metrics_key_name()
|
|
674
679
|
columns, rows = engine.stream_sql(sql, connection_name, params, timeout, key_name=key_name,
|
|
675
|
-
allowed_tables=allowed_tables, mask=mask)
|
|
680
|
+
allowed_tables=allowed_tables, mask=mask, database=database)
|
|
676
681
|
# Captured here, not inside _record_stream_history(): that generator's body runs lazily, as the response
|
|
677
682
|
# streams out - by then the request/app context this view function runs in is long gone (no
|
|
678
683
|
# flask.stream_with_context() wrapping is used), so g, caller_key_name() and current_app are only safe to read
|
|
@@ -48,13 +48,20 @@ def _serve(args):
|
|
|
48
48
|
'Listening on %s without QUERYAPIGATE_API_KEY set: in open-access mode the server answers only local '
|
|
49
49
|
'clients, so callers on other hosts are refused. Set QUERYAPIGATE_API_KEY to serve them.', args.host)
|
|
50
50
|
logging.getLogger('queryapigate').info('Using %s (metadata: %s)', config.home(), db.describe())
|
|
51
|
-
|
|
52
|
-
# revoked (ADR 0015), the audit stream's lease given back. Python's default ends the process without it.
|
|
53
|
-
signal.signal(signal.SIGTERM, lambda *_: sys.exit(0))
|
|
51
|
+
_exit_cleanly_on_sigterm()
|
|
54
52
|
app.run(host=args.host, port=args.port, debug=args.debug, request_handler=_handler())
|
|
55
53
|
return 0
|
|
56
54
|
|
|
57
55
|
|
|
56
|
+
def _exit_cleanly_on_sigterm():
|
|
57
|
+
"""SIGTERM - what a container runtime, systemd or `kill` sends - as a clean exit, so what runs at exit does: run
|
|
58
|
+
history still queued is written (history.py), tracing's last spans are exported, Vault leases are revoked (ADR
|
|
59
|
+
0015), the audit stream's and run store's leases are given back. Python's default ends the process without any
|
|
60
|
+
of it. `queryapigate mcp` needs it too: uvicorn shuts down gracefully on SIGTERM and then raises the signal again,
|
|
61
|
+
with this handler back in place of its own - without it, that ended the process there and then."""
|
|
62
|
+
signal.signal(signal.SIGTERM, lambda *_: sys.exit(0))
|
|
63
|
+
|
|
64
|
+
|
|
58
65
|
def _mcp(args):
|
|
59
66
|
"""`queryapigate mcp`: an MCP server exposing read-only saved queries as tools (BACKLOG #42), on its own
|
|
60
67
|
port, separate from `queryapigate serve` - see mcp_server.py's own module docstring for why. Needs the
|
|
@@ -82,6 +89,7 @@ def _mcp(args):
|
|
|
82
89
|
config.mcp_resource_url(), config.mcp_scope())
|
|
83
90
|
if oidc.jwks_uri(config.mcp_auth_server()) is None:
|
|
84
91
|
log.warning('The MCP server will refuse every access token until that metadata can be fetched')
|
|
92
|
+
_exit_cleanly_on_sigterm()
|
|
85
93
|
run(app, host=args.host, port=args.port)
|
|
86
94
|
return 0
|
|
87
95
|
|
|
@@ -1029,7 +1029,7 @@ def check_jwt_settings():
|
|
|
1029
1029
|
|
|
1030
1030
|
|
|
1031
1031
|
_MCP_OAUTH_VARS = ('QUERYAPIGATE_MCP_RESOURCE_URL', 'QUERYAPIGATE_MCP_AUTH_SERVER', 'QUERYAPIGATE_MCP_SCOPE',
|
|
1032
|
-
'QUERYAPIGATE_MCP_ROLE', 'QUERYAPIGATE_MCP_ROLE_CLAIM')
|
|
1032
|
+
'QUERYAPIGATE_MCP_ROLE', 'QUERYAPIGATE_MCP_ROLE_CLAIM', 'QUERYAPIGATE_MCP_WORKSPACE_CLAIM')
|
|
1033
1033
|
DEFAULT_MCP_SCOPE = 'queryapigate.mcp'
|
|
1034
1034
|
|
|
1035
1035
|
|
|
@@ -1066,6 +1066,13 @@ def mcp_role_claim():
|
|
|
1066
1066
|
return _env('QUERYAPIGATE_MCP_ROLE_CLAIM')
|
|
1067
1067
|
|
|
1068
1068
|
|
|
1069
|
+
def mcp_workspace_claim():
|
|
1070
|
+
"""QUERYAPIGATE_MCP_WORKSPACE_CLAIM: a claim naming the workspace an OAuth caller on /mcp belongs to (ADR 0023) -
|
|
1071
|
+
else QUERYAPIGATE_JWT_WORKSPACE_CLAIM's, so a server that confines REST's signed-in users confines its agents too.
|
|
1072
|
+
Neither set, every OAuth caller acts in the default workspace."""
|
|
1073
|
+
return _env('QUERYAPIGATE_MCP_WORKSPACE_CLAIM') or jwt_workspace_claim()
|
|
1074
|
+
|
|
1075
|
+
|
|
1069
1076
|
def _secure_url(url):
|
|
1070
1077
|
lowered = url.lower()
|
|
1071
1078
|
return lowered.startswith('https://') or lowered.startswith(('http://localhost', 'http://127.0.0.1'))
|
|
@@ -1709,5 +1716,8 @@ def describe_settings():
|
|
|
1709
1716
|
row('Role', 'Role whose grants every agent signed in this way gets.', 'QUERYAPIGATE_MCP_ROLE',
|
|
1710
1717
|
mcp_role() or 'not set'),
|
|
1711
1718
|
row('Role claim', 'Claim naming an agent\'s role instead.', 'QUERYAPIGATE_MCP_ROLE_CLAIM',
|
|
1712
|
-
mcp_role_claim() or 'not set')
|
|
1719
|
+
mcp_role_claim() or 'not set'),
|
|
1720
|
+
row('Workspace claim', 'Claim naming the workspace an agent belongs to; its role is that workspace\'s. '
|
|
1721
|
+
'Unset, QUERYAPIGATE_JWT_WORKSPACE_CLAIM\'s claim; neither set, every agent is in the default '
|
|
1722
|
+
'workspace.', 'QUERYAPIGATE_MCP_WORKSPACE_CLAIM', mcp_workspace_claim() or 'not set')]},
|
|
1713
1723
|
]
|
|
@@ -42,6 +42,9 @@ PEER_HEADER = 'X-QAG-Peer'
|
|
|
42
42
|
WANTED_HEADER = 'X-QAG-Plan-Wanted'
|
|
43
43
|
VERSION_HEADER = 'X-QAG-Dataplane-Version' # the data plane's release, sent with its secret
|
|
44
44
|
PLAN_HEADER = 'X-QAG-Plan'
|
|
45
|
+
# On the data plane's own calls to /internal/dataplane/* - never on one it relays, which it takes off what a client
|
|
46
|
+
# sends. The secret says a call came through the data plane; this, beside it, that the data plane itself made it.
|
|
47
|
+
OWN_HEADER = 'X-QAG-Own'
|
|
45
48
|
COUNTED_HEADER = 'X-QAG-Rate-Counted' # the rate-limit buckets a call the data plane forwards was counted in already
|
|
46
49
|
VERSION = 1
|
|
47
50
|
DIALECTS = ('postgres', 'mysql') # the two the prototype serves - every other connection is forwarded
|
|
@@ -54,6 +57,7 @@ PEER_ENVIRON = 'HTTP_X_QAG_PEER'
|
|
|
54
57
|
WANTED_ENVIRON = 'HTTP_X_QAG_PLAN_WANTED'
|
|
55
58
|
VERSION_ENVIRON = 'HTTP_X_QAG_DATAPLANE_VERSION'
|
|
56
59
|
COUNTED_ENVIRON = 'HTTP_X_QAG_RATE_COUNTED'
|
|
60
|
+
OWN_ENVIRON = 'HTTP_X_QAG_OWN'
|
|
57
61
|
UNPAIRED = ('This data plane is from another release than this server: it gets no plans and no run store lease '
|
|
58
62
|
'until both are the same release')
|
|
59
63
|
_unpaired_seen: set = set()
|
|
@@ -15,7 +15,7 @@ import os
|
|
|
15
15
|
import re
|
|
16
16
|
import time
|
|
17
17
|
|
|
18
|
-
from . import config, db, duckfiles, scope, store
|
|
18
|
+
from . import config, db, duckfiles, scope, secretrefs, store
|
|
19
19
|
from .errors import ApiError
|
|
20
20
|
|
|
21
21
|
FIELDS = ('url', 'storage', 'region', 'endpoint', 'url_style', 'use_ssl', 'account_id', 'user', 'password')
|
|
@@ -157,6 +157,7 @@ def _write(conn, name, fields, created_at, timestamp):
|
|
|
157
157
|
def create(name, fields):
|
|
158
158
|
_check_name(name)
|
|
159
159
|
fields = validate(fields)
|
|
160
|
+
secretrefs.refuse_member_references(fields, capability='destinations.write')
|
|
160
161
|
if 'password' in fields:
|
|
161
162
|
fields['password'] = store._encrypt_password(fields['password'])
|
|
162
163
|
with db.transaction() as conn:
|
|
@@ -186,6 +187,8 @@ def update(name, changes):
|
|
|
186
187
|
fields.pop('storage', None) # re-derived from the new url's scheme
|
|
187
188
|
fields = {**validate({k: v for k, v in fields.items() if k != 'password'}),
|
|
188
189
|
**({'password': fields['password']} if 'password' in fields else {})}
|
|
190
|
+
secretrefs.refuse_member_references(fields, {k: current[k] for k in FIELDS if k in current},
|
|
191
|
+
capability='destinations.write')
|
|
189
192
|
_write(conn, name, fields, current['created_at'], store.now())
|
|
190
193
|
return get(name)
|
|
191
194
|
|
|
@@ -43,6 +43,21 @@ def _sql_connection(connection_name):
|
|
|
43
43
|
return details
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
def with_database(details, database):
|
|
47
|
+
"""`details` pointed at another `database` on the same server - Run SQL's database picker, `?database=` on the
|
|
48
|
+
schema routes, MCP's `database` argument - or `details` unchanged without one. Only a server database
|
|
49
|
+
(store.SERVER_DB_TYPES) switches: on SQLite, DuckDB, H2 and JDBC the `database` is a path or URL on this server,
|
|
50
|
+
and an override would open whatever file the caller names - this server's own store (and with writes on, an
|
|
51
|
+
owner's token), another workspace's database - past the checks the saved connection passed
|
|
52
|
+
(store.refuse_store_access(), services.connections.refuse_local_files())."""
|
|
53
|
+
if not database:
|
|
54
|
+
return details
|
|
55
|
+
if details.get('db') not in store.SERVER_DB_TYPES:
|
|
56
|
+
raise ApiError(f"Switching databases isn't supported for '{details.get('db')}' connections",
|
|
57
|
+
code='unsupported_operation')
|
|
58
|
+
return {**details, 'database': database}
|
|
59
|
+
|
|
60
|
+
|
|
46
61
|
def _table_defaults(details):
|
|
47
62
|
"""The (catalog, schema) that fill a reference's or grant's missing parts for qualified `allowed_tables` matching
|
|
48
63
|
(tableguard.py): what an unqualified table name resolves to on this connection. Trino's catalog is the
|
|
@@ -99,9 +114,7 @@ def execute_sql(sql, connection_name, limit, offset, params=None, timeout=None,
|
|
|
99
114
|
schema.fetch_schema()); a stored, scoped API key can never send this itself (there is no request field
|
|
100
115
|
for it), only the admin UI's own ad-hoc calls do.
|
|
101
116
|
"""
|
|
102
|
-
details = _sql_connection(connection_name)
|
|
103
|
-
if database:
|
|
104
|
-
details = {**details, 'database': database}
|
|
117
|
+
details = with_database(_sql_connection(connection_name), database)
|
|
105
118
|
effective_allow_writes = config.allow_writes() and allow_writes
|
|
106
119
|
default_catalog, default_schema = _table_defaults(details)
|
|
107
120
|
sql = validate_sql(sql, dialect=details['db'], allow_writes=effective_allow_writes,
|
|
@@ -402,6 +415,9 @@ def execute_agent_write(sql, connection_name, params, max_affected_rows, timeout
|
|
|
402
415
|
finally:
|
|
403
416
|
metrics.dec_active_query()
|
|
404
417
|
metrics.observe_query(connection_name, details['db'], status, time.monotonic() - started, key_name)
|
|
418
|
+
if config.live_queries(): # an approved write tells live queries what changed, as execute_sql()'s do (live.py)
|
|
419
|
+
from . import live
|
|
420
|
+
live.note_write(sql, details, connection_name)
|
|
405
421
|
if masked is not None:
|
|
406
422
|
columns, rows = masked.apply(columns, list(rows))
|
|
407
423
|
result = ResultSetDTO(list(rows), columns, has_more=False)
|
|
@@ -409,7 +425,8 @@ def execute_agent_write(sql, connection_name, params, max_affected_rows, timeout
|
|
|
409
425
|
return result, affected
|
|
410
426
|
|
|
411
427
|
|
|
412
|
-
def stream_sql(sql, connection_name, params=None, timeout=None, key_name='-', allowed_tables=None, mask=None
|
|
428
|
+
def stream_sql(sql, connection_name, params=None, timeout=None, key_name='-', allowed_tables=None, mask=None,
|
|
429
|
+
database=None):
|
|
413
430
|
"""Like execute_sql, but for the whole result rather than one page - and, unlike execute_sql, always
|
|
414
431
|
read-only regardless of QUERYAPIGATE_ALLOW_WRITES or the caller's own permission. A large export has no
|
|
415
432
|
business mutating data, and forcing this sidesteps a lot of incidental complexity around commit timing
|
|
@@ -417,18 +434,20 @@ def stream_sql(sql, connection_name, params=None, timeout=None, key_name='-', al
|
|
|
417
434
|
what that already involves per dialect without adding writes into the mix too.
|
|
418
435
|
|
|
419
436
|
``allowed_tables`` is a key's own narrower allow-list of tables it may query, if it has one - see
|
|
420
|
-
``sqltools.validate_sql()``/``tableguard.py``.
|
|
437
|
+
``sqltools.validate_sql()``/``tableguard.py``. ``database`` is execute_sql()'s: another database on the same
|
|
438
|
+
server, for a server database only (with_database()).
|
|
421
439
|
|
|
422
440
|
Returns (columns, rows): ``columns`` is available immediately (the underlying generator is primed once
|
|
423
441
|
to get it, surfacing a connection or SQL error here just like execute_sql does), ``rows`` is a lazy
|
|
424
442
|
generator - the connection checked out (or freshly opened) for it is released only once that generator
|
|
425
443
|
is exhausted, errors, or a client disconnect closes it early (see runners._make_stream_runner).
|
|
426
444
|
"""
|
|
427
|
-
details = _sql_connection(connection_name)
|
|
445
|
+
details = with_database(_sql_connection(connection_name), database)
|
|
428
446
|
default_catalog, default_schema = _table_defaults(details)
|
|
429
447
|
sql = validate_sql(sql, dialect=details['db'], allow_writes=False, allowed_tables=allowed_tables,
|
|
430
448
|
default_catalog=default_catalog, default_schema=default_schema)
|
|
431
|
-
|
|
449
|
+
# before the query runs, as execute_sql's
|
|
450
|
+
masked = masking.prepare(mask, sql, connection_name, details['db'], database)
|
|
432
451
|
timeout = limits.timeout(timeout)
|
|
433
452
|
row_limit = limits.rows(config.stream_max_rows()) # read now, in the request: the rows are read after it returns
|
|
434
453
|
slot = limits.acquire(timeout) # held until the last row is read - _drain() or _Rows.close() releases it
|
|
@@ -38,6 +38,7 @@ order.
|
|
|
38
38
|
import asyncio
|
|
39
39
|
import json
|
|
40
40
|
import logging
|
|
41
|
+
import signal
|
|
41
42
|
import time
|
|
42
43
|
import urllib.parse
|
|
43
44
|
from collections import deque
|
|
@@ -548,8 +549,9 @@ class EventServer:
|
|
|
548
549
|
allow_origin = cors.allow_origin_value(origin)
|
|
549
550
|
try:
|
|
550
551
|
if path == '/health' and method == 'GET':
|
|
551
|
-
|
|
552
|
-
|
|
552
|
+
# Open to anyone - so no counts: how many streams are open and events delivered is every workspace's
|
|
553
|
+
# activity together (ADR 0023). /metrics has both, behind QUERYAPIGATE_METRICS_TOKEN.
|
|
554
|
+
await _respond(writer, 200, {'status': 'ok'}, allow_origin)
|
|
553
555
|
elif path == '/metrics' and method == 'GET':
|
|
554
556
|
from . import metrics
|
|
555
557
|
if metrics.authorized(headers.get('authorization')):
|
|
@@ -874,8 +876,16 @@ def run(host='127.0.0.1', port=None):
|
|
|
874
876
|
async def main():
|
|
875
877
|
server = EventServer(host, port)
|
|
876
878
|
await server.start()
|
|
879
|
+
# SIGTERM - what a container runtime, systemd or `kill` sends - stops it as Ctrl-C does: every stream ended,
|
|
880
|
+
# then a normal exit, so what runs at exit does - live queries' runs still queued are written to history,
|
|
881
|
+
# tracing's last spans exported, leases given back. Python's default ends the process without any of it.
|
|
882
|
+
stopping = asyncio.Event()
|
|
877
883
|
try:
|
|
878
|
-
|
|
884
|
+
asyncio.get_running_loop().add_signal_handler(signal.SIGTERM, stopping.set)
|
|
885
|
+
except NotImplementedError: # Windows' event loop has no signal handlers
|
|
886
|
+
pass
|
|
887
|
+
try:
|
|
888
|
+
await stopping.wait()
|
|
879
889
|
finally:
|
|
880
890
|
await server.stop()
|
|
881
891
|
try:
|
|
@@ -137,12 +137,13 @@ def _role_for(claims, mcp=False):
|
|
|
137
137
|
return None, None
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
def _token_workspace(claims):
|
|
141
|
-
"""The workspace a signed-in user acts in (ADR 0023 §4): the QUERYAPIGATE_JWT_WORKSPACE_CLAIM claim's value
|
|
142
|
-
the
|
|
143
|
-
|
|
144
|
-
they don't belong to is a 404 in
|
|
145
|
-
|
|
140
|
+
def _token_workspace(claims, mcp=False):
|
|
141
|
+
"""The workspace a signed-in user acts in (ADR 0023 §4): the QUERYAPIGATE_JWT_WORKSPACE_CLAIM claim's value - on
|
|
142
|
+
the MCP server, QUERYAPIGATE_MCP_WORKSPACE_CLAIM's, else that one - or the default workspace when it is unset or
|
|
143
|
+
the claim is missing. It comes from the token, never the request path, so a federated user can't reach another
|
|
144
|
+
team's workspace by changing the `/w/<workspace>/` prefix - a workspace they don't belong to is a 404 in
|
|
145
|
+
settle_workspace(), as it is for an API key."""
|
|
146
|
+
claim_name = config.mcp_workspace_claim() if mcp else config.jwt_workspace_claim()
|
|
146
147
|
if not claim_name:
|
|
147
148
|
return DEFAULT_WORKSPACE
|
|
148
149
|
value = claim(claims, claim_name)
|
|
@@ -239,14 +240,16 @@ def authenticate_mcp(authorization, client_ip=None):
|
|
|
239
240
|
user = claims.get('sub')
|
|
240
241
|
if not isinstance(user, str) or user == '':
|
|
241
242
|
return None, McpRefusal(401, 'unauthorized', 'Unauthorized: the access token names no user (sub)')
|
|
242
|
-
|
|
243
|
+
workspace = _token_workspace(claims, mcp=True)
|
|
244
|
+
with scope.using(workspace): # the role is this user's workspace's - the MCP server has no path to name one
|
|
245
|
+
role_name, role = _role_for(claims, mcp=True)
|
|
243
246
|
if role is None:
|
|
244
|
-
log.warning('A valid MCP access token for %s names no existing role - refused
|
|
245
|
-
'QUERYAPIGATE_MCP_ROLE_CLAIM)', user)
|
|
247
|
+
log.warning('A valid MCP access token for %s names no existing role in workspace %r - refused '
|
|
248
|
+
'(QUERYAPIGATE_MCP_ROLE / QUERYAPIGATE_MCP_ROLE_CLAIM)', user, workspace)
|
|
246
249
|
return None, McpRefusal(403, 'forbidden', 'This access token is valid, but its user has no role here')
|
|
247
250
|
if not apikeys.ip_allowed(role, client_ip):
|
|
248
251
|
return None, McpRefusal(403, 'forbidden', "This role isn't allowed from this address")
|
|
249
|
-
return apikeys.permission_from_grants(mcp_caller_name(user), role, claims=claims), None
|
|
252
|
+
return apikeys.permission_from_grants(mcp_caller_name(user), role, claims=claims, workspace=workspace), None
|
|
250
253
|
|
|
251
254
|
|
|
252
255
|
def mcp_caller_name(user):
|
|
@@ -71,10 +71,12 @@ def label_for(permission):
|
|
|
71
71
|
def _in_workspace(name):
|
|
72
72
|
"""A key's or connection's label, qualified by its workspace outside `default` - `team-b/partner` - since two
|
|
73
73
|
workspaces may each have a `partner` (ADR 0023). `default`'s names stay as they were, so a server with one
|
|
74
|
-
workspace counts exactly as before
|
|
74
|
+
workspace counts exactly as before. `-` (no key at all) is never qualified; `admin` - the administrators - is, as
|
|
75
|
+
any name: administrators acting in team-b are `team-b/admin`. Before 0.52 it wasn't, so a key or a connection
|
|
76
|
+
named `admin` in one workspace was counted with every workspace's (a connection still may be called that)."""
|
|
75
77
|
from . import scope
|
|
76
78
|
workspace = scope.current()
|
|
77
|
-
if workspace == 'default' or not isinstance(name, str) or name
|
|
79
|
+
if workspace == 'default' or not isinstance(name, str) or name == '-':
|
|
78
80
|
return name
|
|
79
81
|
return f'{workspace}/{name}'
|
|
80
82
|
|
|
@@ -200,8 +200,7 @@ def _fetch_schema(connection_name, database):
|
|
|
200
200
|
details = store.get_connection(connection_name)
|
|
201
201
|
dialect = details['db']
|
|
202
202
|
if dialect == 'mongo':
|
|
203
|
-
|
|
204
|
-
details = {**details, 'database': database}
|
|
203
|
+
details = engine.with_database(details, database)
|
|
205
204
|
return {'tables': [{'name': name, 'type': 'collection', 'columns': []}
|
|
206
205
|
for name in engine.list_collections(details)], 'truncated': False}
|
|
207
206
|
if dialect not in _QUERIES:
|
|
@@ -442,6 +442,52 @@ def check_fields(fields):
|
|
|
442
442
|
check_credentials(fields['credentials'], fields)
|
|
443
443
|
|
|
444
444
|
|
|
445
|
+
def holds_secrets(fields):
|
|
446
|
+
"""Whether `fields` reach a secret through the server's own identity: a reference in a value - ${VAR}, a file,
|
|
447
|
+
Vault, AWS - or `credentials` (a Vault or RDS IAM lease)."""
|
|
448
|
+
return isinstance(fields, dict) and ('credentials' in fields or any(
|
|
449
|
+
isinstance(value, str) and REF_RE.search(value) for value in fields.values()))
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
_NOT_ROUTING = ('active', 'created_at', 'updated_at', 'example') # fields whose change sends nothing anywhere new
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
def _unchanged(after, before, probe):
|
|
456
|
+
"""Whether `after` sends the secret only where `before` does. A probe (the form's Test button) is judged on the
|
|
457
|
+
fields it sends - the form leaves out what it doesn't edit - and a save on every field, since one taken away
|
|
458
|
+
changes where it goes too (no `host` is localhost)."""
|
|
459
|
+
for key in (set(after) if probe else set(after) | set(before)) - set(_NOT_ROUTING):
|
|
460
|
+
if after.get(key) != before.get(key):
|
|
461
|
+
return False
|
|
462
|
+
return True
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def refuse_member_references(after, before=None, capability='connections.write', probe=False):
|
|
466
|
+
"""Saving, testing or changing a connection or destination that reaches a secret through the server's identity
|
|
467
|
+
takes a server-wide role (ADR 0023). The allow-lists (QUERYAPIGATE_SECRET_ENV_VARS, QUERYAPIGATE_SECRET_FILE_DIRS,
|
|
468
|
+
Vault's and AWS's prefixes) are the server's, one for every workspace: a role from a workspace membership naming
|
|
469
|
+
one - or repointing a connection that holds one at a host of theirs - would have the server send them another
|
|
470
|
+
team's secret as a password. A member still runs these, switches them on and off, and replaces a reference with a
|
|
471
|
+
password of their own; outside a request - the CLI, startup - it is the server's own doing."""
|
|
472
|
+
if before is not None and after.get('password') == config.PASSWORD_MASK:
|
|
473
|
+
after = {**after, 'password': before.get('password')} # the mask keeps the stored password - and its secret
|
|
474
|
+
if not holds_secrets(after):
|
|
475
|
+
return
|
|
476
|
+
from flask import g, has_request_context
|
|
477
|
+
if not has_request_context():
|
|
478
|
+
return
|
|
479
|
+
permission = getattr(g, 'permission', None)
|
|
480
|
+
if permission is None or getattr(permission, 'server_wide', True):
|
|
481
|
+
return
|
|
482
|
+
if before is not None and _unchanged(after, before, probe):
|
|
483
|
+
return
|
|
484
|
+
raise ApiError('A connection or destination that reaches a secret through the server - a ${VAR}, ${file:...}, '
|
|
485
|
+
"Vault or AWS reference, or `credentials` - is set up and changed by a server-wide role: the "
|
|
486
|
+
'allow-lists are the whole server\'s, so a role in a workspace could otherwise send another '
|
|
487
|
+
"team's secret to a host of its own. Type the password itself, or ask a server administrator",
|
|
488
|
+
403, code='role_forbidden', capability=capability, role=getattr(permission, 'role', None))
|
|
489
|
+
|
|
490
|
+
|
|
445
491
|
# --------------------------------------------------------------------------------------
|
|
446
492
|
# Resolving it when a connection is opened
|
|
447
493
|
# --------------------------------------------------------------------------------------
|
|
@@ -11,7 +11,8 @@ import re
|
|
|
11
11
|
|
|
12
12
|
from flask import g, has_request_context
|
|
13
13
|
|
|
14
|
-
from .. import config, duckfiles, engine, masking, metrics, pool, schema, store
|
|
14
|
+
from .. import config, duckfiles, engine, masking, metrics, pool, schema, scope, secretrefs, store
|
|
15
|
+
from ..db import DEFAULT_WORKSPACE
|
|
15
16
|
from ..errors import ApiError
|
|
16
17
|
|
|
17
18
|
# Fields the server owns or computes; never stored from a request.
|
|
@@ -145,6 +146,7 @@ def create(data, actor):
|
|
|
145
146
|
raise ApiError(f"db is required - one of: {', '.join(config.SUPPORTED_DB_TYPES)}", code='invalid_body')
|
|
146
147
|
fields.setdefault('active', True)
|
|
147
148
|
refuse_local_files(fields)
|
|
149
|
+
secretrefs.refuse_member_references(fields)
|
|
148
150
|
store.update_connections({name: fields})
|
|
149
151
|
after = store.read_connections()[name]
|
|
150
152
|
store.record_audit(actor, 'create_connection', name, _masked(name, after))
|
|
@@ -167,6 +169,7 @@ def update(name, data, actor):
|
|
|
167
169
|
if 'password' not in fields and 'password' in before:
|
|
168
170
|
merged['password'] = config.PASSWORD_MASK # keep the stored (possibly encrypted) value as it is
|
|
169
171
|
refuse_local_files(merged, before)
|
|
172
|
+
secretrefs.refuse_member_references(merged, before)
|
|
170
173
|
store.update_connections({name: merged})
|
|
171
174
|
after = store.read_connections()[name]
|
|
172
175
|
changes = audit_changes(before, after)
|
|
@@ -198,7 +201,9 @@ def _probe_details(data):
|
|
|
198
201
|
raise ApiError(f"db must be one of: {', '.join(config.SUPPORTED_DB_TYPES)}", code='invalid_body')
|
|
199
202
|
if fields.get('password') == config.PASSWORD_MASK:
|
|
200
203
|
fields['password'] = store.read_connections().get(name or '', {}).get('password', '')
|
|
201
|
-
|
|
204
|
+
saved = store.read_connections().get(name) if name else None
|
|
205
|
+
refuse_local_files(fields, saved) # a probe opens it too
|
|
206
|
+
secretrefs.refuse_member_references(fields, saved, probe=True) # and sends its secret to the host it names
|
|
202
207
|
return store.resolve_ad_hoc(fields), None
|
|
203
208
|
|
|
204
209
|
|
|
@@ -230,12 +235,16 @@ def databases(data):
|
|
|
230
235
|
|
|
231
236
|
|
|
232
237
|
def deleted():
|
|
233
|
-
"""Every deleted
|
|
234
|
-
deleted-connections store).
|
|
238
|
+
"""Every connection deleted in this workspace, newest first - from the audit log, the only record of one (there is
|
|
239
|
+
no separate deleted-connections store). The log is the whole server's: an entry from before workspaces names none,
|
|
240
|
+
and was the default workspace's."""
|
|
241
|
+
workspace = scope.current()
|
|
235
242
|
out = []
|
|
236
243
|
for entry in reversed(store.read_audit_log()):
|
|
237
244
|
if entry.get('action') != 'delete_connection':
|
|
238
245
|
continue
|
|
246
|
+
if (entry.get('workspace') or DEFAULT_WORKSPACE) != workspace:
|
|
247
|
+
continue
|
|
239
248
|
c = entry.get('changes') or {}
|
|
240
249
|
out.append({'name': entry.get('target'), 'db': c.get('db'), 'host': c.get('host') or None,
|
|
241
250
|
'port': c.get('port') or None, 'database': c.get('database') if isinstance(c.get('database'), str)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
destinations.py holds the rules (validation, the secret, the locked writer); this module gives them the v1 shapes
|
|
4
4
|
and audits every change - with the secret masked, and a changed one recorded only as "changed".
|
|
5
5
|
"""
|
|
6
|
-
from .. import config, destinations, store
|
|
6
|
+
from .. import config, destinations, secretrefs, store
|
|
7
7
|
from .access import _diff, etag # noqa: F401 - etag re-exported for the routes
|
|
8
8
|
|
|
9
9
|
|
|
@@ -55,4 +55,5 @@ def test(name=None, fields=None):
|
|
|
55
55
|
fields = destinations.validate({k: v for k, v in (fields or {}).items() if k != 'name'})
|
|
56
56
|
if fields.get('password') == config.PASSWORD_MASK:
|
|
57
57
|
fields.pop('password')
|
|
58
|
+
secretrefs.refuse_member_references(fields, capability='destinations.write') # a probe writes with its secret
|
|
58
59
|
return destinations.test(fields)
|
|
@@ -7,7 +7,7 @@ whether or not that process is running.
|
|
|
7
7
|
"""
|
|
8
8
|
import socket
|
|
9
9
|
|
|
10
|
-
from .. import apikeys, config, mcp_server
|
|
10
|
+
from .. import apikeys, config, mcp_server, scope
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def status():
|
|
@@ -27,4 +27,4 @@ def tools():
|
|
|
27
27
|
'kind': 'ad-hoc' if t['name'] in mcp_server.RESERVED_TOOL_NAMES else 'saved query',
|
|
28
28
|
'params': sorted(t['inputSchema'].get('properties', {}).keys()),
|
|
29
29
|
'read_only': t['readOnlyHint'],
|
|
30
|
-
} for t in mcp_server.list_tools_for(apikeys.OPEN)]
|
|
30
|
+
} for t in mcp_server.list_tools_for(apikeys.OPEN._replace(workspace=scope.current()))] # this workspace's
|