Repository navigation
Closed
Labels
priority: highHigh prioritytype flag: breaking changeProposed change breaks current APItype: maintenanceRelated to general repository maintenancetype: securityRelated to securityworkload: daysLikely takes days to resolve
Description
Problem
ServerConfigdefaults todebug: Trueonhost: 0.0.0.0(template and examples too), soapp.run()exposes the Werkzeug debugger.enable_cors(foca/security/cors.py) callsCORS(app)with no options:*for every route, nothing configurable.- Dead or misleading options:
access_control.api_routeis documented (README,docs/access_control/README.md) but does not exist;access_control.api_controllersis never applied (the raw spec file is passed toadd_api) and is overwritten increate_app;ServerConfig.environment(ignored by Flask ≥ 2.3) anduse_reloader(never read);SpecConfig.path_out(only logged, plus*.modified.yamlfixtures and anOSErrordocstring);PymongoDirectionEnum(unused). Foca.create_appfills access-control defaults by mutating the parsed config (db_name,collection_name,api_controllersareNonein the model), so consumers needstr(...)casts and repeated calls behave differently.DEFAULT_ACESS_CONTROL_COLLECTION_NAMEis misspelled.create_appandcreate_celery_appduplicate setup.- Smaller issues:
inspect.stack()called twice per factory only for a debug log;importlib.resources.pathused after its context exits;_get_by_pathprivate but imported across modules;store_enum_valuemisnamed;parse_custom_configsplits dotted paths viaPath;merge_yamldocstring says it returnsNone;examples/petstore/petstore_policies.confunused.
Proposal
- Defaults
debug: False; warn at startup ifdebugis on with a non-loopback host; template and examples commentdebugas dev-only. CORSConfig:allow_origins(default["*"]),allow_methods,allow_headers,expose_headers,allow_credentials(defaultFalse),max_age; validation error for credentials with*. Field names match Starlette'sCORSMiddlewarefor Connexion 3.- Remove
api_route(docs),api_controllers,environment,use_reloader,path_out,PymongoDirectionEnumand stale fixtures. - Non-
Nonemodel defaults fordb_name/collection_name; delete the mutation block increate_app; fix the constant name; share a private_create_base_app(). - Fix the smaller issues above (
importlib.resources.files, publicget_by_pathinfoca.utils,rsplit, docstrings, drop stack inspection).
Acceptance criteria
- Default config yields
debug=False; warning test for debug on0.0.0.0. - CORS options are applied (HTTP test checks
Access-Control-Allow-Originfor a configured origin and for*); credentials with*fails validation. - Removed fields fail validation; no references remain in code, docs, template, examples.
-
create_app()called twice on oneFocainstance leavesfoca.confunchanged (test). - Migration note lists every removed or changed key.
Breaking changes
Remove server.environment, server.use_reloader, api.specs[].path_out, security.access_control.api_controllers and api_route from configs; set debug: True explicitly for local development. Custom permissions controllers are selected via operationId in custom api_specs.
Related
Metadata
Metadata
Assignees
Labels
priority: highHigh prioritytype flag: breaking changeProposed change breaks current APItype: maintenanceRelated to general repository maintenancetype: securityRelated to securityworkload: daysLikely takes days to resolve
Activity