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

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

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

相关标签:
15条回答
  • 2021-02-06 17:35

    This is for web stuff but since you left it open ended...

    JavaScript injection. If you allow any input from any source that's being outputting somewhere JavaScript could be typed in the input and then when it's outputting (unless properly encoded/decoded) it will output the raw javascript.

    0 讨论(0)
  • 2021-02-06 17:38

    Never store plaintext passwords, either. (I can't tell you how many commercial packages I've evaluated for my company which did -- and then acted nonchalant about it when I called them out. My favorite excuse, from a CRM vendor: "Will your end users typically have Enterprise Manager or Query Analyzer on their desktops?")

    0 讨论(0)
  • 2021-02-06 17:40

    In addition to the wonderful guidance on OWASP, also check out the SANS/CWE.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-06 17:43

    OWASP.org keeps a list. Start with the OWASP top ten.

    0 讨论(0)
  • 2021-02-06 17:45

    Others have said this, but...

    Essentially all security vulnerabilities come from data. If your program doesn't process any data it's likely to be secure. It's also likely to be pretty useless :).

    That leads to what I think is the core concept of making code secure:

    Don't trust your data. Ever.

    Sanitize everything you possibly can. You can rely on the security guarantees of your platform (for instance, it's highly unlikely that you'll see a classic string based buffer overflow in a managed language like Java or C#), but otherwise you need to validate everything that comes into your application.

    0 讨论(0)
提交回复
热议问题