-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database design #5
Comments
I think it'd be a good idea to add a |
Also, for the references, it may be better if In addition, caps in the keys seem weird, it'd be more consistent if we use lowercases for everything and underscores only instead of mixing |
Added severity to the JSON format by updating the issue |
Changed all to lower case with underscores |
Changed desc to title, I don't believe we need desc+title for references, IMHO with title it's enough, but if you guys believe we should have both, we can add "desc" |
A few more suggestions, maybe rename {
"fix": {
"guidance": "Blah blah",
"effort": 50
}
} So that we can keep a coherent relationship between the fields. |
Why not use yaml? Yaml has multiline support, and you could probably even use yaml-frontmatter format as well. For eg, at backdoor, we store the challenge information in yaml as follows: ---
tags:
- binary
- medium
creator: vampire
score: '70'
title: 'Hidden Flag - Medium'
flag: This is the flag
---
n00b became depressed when 'Pro' found the flag in his binary in a matter of seconds.
This time he hid the flag a little more securely.
See if you can still find it: [file](http://hack.bckdr.in/HIDE-MEDIUM/hide_medium) The lower portion is in markdown, and any such files render with the metadata in github perfectly. |
@Zapotek Agreed on the fix stuff, added to spec in issue text |
@captn3m0 I like yaml, i'm 100% sure it can be used to store our database and solves the multi-line issue that json has. Anything else we need to know about yaml? Any other extra feature we might take into account to consider migrating to that format? |
Well, some YAML parsers aren't really safe (looking at Ruby). |
@andresriancho If references only need a URL and a title we can use the URL as the key and the title as the value like in Arachni. And better make the title mandatory I think. |
Agreed on the mandatory title (changed) but don't agree on the URL as key, this: "references": [
{"url": "http://foo.com/xss", "title": "First reference to XSS vulnerability"},
] is more readable for humans than: "references": [
{"http://foo.com/xss": "First reference to XSS vulnerability"},
] And we want humans editing these JSON files easily, quickly, without second-doubting what they should enter in each section/field |
PS: Also added the tags which were present in the arachni json files |
Other than this (and the high readability), I cant think of any other benefits. |
To accommodate fix guidance for different programming languages: "fix": {
"guidance": "A very long text explaining how to fix XSS vulnerabilities",
"effort": 50
}, Or "fix": {
"guidance": {"general": "A very long text explaining how to fix XSS vulnerabilities in general",
"django": "Change the view / template code using django stuff"}
"effort": 50
}, |
Maybe the good way is to put guidance for different languages in different files, like you already described for languages support? |
I believe that would just complicate things and make it difficult to find the right file to edit 👎 for me. |
Usually, languages have json support out of the box ( "encoding/json" in Go or "json" in Python) and don't have yaml. |
👎 for yaml then |
I want to specify:
|
Yes, I set it to an arbitrary 30 chars, but if you see it's too low set it to more.
Title feel like 4-255 |
If we gonna use "fix": {
"guidance": {"general": "A very long text explaining how to fix XSS vulnerabilities in general",
"django": "Change the view / template code using django stuff"}
"effort": 50
}, than effort also depends on different programming languages/cms/frameworks |
Well, the effort is the aprox number of minutes required to fix the issue, I doubt that fixing a vuln in django takes 1 minute and then it will take 38 in php. We could either:
I'm +0 on this, you take the decision and let me know how it goes. |
What do you think if we add index file for search purpose? {
"tags": {
"tag_name1": [1, 2], // array of vulnerabilities ids for the tag
}
// ...
} The file might be generated automatically. |
Might be useful, please create a different ticket for it |
JSON backend
All the data should be stored in individual JSON files, one for each vulnerability. These files should be stored in
db/
and the name should be<vuln-id>-<vulnerability-name>.json
, where<vuln-id>
is a unique ID (integer) that we'll use to reference/find the vulnerabilities and the<vulnerability-name>
is a human readable name to make it easier for us to find a vulnerability in the output of an "ls" command. The vulnerability name should be dash separated. Examples:1-cross-site-scripting.json
2-sql-injection.json
3-missing-hsts-header.json
JSON files should look similar to this example:
Notes about the JSON file:
Long strings in JSON
JSON has an awful limitation: "No multi-line strings". In our case this is very limiting since we don't want to have awfully long lines in these sections:
So, the parser should check if the
description
andsolution
fields are strings or arrays. If they are arrays, the contents of the array should be joined using an empty space. For example:Will be parsed as
A very long description for Cross-Site Scripting which has more than one line
and then if the user wants to enter new lines, he needs to do so explicitly:Will be parsed as:
Translations
One of the cool things about this architecture is that it will allow us to easily add translations. Just adding a new set of JSON files (keeping the vulnerability IDs) would work.
Implementation details:
db/
LANG
is used for setting the languageLANG
then the English version is useddb/ru/
,db/es/
, etc.And then the Russian translation file (for the same vulnerability id) says:
And if the
LANG
environment variable is set to Russian then the python/ruby/go wrapper should returnCross-Site Scripting in Russian
as the title for this vulnerability. Any field from the main JSON file can be overridden (for example you can override a link to wikipedia to point to the XSS description in Russian).Content
We'll use the content already created for the Arachni scanner, gently contributed to vulndb/data by Tasos.
Unittesting
tests/
directoryseverity
field is one ofhigh
,medium
,low
,informational
url
andtitle
fields, and that they are not emptyhttp://owasp.org/foo/<id>
, the URL is valid, site is online, not 404fix_effort
value is in the right formatReferences
andresriancho/w3af#53
The text was updated successfully, but these errors were encountered: