Skip to content

Commit f7da1e8

Browse files
authored
Merge pull request #23 from benavlabs/warning-gitignore
Warning gitignore
2 parents 07366b9 + 42ba6c3 commit f7da1e8

File tree

4 files changed

+56
-7
lines changed

4 files changed

+56
-7
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: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
**Documentation**: [https://benavlabs.github.io/crudadmin/](https://benavlabs.github.io/crudadmin/)
3030

31-
> [!WARNING]
31+
> \[!WARNING\]
3232
> CRUDAdmin is still experimental. While actively developed and tested, APIs may change between versions. Upgrade with caution in production environments, always carefuly reading the changelog.
3333
3434
## Features
@@ -131,6 +131,21 @@ Navigate to `/admin` to access your admin interface with:
131131
- Responsive UI with dark/light themes
132132
- Built-in security features
133133

134+
> \[!WARNING\]
135+
> **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` to avoid committing sensitive data like admin credentials and session tokens.
136+
>
137+
> ```gitignore
138+
> # SQLite databases - NEVER commit these to version control
139+
> *.db
140+
> *.sqlite
141+
> *.sqlite3
142+
> crudadmin_data/
143+
>
144+
> # Also exclude database journals
145+
> *.db-journal
146+
> *.sqlite3-journal
147+
> ```
148+
134149
## Session Backends
135150
136151
### 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)