The security module - the first of its type in the UK - will train undergraduates how to avoid classic security problems, such as buffer overflows, which can be exploited by hackers to gain access to systems.
"We realised that there was a gap in teaching programming security. About a third of universities do not have modules on security and those that do teach security of networks, rather than secure coding," said Nick Efford, senior teaching fellow at Leeds University.
Undergraduates will be taught how to analyse the security of code, how to model threats and vulnerabilities, how to fix programs, and the differences between secure and insecure programming languages.
The university, which developed the course with support from Microsoft, believes the module will give its graduates an edge in the jobs market and provide employers with sought-after skills.
Leeds University plans to work with other universities to encourage them to offer similar security courses in the future. It also said it wants to work closely with businesses in developing the course contents.