Contextual Integrity
Contextual integrity refers to the requirement that a contract maintains its intended state and logic regardless of the environment in which it is executed. When using delegatecall, the context of the caller is imposed on the callee, which can lead to security vulnerabilities if the callee expects a different environment.
Contextual integrity ensures that the code behaves predictably by validating that the msg.sender and msg.value are appropriate for the operation being performed. If a contract is not designed with context awareness, it might allow unauthorized parties to interact with its sensitive functions.
Maintaining this integrity is a primary goal in designing secure modular systems where different contracts interact frequently.