File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
lib/semmle/python/frameworks
test/library-tests/frameworks/django-orm/testapp Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -865,6 +865,15 @@ module PrivateDjango {
865
865
)
866
866
)
867
867
or
868
+ // attribute store in `<Model>.objects.[<QuerySet>].update()` -> synthetic
869
+ // see https://docs.djangoproject.com/en/4.0/ref/models/querysets/#update
870
+ exists ( DataFlow:: CallCfgNode call , API:: Node modelClass , string fieldName |
871
+ call = [ manager ( modelClass ) , querySet ( modelClass ) ] .getMember ( "update" ) .getACall ( ) and
872
+ nodeFrom = call .getArgByName ( fieldName ) and
873
+ c .( DataFlow:: AttributeContent ) .getAttribute ( ) = fieldName and
874
+ nodeTo .( SyntheticDjangoOrmModelNode ) .getModelClass ( ) = modelClass
875
+ )
876
+ or
868
877
// synthetic -> method-call that returns collection of ORM models (all/filter/...)
869
878
exists ( API:: Node modelClass |
870
879
nodeFrom .( SyntheticDjangoOrmModelNode ) .getModelClass ( ) = modelClass and
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ def test_save8_store():
169
169
170
170
def test_save8_load ():
171
171
obj = TestSave8 .objects .first ()
172
- SINK (obj .text ) # $ MISSING: flow
172
+ SINK (obj .text ) # $ flow="SOURCE, l:-4 -> obj.text"
173
173
174
174
# --------------------------------------
175
175
# .save() on foreign key field
You can’t perform that action at this time.
0 commit comments