Repository navigation
Conversation
two reimport-scan requests with auto_create_context and the same test_title could both miss the lookup and each create a test. add AutoCreateContextManager.get_or_create_test(), which locks the parent engagement row and looks for the test again before creating it. the new test is locked for import before the transaction commits, so the request that lost the race waits and then reimports into it.
|
This pull request contains critical security findings because the user 'k0nnect' modified sensitive codepaths in
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/importers/auto_create_context.py' matches configured sensitive codepath pattern 'dojo/importers/*.py' and was modified by 'k0nnect' (commit 758b903) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/api_v2/serializers.py (drs_b58b48c3)
| 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 'k0nnect' (commit 758b903) 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.
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
fixes #16807. two
reimport-scanrequests withauto_create_context=trueand the sametest_titlecould each create their own test when none existed yetget_target_test_if_exists()is a plain read, and on a miss the importer creates the test with nothing in between, so two requests that both miss both create oneAutoCreateContextManager.get_or_create_test(), modelled onget_or_create_engagement(): lock the parent engagement row, look for the test again, and only create it if it's still missingimport-scancreates a new test every time on purposeTest results
reproduced over http on
devwith postgres, firing pairs of simultaneousreimport-scanrequests (same product, engagement andtest_title):new
unittests/test_reimport_auto_create_test_race.py: 5 tests using two threads on separate connections, ordered with a barrier and events rather than sleeps. all 5 fail with the source change reverted and pass with italso ran the existing import / reimport modules (706 tests, 0 failures) with locations on and off. ruff 0.16.10 is clean and
makemigrations --checkreports no changesnot covered here:
auto_import_scanhas the same race. left out to keep this to the reported pathDD_SERIALIZE_TEST_IMPORTS=Falsethe second request isn't held back400 name: Product with this Name already exists. not touched, can open an issue for it if usefulDocumentation
no docs change needed
Checklist
dev.devbranch.