Security: sanitize database credentials and IP addresses from files and configs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ab7fcd41d8
commit
ef1ccea0ad
5 files changed
+12
-13
No files matched your search
+1
-1
@@ -12,7 +12,7 @@ services:
|
||||
- PORT=3000
|
||||
- HOSTNAME=0.0.0.0
|
||||
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://edu.mstaut.ir}
|
||||
- DATABASE_URL=${DATABASE_URL:-postgresql://managment_web:hD3H9seTqX1GJMu1mDJBGDYr@insaight-postgres:5432/ManagmentWebSite_Db}
|
||||
- DATABASE_URL=${DATABASE_URL:-postgresql://managment_web:password@insaight-postgres:5432/ManagmentWebSite_Db}
|
||||
# Nginx Proxy Manager: edu.mstaut.ir → http://aut-management-faculty:3000
|
||||
# DB: same Docker network as container `insaight-postgres` (not the public IP).
|
||||
expose:
|
||||
|
||||
+7
-9
@@ -1,12 +1,10 @@
|
||||
# Database (Test)
|
||||
|
||||
> محیط تست — امنیت فعلاً اولویت نیست. این فایل شامل credential اتصال است.
|
||||
# Database
|
||||
|
||||
## وضعیت اتصال
|
||||
|
||||
| مورد | مقدار |
|
||||
|---|---|
|
||||
| وضعیت | متصل و تأییدشده روی `185.36.145.12` (`2026-09-29`) |
|
||||
| وضعیت | متصل و تأییدشده |
|
||||
| Engine | PostgreSQL **16.15** |
|
||||
| Encoding | **UTF8** |
|
||||
| جداول فعلی | ۱۴ جدول داده + `schema_migrations` (فاز A تا H؛ لیست در بخش Schema) |
|
||||
@@ -15,11 +13,11 @@
|
||||
|
||||
| فیلد | مقدار |
|
||||
|---|---|
|
||||
| Host | `185.36.145.12` |
|
||||
| Host | از متغیر محیطی `DATABASE_URL` یا `PGHOST` استفاده شود |
|
||||
| Port | `5432` |
|
||||
| Database | `ManagmentWebSite_Db` |
|
||||
| Username | `managment_web` |
|
||||
| Password | `hD3H9seTqX1GJMu1mDJBGDYr` |
|
||||
| Password | از متغیر محیطی خوانده میشود |
|
||||
| Engine | PostgreSQL 16.15 |
|
||||
| Encoding | UTF8 |
|
||||
|
||||
@@ -28,20 +26,20 @@
|
||||
از **خارج سرور** (لپتاپ / migrate / seed):
|
||||
|
||||
```
|
||||
postgresql://managment_web:hD3H9seTqX1GJMu1mDJBGDYr@185.36.145.12:5432/ManagmentWebSite_Db
|
||||
postgresql://<user>:<password>@<host>:5432/ManagmentWebSite_Db
|
||||
```
|
||||
|
||||
از **داخل Docker** روی همان سرور (کانتینر وب → کانتینر `insaight-postgres` روی `shared_web_network`):
|
||||
|
||||
```
|
||||
postgresql://managment_web:hD3H9seTqX1GJMu1mDJBGDYr@insaight-postgres:5432/ManagmentWebSite_Db
|
||||
postgresql://<user>:<password>@insaight-postgres:5432/ManagmentWebSite_Db
|
||||
```
|
||||
|
||||
برای اپلیکیشن از متغیر محیطی استفاده شود. در `deploy.yml` / `docker-compose.yml` هاست `insaight-postgres` است.
|
||||
|
||||
```env
|
||||
# local (.env.local)
|
||||
DATABASE_URL=postgresql://managment_web:hD3H9seTqX1GJMu1mDJBGDYr@185.36.145.12:5432/ManagmentWebSite_Db
|
||||
DATABASE_URL=postgresql://<user>:<password>@<host>:5432/ManagmentWebSite_Db
|
||||
```
|
||||
|
||||
فایل محلی: `.env.local` (در gitignore است).
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
| 2026-09-22 | D9 — فاز ۱: همه مسیرهای منو/فوتر با mock + polish هوم | بستن ۴۰۴ها؛ بدون DB/پرداخت |
|
||||
| 2026-09-22 | D10 — Design system با توکن CSS + کلاسهای `ds-*` | ظاهر دانشگاهی یکدست؛ حرکت transform/opacity؛ بدون فانتزی؛ همراستا با vercel skill |
|
||||
| 2026-09-22 | D11 — بازسازی ۱:۱ بصری از تم زنده Sloan (فارسی RTL) | استخراج پالت/CTA/IA از mitsloan.mit.edu؛ Program Selector در overlay آکادمیک؛ نامگذاری AUT |
|
||||
| 2026-09-22 | D12 — PostgreSQL تست روی `138.124.117.71`؛ جزئیات در `docs/03-database.md` | محیط تست؛ credential در docs قابلقبول؛ امنیت بعداً |
|
||||
| 2026-09-22 | D12 — PostgreSQL تست؛ جزئیات در `docs/03-database.md` | محیط تست |
|
||||
| 2026-09-29 | D12b — Postgres به `185.36.145.12` منتقل شد (`ManagmentWebSite_Db` / `managment_web`)؛ production deploy هم همان `DATABASE_URL` را میگیرد | سرور مشترک InsAIght |
|
||||
| 2026-09-22 | D13 — پلن کامل توسعه در `docs/04-development-plan.md` (A–H؛ SQL/`pg`؛ ادمین در همان Next) | اجرای مرحلهای با ایجنت بدون حدس معماری؛ ORM اختیاری بعداً |
|
||||
| 2026-09-22 | D14 — Schema و migration با SQL خام + runner سادهٔ `db/migrate.mjs` (نسخهگذاری در `schema_migrations`؛ هر فایل یک تراکنش؛ + `set_updated_at` trigger) | ایدمپوتنت و تکرارپذیر؛ بدون وابستگی ORM در فاز اول |
|
||||
|
||||
@@ -7,7 +7,8 @@ const client = new Client({
|
||||
port: 5432,
|
||||
database: "ManagmentWebSite_Db",
|
||||
user: "managment_web",
|
||||
password: "hD3H9seTqX1GJMu1mDJBGDYr",
|
||||
password: process.env.DB_PASSWORD,
|
||||
|
||||
connectionTimeoutMillis: 20000,
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ const { Pool } = pg;
|
||||
export const pool = new Pool({
|
||||
connectionString:
|
||||
process.env.DATABASE_URL ||
|
||||
"postgresql://managment_web:hD3H9seTqX1GJMu1mDJBGDYr@185.36.145.12:5432/ManagmentWebSite_Db",
|
||||
undefined, // Rely on process.env.DATABASE_URL, or ensure it's set upstream
|
||||
max: 5,
|
||||
idleTimeoutMillis: 30000,
|
||||
connectionTimeoutMillis: 10000,
|
||||
|
||||
Reference in new issue
Block a user