Is there a way to programmatically retrieve the wasm module of a canister?

dfx canister info works by retrieving this information through the state tree, see relevant section in the interface spec. This is fine as long as you’re ok retrieving this information “off-chain” but people have been asking for a way to retrieve this “on-chain”, i.e. from canisters through the management call canister_status. This is currently private in the sense that only controllers of the canister can access it, not anyone. Here’s a relevant discussion about this.