mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Harden installs reachable from the internet without a proxy
- Refuse to start with a placeholder or short SECRET_KEY_BASE (under 32 characters); warn and fail sam:doctor under 64. .env.example no longer ships a placeholder. - First-run setup needs a one-time code printed only in the server log, so only whoever runs the server can create the admin account. - AirTrail: the server resolves the address and connects to exactly that; never the server itself or link-local addresses (cloud metadata); private-network addresses only for admins or hosts in AIRTRAIL_ALLOWED_HOSTS. - Host authorization when APP_HOST is set: APP_HOST, the APP_URL host, ALLOWED_HOSTS, localhost and IP addresses; /up exempt. A blocked name gets a short explanation instead of a blank 403. - docker-compose.direct.yml: HTTPS without a proxy via Thruster's built-in Let's Encrypt (TLS_DOMAIN). - Notes' Markdown no longer allows the unused class attribute. - README, .env.example and the user guide updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
faae719b12
commit
5876c07a1a
20 files changed
+319
-29
No files matched your search
@@ -1,11 +1,20 @@
|
||||
require "test_helper"
|
||||
|
||||
class SetupTest < ActionDispatch::IntegrationTest
|
||||
test "first run creates admin, then setup is closed" do
|
||||
test "first run creates admin with the code from the server log, then setup is closed" do
|
||||
get root_path
|
||||
assert_redirected_to new_setup_path
|
||||
post setup_path, params: { user: { name: "Jane", email_address: "a@b.com", password: "test-password-123", password_confirmation: "test-password-123" } }
|
||||
get new_setup_path
|
||||
assert_select "input[name=setup_code]"
|
||||
admin = { name: "Jane", email_address: "a@b.com", password: "test-password-123", password_confirmation: "test-password-123" }
|
||||
|
||||
post setup_path, params: { user: admin, setup_code: "AAAA-AAAA" }
|
||||
assert_response :unprocessable_entity
|
||||
assert_not User.exists?
|
||||
|
||||
post setup_path, params: { user: admin, setup_code: SetupCode.current.downcase.delete("-") } # forgiving about case and the dash
|
||||
assert_redirected_to root_path
|
||||
assert_not SetupCode.file.exist?, "the code is used up"
|
||||
assert User.last.admin?
|
||||
get new_setup_path
|
||||
assert_redirected_to root_path
|
||||
|
||||
Reference in new issue
Block a user