simple-module-hosting 0.0.43__tar.gz → 0.0.45__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.
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/PKG-INFO +5 -5
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/README.md +1 -1
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/pyproject.toml +4 -4
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_api_version.py +3 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_app_boot.py +4 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_deferred_startup.py +2 -0
- simple_module_hosting-0.0.45/simple_module_hosting/_i18n_json.py +28 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_inertia_shared.py +2 -1
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_lifespan.py +2 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_middleware_pipeline.py +8 -2
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_observability.py +2 -2
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_phase_helpers.py +1 -1
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_rate_limit.py +2 -2
- simple_module_hosting-0.0.45/simple_module_hosting/_security_headers.py +149 -0
- simple_module_hosting-0.0.45/simple_module_hosting/_server_timing.py +64 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_settings_registration.py +1 -1
- simple_module_hosting-0.0.45/simple_module_hosting/_table_coverage.py +44 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/assets.py +10 -3
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/bootstrap_settings.py +2 -22
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/maintenance.py +2 -2
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/middleware.py +2 -136
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/migrations.py +37 -2
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/path_matching.py +7 -2
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/permissions.py +29 -5
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_gate.py +2 -2
- simple_module_hosting-0.0.45/tests/test_hosting_api_version_cache.py +10 -0
- simple_module_hosting-0.0.45/tests/test_hosting_catalog_json_cache.py +64 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_csp_nonce.py +37 -5
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_csrf_shared_prop.py +5 -6
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_openapi.py +3 -0
- simple_module_hosting-0.0.45/tests/test_hosting_platform_permissions.py +54 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_public_path_boundaries.py +6 -1
- simple_module_hosting-0.0.45/tests/test_hosting_security_static_headers.py +42 -0
- simple_module_hosting-0.0.45/tests/test_hosting_server_timing.py +70 -0
- simple_module_hosting-0.0.45/tests/test_hosting_table_coverage.py +108 -0
- simple_module_hosting-0.0.45/tests/test_hosting_ui_assets.py +52 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_invalidation_wiring.py +7 -7
- simple_module_hosting-0.0.45/tests/test_migration_script_cache.py +79 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_sqlite_path_anchor.py +9 -10
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/.gitignore +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/LICENSE +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/__init__.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/__main__.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_anonymous.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_body_limit.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_boot_checks.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_cors.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_csp_dynamic.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_db_health.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_dev_boot.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_error_handlers.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_error_negotiation.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_error_page.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_favicon.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_forwarded_host.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_host_services.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_host_settings_support.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_hydrate_step.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_i18n_build.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_i18n_target.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_inertia_setup.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_insecure_transport.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_lease_redis.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_module_routes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_openapi.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_preapp_config.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_process_services.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_project_root.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_rate_limit_keys.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_rate_limit_store.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_registrations.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_request_guard_responses.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_route_access.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_route_guard.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_route_paths.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_secret_key.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_spa_mount.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_tenant.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/app_builder.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/csrf.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/data_compatibility.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/db_options.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/errors.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/health.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/host_cli.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/host_settings.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/i18n_deps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/i18n_manifest.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/i18n_middleware.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/i18n_routes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/inertia_deps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/inertia_utils.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/leases.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/locales/de.json +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/locales/en.json +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/locales/es.json +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/log_sinks.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/logging.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/manifest.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/page_globs.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/pagination.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/public_access.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/py.typed +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/rate_limit_deps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/redirects.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/resource_deps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/sentry.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/sentry_scrub.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/sentry_scrub_text.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/session.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/settings.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/__init__.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/_migration_lock.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/components/ConnectionList.tsx +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/components/StepForm.tsx +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/migrate.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/pages/Wizard.tsx +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/payloads.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/setup_wizard/routes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/shared_props.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/static_files.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/tenancy.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/token_guard.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/ui_locales/de.json +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/ui_locales/en.json +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/ui_locales/es.json +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/_hosting_settings_db.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/_resacc_models.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/_sentry_transport.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/conftest.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_api_error_negotiation.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_app.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_auth_provider_setting.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_boot_config_hardening.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_boot_drift_check.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_branding_head.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_build_time_settings_marked.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_check_migrations.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_check_migrations_expression_note.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_csp_module_sources.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_db_health_check.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_design_packs_wiring.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_diagnostics_state.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_error_page_shared_props.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_error_status_coverage.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_favicon_default.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_forwarded_host.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_grant_sources.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_health.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_home_url_default.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_host_cli.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_host_settings_fields.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_asset_version.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_config_sources.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_cors_api.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_cors_unset.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_csp_providers.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_csrf.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_data_compatibility.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_error_handling_policy.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_error_json_and_session_cookie.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_health_bounded.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_inertia_body_validation.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_inertia_cache.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_inertia_validation_errors.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_lazy_layout_catalogs.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_lease_backends.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_lease_selection.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_lease_timeouts.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_lifespan_cleanup.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_log_sinks.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_migration_target.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_openapi_security.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_pagination_deps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_permissions.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_public_access.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_public_error_page.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_sentry.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_sentry_scrub.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_sentry_scrub_gaps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_hosting_spa_mount_nonce.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_i18n_build_overrides.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_i18n_manifest.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_i18n_manifest_published_target.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_i18n_routes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_i18n_types_cover_installed_modules.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_i18n_ui_namespace.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_inertia_i18n_shared_props.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_inertia_protocol_middleware.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_inertia_shared_providers.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_insecure_transport_warning.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_lifespan_deferred_startup.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_lifespan_order.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_locale_middleware.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_logging.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_maintenance_mode.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_manifest.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_menu_providers_wiring.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_menu_urls_are_canonical.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_merge_host_settings_strict.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_middleware_order.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_migration_listing.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_migration_multihead.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_native_link_prefixes_strip.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_preapp_config.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_preapp_invalid_values.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_preapp_read_failures.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_precompressed_static.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_principal_permissions_claim.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_proxy_headers.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_rate_limit_rules_redis.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_rate_limit_rules_registry.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_rate_limit_store_shared.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_redirects.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_request_guard_auth_parity.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_request_guard_body_limit.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_request_guard_body_limit_middleware_read.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_request_guard_body_limit_started.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_request_guard_rate_limit.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_resource_deps.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_resource_policy_owned.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_resource_policy_parity.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_resource_types_wiring.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_response_compression.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_route_guard.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_route_guard_fastapi_contract.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_route_paths.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_secret_key_bootstrap.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_server_rendered_head.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_session_cookie_secure.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_session_cookie_security.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_session_cookie_window.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_session_vary_dedupe.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_settings_i18n.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_settings_secrets.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_gate.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_gate_single_flight.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_migrate_error_redaction.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_migrate_worker_lock.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_public_routes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_registry.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_setup_routes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_spa_mounts_541.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_static_caching.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_strict_discovery_wiring.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_tenancy_api.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_tenant_middleware.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_tenant_resolver_diagnostic.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_tenant_resolver_types.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_tenant_scope_helpers.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_tenant_source.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_token_guard_effective_route.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_token_route_guard.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_translator_dep.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests/test_view_prefixes.py +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tests-js/hosting_SetupWizard.test.tsx +0 -0
- {simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/tsconfig.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: simple_module_hosting
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.45
|
|
4
4
|
Summary: FastAPI + Inertia.js host runtime for simple_module — app_builder, middleware stack, CLI (sm / simple-module), scaffolding
|
|
5
5
|
Project-URL: Homepage, https://github.com/antosubash/simple_module_python
|
|
6
6
|
Project-URL: Repository, https://github.com/antosubash/simple_module_python
|
|
@@ -26,9 +26,9 @@ Requires-Dist: fastapi<0.163,>=0.140
|
|
|
26
26
|
Requires-Dist: httpx<0.29,>=0.27
|
|
27
27
|
Requires-Dist: itsdangerous<3,>=2.0
|
|
28
28
|
Requires-Dist: jinja2<4,>=3.1
|
|
29
|
-
Requires-Dist: simple-module-core==0.0.
|
|
30
|
-
Requires-Dist: simple-module-db==0.0.
|
|
31
|
-
Requires-Dist: simple-module-inertia==0.0.
|
|
29
|
+
Requires-Dist: simple-module-core==0.0.45
|
|
30
|
+
Requires-Dist: simple-module-db==0.0.45
|
|
31
|
+
Requires-Dist: simple-module-inertia==0.0.45
|
|
32
32
|
Requires-Dist: starlette<2,>=0.44
|
|
33
33
|
Requires-Dist: tomlkit<0.16,>=0.13
|
|
34
34
|
Requires-Dist: uvicorn[standard]<0.55,>=0.34
|
|
@@ -51,7 +51,7 @@ pip install simple_module_hosting
|
|
|
51
51
|
For a new project, most users run the generator instead (shipped by the standalone `simple_module_cli` distribution):
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
uvx --from simple_module_cli smpy new my-app
|
|
54
|
+
uvx --from simple_module_cli@latest smpy new my-app
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
## What it provides
|
|
@@ -11,7 +11,7 @@ pip install simple_module_hosting
|
|
|
11
11
|
For a new project, most users run the generator instead (shipped by the standalone `simple_module_cli` distribution):
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
uvx --from simple_module_cli smpy new my-app
|
|
14
|
+
uvx --from simple_module_cli@latest smpy new my-app
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## What it provides
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "simple_module_hosting"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.45"
|
|
4
4
|
description = "FastAPI + Inertia.js host runtime for simple_module — app_builder, middleware stack, CLI (sm / simple-module), scaffolding"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -29,9 +29,9 @@ dependencies = [
|
|
|
29
29
|
# it directly — out-of-tree hosts have nothing else pulling it in.
|
|
30
30
|
"itsdangerous>=2.0,<3",
|
|
31
31
|
"jinja2>=3.1,<4",
|
|
32
|
-
"simple_module_core==0.0.
|
|
33
|
-
"simple_module_db==0.0.
|
|
34
|
-
"simple_module_inertia==0.0.
|
|
32
|
+
"simple_module_core==0.0.45",
|
|
33
|
+
"simple_module_db==0.0.45",
|
|
34
|
+
"simple_module_inertia==0.0.45",
|
|
35
35
|
"starlette>=0.44,<2",
|
|
36
36
|
"tomlkit>=0.13,<0.16",
|
|
37
37
|
"uvicorn[standard]>=0.34,<0.55",
|
{simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_app_boot.py
RENAMED
|
@@ -13,6 +13,7 @@ from simple_module_core.menu import MenuRegistry
|
|
|
13
13
|
from simple_module_core.permissions import PermissionRegistry
|
|
14
14
|
from simple_module_core.public_routes import PublicRouteRegistry
|
|
15
15
|
from simple_module_db.listeners import register_listeners
|
|
16
|
+
from simple_module_db.query_stats import install_query_stats
|
|
16
17
|
from simple_module_db.session import init_db
|
|
17
18
|
|
|
18
19
|
from simple_module_hosting._db_health import register_database_check
|
|
@@ -93,6 +94,9 @@ def init_database(settings: Settings, health_registry: HealthRegistry):
|
|
|
93
94
|
if not settings.multi_tenant and settings.default_tenant:
|
|
94
95
|
db_state.default_tenant_id = settings.default_tenant
|
|
95
96
|
register_listeners(db_state)
|
|
97
|
+
if settings.is_development:
|
|
98
|
+
# Feeds the development Server-Timing header (query count per request).
|
|
99
|
+
install_query_stats(db_state.engine)
|
|
96
100
|
configure_process_services(settings.redis_url, engine=db_state.engine)
|
|
97
101
|
# The host's own readiness signal, and the only probe-safe check in a
|
|
98
102
|
# default install — module checks reach third parties and are on-demand.
|
|
@@ -11,6 +11,7 @@ from simple_module_core.module_settings import get_module_settings_registry
|
|
|
11
11
|
from simple_module_db.stored_settings import SessionOverrideSource, settings_table_exists
|
|
12
12
|
|
|
13
13
|
from simple_module_hosting._hydrate_step import hydrate_all
|
|
14
|
+
from simple_module_hosting._table_coverage import add_table_coverage
|
|
14
15
|
from simple_module_hosting.data_compatibility import check_data_compatibility
|
|
15
16
|
|
|
16
17
|
logger = logging.getLogger(__name__)
|
|
@@ -52,6 +53,7 @@ async def run_deferred_startup(app: FastAPI) -> None:
|
|
|
52
53
|
pending_checks = getattr(app.state, "deferred_data_compatibility", None)
|
|
53
54
|
if pending_checks:
|
|
54
55
|
await check_data_compatibility(app, pending_checks)
|
|
56
|
+
await add_table_coverage(app, pending_checks)
|
|
55
57
|
app.state.deferred_data_compatibility = []
|
|
56
58
|
deferred = get_deferred_startup(app)
|
|
57
59
|
if not deferred:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Serialized catalogs owned by a registry and replaced with its snapshots."""
|
|
2
|
+
|
|
3
|
+
from weakref import WeakKeyDictionary
|
|
4
|
+
|
|
5
|
+
from simple_module_core.i18n import I18nRegistry
|
|
6
|
+
from simple_module_inertia._json_snapshot import JsonSnapshot
|
|
7
|
+
|
|
8
|
+
_catalogs: WeakKeyDictionary[
|
|
9
|
+
I18nRegistry, dict[tuple[str, bool], tuple[dict[str, str], JsonSnapshot]]
|
|
10
|
+
] = WeakKeyDictionary()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def catalog_json(registry: I18nRegistry, locale: str, *, include_admin: bool) -> JsonSnapshot:
|
|
14
|
+
snapshot = registry.messages_snapshot(locale, include_admin=include_admin)
|
|
15
|
+
try:
|
|
16
|
+
pool = _catalogs.setdefault(registry, {})
|
|
17
|
+
except TypeError:
|
|
18
|
+
# A stub registry (``__slots__``, unhashable dataclass) cannot key a weak
|
|
19
|
+
# dict; serve it uncached rather than fail the request.
|
|
20
|
+
return JsonSnapshot(snapshot)
|
|
21
|
+
key = (locale, include_admin)
|
|
22
|
+
cached = pool.get(key)
|
|
23
|
+
# load() replaces snapshots: identity is the catalog version, without a hash
|
|
24
|
+
# or a walk of the catalog on the request path.
|
|
25
|
+
if cached is None or cached[0] is not snapshot:
|
|
26
|
+
cached = (snapshot, JsonSnapshot(snapshot))
|
|
27
|
+
pool[key] = cached
|
|
28
|
+
return cached[1]
|
|
@@ -15,6 +15,7 @@ from starlette.datastructures import Headers
|
|
|
15
15
|
from starlette.requests import Request
|
|
16
16
|
from starlette.types import Scope
|
|
17
17
|
|
|
18
|
+
from simple_module_hosting._i18n_json import catalog_json
|
|
18
19
|
from simple_module_hosting.csrf import get_csrf_token
|
|
19
20
|
|
|
20
21
|
logger = logging.getLogger(__name__)
|
|
@@ -80,7 +81,7 @@ def build_i18n_block(scope: Scope, request: Request, *, is_authenticated: bool =
|
|
|
80
81
|
"audience": audience,
|
|
81
82
|
"supportedLocales": registry.available_locales(),
|
|
82
83
|
"messages": (
|
|
83
|
-
registry
|
|
84
|
+
catalog_json(registry, locale, include_admin=is_authenticated)
|
|
84
85
|
if send_messages
|
|
85
86
|
else None
|
|
86
87
|
),
|
{simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_lifespan.py
RENAMED
|
@@ -22,6 +22,7 @@ from simple_module_core.app_state import get_migration_status
|
|
|
22
22
|
|
|
23
23
|
from simple_module_hosting._deferred_startup import hydrate_settings_from_db
|
|
24
24
|
from simple_module_hosting._route_guard import guard_included_routers
|
|
25
|
+
from simple_module_hosting._table_coverage import add_table_coverage
|
|
25
26
|
from simple_module_hosting.data_compatibility import check_data_compatibility
|
|
26
27
|
from simple_module_hosting.migrations import migration_status
|
|
27
28
|
from simple_module_hosting.setup_gate import STEP_MIGRATIONS
|
|
@@ -89,6 +90,7 @@ def build_lifespan(modules: Sequence) -> Callable:
|
|
|
89
90
|
migration = app.state.migration
|
|
90
91
|
if migration["is_current"] and migration.get("current_revision") is not None:
|
|
91
92
|
await check_data_compatibility(app, modules)
|
|
93
|
+
await add_table_coverage(app, modules)
|
|
92
94
|
else:
|
|
93
95
|
app.state.deferred_data_compatibility = list(modules)
|
|
94
96
|
|
|
@@ -18,6 +18,7 @@ from simple_module_hosting._cors import CorsMiddleware, host_policy
|
|
|
18
18
|
from simple_module_hosting._forwarded_host import ForwardedHostMiddleware
|
|
19
19
|
from simple_module_hosting._rate_limit import RateLimitMiddleware
|
|
20
20
|
from simple_module_hosting._route_access import API_PREFIX
|
|
21
|
+
from simple_module_hosting._server_timing import ServerTimingMiddleware
|
|
21
22
|
from simple_module_hosting.i18n_middleware import LocaleMiddleware
|
|
22
23
|
from simple_module_hosting.maintenance import MaintenanceMiddleware
|
|
23
24
|
from simple_module_hosting.middleware import (
|
|
@@ -87,8 +88,9 @@ def install_middleware(
|
|
|
87
88
|
|
|
88
89
|
Order matters: last added = first executed. Execution order:
|
|
89
90
|
(ForwardedHost, if trusted_proxy and forwarded_host_allowlist) →
|
|
90
|
-
(ProxyHeaders, if trusted_proxy) → CorrelationId → RequestLogging →
|
|
91
|
-
|
|
91
|
+
(ProxyHeaders, if trusted_proxy) → CorrelationId → RequestLogging →
|
|
92
|
+
(ServerTiming, development only) → CORS → BodyLimit → GZip → Security →
|
|
93
|
+
Session → InertiaMiddleware → [module] →
|
|
92
94
|
(Tenant, if multi_tenant) → Locale → InertiaLayoutData →
|
|
93
95
|
RateLimit → Setup → Maintenance → CommitBeforeResponse.
|
|
94
96
|
"""
|
|
@@ -174,6 +176,10 @@ def install_middleware(
|
|
|
174
176
|
if api_policy is not None:
|
|
175
177
|
cors_registry.add_prefix(API_PREFIX, api_policy)
|
|
176
178
|
app.add_middleware(CorsMiddleware, registry=cors_registry)
|
|
179
|
+
if settings.is_development:
|
|
180
|
+
# Inside RequestLogging, outside everything that does work: its ``app``
|
|
181
|
+
# time covers the whole pipeline and every query the request ran.
|
|
182
|
+
app.add_middleware(ServerTimingMiddleware)
|
|
177
183
|
app.add_middleware(RequestLoggingMiddleware)
|
|
178
184
|
app.add_middleware(CorrelationIdMiddleware)
|
|
179
185
|
if sentry.is_enabled():
|
|
@@ -10,7 +10,7 @@ from starlette.datastructures import Headers, MutableHeaders
|
|
|
10
10
|
from starlette.types import ASGIApp, Message, Receive, Scope, Send
|
|
11
11
|
|
|
12
12
|
from simple_module_hosting.logging import correlation_id
|
|
13
|
-
from simple_module_hosting.path_matching import matches_path
|
|
13
|
+
from simple_module_hosting.path_matching import matches_path, validated_prefixes
|
|
14
14
|
|
|
15
15
|
_LOGGER_NAME = "simple_module.request"
|
|
16
16
|
_request_logger = logging.getLogger(_LOGGER_NAME)
|
|
@@ -22,7 +22,7 @@ _EVENT_REQUEST_COMPLETED = "request.completed"
|
|
|
22
22
|
|
|
23
23
|
# Paths that produce noisy, low-value log entries
|
|
24
24
|
_QUIET_EXACT = ("/health",)
|
|
25
|
-
_QUIET_PREFIXES = ("/health/", "/static/")
|
|
25
|
+
_QUIET_PREFIXES = validated_prefixes("/health/", "/static/")
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class CorrelationIdMiddleware:
|
|
@@ -66,7 +66,7 @@ def attach_public_routes(app: FastAPI, settings: Settings, registry) -> None:
|
|
|
66
66
|
Modules contribute method-aware rules through their ``register_public_routes``
|
|
67
67
|
hook (already applied to *registry* by the caller). This adds the host escape
|
|
68
68
|
hatch — ``SM_AUTH_PUBLIC_PATHS`` prefixes — then exposes the registry at
|
|
69
|
-
``app.state.public_routes``, where ``auth.middleware.AuthMiddleware`` reads it
|
|
69
|
+
``app.state.public_routes``, where ``auth.web.middleware.AuthMiddleware`` reads it
|
|
70
70
|
on every request.
|
|
71
71
|
"""
|
|
72
72
|
# The setup wizard is anonymous by necessity: it is served precisely when
|
{simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/_rate_limit.py
RENAMED
|
@@ -39,7 +39,7 @@ from starlette.types import ASGIApp, Receive, Scope, Send
|
|
|
39
39
|
|
|
40
40
|
from simple_module_hosting._rate_limit_keys import KEY_IP, KEY_USER_OR_IP, rule_bucket, rule_key
|
|
41
41
|
from simple_module_hosting._request_guard_responses import send_guard_response
|
|
42
|
-
from simple_module_hosting.path_matching import matches_path
|
|
42
|
+
from simple_module_hosting.path_matching import matches_path, validated_prefixes
|
|
43
43
|
from simple_module_hosting.public_access import is_public
|
|
44
44
|
|
|
45
45
|
__all__ = ["RateLimitMiddleware"]
|
|
@@ -48,7 +48,7 @@ logger = logging.getLogger("simple_module.request_guard")
|
|
|
48
48
|
|
|
49
49
|
_MESSAGE = "Too many requests. Please slow down and try again shortly."
|
|
50
50
|
_OPERATIONAL_EXACT = ("/health",)
|
|
51
|
-
_OPERATIONAL_PREFIXES = ("/health/", "/static/")
|
|
51
|
+
_OPERATIONAL_PREFIXES = validated_prefixes("/health/", "/static/")
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
class RateLimitMiddleware:
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""Security response headers and per-request CSP nonces."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import secrets
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
from starlette.datastructures import MutableHeaders
|
|
9
|
+
from starlette.types import ASGIApp, Message, Receive, Scope, Send
|
|
10
|
+
|
|
11
|
+
from simple_module_hosting._csp_dynamic import DynamicCsp
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from simple_module_core.csp import CspSourceRegistry
|
|
15
|
+
|
|
16
|
+
_SCOPE_HTTP = "http"
|
|
17
|
+
_MSG_RESPONSE_START = "http.response.start"
|
|
18
|
+
|
|
19
|
+
# Security response header names
|
|
20
|
+
_HEADER_CSP = "Content-Security-Policy"
|
|
21
|
+
_HEADER_HSTS = "Strict-Transport-Security"
|
|
22
|
+
|
|
23
|
+
# Security response header values
|
|
24
|
+
_XCTO_NOSNIFF = "nosniff"
|
|
25
|
+
_XFO_SAMEORIGIN = "SAMEORIGIN"
|
|
26
|
+
# OWASP/MDN now recommend disabling the legacy XSS auditor — older
|
|
27
|
+
# browser implementations introduced reflected-XSS vectors of their own.
|
|
28
|
+
# Production CSP authorizes scripts with a per-request nonce.
|
|
29
|
+
_XXSS_DISABLED = "0"
|
|
30
|
+
_HTTP_NOT_MODIFIED = 304
|
|
31
|
+
_REFERRER_STRICT_ORIGIN = "strict-origin-when-cross-origin"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class SecurityHeadersMiddleware:
|
|
35
|
+
"""Add security headers to every response.
|
|
36
|
+
|
|
37
|
+
``content_security_policy`` and ``strict_transport_security`` accept a
|
|
38
|
+
string to override the defaults, or ``None`` to suppress that header
|
|
39
|
+
(useful in development when Vite's HMR client loads cross-origin scripts,
|
|
40
|
+
or behind plain-HTTP loopbacks where HSTS would lock users out).
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
DEFAULT_CSP = (
|
|
44
|
+
"default-src 'self'; "
|
|
45
|
+
# The request nonce is inserted after static/dynamic sources are merged.
|
|
46
|
+
# 'wasm-unsafe-eval' lets WebAssembly compile (see worker-src below)
|
|
47
|
+
# without re-allowing JavaScript eval.
|
|
48
|
+
"script-src 'self' 'strict-dynamic' 'wasm-unsafe-eval'; "
|
|
49
|
+
"script-src-elem 'self' 'strict-dynamic'; "
|
|
50
|
+
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; "
|
|
51
|
+
"img-src 'self' data: blob:; "
|
|
52
|
+
"font-src 'self' https://fonts.gstatic.com data:; "
|
|
53
|
+
"connect-src 'self'; "
|
|
54
|
+
# Allow blob: workers — MapLibre, comlink, web-tree-sitter and most
|
|
55
|
+
# WASM libs ship their worker as a Blob URL. `child-src` is the
|
|
56
|
+
# legacy fallback some browsers consult before `worker-src`.
|
|
57
|
+
"worker-src 'self' blob:; "
|
|
58
|
+
"child-src 'self' blob:; "
|
|
59
|
+
"frame-ancestors 'self'; "
|
|
60
|
+
"base-uri 'self'; "
|
|
61
|
+
"form-action 'self'"
|
|
62
|
+
)
|
|
63
|
+
_DEFAULT_HSTS = "max-age=31536000; includeSubDomains"
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
def dev_csp(vite_dev_url: str) -> str:
|
|
67
|
+
"""Build a dev CSP that whitelists the Vite dev server.
|
|
68
|
+
|
|
69
|
+
In development the browser fetches ``@vite/client``, ``main.tsx``, and
|
|
70
|
+
React Refresh from the Vite origin (default ``http://localhost:5050``),
|
|
71
|
+
and opens a WebSocket there for HMR. Those fail under the prod CSP,
|
|
72
|
+
so we widen ``script-src*``/``connect-src``/``style-src`` for that
|
|
73
|
+
origin only (including the ``ws://`` equivalent for HMR).
|
|
74
|
+
"""
|
|
75
|
+
ws_url = vite_dev_url.replace("http://", "ws://").replace("https://", "wss://")
|
|
76
|
+
return (
|
|
77
|
+
"default-src 'self'; "
|
|
78
|
+
f"script-src 'self' 'unsafe-inline' 'unsafe-eval' {vite_dev_url}; "
|
|
79
|
+
f"script-src-elem 'self' 'unsafe-inline' {vite_dev_url}; "
|
|
80
|
+
f"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com {vite_dev_url}; "
|
|
81
|
+
"img-src 'self' data: blob:; "
|
|
82
|
+
"font-src 'self' https://fonts.gstatic.com data:; "
|
|
83
|
+
f"connect-src 'self' {vite_dev_url} {ws_url}; "
|
|
84
|
+
"worker-src 'self' blob:; "
|
|
85
|
+
"child-src 'self' blob:; "
|
|
86
|
+
"frame-ancestors 'self'; "
|
|
87
|
+
"base-uri 'self'; "
|
|
88
|
+
"form-action 'self'"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def __init__(
|
|
92
|
+
self,
|
|
93
|
+
app: ASGIApp,
|
|
94
|
+
*,
|
|
95
|
+
content_security_policy: str | None = DEFAULT_CSP,
|
|
96
|
+
strict_transport_security: str | None = _DEFAULT_HSTS,
|
|
97
|
+
csp_registry: CspSourceRegistry | None = None,
|
|
98
|
+
) -> None:
|
|
99
|
+
self.app = app
|
|
100
|
+
self.csp = content_security_policy
|
|
101
|
+
self.hsts = strict_transport_security
|
|
102
|
+
self._static_headers = (
|
|
103
|
+
(b"x-content-type-options", _XCTO_NOSNIFF.encode("latin-1")),
|
|
104
|
+
(b"x-frame-options", _XFO_SAMEORIGIN.encode("latin-1")),
|
|
105
|
+
(b"x-xss-protection", _XXSS_DISABLED.encode("latin-1")),
|
|
106
|
+
(b"referrer-policy", _REFERRER_STRICT_ORIGIN.encode("latin-1")),
|
|
107
|
+
)
|
|
108
|
+
self._static_names = frozenset(name for name, _ in self._static_headers)
|
|
109
|
+
# Providers (settings-driven origins, #434) are evaluated per response;
|
|
110
|
+
# with none, the precomputed string above is the whole story.
|
|
111
|
+
self._dynamic = (
|
|
112
|
+
DynamicCsp(content_security_policy, csp_registry)
|
|
113
|
+
if content_security_policy and csp_registry is not None and csp_registry.providers
|
|
114
|
+
else None
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
118
|
+
if scope["type"] != _SCOPE_HTTP:
|
|
119
|
+
await self.app(scope, receive, send)
|
|
120
|
+
return
|
|
121
|
+
|
|
122
|
+
nonce = secrets.token_urlsafe(16)
|
|
123
|
+
scope.setdefault("state", {})["csp_nonce"] = nonce
|
|
124
|
+
|
|
125
|
+
async def send_with_headers(message: Message) -> None:
|
|
126
|
+
if message["type"] == _MSG_RESPONSE_START:
|
|
127
|
+
# Build a fresh list: the app's own list (or tuple) is never mutated.
|
|
128
|
+
raw = [h for h in message.get("headers", ()) if h[0] not in self._static_names]
|
|
129
|
+
raw.extend(self._static_headers)
|
|
130
|
+
message["headers"] = raw
|
|
131
|
+
headers = MutableHeaders(raw=raw)
|
|
132
|
+
# A 304 refreshes the cached response's headers: a new nonce there
|
|
133
|
+
# would no longer match the cached body, so keep the cached CSP.
|
|
134
|
+
if self.csp and message.get("status") != _HTTP_NOT_MODIFIED:
|
|
135
|
+
# Separate policies intersect, so a response's own policy is
|
|
136
|
+
# kept beside the app policy: it can tighten a page (#870) but
|
|
137
|
+
# never relax default-src or frame-ancestors.
|
|
138
|
+
dyn = self._dynamic
|
|
139
|
+
policy = dyn.policy_for(scope.get("app")) if dyn else self.csp
|
|
140
|
+
policy = policy.replace("'strict-dynamic'", f"'nonce-{nonce}' 'strict-dynamic'")
|
|
141
|
+
if _HEADER_CSP in headers:
|
|
142
|
+
headers.append(_HEADER_CSP, policy)
|
|
143
|
+
else:
|
|
144
|
+
headers[_HEADER_CSP] = policy
|
|
145
|
+
if self.hsts:
|
|
146
|
+
headers[_HEADER_HSTS] = self.hsts
|
|
147
|
+
await send(message)
|
|
148
|
+
|
|
149
|
+
await self.app(scope, receive, send_with_headers)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Development-only ``Server-Timing`` header: request time and SQL statements.
|
|
2
|
+
|
|
3
|
+
Every response in a development host carries::
|
|
4
|
+
|
|
5
|
+
Server-Timing: app;dur=12.4, db;dur=3.1;desc="5 queries"
|
|
6
|
+
|
|
7
|
+
``app`` is the time from this middleware until the response starts (the
|
|
8
|
+
handler, every inner middleware and the commit); ``db`` is the time spent in
|
|
9
|
+
the database driver, and ``desc`` the number of statements. Browsers show both
|
|
10
|
+
in the network panel's Timing tab, and the page-perf audit
|
|
11
|
+
(``skills/simple-module-page-perf``) reads them to flag N+1 pages.
|
|
12
|
+
|
|
13
|
+
Never installed outside development: per-request timings help an attacker
|
|
14
|
+
time lookups (user enumeration, cache probing).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import time
|
|
20
|
+
|
|
21
|
+
from simple_module_db.query_stats import track_queries
|
|
22
|
+
from starlette.datastructures import MutableHeaders
|
|
23
|
+
from starlette.types import ASGIApp, Message, Receive, Scope, Send
|
|
24
|
+
|
|
25
|
+
__all__ = ["SERVER_TIMING_HEADER", "ServerTimingMiddleware", "format_server_timing"]
|
|
26
|
+
|
|
27
|
+
SERVER_TIMING_HEADER = "Server-Timing"
|
|
28
|
+
_SCOPE_HTTP = "http"
|
|
29
|
+
_MSG_RESPONSE_START = "http.response.start"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def format_server_timing(app_seconds: float, db_seconds: float, queries: int) -> str:
|
|
33
|
+
"""Render the header value (durations in milliseconds, one decimal)."""
|
|
34
|
+
noun = "query" if queries == 1 else "queries"
|
|
35
|
+
return (
|
|
36
|
+
f'app;dur={app_seconds * 1000:.1f}, db;dur={db_seconds * 1000:.1f};desc="{queries} {noun}"'
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ServerTimingMiddleware:
|
|
41
|
+
"""Add a ``Server-Timing`` header with app time and SQL statement totals."""
|
|
42
|
+
|
|
43
|
+
def __init__(self, app: ASGIApp) -> None:
|
|
44
|
+
self.app = app
|
|
45
|
+
|
|
46
|
+
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
47
|
+
if scope["type"] != _SCOPE_HTTP:
|
|
48
|
+
await self.app(scope, receive, send)
|
|
49
|
+
return
|
|
50
|
+
|
|
51
|
+
start = time.perf_counter()
|
|
52
|
+
with track_queries() as stats:
|
|
53
|
+
|
|
54
|
+
async def send_with_timing(message: Message) -> None:
|
|
55
|
+
if message["type"] == _MSG_RESPONSE_START:
|
|
56
|
+
MutableHeaders(scope=message).append(
|
|
57
|
+
SERVER_TIMING_HEADER,
|
|
58
|
+
format_server_timing(
|
|
59
|
+
time.perf_counter() - start, stats.seconds, stats.count
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
await send(message)
|
|
63
|
+
|
|
64
|
+
await self.app(scope, receive, send_with_timing)
|
|
@@ -34,7 +34,7 @@ def check_settings_registration(app: FastAPI, modules: list) -> list[Diagnostic]
|
|
|
34
34
|
continue
|
|
35
35
|
# Match the convention actually used by modules: `app.state.<package>`
|
|
36
36
|
# (snake_case package name, e.g. `background_tasks`), which aligns
|
|
37
|
-
# with Settings-module autodiscovery in `settings.
|
|
37
|
+
# with Settings-module autodiscovery in `settings.module_settings.discovery`.
|
|
38
38
|
package = cls.__module__.split(".", 1)[0]
|
|
39
39
|
candidates = (package, mod.meta.name.lower())
|
|
40
40
|
if any(hasattr(app.state, c) for c in candidates):
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""SM011 at a development boot, once the database is open and at head (#895)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
|
|
8
|
+
from fastapi import FastAPI
|
|
9
|
+
from simple_module_core.diagnostics import Diagnostic, print_diagnostics
|
|
10
|
+
from simple_module_core.diagnostics._migration import MigrationDiagnostics, module_table_names
|
|
11
|
+
from simple_module_core.module import ModuleBase
|
|
12
|
+
from sqlalchemy import inspect
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async def add_table_coverage(app: FastAPI, modules: Sequence[ModuleBase]) -> None:
|
|
18
|
+
"""Report module tables the migrated database lacks, and keep them for the Doctor screen.
|
|
19
|
+
|
|
20
|
+
The boot diagnostics run while the app is built, before the database is
|
|
21
|
+
open, so this half runs from the lifespan. Only development keeps a runner;
|
|
22
|
+
wrapping it lets the Doctor screen's ``rerun()`` show the findings again.
|
|
23
|
+
Call it only for a database at every head: behind head, a missing table may
|
|
24
|
+
simply be in a pending revision.
|
|
25
|
+
"""
|
|
26
|
+
state = getattr(app.state.sm, "diagnostics", None)
|
|
27
|
+
runner = state.runner if state is not None else None
|
|
28
|
+
if state is None or runner is None:
|
|
29
|
+
return
|
|
30
|
+
try:
|
|
31
|
+
async with app.state.sm.db.engine.connect() as conn:
|
|
32
|
+
tables = set(await conn.run_sync(lambda sync: inspect(sync).get_table_names()))
|
|
33
|
+
except Exception:
|
|
34
|
+
# A diagnostics-only read must never fail the boot or the wizard's migrations action.
|
|
35
|
+
logger.warning("SM011 table coverage could not be read; skipped", exc_info=True)
|
|
36
|
+
return
|
|
37
|
+
found: list[Diagnostic] = MigrationDiagnostics().check_table_coverage(
|
|
38
|
+
module_table_names(modules), tables
|
|
39
|
+
)
|
|
40
|
+
if not found:
|
|
41
|
+
return
|
|
42
|
+
print_diagnostics(found)
|
|
43
|
+
state.runner = lambda: [*runner(), *found]
|
|
44
|
+
state.results = [*state.results, *found]
|
{simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/assets.py
RENAMED
|
@@ -50,6 +50,7 @@ STYLES_CSS = "styles.css"
|
|
|
50
50
|
PACKAGE_JSON = "package.json"
|
|
51
51
|
PAGES_DIR = "pages"
|
|
52
52
|
COMPONENTS_DIR = "components"
|
|
53
|
+
UI_DIR = "ui"
|
|
53
54
|
|
|
54
55
|
|
|
55
56
|
@dataclass(frozen=True)
|
|
@@ -64,6 +65,7 @@ class ModuleAssets:
|
|
|
64
65
|
styles_css: Path | None
|
|
65
66
|
npm_name: str | None = None
|
|
66
67
|
components_dir: Path | None = None
|
|
68
|
+
ui_dir: Path | None = None
|
|
67
69
|
|
|
68
70
|
|
|
69
71
|
def find_npm_name(pkg_root: Path) -> str | None:
|
|
@@ -120,6 +122,7 @@ def compute_module_assets(modules: Sequence[ModuleBase]) -> list[ModuleAssets]:
|
|
|
120
122
|
continue
|
|
121
123
|
pages_dir = pkg_root / PAGES_DIR
|
|
122
124
|
components_dir = pkg_root / COMPONENTS_DIR
|
|
125
|
+
ui_dir = pkg_root / UI_DIR
|
|
123
126
|
theme = pkg_root / THEME_CSS
|
|
124
127
|
styles = pkg_root / STYLES_CSS
|
|
125
128
|
entry = ModuleAssets(
|
|
@@ -131,8 +134,11 @@ def compute_module_assets(modules: Sequence[ModuleBase]) -> list[ModuleAssets]:
|
|
|
131
134
|
styles_css=styles.resolve() if styles.is_file() else None,
|
|
132
135
|
npm_name=find_npm_name(pkg_root),
|
|
133
136
|
components_dir=components_dir.resolve() if components_dir.is_dir() else None,
|
|
137
|
+
ui_dir=ui_dir.resolve() if ui_dir.is_dir() else None,
|
|
134
138
|
)
|
|
135
|
-
if
|
|
139
|
+
if any(
|
|
140
|
+
(entry.pages_dir, entry.theme_css, entry.styles_css, entry.components_dir, entry.ui_dir)
|
|
141
|
+
):
|
|
136
142
|
result.append(entry)
|
|
137
143
|
return result
|
|
138
144
|
|
|
@@ -206,7 +212,7 @@ def render_modules_css(
|
|
|
206
212
|
``@import`` is emitted for *every* module, in-repo and wheel alike, because
|
|
207
213
|
there is no static-glob equivalent for CSS.
|
|
208
214
|
|
|
209
|
-
|
|
215
|
+
``pages/``, ``ui/`` and legacy ``components/`` are scanned. A wheel module's widgets
|
|
210
216
|
live under ``components/``, and leaving them out meant every host had to
|
|
211
217
|
hand-write a ``@source`` pointing into ``.venv`` — which cannot be written
|
|
212
218
|
portably: POSIX venvs nest under ``lib/python3.x/site-packages`` while
|
|
@@ -225,7 +231,7 @@ def render_modules_css(
|
|
|
225
231
|
source_lines = [
|
|
226
232
|
f'@source "{s.as_posix()}/**/*.{{ts,tsx}}";'
|
|
227
233
|
for e in assets
|
|
228
|
-
for d in (e.pages_dir, e.components_dir)
|
|
234
|
+
for d in (e.pages_dir, e.components_dir, e.ui_dir)
|
|
229
235
|
if d and not in_repo(d)
|
|
230
236
|
for s in _source_dirs(d)
|
|
231
237
|
]
|
|
@@ -270,6 +276,7 @@ def render_assets_json(assets: Sequence[ModuleAssets]) -> str:
|
|
|
270
276
|
"package": e.package_dir.as_posix(),
|
|
271
277
|
"pages": e.pages_dir.as_posix() if e.pages_dir else None,
|
|
272
278
|
"components": e.components_dir.as_posix() if e.components_dir else None,
|
|
279
|
+
"ui": e.ui_dir.as_posix() if e.ui_dir else None,
|
|
273
280
|
"theme": e.theme_css.as_posix() if e.theme_css else None,
|
|
274
281
|
"styles": e.styles_css.as_posix() if e.styles_css else None,
|
|
275
282
|
"npm_name": e.npm_name,
|
|
@@ -22,32 +22,12 @@ from typing import Any
|
|
|
22
22
|
|
|
23
23
|
from pydantic import model_validator
|
|
24
24
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
25
|
-
from simple_module_core.dotenv import find_env_file
|
|
25
|
+
from simple_module_core.dotenv import absolutize_sqlite_url, find_env_file
|
|
26
26
|
from simple_module_core.environments import NON_PROD_ENVIRONMENTS
|
|
27
27
|
|
|
28
28
|
PLACEHOLDER_SECRET_KEY = "change-me-in-production"
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
def _absolutize_sqlite_url(url: str, *, anchor: Path) -> str:
|
|
32
|
-
"""Rewrite a relative sqlite path to an absolute one under ``anchor``.
|
|
33
|
-
|
|
34
|
-
``sqlite+aiosqlite:///./host/app.db`` means "relative to the project
|
|
35
|
-
root" by convention, but SQLAlchemy resolves it against the process cwd
|
|
36
|
-
— correct in the web process (which chdirs) and silently wrong in every
|
|
37
|
-
CLI run from a subdirectory. Absolute paths (``:////...``), ``:memory:``,
|
|
38
|
-
SQLite URI-mode paths (``file:...?uri=true``), and non-sqlite URLs pass
|
|
39
|
-
through untouched.
|
|
40
|
-
"""
|
|
41
|
-
if not url.startswith("sqlite"):
|
|
42
|
-
return url
|
|
43
|
-
scheme, sep, rest = url.partition(":///")
|
|
44
|
-
if not sep or not rest or rest.startswith(("/", ":memory:", "file:")):
|
|
45
|
-
return url
|
|
46
|
-
path_part, query_sep, query = rest.partition("?")
|
|
47
|
-
resolved = (anchor / path_part).resolve()
|
|
48
|
-
return f"{scheme}:///{resolved}{query_sep}{query}"
|
|
49
|
-
|
|
50
|
-
|
|
51
31
|
class BootstrapSettings(BaseSettings):
|
|
52
32
|
"""Pre-DB bootstrap environment knobs."""
|
|
53
33
|
|
|
@@ -77,7 +57,7 @@ class BootstrapSettings(BaseSettings):
|
|
|
77
57
|
anchor = (
|
|
78
58
|
Path(env_file).parent if isinstance(env_file, (str, Path)) else find_env_file().parent
|
|
79
59
|
)
|
|
80
|
-
self.database_url =
|
|
60
|
+
self.database_url = absolutize_sqlite_url(self.database_url, anchor=anchor)
|
|
81
61
|
|
|
82
62
|
database_url: str = "sqlite+aiosqlite:///./app.db"
|
|
83
63
|
|
{simple_module_hosting-0.0.43 → simple_module_hosting-0.0.45}/simple_module_hosting/maintenance.py
RENAMED
|
@@ -20,14 +20,14 @@ from starlette.types import ASGIApp, Receive, Scope, Send
|
|
|
20
20
|
|
|
21
21
|
from simple_module_hosting._error_negotiation import _wants_json
|
|
22
22
|
from simple_module_hosting._error_page import render_error_page
|
|
23
|
-
from simple_module_hosting.path_matching import matches_path
|
|
23
|
+
from simple_module_hosting.path_matching import matches_path, validated_prefixes
|
|
24
24
|
from simple_module_hosting.public_access import is_public
|
|
25
25
|
|
|
26
26
|
# Kept reachable while the gate is closed: liveness probes (so orchestrators
|
|
27
27
|
# do not kill the pod mid-maintenance), static assets and i18n bundles (or the
|
|
28
28
|
# 503 page renders unstyled and untranslated).
|
|
29
29
|
_ALWAYS_OPEN_EXACT = ("/health",)
|
|
30
|
-
_ALWAYS_OPEN_PREFIXES = (
|
|
30
|
+
_ALWAYS_OPEN_PREFIXES = validated_prefixes(
|
|
31
31
|
"/health/",
|
|
32
32
|
"/static/",
|
|
33
33
|
"/i18n/",
|