In: Computer Science
Are there specific rules or industry standards for writing security code?
There is no such industrial Standards for writing security codes, firstly because declaring a standard to all security code make it vulnerable even more if someone finds a way around.
Second the security codes are not having anything other then a different application compared to other purpose,
But yes there are some principles which are commonly used by all security Developers like
1. Never Hard Code Login Credentials,it's a common mistake
2. Assignment of Names of Variables, and Files example the Cookies and Cache which is used to manipulate that to get login credentials, so using difficult to crack patterns and keep them changing etc
3. Permission and Authentication of the users and processes one allow on there software.
And there are more and more things one need to keep track, and it keeps adding as per the attacks and there success.
From coding principles yes but that's common for all of them, so if you consider them then yes, but there aren't any specific rules but it does try to prevent exploiting of the systems.