Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e945585
Adding allow list for safe production database export
nishtha-kalra Nov 15, 2025
9811567
Fix indentation in allow_list.yaml
nishtha-kalra Nov 17, 2025
3980665
Updating sump_db.py script
nishtha-kalra Nov 17, 2025
0fe066a
Refactor script so that values for sensitive columns are made null
nishtha-kalra Nov 17, 2025
7fed429
Removing allow_list.yaml
nishtha-kalra Nov 17, 2025
176304d
Refactor dump_db script
nishtha-kalra Nov 18, 2025
12ae1ed
Refactor dump_db script
nishtha-kalra Dec 1, 2025
f3c310e
Make code functional and readable
nishtha-kalra Dec 2, 2025
4f4917a
Rename temp schema and add description
nishtha-kalra Dec 2, 2025
2c84857
Update DEVELOPERS.md with changes in dump_db script
nishtha-kalra Dec 2, 2025
9fb5a75
remove comment
nishtha-kalra Dec 2, 2025
0d3a67e
Rename script and dump
nishtha-kalra Dec 2, 2025
8a653eb
Updating name of script in DEVELOPERS.md
nishtha-kalra Dec 3, 2025
c313c23
Move allowlist_path and out_dir with constants
nishtha-kalra Jan 6, 2026
6d6e0cc
Load sanitised DB by default and keep django_session usable
nishtha-kalra Jan 7, 2026
2128c33
Improve _fake_expression function
nishtha-kalra Jan 7, 2026
880496c
Terminate script when allowlist is not present
nishtha-kalra Jan 7, 2026
831c0b3
Improve sanitised dump cleanup
nishtha-kalra Jan 7, 2026
b443315
Add docstrings for clarity and documentation
nishtha-kalra Jan 7, 2026
1f6b671
Add unit tests for dump_sanitised_db script
nishtha-kalra Jan 8, 2026
24eca16
Removed is_nullable from column metadata
nishtha-kalra Jan 8, 2026
f7cd9ef
More unit tests for dump_sanitised_db script
nishtha-kalra Jan 9, 2026
274bbb7
Add integration tests for dump_sanitised_db script
nishtha-kalra Jan 11, 2026
d6296df
Refactor fake data generation logic to avoid duplication
nishtha-kalra Jan 11, 2026
f4234bf
Move sanitised dump daily job to yearly job
nishtha-kalra Jan 11, 2026
8724385
Refactor script to prevent sql injection
nishtha-kalra Jan 11, 2026
954e2ab
Add document for Sanitised db dump job
nishtha-kalra Jan 11, 2026
aa08fde
Handle missing allowlisted columns
nishtha-kalra Jan 12, 2026
4d257f3
Restore docker db logic to handle temp schema
nishtha-kalra Jan 12, 2026
1539a7c
Remove sanitised dump script from Developers doc
nishtha-kalra Jan 12, 2026
10e54f6
Remove mention of sanitised dump from doc
nishtha-kalra Jan 12, 2026
108730a
Get a list of tables: columns excluded from allowlist
nishtha-kalra Jan 14, 2026
b456179
Update location of get_excluded_columns script
nishtha-kalra Jan 14, 2026
89f8c4f
Adding non sensitive columns fot social_auth_code in allowlist
nishtha-kalra Jan 14, 2026
9fd815a
Improve documentation for dump sanitised db
nishtha-kalra Jan 14, 2026
803f698
Edit note about future of dump_db script
nishtha-kalra Jan 14, 2026
3657891
Add missing info in markdown file
nishtha-kalra Jan 16, 2026
11fb1d6
Keep scrubbed dump sequences in sync to avoid duplicate IDs
nishtha-kalra Jan 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
/.venv/
**/*.egg-info/
__pycache__
/all_columns.txt
/assets/dist
/assets/stats.html
/assets/src/scripts/outputs-viewer/coverage
/coverage
/docker/staticfiles/*
/excluded_columns.txt
/htmlcov
/jobserver.dump
/jobserver.sqlite.zip
node_modules
/releases
/repos
/sanitised_jobserver.dump
/staticfiles
/uploads
/workspaces
Expand Down
10 changes: 9 additions & 1 deletion docker/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,12 @@ restore-db dump="jobserver.dump": clean-volumes db
#!/bin/bash
set -eux
path=$(realpath ../{{ dump }})
docker compose run -v "$path:/tmp/jobserver.dump" --entrypoint bash --rm dev -c "pg_restore --clean --if-exists --no-acl --no-owner -d \$DATABASE_URL /tmp/jobserver.dump"
docker compose run -v "$path:/tmp/jobserver.dump" --entrypoint bash --rm dev -c '
set -eux
pg_restore --clean --if-exists --no-acl --no-owner -d "$DATABASE_URL" /tmp/jobserver.dump
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, documentation: Could use a comment here explaining that if restoring the sanitised dump we need to alter the scratch schema name to public, and a reference to the overview documentation.

has_temp=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name = '\''temp_scrubbed_schema'\''")
if [ "$has_temp" = "1" ]; then
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -c "DROP SCHEMA IF EXISTS public CASCADE"
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -c "ALTER SCHEMA temp_scrubbed_schema RENAME TO public"
fi
'
Loading