3x-ui/internal
ilyusha 23511108bf
fix(database): keep the SQLite store owner-only (#6390)
* fix(database): keep the SQLite store owner-only

InitDB created the data directory 0755 and let SQLite create x-ui.db
and its -wal/-shm side files under the default umask, so on a stock
install they are world-readable. The store holds client UUIDs, Reality
private keys and the admin password hash, so any local account could
read them.

Create the directory 0700 and chmod the database files to 0600 right
after opening. SQLite gives -wal/-shm the mode of the main file, so
files created later inherit it; existing installs are tightened on the
next start. PostgreSQL deployments are untouched.

Assisted-by: Claude Code:claude-fable-5-1

* fix(database): tolerate chmod failures, keep the dump and install dir owner-only

Review follow-ups. A store the panel cannot chmod (root_squash NFS, a
foreign uid in a container) refused to start, which is worse than the
0644 it had before; log and continue instead, as the backup-directory
cleanup above already does. install.sh reset /etc/x-ui to 0755 right
after the binary created it 0700, so the directory hunk was inert on
real installs; create it 0700 there too. The migrate-db dump in the same
directory is a plaintext copy of the same secrets and was written 0644.

Assisted-by: Claude Code:claude-fable-5-1
2026-09-03 16:37:35 +02:00
..
amneziawg feat(amneziawg): add native AmneziaWG protocol support (#6105) 2026-08-24 02:41:15 +02:00
amneziawgnet fix(hysteria): standard geco share links and persistent uTLS None (#6325) 2026-09-03 16:35:07 +02:00
config v3.7.0 2026-08-24 15:07:15 +02:00
crypto/nodetoken feat(pia): add PIA login-and-add WireGuard outbounds (#6272) 2026-08-22 23:11:06 +02:00
database fix(database): keep the SQLite store owner-only (#6390) 2026-09-03 16:37:35 +02:00
eventbus chore: refresh dependencies, fix Linux tool tasks, modernize Go idioms 2026-07-25 16:08:09 +02:00
logger fix(inbounds): apply runtime changes after the DB commit (#5768) 2026-07-08 22:12:28 +02:00
mtproto fix(mtproto): synchronize child-process lifecycle (#6141) 2026-07-29 20:56:26 +02:00
pia chore(build): bump Go toolchain to 1.27.0 2026-08-23 21:57:03 +02:00
sub fix(hysteria): standard geco share links and persistent uTLS None (#6325) 2026-09-03 16:35:07 +02:00
tunnelmonitor style: adopt golangci-lint v2 and resolve all findings 2026-06-27 15:42:22 +02:00
util fix(hysteria): standard geco share links and persistent uTLS None (#6325) 2026-09-03 16:35:07 +02:00
web fix(sub): randomize fresh panel subscription paths (#6375) 2026-09-03 16:34:37 +02:00
xray feat(amneziawg): add native AmneziaWG protocol support (#6105) 2026-08-24 02:41:15 +02:00