@@ -1219,8 +1219,8 @@ def get_flags_using_cohort(cohort: Cohort) -> list[FeatureFlag]:
12191219
12201220def get_insights_using_cohort (cohort : Cohort ) -> QuerySet [Insight ]:
12211221 """Return insights that reference this cohort in their query filters or breakdown."""
1222- # nosemgrep: python.django.security.audit.query-set-extra.avoid-query-set-extra (parameterized via params)
12231222 return (
1223+ # nosemgrep: python.django.security.audit.query-set-extra.avoid-query-set-extra (parameterized via params)
12241224 Insight .objects .filter (
12251225 team_id = cohort .team_id ,
12261226 deleted = False ,
@@ -1239,8 +1239,8 @@ def get_insights_using_cohort(cohort: Cohort) -> QuerySet[Insight]:
12391239
12401240def get_cohorts_using_cohort (cohort : Cohort ) -> QuerySet [Cohort ]:
12411241 """Return other cohorts that include this cohort as criteria."""
1242- # nosemgrep: python.django.security.audit.query-set-extra.avoid-query-set-extra (parameterized via params)
12431242 return (
1243+ # nosemgrep: python.django.security.audit.query-set-extra.avoid-query-set-extra (parameterized via params)
12441244 Cohort .objects .filter (
12451245 team__project_id = cohort .team .project_id ,
12461246 deleted = False ,
@@ -1676,7 +1676,9 @@ def used_in(self, request: request.Request, **kwargs) -> Response:
16761676
16771677 flag_ids = [flag .id for flag in get_flags_using_cohort (cohort )]
16781678 flags_qs = uac .filter_queryset_by_access_level (
1679- FeatureFlag .objects .filter (id__in = flag_ids ), include_all_if_admin = True
1679+ # nosemgrep: idor-lookup-without-team (flag_ids are already team-scoped via get_flags_using_cohort)
1680+ FeatureFlag .objects .filter (id__in = flag_ids ),
1681+ include_all_if_admin = True ,
16801682 ).order_by ("id" )
16811683 flags_data = [{"id" : flag .id , "key" : flag .key , "name" : flag .name } for flag in flags_qs ]
16821684
0 commit comments