CVE-2026-40300: Insecure Dict Denylist Filter

A dictionary from a loop is mutated using a denylist approach (`del dict[key]`) and then appended to a collection. This can leak data if unexpected or new sensitive keys are added to the dictionary over time. Prefer an explicit allowlist approach where a new dictionary is instantiated containing only the explicitly permitted keys.

Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0Python
greprules fetch cve-2026-40300-insecure-dict-denylist-filter --engine opengrep

Description

A dictionary from a loop is mutated using a denylist approach (`del dict[key]`) and then appended to a collection. This can leak data if unexpected or new sensitive keys are added to the dictionary over time. Prefer an explicit allowlist approach where a new dictionary is instantiated containing only the explicitly permitted keys.