Skip to content

Commit 109c9a8

Browse files
committed
add warning to ignore db files
1 parent 07366b9 commit 109c9a8

File tree

4 files changed

+66
-6
lines changed

4 files changed

+66
-6
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ local_settings.py
6161
db.sqlite3
6262
db.sqlite3-journal
6363

64+
# SQLite databases
65+
*.db
66+
*.db-journal*
67+
*.sqlite
68+
*.sqlite3
69+
6470
# Flask stuff:
6571
instance/
6672
.webassets-cache
@@ -169,4 +175,5 @@ cython_debug/
169175
uv.lock
170176
.python-version
171177

172-
local_test
178+
local_test
179+
crudadmin_data/

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,32 @@ Navigate to `/admin` to access your admin interface with:
131131
- Responsive UI with dark/light themes
132132
- Built-in security features
133133

134+
## ⚠️ Security Notice
135+
136+
**Important for SQLite users:** If you're using SQLite databases (which is the default for CRUDAdmin), make sure to add database files to your `.gitignore`:
137+
138+
```gitignore
139+
# SQLite databases - NEVER commit these to version control
140+
*.db
141+
*.sqlite
142+
*.sqlite3
143+
crudadmin_data/ # CRUDAdmin's default admin database directory
144+
145+
# Also exclude database journals
146+
*.db-journal
147+
*.sqlite3-journal
148+
```
149+
150+
**Why this matters:**
151+
- SQLite databases contain sensitive data including admin credentials, session tokens, and user data
152+
- Committing database files to public repositories exposes this sensitive information
153+
- Database files can become large and are not suitable for version control
154+
155+
**What to commit instead:**
156+
- Database schema/migration files
157+
- Sample data files (with fake/sanitized data)
158+
- Configuration files (with placeholder values)
159+
134160
## Session Backends
135161

136162
### Development (Default)

docs/quick-start.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,25 @@ app = FastAPI(lifespan=lifespan)
133133
app.mount("/admin", admin.app)
134134
```
135135

136-
And you're all done!
136+
## 🔒 Security Setup
137+
138+
**Before committing your code**, ensure your `.gitignore` excludes database files:
139+
140+
```gitignore
141+
# Add these to your .gitignore
142+
*.db
143+
*.sqlite
144+
*.sqlite3
145+
crudadmin_data/
146+
*.db-journal
147+
*.sqlite3-journal
148+
```
149+
150+
This prevents accidentally committing:
151+
- Your admin database with credentials
152+
- Application databases with user data
153+
- Session storage files
154+
- SQLite journal files
137155

138156
## Accessing Your Admin Interface
139157

docs/usage/configuration.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,22 @@ admin = CRUDAdmin(
7676
- **Optional parameters**: All other parameters have sensible defaults and can be omitted
7777
- **Most minimal setup**: `CRUDAdmin(session=get_session, SECRET_KEY="your-key")` uses all defaults
7878

79-
---
79+
!!! warning "Security Best Practices"
80+
**Database Security:** When using SQLite, always add `*.db`, `*.sqlite`, and `crudadmin_data/` to your `.gitignore` to prevent committing sensitive data.
81+
82+
**Production Security:** For production environments, always follow these best practices:
83+
84+
- Use strong, randomly generated secret keys.
85+
- Use environment variables for all sensitive configuration.
86+
- Use a robust session backend like Redis: `uv add "crudadmin[redis]"`
87+
- Enable HTTPS and secure cookies to protect data in transit.
88+
- Set up proper logging and monitoring to detect security events.
8089

81-
## Essential Configuration Parameters
90+
---
8291

83-
### Required Parameters
92+
## Parameter Details
8493

85-
#### `session` (AsyncSession)
94+
### `session` (Callable, required)
8695
Your SQLAlchemy async session factory or callable that returns sessions:
8796

8897
```python

0 commit comments

Comments
 (0)