init_app should fail fast on missing SECRET_KEY and unresolvable campus.auth origin
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- authentication, backend
Research direction
Start in login_manager.py at OAuthLoginManager.init_app, where the session provider and request hook are installed. Read how app.secret_key is accessed and how get_base_url resolves the campus.auth origin; add the proposed boot checks there and run the existing test suite. Done means missing configuration fails during initialization with a useful error, while configured apps and TESTING environments initialize successfully.
Written by the indexing model from the issue text.
Description
flask_campus's login flow depends on two environment facts that currently
surface only at first use, so each consumer app reimplements boot-time
checks locally.
SECRET_KEY—OAuthLoginManager.init_appinstalls the session
provider and the login flow writesflask.session(login_next, OAuth
state). Unset, Flask accepts the app until the session is first used and
dies far from the cause. Worked example: nyjc-computing/campus-profile#60,
implemented per-app in PR nyjc-computing/campus-profile#64 (closed
unmerged in favour of this issue).- campus.auth origin — the
before_requesthook re-resolves the
campus.auth origin on every request, so a missing
CAMPUS_AUTH_URL/CAMPUS_BASE_URL/BASE_URL500s every page, landing
included. Worked example: nyjc-computing/campus-profile#59, implemented
per-app in PR nyjc-computing/campus-profile#66 (closed unmerged in favour
of this issue).
Proposal: enforce in OAuthLoginManager.init_app — the natural
integration point, since it already installs the session provider and
registers the request hook:
- Guard
app.secret_key(Flask instances only; blueprints have none) and
raise with a message naming the variable and a generation snippet
(python -c 'import secrets; print(secrets.token_urlsafe())'). - Eagerly resolve the campus.auth origin once via
campus.common.services.resolve_base_url("campus.auth")— the module is
already imported in login_manager.py (get_base_url), so this is
dependency-clean. The resolver's error message is already good
("set CAMPUS_AUTH_URL, or CAMPUS_BASE_URL / BASE_URL for a gateway
origin"); resolving at init turns per-request 500s into one loud boot
failure. campus-common's TESTING short-circuit keeps test environments
green.
Layering note: keep it narrow — each layer fails fast on what it itself
consumes. campus-common keeps owning resolution semantics; campus_python
already fails at import for its own credentials; app-specific env (e.g.
PUBLIC_URL) stays the app's job. No generic env-schema validator.
Deployment semantics: raising at import is what actually blocks a
Railway deploy — the process dies, the deploy goes red, the old release
keeps serving.
Migration: consumers delete their local boot checks and pin the next
flask-campus release. campus-profile's local implementations (PRs #64/#66
above) are the reference behaviour.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 9m
- Merged PRs (30d)
- 40
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nyjc-computing/flask-campus
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
nyjc-computing/flask-campus#46 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 38/100
nyjc-computing/flask-campus#43 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
nyjc-computing/flask-campus#30 ·
Maintainers usually reply within 1 day
All issues in nyjc-computing/flask-campus
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day