Repository navigation
Conversation
…olling upgrade A rolling upgrade migrates the database first and replaces the running containers afterwards, so for a while the previous release's code runs against the new schema. scripts/check_migration_safety.py reads the migrations a pull request adds or edits (ast and git only: no Django, no database) and reports each operation that code cannot survive: a dropped or renamed column or table, a NOT NULL column with no database default, a column tightened under values it can still write. The report says how to split the change across releases. The Migration Safety workflow runs it on pull requests that touch a migration. It is advisory: each finding is an annotation on the migration's line and the job stays green. A migration records a deliberate decision with `# migration-safety: ok <rule> (<reason>)`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
This pull request contains multiple critical findings where the user 'rossops' modified numerous sensitive codepaths, including authorization, API, and template files, without being on the allowed authors list.
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/product/admin.py' matches configured sensitive codepath pattern 'dojo/product/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/simple_metrics.html (drs_06a9c6cb)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/simple_metrics.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/view_engineer.html (drs_0c423444)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/view_engineer.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/delete_product_api_scan_configuration.html (drs_0c7ed523)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/delete_product_api_scan_configuration.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/importers/default_reimporter.py (drs_108eacfc)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/importers/default_reimporter.py' matches configured sensitive codepath pattern 'dojo/importers/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/authorization/roles_permissions.py (drs_120eaa17)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/authorization/roles_permissions.py' matches configured sensitive codepath pattern 'dojo/authorization/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/forms.py (drs_240101c4)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/forms.py' matches configured sensitive codepath pattern 'dojo/forms.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/product/models.py (drs_24b71174)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/product/models.py' matches configured sensitive codepath pattern 'dojo/product/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/importers/base_importer.py (drs_318e9877)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/importers/base_importer.py' matches configured sensitive codepath pattern 'dojo/importers/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/dashboard-metrics.html (drs_4743c89c)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/dashboard-metrics.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/search/views.py (drs_48f6d88e)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/search/views.py' matches configured sensitive codepath pattern 'dojo/search/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/tool_config/factory.py (drs_499742eb)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/tool_config/factory.py' matches configured sensitive codepath pattern 'dojo/tool_config/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/importers/default_importer.py (drs_59c32f9b)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/importers/default_importer.py' matches configured sensitive codepath pattern 'dojo/importers/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/product.html (drs_5d7ea671)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/product.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/finding/helper.py (drs_663d4ba6)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/finding/helper.py' matches configured sensitive codepath pattern 'dojo/finding/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/view_product_api_scan_configurations.html (drs_677190e9)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/view_product_api_scan_configurations.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/edit_product_api_scan_configuration.html (drs_69b8a903)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/edit_product_api_scan_configuration.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/authorization/authorization.py (drs_6a0883c5)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/authorization/authorization.py' matches configured sensitive codepath pattern 'dojo/authorization/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/product/queries.py (drs_6d91ef23)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/product/queries.py' matches configured sensitive codepath pattern 'dojo/product/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/base.html (drs_74a789ac)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/base.html' matches configured sensitive codepath pattern 'dojo/templates/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/simple_search.html (drs_78eafa07)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/simple_search.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/authorization/query_registrations.py (drs_7cbe46d3)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/authorization/query_registrations.py' matches configured sensitive codepath pattern 'dojo/authorization/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/view_product_details.html (drs_809faf8c)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/view_product_details.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/importers/options.py (drs_82e0b7a0)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/importers/options.py' matches configured sensitive codepath pattern 'dojo/importers/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/authorization/url_permissions.py (drs_975470bd)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/authorization/url_permissions.py' matches configured sensitive codepath pattern 'dojo/authorization/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/db_migrations/0317_remove_api_scan_configuration.py (drs_980b4361)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/db_migrations/0317_remove_api_scan_configuration.py' matches configured sensitive codepath pattern 'dojo/db_migrations/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/pt_counts.html (drs_9880cfa9)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/pt_counts.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/authorization/api_permissions.py (drs_a327e5f1)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/authorization/api_permissions.py' matches configured sensitive codepath pattern 'dojo/authorization/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/metrics/views.py (drs_a5f16a18)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/metrics/views.py' matches configured sensitive codepath pattern 'dojo/metrics/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/test/models.py (drs_b21b742b)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/test/models.py' matches configured sensitive codepath pattern 'dojo/test/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/filters.py (drs_b5e1395d)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/filters.py' matches configured sensitive codepath pattern 'dojo/filters.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/view_test.html (drs_ba6c30fa)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/view_test.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/metrics.html (drs_bac86e90)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/metrics.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/models.py (drs_c4dcbb90)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/models.py' matches configured sensitive codepath pattern 'dojo/models.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/api_v2/prefetch/registrations.py (drs_ce6e25dd)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/api_v2/prefetch/registrations.py' matches configured sensitive codepath pattern 'dojo/api_v2/**/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/templates/dojo/add_product_api_scan_configuration.html (drs_d7d14072)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/templates/dojo/add_product_api_scan_configuration.html' matches configured sensitive codepath pattern 'dojo/templates/**/*.html' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/api_v2/serializers.py (drs_f6d9df2b)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/api_v2/serializers.py' matches configured sensitive codepath pattern 'dojo/api_v2/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/api_v2/views.py (drs_fd60950a)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/api_v2/views.py' matches configured sensitive codepath pattern 'dojo/api_v2/*.py' and was modified by 'rossops' (commit 53a85b1) who is not in the allowed authors list. |
We've notified @mtesauro.
Comment to provide feedback on these findings.
Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]
Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing
All finding details can be found in the DryRun Security Dashboard.
…ledgements The check read hand-written SQL too loosely. A DO block was dropped as if it were a function body, so a column or table drop inside one came out additive. A drop without the word COLUMN was missed, NOT NULL was lost behind the comma in numeric(10,2), and adding a column with a default and then dropping the default by hand passed, though that is the sequence not-null-add exists for. All four are read now. An acknowledgement covered every operation of its rule in the file, so a comment written for one column also covered the next one added to the same migration. It now covers the operation on the next line of code and nothing else, and one that covers nothing is reported. --annotate-on puts the annotations on another file, for a caller that checks migrations its own pull request does not hold. The real-history test now reaches the rules for added and altered fields, and the workflow header says the verdict can go stale in both directions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A rolling upgrade migrates the database first and replaces the running containers afterwards. For a while the previous release's code runs against the new schema. A migration that drops a column that code still selects, or adds a NOT NULL column its INSERTs don't name, breaks it for that window.
This adds a check that reads the migrations a PR adds or edits and says whether each one is additive, meaning the previous release can't tell the difference. When one isn't, the report says how to split the change across releases.
It only advises. The job stays green. Each finding is an annotation on the migration's line in the diff, and the run summary lists every migration with its verdict.
How it works:
scripts/check_migration_safety.pyneedsastandgitonly. No Django, no database, about a second.origin/master. A table or column that no migration on master created is unknown to running code, so anything may be done to it.column-drop,table-drop,column-rename,table-rename,not-null-add,set-not-null,type-narrowing.CONCURRENTLY, a constraint or type change that scans the table.# migration-safety: ok <rule> (<reason>). The warning for that one operation becomes a notice that carries the reason.The workflow runs on PRs that touch
dojo/db_migrations/, the script, its tests or the workflow itself. If we ever want a migration that is not additive to fail the job, dropping--advisoryfrom the workflow does that. The job does fail when the check could not run at all, a missing git ref for example.Test results
python3 -m unittest unittests.test_migration_safety: 74 tests pass. Sixteen of them build a throwaway git repository and skip where git isn't installed, which is the case in the unit-test image. The workflow runs the file on the runner, where git is, before it runs the check.One of them replays every migration in
dojo/db_migrations, so a shape the reader can't follow shows up as a test failure here and not as a crash on someone's PR.ruff check --config ruff.tomlwith ruff 0.16.10: clean.Run against
0316_system_settings_behaviour_settings, the one migrationdevhas thatmasterdoesn't: additive.Run against throwaway migrations that drop
finding.cweand add a plain index onfinding: the drop is reported ascolumn-dropwith the two-release advice, the index as a caution, and the exit status stays 0 with--advisory.Each of the 318 migrations in
dojo/db_migrations, judged as if it were new on its day, comes out the same before and after the second commit, which widens how hand-written SQL is read (DOblocks, a drop without the wordCOLUMN, a dropped default).The workflow has run on this PR. On the runner all 74 tests ran, none skipped, and the check found no migration in the diff to judge.
Documentation
No docs change. The workflow's header and the script's docstring describe the rules and the acknowledgement comment, and each annotation carries its own advice.
Checklist
dev, six commits behind its tip when opened.dev.🤖 Generated with Claude Code