{"_id":"5697888bd231880d00676eaf","__v":1,"project":"553aa3050074c80d00621c33","user":"553aac0436d0100d004b35a5","category":{"_id":"569784c469393517000c8315","__v":3,"pages":["569785f869393517000c8319","5697879d8560a60d00e2c2b4","5697888bd231880d00676eaf"],"project":"553aa3050074c80d00621c33","version":"553aa3050074c80d00621c36","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-14T11:21:40.670Z","from_sync":false,"order":3,"slug":"edit-skf-content","title":"Add or edit SKF content"},"version":{"_id":"553aa3050074c80d00621c36","__v":5,"project":"553aa3050074c80d00621c33","createdAt":"2015-04-24T20:09:41.956Z","releaseDate":"2015-04-24T20:09:41.955Z","categories":["553aa3060074c80d00621c37","554dd8d10f31e40d0028e7a2","554ddd802432590d00bd511a","569784c469393517000c8315","569784ce3503e40d0061f40e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-14T11:37:47.504Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"In order to add new code examples to the s.k.f you have to know the build structure of the code examples.\n\nLet's break them up into peaces:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/t2oTIZmFQFixvI00Oekk_AddCodeExampes.png\",\n        \"AddCodeExampes.png\",\n        \"568\",\n        \"43\",\n        \"#098409\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Red:    Identifier, this number must increment.\\nBlue:   Separators, must be used exactly as seen in example, otherwise the checklist engine fails\\nYellow: Checklist type\\nGreen:  code example item name, cannot contain special chars like (&><'\\\") \",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nWhat we want to achieve when presenting the code examples is teaching the developer the defensive programming mindset, so we would like to see the examples do the following things at a minimum:\n\n  1 Sanitising / Type checking / whitelisting of userinput\n  2 Encoding userinput if necessary\n  3 Active logging\n  4 mitigation\n  5 extensive commenting for explaining your steps\n\nThe code examples have some styling rules whenever you want to implement them in your markdown files:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Directory/path traversal <-- name as seen in the drop-down head\\n-------\\n\\n**Example:**            <-- Bold separator telling where the example starts\\n    \\n    /*\\n    Your code has to indent the 4 spaces(tab) in order for the markdown engine       to know it has to interpreted this as written code\\n    */\\n    \",\n      \"language\": \"markdown\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"code-examples-1","type":"basic","title":"Code examples"}
In order to add new code examples to the s.k.f you have to know the build structure of the code examples. Let's break them up into peaces: [block:image] { "images": [ { "image": [ "https://files.readme.io/t2oTIZmFQFixvI00Oekk_AddCodeExampes.png", "AddCodeExampes.png", "568", "43", "#098409", "" ] } ] } [/block] [block:code] { "codes": [ { "code": "Red: Identifier, this number must increment.\nBlue: Separators, must be used exactly as seen in example, otherwise the checklist engine fails\nYellow: Checklist type\nGreen: code example item name, cannot contain special chars like (&><'\") ", "language": "text" } ] } [/block] What we want to achieve when presenting the code examples is teaching the developer the defensive programming mindset, so we would like to see the examples do the following things at a minimum: 1 Sanitising / Type checking / whitelisting of userinput 2 Encoding userinput if necessary 3 Active logging 4 mitigation 5 extensive commenting for explaining your steps The code examples have some styling rules whenever you want to implement them in your markdown files: [block:code] { "codes": [ { "code": "Directory/path traversal <-- name as seen in the drop-down head\n-------\n\n**Example:** <-- Bold separator telling where the example starts\n \n /*\n Your code has to indent the 4 spaces(tab) in order for the markdown engine to know it has to interpreted this as written code\n */\n ", "language": "markdown" } ] } [/block]