Repository navigation
Housekeeping: Passenger/nginx security and config fixes, dev reload, Dependabot - #92
Conversation
…add Dependabot Security - Run Passenger with passenger_app_env production. Development mode enabled friendly error pages, which list the process environment (including DATACITE_API_ADMIN_PASSWORD) when the app fails to start. - Delete the SSH host keys shipped in the public base image so each container generates its own at startup instead of all sharing well-known keys. Fixes - cors.conf: correct add_header syntax; headers were emitted as "Access-Control-Allow-Origin: *: always", which browsers reject. - webapp.conf: drop the location block pointing at a nonexistent middleman build dir so nginx serves viringo/static (e.g. /favicon.ico). - Dev reload: trigger on FLASK_DEBUG (FLASK_ENV is gone from Flask), write the always_restart marker into passenger_restart_dir, remove it on normal starts, stop committing it, and pass FLASK_DEBUG through compose and nginx. Cleanup - Add .github/dependabot.yml (pip, docker, github-actions). - Move factory-boy out of production packages (lockfile otherwise unchanged). - Remove Travis script, obsolete compose version key; update readme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
digitaldogsbody
left a comment
There was a problem hiding this comment.
Tentative approval because some parts are good to go (fixing the broken CORS etc) but I have concerns about whether all of the other changes find a balance between being beneficial (or even necessary) vs adding complexity.
| # Must not be "development": that turns on Passenger's friendly error pages, | ||
| # which show the process environment (including secrets) when the app fails. | ||
| passenger_app_env production; |
There was a problem hiding this comment.
The logic here is sound-ish, but it varies from our usual pattern, which is to leave this as development to make it simpler for local work, and then set the environment variable appropriately for the deployed containers using terraform.
See https://github.com/datacite/mastino/blob/master/prod-eu-west/services/client-api/client-api.json#L29-L32 and https://github.com/datacite/mastino/blob/master/stage/services/client-api/client-api.json#L24-L27
I personally think having the friendly error pages turned on by default when developing locally is a more useful approach than having to remember to explicitly enable them.
There was a problem hiding this comment.
Usually this is the case with how we configure things in mastino. The oai service was not setup this way. I think it better to be defensive with this so that the default is more secure and devs can turn on the dev interface if desired
| case "${FLASK_DEBUG,,}" in | ||
| "" | 0 | false | no) | ||
| # Don't keep restarting because of a file left behind by an earlier dev run. | ||
| rm -f "$RESTART_FILE" | ||
| exit 0 | ||
| ;; | ||
| esac |
There was a problem hiding this comment.
Does this actually happen in practice? If the container has been stopped and restarted with different env variables, I would have expected docker to recreate it, which means the restart file wouldn't exist, right?
There was a problem hiding this comment.
Also, I know this is a not a change from this PR, but why are we creating a whole directory for this file and not just keeping it in /tmp?
There was a problem hiding this comment.
I think your comment is far. This PR was more to align with FLASK_ENV vs FLASK_DEBUG
In production neither would be used, and in dev I think it much more likely we would just rebuild the container.
| passenger_python /home/app/venv/bin/python; | ||
| passenger_app_root /home/app/webapp/; | ||
| # 20_always_restart.sh creates tmp/always_restart.txt here in development. | ||
| passenger_restart_dir /home/app/webapp/tmp; |
There was a problem hiding this comment.
As commented elsewhere, I think we could just use /tmp for this and save ourselves some hassle.
There was a problem hiding this comment.
We can look at this going forward but if i recall, many (any?) users can write to /tmp
whereas to write to /home/app/webapp/tmp they would have to be part of a very small group.
The container is only reachable inside the VPC via the bastion, so per-container host keys aren't worth the known_hosts churn on every deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Third PR of the viringo modernization (after #87 image/deps, #88 CI/CD, #89 CI speed-up).
Security
developmentmode (vendor/docker/00_app_env.conf). That enables Passenger's friendly error pages, which list the process environment when the app fails to start. Reproduced on master: a startup failure returned a 500 page containingDATACITE_API_ADMIN_PASSWORDand its value. Nowproduction; the same failure shows a generic error page.Fixes
Access-Control-Allow-Origin: *: always), so browsers rejected them. Fixedadd_headersyntax. Note: this effectively turns CORS on for the first time (public, read-only endpoint, no credentials).location /block pointing at a nonexistent middleman build dir; nginx now servesviringo/static(/favicon.icowas 404, now 200).viringo/tmpwhilepassenger_restart_diris/home/app/webapp/tmp. Now triggered byFLASK_DEBUG=1 docker compose up(Flask removedFLASK_ENV), the marker lives in the restart dir, is removed on normal starts, and is no longer committed. Edits are picked up within ~10 s (Passenger stat throttle).Cleanup
.github/dependabot.yml: weekly version updates for pip (minor/patch grouped), the Docker base image, and GitHub Actions (grouped).factory-boy(andfaker) out of production packages; viapipenv uninstall, so all other pins are unchanged. A full relock would have bumpedsentry-sdk2 → 3, left for Dependabot.version:; readme uses GitHub Actions badge,docker compose,flask --app viringo run --debug.Testing
PUBLIC_KEYwritten toauthorized_keys, no factory-boy/faker/pytest in the prod venv.docker compose up --no-build+bin/ci.sh): 25/25 tests pass.FLASK_DEBUG=1compose: dev deps installed,app.debugtrue, source edit reloaded; normal start removes the marker.Not included
known_hostson every deploy. Longer term, ECS Exec could replace sshd.pull_reqest.yml.🤖 Generated with Claude Code