Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Writing safe and secure code


Published on

Daniel's presentation at April 9 2019 at FOSS-North.

Published in: Technology
  • My friend sent me a link to to tis site. This awesome company. They wrote my entire research paper for me, and it turned out brilliantly. I highly recommend this service to anyone in my shoes. ⇒ ⇐.
    Are you sure you want to  Yes  No
    Your message goes here
  • Earn Up To $316/day! Easy Writing Jobs from the comfort of home! ➤➤
    Are you sure you want to  Yes  No
    Your message goes here

Writing safe and secure code

  1. 1. Writing safe and secure codeWriting safe and secure code FOSS-North 2019FOSS-North 2019
  2. 2. … in six billion installations across the world My code exists
  3. 3. …… inside devices all of youinside devices all of you here today own and use!here today own and use! My code exists
  4. 4. Write safe codeWrite safe code
  5. 5. Safe code is not a coincidence Doesn’t happen randomly, you need to work on it! You need to care about it! It is about time we all address this topic! Everything I’ll tell you today, you already know!
  6. 6. Writing Help users use your app or APIHelp users use your app or API Defaults!Defaults! Document. Everything and a lot.Document. Everything and a lot. Get rid of warningsGet rid of warnings UseUse commentscomments assert()assert() Release code asRelease code as open sourceopen source
  7. 7. Review All codeAll code shallshall get reviewedget reviewed CodeCode shallshall be easy to readbe easy to read and understandand understand Use theUse the same code stylesame code style everywhereeverywhere Commit message template ochCommit message template och qualityquality Make sure style and templates are followed!Make sure style and templates are followed!
  8. 8. Test! Unit tests System tests Integration tests Test the documentation Manual tests Fixed a bug? Add a test. Or two.
  9. 9. Torment Valgrind, address/UB/integer sanitizersValgrind, address/UB/integer sanitizers Static code analyses (clang, Coverity, lints)Static code analyses (clang, Coverity, lints) FuzzersFuzzers
  10. 10. All that, all the time For every commit For every PR All. The. Time
  11. 11. The curl project >50 builds + test “rounds” per commit Tests code style, indenting etc Thousands of tests per build Builds and tests on tens of platforms 20-25 hours of CI per commit
  12. 12. The curl project’s choice of tools Valgrind Clang address, undefined, signed- integer-overflow sanitizers Clang tidy “torture tests” Scan-build Lgtm codacy Coverity OSS-Fuzz Travis CI Appveyor Cirrus CI Buildbots
  13. 13. The curl project’s policy Fix all warnings (eye roll)Fix all warnings (eye roll) No defects leftNo defects left Use the strictest and most picky optionsUse the strictest and most picky options As many tests as possibleAs many tests as possible Fix security issues as soon as possibleFix security issues as soon as possible
  14. 14. But... That takes a lot of time and is expensive!
  15. 15. Perhaps, but...
  16. 16. Bad things will happen No one is immune, no matter how hard we try! Act immediately Own the problem Fix it Learn from it Otherwise...
  17. 17. CRTTA
  18. 18. Clean code Review Test Torment Act on mistakes
  19. 19. Thank you! @bagder
  20. 20. ““TheThe created economic valuecreated economic value cannot be overstated”cannot be overstated”
  21. 21. License This presentation and its contents are licensed under the Creative Commons Attribution 4.0 license: