install-time hook

Code a package runs while it is being installed or built, before you ever import it.

A malicious package runs with your credentials the moment you install it.

In more detail

Installing a source distribution imports its declared build backend and calls hooks such as get_requires_for_build_wheel, running as you with your tokens. Attackers use this step to steal credentials before any import happens.

Example

The course's hook writes a file to disk to prove it; real attacks use this step to steal credentials.

Related terms

Taught in

References