<p>Regarding Agile development, what are the best practices for testing security per release?</p>

<p>If it is a monthly release, are there shops doing pen-tests every month?</p>

[{'answer_id': 2596, 'author': 'pix0r', 'author_id': 72, 'author_profile': 'https://Stackoverflow.com/users/72', 'pm_score': 1, 'selected': False, 'text': "<p>I'm no expert on Agile development, but I would imagine that integrating some basic automated pen-test software into your build cycle would be a good start.  I have seen several software packages out there that will do basic testing and are well suited for automation.</p>\n"}, {'answer_id': 2620, 'author': 'dlinsin', 'author_id': 198, 'author_profile': 'https://Stackoverflow.com/users/198', 'pm_score': 1, 'selected': False, 'text': "<p>I'm not a security expert, but I think the most important fact you should be aware of, before testing security, is what you are trying to protect. Only if you know what you are trying to protect, you can do a proper analysis of your security measures and only then you can start testing those implemented measures.</p>\n\n<p>Very abstract, I know. However, I think it should be the first step of every security audit.</p>\n"}, {'answer_id': 14109, 'author': 'MrValdez', 'author_id': 1599, 'author_profile': 'https://Stackoverflow.com/users/1599', 'pm_score': 1, 'selected': False, 'text': '<p><a href="https://stackoverflow.com/questions/1383/what-is-unit-testing">Unit testing</a>, <a href="http://en.wikipedia.org/wiki/Defensive_programming" rel="nofollow noreferrer">Defense Programming</a> and lots of logs</p>\n\n<p><strong>Unit testing</strong></p>\n\n<p>Make sure you unit test as early as possible (e.g. the password should be encrypted before sending, the SSL tunnel is working, etc). This would prevent your programmers from accidentally making the program insecure.</p>\n\n<p><strong>Defense Programming</strong></p>\n\n<p>I personally call this the Paranoid Programming but Wikipedia is never wrong (<em>sarcasm</em>). Basically, you add tests to your functions that checks all the inputs:</p>\n\n<ul>\n<li>is the user\'s cookies valid?</li>\n<li>is he still currently logged in?</li>\n<li>are the function\'s parameters protected against SQL injection? (even though you know that the input are generated by your own functions, you will test anyway)</li>\n</ul>\n\n<p><strong>Logging</strong></p>\n\n<p>Log everything like crazy. Its easier to remove logs then to add them. A user have logged in? Log it. A user found a 404? Log it. The admin edited/deleted a post? Log it. Someone was able to access a restricted page? Log it.</p>\n\n<p>Don\'t be surprised if your log file reaches 15+ Mb during your development phase. During beta, you can decide which logs to remove. If you want, you can add a flag to decide when a certain event is logged.</p>\n'}, {'answer_id': 55351, 'author': 'tqbf', 'author_id': 5674, 'author_profile': 'https://Stackoverflow.com/users/5674', 'pm_score': 2, 'selected': False, 'text': '<p>What\'s your application domain? It depends. </p>\n\n<p>Since you used the word "Agile", I\'m guessing it\'s a web app. I have a nice easy answer for you. </p>\n\n<p>Go buy a copy of Burp Suite (it\'s the #1 Google result for "burp" --- a sure endorsement!); it\'ll cost you 99EU, or ~$180USD, or $98 Obama Dollars if you wait until November. </p>\n\n<p>Burp works as a web proxy. You browse through your web app using Firefox or IE or whatever, and it collects all the hits you generate. These hits get fed to a feature called "Intruder", which is a web fuzzer. Intruder will figure out all the parameters you provide to each one of your query handlers. It will then try crazy values for each parameter, including SQL, filesystem, and HTML metacharacters. On a typical complex form post, this is going to generate about 1500 hits, which you\'ll look through to identify scary --- or, more importantly in an Agile context, new --- error responses.</p>\n\n<p>Fuzzing every query handler in your web app at each release iteration is the #1 thing you can do to improve application security without instituting a formal "SDLC" and adding headcount. Beyond that, review your code for the major web app security hot spots:</p>\n\n<ul>\n<li><p>Use only parameterized prepared SQL statements; don\'t ever simply concatenate strings and feed them to your database handle.</p></li>\n<li><p>Filter all inputs to a white list of known good characters (alnum, basic punctuation), and, more importantly, output filter data from your query results to "neutralize" HTML metacharacters to HTML entities (quot, lt, gt, etc). </p></li>\n<li><p>Use long random hard-to-guess identifiers anywhere you\'re currently using simple integer row IDs in query parameters, and make sure user X can\'t see user Y\'s data just by guessing those identifiers.</p></li>\n<li><p>Test every query handler in your application to ensure that they function only when a valid, logged-on session cookie is presented.</p></li>\n<li><p>Turn on the XSRF protection in your web stack, which will generate hidden form token parameters on all your rendered forms, to prevent attackers from creating malicious links that will submit forms for unsuspecting users.</p></li>\n<li><p>Use bcrypt --- and nothing else --- to store hashed passwords.</p></li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/2447', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']