What are the security concerns I need to consider while coding?

后端 未结 15 1135
栀梦
栀梦 2021-02-06 17:14

I know SQL Injection is one... what are the others...

15条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 17:42

    Simply program defensively. For each function/method/procedure/subroutine consider "What is the expected input? What do I do when the input deviates from that? How can I most easily ensure that the input will not deviate from that." Know your input; know your output. Don't go overboard, but also understand that data in a database might have been compromised. If a particular set of data can be constrained in some particular way then select your data types and variables to play to that. Keep numeric things numeric.

    Whenever I see a String object in a program I facetiously ask "What would happen if this string contained the lyrics to Gilbert and Sullivan songs?" Simple if-else checks and premature return statements at the beginning of a function can prevent that sort of thing from wreaking havoc later.

提交回复
热议问题