Web APIs for Django. 🎸
This report summarizes scanner evidence for encode/django-rest-framework, a Python project with 30,200 GitHub stars. SynthScan examined 67,248 lines of code across 307 source files, recording 1100 pattern matches distributed across 18 syntactic categories. The legacy adjusted pattern signal is 18.4 (Elevated pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Can maintainers explain intent, assumptions, and trade-offs? 1024 finding(s).
Are imports declared and package/API names verified? 30 finding(s).
Are wrappers, guards, and repeated structures necessary? 1030 finding(s).
Which changes need focused human review? 1100 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 1100 distinct pattern matches across 18 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/test_utils.py | 87 | def test_resource_root_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 93 | def test_resource_instance_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 101 | def test_resource_instance_customname_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 109 | def test_nested_resource_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 118 | def test_nested_resource_instance_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 128 | def test_broken_url_breadcrumbs_handled_gracefully(self): | CODE |
| LOW⚡ | tests/test_utils.py | 132 | def test_modelviewset_resource_instance_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 140 | def test_modelviewset_list_action_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 148 | def test_modelviewset_detail_action_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 157 | def test_modelviewset_action_name_kwarg(self): | CODE |
| LOW⚡ | tests/test_utils.py | 166 | def test_modelviewset_action_suffix_kwarg(self): | CODE |
| LOW | tests/test_utils.py | 207 | def test_valid_unicode_preserved(self): | CODE |
| LOW | tests/test_utils.py | 217 | def test_valid_unicode_replaced(self): | CODE |
| LOW | tests/test_utils.py | 239 | def test_valid_unicode_removed(self): | CODE |
| LOW | tests/test_utils.py | 258 | def test_it_formats_correctly(self): | CODE |
| LOW | tests/test_pagination.py | 42 | def test_filtered_items_are_paginated(self): | CODE |
| LOW | tests/test_pagination.py | 67 | def test_setting_page_size_over_maximum(self): | CODE |
| LOW | tests/test_pagination.py | 85 | def test_setting_page_size_to_zero(self): | CODE |
| LOW | tests/test_pagination.py | 99 | def test_additional_query_params_are_preserved(self): | CODE |
| LOW | tests/test_pagination.py | 110 | def test_empty_query_params_are_preserved(self): | CODE |
| LOW | tests/test_pagination.py | 263 | def test_get_paginated_response_schema(self): | CODE |
| LOW | tests/test_pagination.py | 407 | def test_pagination_not_applied_if_limit_or_default_limit_not_set(self): | CODE |
| LOW | tests/test_pagination.py | 575 | def test_get_paginated_response_schema(self): | CODE |
| LOW | tests/test_pagination.py | 619 | def test_use_with_ordering_filter(self): | CODE |
| LOW | tests/test_pagination.py | 637 | def test_use_with_ordering_filter_without_ordering_default_value(self): | CODE |
| LOW | tests/test_pagination.py | 724 | def test_cursor_pagination_current_page_empty_forward(self): | CODE |
| LOW | tests/test_pagination.py | 747 | def test_cursor_pagination_current_page_empty_reverse(self): | CODE |
| LOW | tests/test_pagination.py | 770 | def test_cursor_pagination_with_page_size(self): | CODE |
| LOW | tests/test_pagination.py | 782 | def test_cursor_pagination_with_page_size_over_limit(self): | CODE |
| LOW | tests/test_pagination.py | 794 | def test_cursor_pagination_with_page_size_zero(self): | CODE |
| LOW | tests/test_pagination.py | 861 | def test_cursor_pagination_with_page_size_negative(self): | CODE |
| LOW | tests/test_pagination.py | 928 | def test_get_paginated_response_schema(self): | CODE |
| LOW | tests/test_pagination.py | 1105 | def test_get_displayed_page_numbers(): | CODE |
| LOW | tests/test_relations_slug.py | 57 | def test_foreign_key_retrieve(self): | CODE |
| LOW⚡ | tests/test_relations_slug.py | 68 | def test_foreign_key_retrieve_select_related(self): | CODE |
| LOW⚡ | tests/test_relations_slug.py | 74 | def test_reverse_foreign_key_retrieve(self): | CODE |
| LOW⚡ | tests/test_relations_slug.py | 83 | def test_reverse_foreign_key_retrieve_prefetch_related(self): | CODE |
| LOW | tests/test_relations_slug.py | 107 | def test_foreign_key_update_incorrect_type(self): | CODE |
| LOW | tests/test_relations_slug.py | 114 | def test_reverse_foreign_key_update(self): | CODE |
| LOW | tests/test_relations_slug.py | 161 | def test_reverse_foreign_key_create(self): | CODE |
| LOW | tests/test_relations_slug.py | 179 | def test_foreign_key_update_with_invalid_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 198 | def test_foreign_key_retrieve_with_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 208 | def test_foreign_key_create_with_valid_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 227 | def test_foreign_key_create_with_valid_emptystring(self): | CODE |
| LOW | tests/test_relations_slug.py | 251 | def test_foreign_key_update_with_valid_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 269 | def test_foreign_key_update_with_valid_emptystring(self): | CODE |
| LOW | tests/conftest.py | 137 | def pytest_collection_modifyitems(config, items): | CODE |
| LOW⚡ | tests/test_authtoken.py | 91 | def test_token_string_representation(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 94 | def test_validate_raise_error_if_no_credentials_provided(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 98 | def test_whitespace_in_password(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 104 | def test_token_creation_collision_raises_integrity_error(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 112 | def test_key_generated_on_save_when_cleared(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 125 | def test_clearing_key_on_existing_token_raises_integrity_error(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 137 | def test_saving_existing_token_without_changes_does_not_alter_key(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 143 | def test_token_proxy_delete_deletes_the_token(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 149 | def test_token_proxy_delete_deletes_the_token_with_a_receiver_connected(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 179 | def test_token_proxy_queryset_delete_deletes_the_token(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 185 | def test_token_proxy_queryset_delete_leaves_other_tokens_alone(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 193 | def test_token_proxy_queryset_delete_follows_a_filter_across_a_join(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 201 | def test_token_proxy_delete_leaves_other_tokens_alone(self): | CODE |
| 922 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | tests/test_fields.py | 13 | from django.core.exceptions import ValidationError as DjangoValidationError | CODE |
| CRITICAL | rest_framework/fields.py | 16 | from django.core.exceptions import ValidationError as DjangoValidationError | CODE |
| CRITICAL | rest_framework/validators.py | 9 | from django.core.exceptions import FieldError | CODE |
| CRITICAL | rest_framework/serializers.py | 23 | from django.core.exceptions import ValidationError as DjangoValidationError | CODE |
| CRITICAL | rest_framework/generics.py | 4 | from django.core.exceptions import ValidationError | CODE |
| CRITICAL | rest_framework/authtoken/admin.py | 5 | from django.core.exceptions import ValidationError | CODE |
| CRITICAL | …framework/static/rest_framework/js/jquery-3.7.1.min.js | 2 | !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):f | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | runtests.py | 30 | except ValueError: | CODE |
| HIGH | runtests.py | 40 | except ValueError: | CODE |
| HIGH | tests/conftest.py | 112 | except ImportError: | CODE |
| HIGH | rest_framework/metadata.py | 87 | except (exceptions.APIException, PermissionDenied, Http404): | CODE |
| HIGH | rest_framework/fields.py | 1262 | except (ValueError, TypeError): | CODE |
| HIGH | rest_framework/fields.py | 1270 | except (ValueError, TypeError): | CODE |
| HIGH | rest_framework/fields.py | 1325 | except (ValueError, TypeError): | CODE |
| HIGH | rest_framework/fields.py | 1333 | except (ValueError, TypeError): | CODE |
| HIGH | rest_framework/viewsets.py | 212 | except NoReverseMatch: | CODE |
| HIGH | rest_framework/serializers.py | 520 | except SkipField: | CODE |
| HIGH | rest_framework/test.py | 166 | except AttributeError: | CODE |
| HIGH | rest_framework/negotiation.py | 138 | except Exception: | CODE |
| HIGH | rest_framework/utils/breadcrumbs.py | 19 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | tests/test_model_serializer.py | 39 | # --------------------------------- | COMMENT |
| MEDIUM | tests/test_model_serializer.py | 603 | # ------------------------------------ | STRING |
| MEDIUM | tests/test_serializer.py | 22 | # ------------------------------- | COMMENT |
| MEDIUM | tests/test_serializer.py | 62 | # ----------------------------- | COMMENT |
| MEDIUM | tests/test_validators.py | 22 | # --------------------------- | COMMENT |
| MEDIUM | tests/test_validators.py | 222 | # ----------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 1281 | # ---------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 1388 | # ---------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 1427 | # ---------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 1554 | # --------------------------------- | STRING |
| MEDIUM⚡ | tests/test_fields.py | 2797 | # -------------------- | COMMENT |
| MEDIUM⚡ | tests/test_fields.py | 2814 | # -------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 31 | # --------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 126 | # --------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 700 | # ---------------------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 2829 | # -------------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 2855 | # --------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 2867 | # --------------------------- | COMMENT |
| MEDIUM | rest_framework/serializers.py | 87 | # -------------- | COMMENT |
| MEDIUM | rest_framework/serializers.py | 274 | # ----------------------------------- | COMMENT |
| MEDIUM | rest_framework/serializers.py | 835 | # -------------------------------------------- | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_views.py | 29 | CODE | |
| LOW | rest_framework/fields.py | 161 | CODE | |
| LOW | rest_framework/fields.py | 695 | CODE | |
| LOW | rest_framework/fields.py | 833 | CODE | |
| LOW | rest_framework/fields.py | 1194 | CODE | |
| LOW | rest_framework/fields.py | 1249 | CODE | |
| LOW | rest_framework/fields.py | 1315 | CODE | |
| LOW | rest_framework/serializers.py | 1266 | CODE | |
| LOW | rest_framework/serializers.py | 1464 | CODE | |
| LOW | rest_framework/serializers.py | 1503 | CODE | |
| LOW | rest_framework/renderers.py | 179 | CODE | |
| LOW | rest_framework/renderers.py | 558 | CODE | |
| LOW | rest_framework/renderers.py | 778 | CODE | |
| LOW | rest_framework/routers.py | 266 | CODE | |
| LOW | rest_framework/filters.py | 20 | CODE | |
| LOW | rest_framework/filters.py | 84 | CODE | |
| LOW | rest_framework/filters.py | 112 | CODE | |
| LOW | rest_framework/negotiation.py | 43 | CODE | |
| LOW | rest_framework/templatetags/rest_framework.py | 182 | CODE | |
| LOW | rest_framework/utils/encoders.py | 23 | CODE | |
| LOW | rest_framework/utils/representation.py | 70 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 215 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 269 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 338 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 561 | CODE | |
| LOW | rest_framework/schemas/generators.py | 72 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests/test_relations_slug.py | 0 | the emptystring should be interpreted as null in the context of relationships. | STRING |
| HIGH | tests/test_relations_hyperlink.py | 0 | the emptystring should be interpreted as null in the context of relationships. | STRING |
| HIGH | tests/test_relations_pk.py | 0 | the emptystring should be interpreted as null in the context of relationships. | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM⚡ | tests/test_authtoken.py | 113 | # Create a new user for this test to avoid conflicts with setUp token | COMMENT |
| MEDIUM⚡ | tests/test_authtoken.py | 116 | # Create a token without a key - it should generate one automatically | COMMENT |
| MEDIUM | tests/test_model_serializer.py | 941 | # Creating the instance, relationship attributes should be set. | STRING |
| MEDIUM | tests/test_model_serializer.py | 989 | # Creating the instance, relationship attributes should be set. | STRING |
| MEDIUM | rest_framework/serializers.py | 1150 | # Create the serializer field. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/conftest.py | 111 | CODE | |
| LOW | tests/importable/__init__.py | 6 | CODE | |
| LOW | rest_framework/compat.py | 145 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 62 | CODE | |
| LOW | rest_framework/serializers.py | 62 | CODE | |
| LOW | rest_framework/serializers.py | 62 | CODE | |
| LOW | rest_framework/serializers.py | 68 | CODE | |
| LOW | rest_framework/serializers.py | 71 | CODE | |
| LOW | rest_framework/apps.py | 10 | CODE | |
| LOW | rest_framework/schemas/__init__.py | 25 | CODE | |
| LOW | rest_framework/schemas/__init__.py | 26 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_urlpatterns.py | 27 | except Exception: | CODE |
| LOW | tests/test_urlpatterns.py | 43 | except Exception: | CODE |
| LOW | rest_framework/request.py | 368 | except Exception: | CODE |
| LOW | rest_framework/renderers.py | 199 | except Exception: | CODE |
| LOW | rest_framework/negotiation.py | 138 | except Exception: | CODE |
| LOW | rest_framework/views.py | 316 | except Exception: | CODE |
| LOW | rest_framework/views.py | 525 | except Exception as exc: | CODE |
| LOW | rest_framework/utils/breadcrumbs.py | 19 | except Exception: | CODE |
| LOW | rest_framework/schemas/openapi.py | 284 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | README.md | 132 | "email": "admin@example.com", | CODE |
| LOW | tests/schemas/test_openapi.py | 1105 | assert properties['email']['default'] == 'foo@bar.com' | CODE |
| LOW | tests/schemas/views.py | 131 | email = serializers.EmailField(default='foo@bar.com') | CODE |
| LOW | docs/tutorial/quickstart.md | 229 | "email": "admin@example.com", | CODE |
| LOW | docs/tutorial/quickstart.md | 249 | "email": "admin@example.com", | CODE |
| LOW | docs/topics/html-and-forms.md | 111 | style={'placeholder': 'Email', 'autofocus': True} | CODE |
| LOW | docs/topics/html-and-forms.md | 115 | style={'input_type': 'password', 'placeholder': 'Password'} | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | rest_framework/relations.py | 291 | # We include this simply for dependency injection in tests. | COMMENT |
| MEDIUM | rest_framework/views.py | 117 | # Allow dependency injection of other settings to make testing easier. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests/test_fields.py | 2781 | (b'{"a": 1, "3": null, "b": ["some", "list", true, 1.23]}', { | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | docs/tutorial/2-requests-and-responses.md | 20 | return Response(data) # Renders to content type as requested by the client. | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/settings.py | 223 | # Check if present in user settings | COMMENT |
| LOW | rest_framework/decorators.py | 97 | # Check if func is actually a view function (result of APIView.as_view()) | COMMENT |
| LOW | rest_framework/utils/breadcrumbs.py | 22 | # Check if this is a REST framework view, | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/fields.py | 294 | CODE | |
| LOW | rest_framework/schemas/__init__.py | 29 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/serializers.py | 1678 | # Note that we make sure to check `unique_together` both on the | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/serializers.py | 881 | method_name=method_name, | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_fields.py | 68 | def test_function(self): | CODE |