logoalt Hacker News

1718627440yesterday at 10:11 AM1 replyview on HN

Idiomatic Python often branches on getattr to implement the interface and that is really hard to analyze from the outside.


Replies

woodruffwyesterday at 4:21 PM

I wouldn’t say that’s particularly idiomatic in modern Python. But even when it occurs, it’s not the end of the world: if it’s a computed getattr, you consider the parent object tainted for the purpose of reachability. This is less precise, but it’s equivalent to what the programmer has expressed (and is still more precise than flagging the entire codebase as vulnerable because it uses a dependency.)