[
  {
    "path": ".dockerignore",
    "content": "*/node_modules\n*.log\n"
  },
  {
    "path": ".github/workflows/main.yml",
    "content": "name: CI\n\non: [push]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n    \n    steps:\n    - uses: actions/checkout@v1\n    - name: Build API Docker Container \n      run: cd $GITHUB_WORKSPACE/api/ && docker build . --file $GITHUB_WORKSPACE/api/Dockerfile --tag we45/threatplaybook-server\n    - name: Test Secret\n      run: echo $DOCKER_LOGIN_USER\n    - name: Build and Push\n      uses: zemuldo/docker-build-push@master\n      env:\n        DOCKER_USERNAME: \"we45\"\n        DOCKER_NAMESPACE: \"we45\"\n        DOCKER_PASSWORD: ${{ secrets.DOCKER_LOGIN_PASS }}\n        REGISTRY_URL: \"docker.io\"\n      with:\n       image_name: \"threatplaybook-server\"\n       image_tag: \"latest\"\n"
  },
  {
    "path": ".gitignore",
    "content": "example/*.html\nexample/*.xml\nexample/*.json\nexample/*.png\nexample/*.txt\nexample/*.mmd\nexample/*.md\nresults/\ntv/\nThreatPlaybook.egg-info/*\ndist/*\nthreat_playbook/ThreatPlaybook.egg-info/dependency_links.txt\nthreat_playbook/ThreatPlaybook.egg-info/entry_points.txt\nthreat_playbook/ThreatPlaybook.egg-info/PKG-INFO\nthreat_playbook/ThreatPlaybook.egg-info/requires.txt\nthreat_playbook/ThreatPlaybook.egg-info/SOURCES.txt\nthreat_playbook/ThreatPlaybook.egg-info/top_level.txt\nvenv3/*\nv1/ThreatPlaybook.egg-info/top_level.txt\nv1/ThreatPlaybook.egg-info/SOURCES.txt\nv1/ThreatPlaybook.egg-info/requires.txt\nv1/ThreatPlaybook.egg-info/PKG-INFO\nv1/ThreatPlaybook.egg-info/entry_points.txt\nv1/ThreatPlaybook.egg-info/dependency_links.txt\nv3/cli/.cred\nv3/cli/schematest.json\nv3/cli/schema.schema\nv3/cli/threat_model_example.json\nv3/cli/case_example.json\nv3/cli/repo_gql.json\nv3/cli/feature_test.json\nv3/api/.env\n.idea/encodings.xml\n*.xml\n*.xml\n.idea/vcs.xml\n.idea/ThreatPlaybook.iml\nv3/api/.env\nv3/api/.env\n.idea/vcs.xml\n.idea/*\nv3/threatplaybook_db/\nv3/robot/test/log.html\nv3/robot/test/report.html\nv3/.DS_Store\nv3/frontend/.DS_Store\n.DS_Store\napi/.env\nthreatplaybook_db/*\nrobot/test/log.html\nrobot/test/report.html\nrobot/test/log.html\nrobot/test/report.html\nrobot/test/log.html\n*.html\nv3/frontend/ThreatPlaybook-Frontend/node_modules/\nv3/frontend/ThreatPlaybook-Frontend/dist/\nv3/frontend/ThreatPlaybook-Frontend/npm-debug.log*\nv3/frontend/ThreatPlaybook-Frontend/yarn-debug.log*\nv3/frontend/ThreatPlaybook-Frontend/yarn-error.log*\nv3/frontend/ThreatPlaybook-Frontend/package-lock.json\nfrontend/ThreatPlaybook-Frontend/node_modules/\nfrontend/ThreatPlaybook-Frontend/npm-debug.log*\nfrontend/ThreatPlaybook-Frontend/yarn-debug.log*\nfrontend/ThreatPlaybook-Frontend/yarn-error.log*\nfrontend/ThreatPlaybook-Frontend/package-lock.json\n# frontend/ThreatPlaybook-Frontend/.babelrc\n# frontend/ThreatPlaybook-Frontend/.editorconfig\nPipfile.lock\nPipfile\ncli/dist/ThreatPlaybook-Client-3.0.3.tar.gz\ncli/playbook/.cred\nvenv/\n*.pyc\napi/__pycache__/utils.cpython-37.pyc\napi/__pycache__/models.cpython-37.pyc\n.vscode/settings.json\n*.lock\napiv2/.vscode/settings.json\napiv2/tp_api/logs/output.log\napiv2/logs/output.log\nlogs/output.log\nwebsite/node_modules/*\nfrontend/Playbook-Frontend/package-lock.json\napi/tp_api/logs/output.log\n"
  },
  {
    "path": "README.md",
    "content": "# ThreatPlaybook\n\n> This is version 3 (beta)\n\n### What it was: \nA (relatively) Unopinionated framework that faciliates Threat Modeling as Code married with Application Security Automation on a single Fabric\n\n### What it is now: \nA unified DevSecOps Framework that allows you to go from iterative, collaborative Threat Modeling to Application Security Test Orchestration\n\n[![Black Hat Arsenal USA](https://rawgit.com/toolswatch/badges/master/arsenal/usa/2018.svg)](https://www.blackhat.com/us-18/arsenal/schedule/index.html#threatplaybook-11697)\n\n\n[Documentation](https://threatplaybook.netlify.app)\n\n* [Quick Start](https://threatplaybook.netlify.app/docs/installation)\n* [Tutorial](https://threatplaybook.netlify.app/docs/tutorial)\n\n\n![](img/tp-logo.png)\n\n## Brought to you proudly by\n![](img/we45logo.jpg)"
  },
  {
    "path": "api/.vscode/settings.json",
    "content": "{\n    \"python.formatting.provider\": \"black\",\n    \"python.pythonPath\": \"venv/bin/python\"\n}"
  },
  {
    "path": "api/Dockerfile",
    "content": "FROM python:alpine3.7\nCOPY tp_api/ /app\nCOPY requirements.txt /app\nADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait ./wait\nRUN chmod +x ./wait\nWORKDIR /app\nRUN chmod +x wait-for\nRUN apk add --no-cache --virtual .build-deps g++ python3-dev libffi-dev libressl-dev && \\\n    apk add --no-cache --update python3 && \\\n    pip3 install --upgrade pip setuptools\nRUN pip install -r requirements.txt\nEXPOSE 5000\nCMD [\"/usr/local/bin/python\", \"/app/app.py\"]"
  },
  {
    "path": "api/conftest.py",
    "content": ""
  },
  {
    "path": "api/requirements.txt",
    "content": "appdirs==1.4.3\nattrs==19.3.0\nbcrypt==3.1.7\nblack==19.10b0\nblinker==1.4\ncffi==1.14.0\nclick==7.1.1\nentrypoints==0.3\nflake8==3.7.9\nflasgger==0.9.4\nFlask==1.1.2\nFlask-Cors==3.0.8\nflask-mongoengine==0.9.5\nFlask-WTF==0.14.3\nimportlib-metadata==1.6.0\nitsdangerous==1.1.0\nJinja2==2.11.2\njsonschema==3.2.0\nloguru==0.4.1\nMarkupSafe==1.1.1\nmccabe==0.6.1\nmistune==0.8.4\nmongoengine==0.19.1\nmore-itertools==8.2.0\npackaging==20.3\npathspec==0.8.0\npluggy==0.13.1\npy==1.8.1\npycodestyle==2.5.0\npycparser==2.20\npyflakes==2.1.1\nPyJWT==1.7.1\npymongo==3.10.1\npyparsing==2.4.7\npyrsistent==0.16.0\npytest==5.4.1\npytest-flask==1.0.0\nPyYAML==5.3.1\nregex==2020.4.4\nsix==1.14.0\ntoml==0.10.0\ntyped-ast==1.4.1\nwcwidth==0.1.9\nWerkzeug==1.0.1\nWTForms==2.3.1\nzipp==3.1.0\n"
  },
  {
    "path": "api/tests/test_flask.py",
    "content": "import pytest\nfrom tp_api.app import app\nimport json\nimport secrets\n\n\ntoken = \"\"\nproject_name = \"\"\nuse_case = \"\"\nabuse_case = \"\"\nthreat_scenario = \"\"\ntarget_name = \"\"\nscan_name = \"\"\ncwe = 89\n\n\n@pytest.fixture(scope=\"module\")\ndef client():\n    with app.test_client() as c:\n        yield c\n\n\ndef test_change_password(client):\n    response = client.post(\n        \"/change-password\",\n        data=json.dumps(\n            {\n                \"email\": \"admin@admin.com\",\n                \"old_password\": \"supersecret\",\n                \"new_password\": \"supersecret\",\n                \"verify_password\": \"supersecret\",\n            }\n        ),\n        content_type=\"application/json\",\n    )\n    data = json.loads(response.get_data(as_text=True))\n\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_login(client):\n    response = client.post(\n        \"/login\",\n        data=json.dumps({\"email\": \"admin@admin.com\",\n                         \"password\": \"supersecret\"}),\n        content_type=\"application/json\",\n    )\n    data = json.loads(response.get_data(as_text=True))\n    global token\n    token = data.get(\"data\").get(\"token\")\n\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_create_project(client):\n    response = client.post(\n        \"/project/create\",\n        data=json.dumps(\n            {\"name\": \"test-project-{}\".format(secrets.token_urlsafe(8))}),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n    global project_name\n    project_name = data.get(\"data\").get(\"name\")\n\n\ndef test_create_feature(client):\n    response = client.post(\n        \"/feature/create\",\n        data=json.dumps(\n            {\n                \"short_name\": \"test-feature-{}\".format(secrets.token_urlsafe(8)),\n                \"description\": \"This is a test description\",\n                \"project\": project_name,\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"short_name\")\n    global use_case\n    use_case = data.get(\"data\").get(\"short_name\")\n\n\ndef test_create_abuser_story(client):\n    response = client.post(\n        \"/abuse-case/create\",\n        data=json.dumps(\n            {\n                \"short_name\": \"test-abuser-story-{}\".format(secrets.token_urlsafe(8)),\n                \"description\": \"This is a test description\",\n                \"feature\": use_case,\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"short_name\")\n    global abuse_case\n    abuse_case = data.get(\"data\").get(\"short_name\")\n\n\ndef test_create_threat_scenario_repo(client):\n    response = client.post(\n        \"/scenario/repo/create\",\n        data=json.dumps(\n            {\n                \"name\": \"threat-scenario-{}\".format(secrets.token_urlsafe(8)),\n                \"description\": \"This is a test description\",\n                \"feature\": use_case,\n                \"abuser_story\": abuse_case,\n                \"vul_name\": \"SQL Injection\",\n                \"type\": \"repo\",\n                \"repo_name\": \"sql_injection\"\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n\n\ndef test_create_threat_scenario(client):\n    response = client.post(\n        \"/scenario/create\",\n        data=json.dumps(\n            {\n                \"name\": \"threat-scenario-{}\".format(secrets.token_urlsafe(8)),\n                \"description\": \"This is a test description\",\n                \"feature\": use_case,\n                \"abuser_story\": abuse_case,\n                \"vul_name\": \"SQL Injection\",\n                \"type\": \"inline\"\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n    global threat_scenario\n    threat_scenario = data.get(\"data\").get(\"name\")\n\n\ndef test_create_test_case(client):\n    response = client.post(\n        \"/test/create\",\n        data=json.dumps(\n            {\n                \"name\": \"test-case-{}\".format(secrets.token_urlsafe(8)),\n                \"test_case\": \"some test case\",\n                \"threat_scenario\": threat_scenario,\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n\n\ndef test_create_target(client):\n    response = client.post(\n        \"/target/create\",\n        data=json.dumps(\n            {\n                \"name\": \"test-target-{}\".format(secrets.token_urlsafe(8)),\n                \"url\": \"http://example.com\",\n                \"project\": project_name,\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n    global target_name\n    target_name = data.get('data').get('name')\n\n\ndef test_create_scan(client):\n    response = client.post(\n        \"/scan/create\",\n        data=json.dumps(\n            {\n                \"tool\": \"ZAP\",\n                \"target\": target_name,\n                \"scan_type\": \"DAST\"\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n    global scan_name\n    scan_name = data.get('data').get('name')\n\n\ndef test_create_vulnerability(client):\n    response = client.post(\n        \"/vulnerability/create\",\n        data=json.dumps(\n            {\n                \"name\": \"SQL Injection\",\n                \"scan\": scan_name,\n                \"vul_name\": \"SQL Injection\",\n                \"cwe\": 89,\n                \"severity\": 3,\n                \"description\": \"Test Description\",\n                \"evidences\": [\n                    {\n                        \"log\": \"test log\",\n                        \"url\": \"attack.php\",\n                        \"param\": \"vulnId\",\n                        \"info\": \"Found this param by Vulnerability Scanning\"\n                    }\n                ]\n            }\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n    assert data.get(\"data\").get(\"name\")\n\n\ndef test_get_project(client):\n    response = client.get(\"/project/read\", headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_project_specific(client):\n    response = client.post(\n        \"/project/read\",\n        data=json.dumps(\n            {\"name\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_feature_by_project(client):\n    response = client.post(\n        \"/feature/read\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_abuse_case_specific(client):\n    response = client.post(\n        \"/abuses/read\",\n        data=json.dumps(\n            {\"user_story\": use_case}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_threat_scenario(client):\n    response = client.post(\n        \"/scenarios/read\",\n        data=json.dumps(\n            {\"abuser_story\": abuse_case}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_test_case(client):\n    response = client.post(\n        \"/test/read\",\n        data=json.dumps(\n            {\"scenario\": threat_scenario}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token},\n    )\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_threat_scenario_severity(client):\n    response = client.get(\"/scenario/severity\",\n                          headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_vulnerability_severity(client):\n    response = client.get(\"/vulnerability/severity\",\n                          headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_scan(client):\n    response = client.get(\"/scan/read\",\n                          headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_threat_scenario_by_project(client):\n    response = client.post(\n        \"/scenarios/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_vulnerability(client):\n    response = client.get(\n        \"/vulnerability/read\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_vulnerability_by_project(client):\n    response = client.post(\n        \"/vulnerability/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_scan_by_project(client):\n    response = client.post(\n        \"/scan/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_user_story_tree_by_project(client):\n    response = client.post(\n        \"/user-story/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_abuser_story_tree_by_project(client):\n    response = client.post(\n        \"/abuser-story/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_threat_scenario_tree_by_project(client):\n    response = client.post(\n        \"/threat-scenario/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_threatmap_by_project(client):\n    response = client.post(\n        \"/threatmap/project\",\n        data=json.dumps(\n            {\"project\": project_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_individual_scan_vuls(client):\n    response = client.post(\n        \"/scan-vuls/project\",\n        data=json.dumps(\n            {\"name\": scan_name}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n\n\ndef test_get_asvs_vuls(client):\n    response = client.post(\n        \"/asvs\",\n        data=json.dumps(\n            {\"cwe\": cwe}\n        ),\n        content_type=\"application/json\",\n        headers={\"Authorization\": token})\n    data = json.loads(response.get_data(as_text=True))\n    assert response.status_code == 200\n    assert data.get(\"success\")\n"
  },
  {
    "path": "api/tp_api/__init__.py",
    "content": ""
  },
  {
    "path": "api/tp_api/app.py",
    "content": "from flask import Flask, jsonify, request\nimport jwt\nfrom secrets import token_urlsafe\nfrom os import getenv\nfrom utils import (\n    logger,\n    connect_db,\n    load_reload_asvs_db,\n    load_reload_repo_db,\n    initialize_superuser,\n    respond,\n)\nfrom models import *\nimport bcrypt\nfrom functools import wraps\nimport json\nfrom flask_cors import CORS\nimport uuid\nfrom flasgger import Swagger, swag_from\n\nJWT_PASSWORD = getenv(\"JWT_PASS\", token_urlsafe(16))\nitems_per_page = 20\ndb = connect_db()\nload_reload_repo_db()\nload_reload_asvs_db()\ninitialize_superuser()\n\n\napp = Flask(__name__)\nswagger = Swagger(app)\n\nCORS(app)\n\n\ndef validate_user(f):\n    @wraps(f)\n    def inner(*args, **kwargs):\n        if \"Authorization\" not in request.headers and not request.headers.get(\n            \"Authorization\"\n        ):\n            no_auth = respond(False, True, message=\"No Authentication data\")\n            return no_auth, 403\n        else:\n            try:\n                token = request.headers.get(\"Authorization\")\n                decoded = jwt.decode(token, JWT_PASSWORD, algorithms=[\"HS256\"])\n                ref_user = User.objects.get(email=decoded[\"email\"])\n                return f(*args, **kwargs)\n            except Exception as e:\n                logger.exception(e)\n                token_err = respond(False, True, message=\"Invalid Token or User\")\n                return token_err, 403\n\n    return inner\n\n\n# swagger done\n@app.route(\"/api/change-password\", methods=[\"POST\"])\n@swag_from(\"swagger/change-password.yml\")\ndef change_password():\n    if request.method == \"POST\":\n        pass_data = request.get_json()\n        if pass_data:\n            if (\n                \"email\" not in pass_data\n                and \"old_password\" not in pass_data\n                and \"verify_password\" not in pass_data\n            ):\n                return (\n                    jsonify(\n                        {\n                            \"success\": False,\n                            \"error\": True,\n                            \"message\": \"Mandatory values in request unavailable\",\n                        }\n                    ),\n                    400,\n                )\n            else:\n                try:\n                    ref_user = User.objects.get(email=pass_data[\"email\"])\n                except DoesNotExist:\n                    return (\n                        jsonify(\n                            {\n                                \"success\": False,\n                                \"error\": True,\n                                \"message\": \"No user found\",\n                            }\n                        ),\n                        403,\n                    )\n                verify_pass = bcrypt.checkpw(\n                    pass_data[\"old_password\"].encode(), str(ref_user.password).encode()\n                )\n                if verify_pass and (\n                    pass_data[\"new_password\"] == pass_data[\"verify_password\"]\n                ):\n                    hash_pass = bcrypt.hashpw(\n                        pass_data.get(\"new_password\").encode(), bcrypt.gensalt()\n                    ).decode()\n                    ref_user.update(password=hash_pass, default_password=False)\n                    logger.info(\n                        \"Changed password for user {}\".format(pass_data[\"email\"])\n                    )\n                    return jsonify(\n                        {\n                            \"success\": True,\n                            \"error\": False,\n                            \"message\": \"Successfully changed password for user {}\".format(\n                                pass_data[\"email\"]\n                            ),\n                        }\n                    )\n                else:\n                    logger.error(\n                        \"Change password exception. User passwords dont match OR old password is wrong for user {}\".format(\n                            pass_data[\"email\"]\n                        )\n                    )\n                    return (\n                        jsonify(\n                            {\n                                \"success\": False,\n                                \"error\": True,\n                                \"message\": \"Unable to change password for user {}\".format(\n                                    pass_data[\"email\"]\n                                ),\n                            }\n                        ),\n                        403,\n                    )\n\n        else:\n            invalid_data = respond(\n                False, True, message=\"Unable to decode request payload\"\n            )\n            return jsonify(invalid_data), 400\n\n\n# swagger done\n@app.route(\"/api/login\", methods=[\"POST\"])\ndef login():\n    if request.method == \"POST\":\n        login_data = request.get_json()\n        if \"email\" not in login_data and \"password\" not in login_data:\n            input_error = respond(False, True, message=\"Input Validation Error\")\n            return input_error, 400\n        else:\n            try:\n                ref_user = User.objects.get(email=login_data[\"email\"])\n            except DoesNotExist:\n                user_not_exists = respond(False, True, message=\"Invalid credentials\")\n                return user_not_exists, 403\n\n            verify_pass = bcrypt.checkpw(\n                login_data[\"password\"].encode(), str(ref_user.password).encode()\n            )\n            if verify_pass:\n                logger.info(\"User '{}' successfully logged in\".format(ref_user.email))\n                token = jwt.encode(\n                    {\"email\": ref_user.email}, key=JWT_PASSWORD, algorithm=\"HS256\"\n                ).decode()\n                success_message = respond(\n                    True, False, message=\"Logged in successfully\", data={\"token\": token}\n                )\n                return success_message\n\n            else:\n                invalid_credentials = respond(\n                    False, True, message=\"Invalid credentials\"\n                )\n                return invalid_credentials, 403\n\n\n# swagger done\n@app.route(\"/api/project/create\", methods=[\"POST\"])\n@validate_user\ndef create_project():\n    data = request.get_json()\n    if \"name\" not in data and not data.get(\"name\"):\n        logger.error(\"Input Validation Error - no 'name' param in request\")\n        inval_err = respond(False, True, \"Mandatory param not in request\")\n        return inval_err, 400\n    else:\n        try:\n            Project(name=data.get(\"name\")).save()\n            success = respond(\n                True,\n                False,\n                message=\"successfully saved project\",\n                data={\"name\": data.get(\"name\")},\n            )\n            logger.info(\"Successfully created project {}\".format(data.get(\"name\")))\n            return success\n        except Exception as e:\n            logger.exception(e)\n            exc = respond(False, True, \"unable to save Project to DB\")\n            return exc, 400\n\n\n# swagger done\n@app.route(\"/api/feature/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/feature-create.yml\")\ndef create_user_story():\n    data = request.get_json()\n    if not set((\"short_name\", \"description\", \"project\")) <= set(data):\n        logger.error(\n            \"Mandatory params 'short_name', 'description', 'project' not in request\"\n        )\n        input_val_err = respond(\n            False,\n            True,\n            message=\"Mandatory params 'short_name', 'description', 'project' not in request\",\n        )\n        return input_val_err, 400\n    else:\n        try:\n            my_proj = Project.objects.get(name=data.get(\"project\"))\n        except DoesNotExist:\n            project_not_exists = respond(\n                False,\n                True,\n                message=\"Project '{}' does not exist\".format(data.get(\"project\")),\n            )\n            return project_not_exists, 404\n\n        short_name = data.get(\"short_name\")\n        desc = data.get(\"description\")\n        try:\n            ref_user_case = UseCase.objects(short_name=short_name).update_one(\n                short_name=short_name, description=desc, project=my_proj, upsert=True,\n            )\n            ref_feature = UseCase.objects.get(short_name=short_name)\n            if ref_feature not in my_proj.features:\n                my_proj.features.append(ref_feature)\n                my_proj.save()\n            logger.info(\n                \"Successfully created user-story/feature '{}'\".format(short_name)\n            )\n            return respond(\n                True,\n                False,\n                message=\"Successfully created Feature '{}'\".format(short_name),\n                data={\"short_name\": short_name},\n            )\n        except Exception as e:\n            logger.exception(e)\n            return respond(False, True, message=\"Unable to create User Story\"), 400\n\n\n# swagger done\n@app.route(\"/api/abuse-case/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/abuse-create.yml\")\ndef create_abuser_story():\n    data = request.get_json()\n    if not set((\"short_name\", \"description\", \"feature\")) <= set(data):\n        logger.error(\n            \"Mandatory params 'short_name', 'description', 'feature' not in request\"\n        )\n        input_val_err = respond(\n            False,\n            True,\n            message=\"Mandatory params 'short_name', 'description', 'feature' not in request\",\n        )\n        return input_val_err, 400\n    else:\n        try:\n            ref_user_story = UseCase.objects.get(short_name=data.get(\"feature\"))\n        except DoesNotExist:\n            project_not_exists = respond(\n                False,\n                True,\n                message=\"Feature '{}' does not exist\".format(data.get(\"feature\")),\n            )\n            return project_not_exists, 404\n\n        short_name = data.get(\"short_name\")\n        desc = data.get(\"description\")\n        try:\n            ref_user_case = AbuseCase.objects(short_name=short_name).update_one(\n                short_name=short_name,\n                description=desc,\n                use_case=ref_user_story,\n                upsert=True,\n            )\n            ref_abuse = AbuseCase.objects.get(short_name=short_name)\n            if ref_abuse not in ref_user_story.abuses:\n                ref_user_story.abuses.append(ref_abuse)\n                ref_user_story.save()\n            logger.info(\"Successfully created abuser-story '{}'\".format(short_name))\n            return respond(\n                True,\n                False,\n                message=\"Successfully created Abuser Story '{}'\".format(short_name),\n                data={\"short_name\": short_name},\n            )\n        except Exception as e:\n            logger.exception(e)\n            return respond(False, True, message=\"Unable to create Abuser Story\"), 400\n\n\n# swagger done\n@app.route(\"/api/scenario/repo/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/scenario-repo.yml\")\ndef create_repo_scenario():\n    data = request.get_json()\n    try:\n        ref_user_story = UseCase.objects.get(short_name=data.get(\"feature\"))\n    except DoesNotExist:\n        return (\n            respond(False, True, message=\"Unable to find reference User Story\"),\n            400,\n        )\n\n    try:\n        ref_abuser_story = AbuseCase.objects.get(short_name=data.get(\"abuser_story\"))\n    except DoesNotExist:\n        return (\n            respond(False, True, message=\"Unable to find reference Abuser Story\"),\n            400,\n        )\n    tm_name = data.get(\"name\")\n    description = data.get(\"description\")\n    if not data.get(\"type\") == \"repo\" and data.get(\"repo_name\"):\n        return respond(False, True, message=\"Input Validation Error\"), 400\n    else:\n        repo_name = data.get(\"repo_name\")\n        severity = data.get(\"severity\", 1)\n        try:\n            ref_repo = Repo.objects.get(short_name=repo_name)\n        except Exception:\n            return respond(False, True, message=\"repo not found\"), 404\n        try:\n            ThreatModel.objects(name=tm_name).update_one(\n                name=tm_name,\n                cwe=ref_repo.cwe,\n                vul_name=ref_repo.name,\n                description=description,\n                use_case=ref_user_story,\n                abuse_case=ref_abuser_story,\n                mitigations=ref_repo.mitigations,\n                categories=ref_repo.categories,\n                severity=severity,\n                upsert=True,\n            )\n            ref_scenario = ThreatModel.objects.get(name=tm_name)\n            if ref_scenario not in ref_abuser_story.scenarios:\n                ref_abuser_story.scenarios.append(ref_scenario)\n                ref_abuser_story.save()\n        except Exception as e:\n            logger.exception(e)\n            return (\n                respond(\n                    False,\n                    True,\n                    message=\"Unable to store Threat Scenario: {}\".format(tm_name),\n                ),\n                500,\n            )\n\n        if ref_repo.tests:\n            for single_test in ref_repo.tests:\n                try:\n                    Test.objects(name=single_test.name).update_one(\n                        name=single_test.name,\n                        test_case=single_test.test_case,\n                        executed=False,\n                        scenario=ref_scenario,\n                        tools=single_test.tools,\n                        upsert=True,\n                    )\n                    ref_my_test = Test.objects.get(\n                        name=single_test.name, scenario=ref_scenario\n                    )\n                    if ref_my_test not in ref_scenario.tests:\n                        ref_scenario.tests.append(ref_my_test)\n                        ref_scenario.save()\n                except Exception as e:\n                    logger.exception(e)\n                    pass\n\n        return respond(\n            True,\n            False,\n            message=\"Successfully created Threat Scenario\",\n            data={\"name\": tm_name},\n        )\n\n\n# swagger done\n@app.route(\"/api/scenario/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/scenario-inline.yml\")\ndef create_threat_scenario():\n    data = request.get_json()\n    mandatory_params = (\n        \"vul_name\",\n        \"name\",\n        \"description\",\n        \"feature\",\n        \"abuser_story\",\n        \"type\",\n    )\n    if not set(mandatory_params) <= set(data):\n        return (\n            respond(\n                False,\n                True,\n                message=\"Input validation error\",\n                data={\"mandatory_params\": list(mandatory_params)},\n            ),\n            400,\n        )\n    else:\n        try:\n            ref_user_story = UseCase.objects.get(short_name=data.get(\"feature\"))\n        except DoesNotExist:\n            return (\n                respond(False, True, message=\"Unable to find reference User Story\"),\n                400,\n            )\n\n        try:\n            ref_abuser_story = AbuseCase.objects.get(\n                short_name=data.get(\"abuser_story\")\n            )\n        except DoesNotExist:\n            return (\n                respond(False, True, message=\"Unable to find reference Abuser Story\"),\n                400,\n            )\n        try:\n            tm_name = data.get(\"name\")\n            description = data.get(\"description\")\n            cwe_val = data.get(\"cwe\", 0)\n            mitigations = data.get(\"mitigations\", [])\n            severity = int(data.get(\"severity\", 1))\n            vul_name = data.get(\"vul_name\")\n            ThreatModel.objects(name=tm_name).update_one(\n                name=tm_name,\n                vul_name=vul_name,\n                cwe=cwe_val,\n                severity=severity,\n                mitigations=mitigations,\n                description=description,\n                use_case=ref_user_story,\n                abuse_case=ref_abuser_story,\n                upsert=True,\n            )\n            ref_threat_model = ThreatModel.objects.get(name=tm_name)\n            # if \"categories\" in data:\n            #     for single_category in data.categories:\n            #         if single_category not in ref_threat_model.categories:\n            #             ref_threat_model.categories.append(single_category)\n            #             ref_threat_model.save()\n\n            if \"mitigations\" in data:\n                ThreatModel.objects(name=tm_name).update_one(\n                    mitigations=data.get(\"mitigations\"), upsert=True\n                )\n\n            if ref_threat_model not in ref_abuser_story.scenarios:\n                ref_abuser_story.scenarios.append(ref_threat_model)\n                ref_abuser_story.save()\n\n            logger.info(\"Created Threat Scenario '{}'\".format(tm_name))\n            return respond(\n                True,\n                False,\n                message=\"Successfully created Threat Scenario\",\n                data={\"name\": tm_name},\n            )\n        except Exception as e:\n            logger.exception(e)\n            return respond(False, True, message=\"Unable to load Threat Scenario\"), 400\n\n\n# swagger done\n@app.route(\"/api/test/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/test-case-create.yml\")\ndef create_test_case():\n    data = request.get_json()\n    if not set((\"test_case\", \"name\", \"threat_scenario\")) <= set(data):\n        logger.error(\n            \"Mandatory params 'test_case', 'name', 'threat_scenario' not in request\"\n        )\n        input_val_err = respond(\n            False,\n            True,\n            message=\"Mandatory params 'test_case', 'name', 'threat_scenario' not in request\",\n        )\n        return input_val_err, 400\n    else:\n        try:\n            ref_scenario = ThreatModel.objects.get(name=data.get(\"threat_scenario\"))\n        except DoesNotExist:\n            project_not_exists = respond(\n                False,\n                True,\n                message=\"Threat Scenario '{}' does not exist\".format(\n                    data.get(\"threat_scenario\")\n                ),\n            )\n            return project_not_exists, 404\n\n        test_name = data.get(\"name\")\n        test_case = data.get(\"test_case\")\n        tool_list = data.get(\"tools\", [])\n        tag_list = data.get(\"tags\", [])\n        executed = data.get(\"executed\", False)\n        test_type = data.get(\"test_type\", \"discovery\")\n\n        try:\n            Test.objects(name=test_name).update_one(\n                name=test_name,\n                test_case=test_case,\n                executed=executed,\n                test_type=test_type,\n                scenario=ref_scenario,\n                upsert=True,\n            )\n            if tool_list:\n                Test.objects(name=test_name, scenario=ref_scenario).update_one(\n                    tools=tool_list\n                )\n\n            if tag_list:\n                Test.objects(name=test_name, scenario=ref_scenario).update_one(\n                    tags=tag_list\n                )\n\n            ref_test = Test.objects.get(name=test_name, scenario=ref_scenario)\n            if ref_test not in ref_scenario.tests:\n                ref_scenario.tests.append(ref_test)\n                ref_scenario.save()\n\n            logger.info(\n                \"Created Test-Case '{}' for Threat Scenario '{}'\".format(\n                    test_name, ref_scenario.name\n                )\n            )\n            return respond(\n                True,\n                False,\n                message=\"Created Test-Case '{}' for Threat Scenario '{}'\".format(\n                    test_name, ref_scenario.name\n                ),\n                data={\"name\": test_name},\n            )\n\n        except Exception as e:\n            logger.exception(e)\n            return respond(False, True, message=\"Unable to create Test Case\"), 400\n\n\n# swagger done\n@app.route(\"/api/target/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/target-create-update.yml\")\ndef create_target():\n    data = request.get_json()\n    if not set((\"name\", \"url\", \"project\")) <= set(data):\n        logger.error(\"Mandatory params 'name', 'url', 'project' not in request\")\n        input_val_err = respond(\n            False,\n            True,\n            message=\"Mandatory params 'name', 'url', 'project' not in request\",\n        )\n        return input_val_err, 400\n    else:\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n        except Exception:\n            return respond(False, True, message=\"Project not found\"), 404\n        try:\n            new_target = Target(\n                name=data.get(\"name\"), url=data.get(\"url\"), project=ref_project\n            )\n            new_target.save()\n            return respond(\n                True,\n                False,\n                message=\"successfully created target\",\n                data={\"name\": data.get(\"name\")},\n            )\n        except Exception:\n            return respond(False, True, message=\"Unable to create Target\")\n\n\n@app.route(\"/api/scan/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/scan-create.yml\")\ndef create_scan():\n    data = request.get_json()\n    if not set((\"tool\", \"target\")) <= set(data):\n        logger.error(\"Mandatory params 'tool', 'target' not in request\")\n        input_val_err = respond(\n            False, True, message=\"Mandatory params 'tool', 'target' not in request\",\n        )\n        return input_val_err, 400\n    else:\n        try:\n            ref_target = Target.objects.get(name=data.get(\"target\"))\n            ref_project = Project.objects.get(id=ref_target.project.id)\n        except Exception:\n            return respond(False, True, message=\"Target not found\"), 404\n        try:\n            new_scan = Scan(tool=data.get(\"tool\"), target=ref_target)\n            if \"scan_type\" in data:\n                if data.get(\"scan_type\") in [\"SAST\", \"DAST\", \"SCA\", \"IAST\", \"Manual\"]:\n                    new_scan.scan_type = data.get(\"scan_type\")\n\n            new_scan.save()\n            if new_scan not in ref_target.scans:\n                ref_target.scans.append(new_scan)\n                ref_target.save()\n\n            ref_features = UseCase.objects(project=ref_project)\n            for single_feature in ref_features:\n                ref_scenarios = ThreatModel.objects(use_case=single_feature)\n                for single_scenario in ref_scenarios:\n                    for single_test in single_scenario.tests:\n                        ref_test = Test.objects.get(id=single_test.id)\n                        if data.get(\"tool\") in ref_test.tools:\n                            ref_test.executed = True\n                            ref_test.save()\n\n            return respond(\n                True,\n                False,\n                message=\"successfully created scan\",\n                data={\"name\": new_scan.name},\n            )\n        except Exception as ex:\n            logger.error(ex)\n            return respond(False, True, message=\"Unable to create Scan\")\n\n\n@app.route(\"/api/vulnerability/create\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/vulnerability-create.yml\")\ndef create_vulnerability():\n    data = request.get_json()\n    if \"name\" not in data and \"scan\" not in data:\n        return (\n            respond(\n                False, True, message=\"Mandatory field 'name' and 'scan' not in request\"\n            ),\n            400,\n        )\n    else:\n        scan = data.get(\"scan\")\n        try:\n            ref_scan = Scan.objects.get(name=scan)\n        except Exception:\n            return respond(False, True, message=\"Unable to find scan\"), 404\n\n        try:\n            ref_target = Target.objects.get(id=ref_scan.target.id)\n            ref_project = Project.objects.get(id=ref_target.project.id)\n        except Exception:\n            return respond(False, True, message=\"Unable to find target\"), 404\n\n        name = data.get(\"name\")\n        severity = data.get(\"severity\", 1)\n        cwe = data.get(\"cwe\", 0)\n        new_vul = Vulnerability(name=name, severity=severity, cwe=cwe)\n        new_vul.scan = ref_scan\n        new_vul.target = ref_target\n        if \"description\" in data:\n            new_vul.description = data.get(\"description\")\n        if \"observation\" in data:\n            new_vul.description = data.get(\"observation\")\n        if \"vul_name\" in data:\n            new_vul.description = data.get(\"vul_name\")\n        if \"remediation\" in data:\n            new_vul.description = data.get(\"remediation\")\n\n        try:\n            new_vul.save()\n            if (\n                \"evidences\" in data\n                and isinstance(data.get(\"evidences\"), list)\n                and data.get(\"evidences\")\n            ):\n                all_evidences = data.get(\"evidences\")\n                for single in all_evidences:\n                    new_evid = VulnerabilityEvidence()\n                    new_evid.evidence_type = ref_scan.scan_type\n                    if \"log\" in single:\n                        new_evid.log = single.get(\"log\")\n                    if \"url\" in single:\n                        new_evid.url = single.get(\"url\")\n                    if \"param\" in single:\n                        new_evid.param = single.get(\"param\")\n                    if \"line_num\" in single:\n                        new_evid.line_num = single.get(\"line_num\")\n                    if \"attack\" in single:\n                        new_evid.attack = single.get(\"attack\")\n                    if \"info\" in single:\n                        new_evid.info = single.get(\"info\")\n                    new_evid.vuln = new_vul\n\n                    try:\n                        new_evid.save()\n                        if new_evid not in new_vul.evidences:\n                            new_vul.evidences.append(new_evid)\n                            new_vul.save()\n                    except Exception as ev_e:\n                        logger.error(ev_e)\n                        return (\n                            respond(False, True, message=\"Unable to save evidence\"),\n                            500,\n                        )\n\n            return respond(\n                True,\n                False,\n                message=\"Vulnerability successfully created\",\n                data={\"name\": name},\n            )\n        except Exception as vul_ex:\n            logger.error(vul_ex)\n            return (\n                respond(\n                    False,\n                    True,\n                    \"Unable to save vulnerability with name '{}'\".format(name),\n                ),\n                500,\n            )\n\n\n@app.route(\"/api/project/read\", methods=[\"GET\", \"POST\"])\n@app.route(\"/api/project/read/<page_num>\", methods=[\"GET\", \"POST\"])\n@validate_user\n@swag_from(\"swagger/get-project.yml\")\ndef get_project(page_num=1):\n    if request.method == \"GET\":\n        num_pages = (Project.objects.count() % items_per_page) + 1\n        if num_pages > 1 and page_num:\n            if page_num == 1:\n                project_list = json.loads(\n                    Project.objects.limit(items_per_page).to_json()\n                )\n                return respond(\n                    True,\n                    False,\n                    message=\"Successfully retrieved data\",\n                    data=project_list,\n                )\n            else:\n                offset = (page_num - 1) * items_per_page\n                project_list = json.loads(\n                    Project.objects.skip(offset).limit(items_per_page).to_json()\n                )\n                return respond(\n                    True,\n                    False,\n                    message=\"Successfully retrieved data\",\n                    data=project_list,\n                )\n        else:\n            project_list = json.loads(Project.objects().to_json())\n            return respond(True, False, data=project_list)\n\n    if request.method == \"POST\":\n        data = request.get_json()\n        if \"name\" in data:\n            try:\n                ref_project = json.loads(\n                    Project.objects.get(name=data.get(\"name\")).to_json()\n                )\n                return respond(True, False, data=ref_project)\n            except Exception as e:\n                logger.exception(e)\n                return respond(False, True, message=\"Unable to find the project\"), 404\n\n\n@app.route(\"/api/feature/read\", methods=[\"GET\", \"POST\"])\n@validate_user\n@swag_from(\"swagger/get-feature.yml\")\ndef get_features():\n    if request.method == \"GET\":\n        user_story_list = json.loads(UseCase.objects().to_json())\n        return respond(True, False, data=user_story_list)\n    elif request.method == \"POST\":\n        data = request.get_json()\n        if \"project\" in data:\n            try:\n                ref_project = Project.objects.get(name=data.get(\"project\"))\n            except Exception:\n                return respond(False, True, message=\"Project does not exist\"), 404\n\n            if \"short_name\" in data:\n                try:\n                    ref_feature = json.loads(\n                        UseCase.objects.get(\n                            short_name=data.get(\"short_name\"), project=ref_project\n                        ).to_json()\n                    )\n                    return respond(True, False, data=ref_feature)\n                except Exception as e:\n                    logger.exception(e)\n                    return (\n                        respond(\n                            False,\n                            True,\n                            message=\"Unable to fetch the referenced user story\",\n                        ),\n                        404,\n                    )\n            else:\n                if \"page\" in data:\n                    page_num = data.get(\"page\")\n                    num_pages = (UseCase.objects.count() % items_per_page) + 1\n                    if num_pages > 1 and page_num:\n                        if page_num == 1:\n                            feature_list = json.loads(\n                                UseCase.objects(project=ref_project)\n                                .limit(items_per_page)\n                                .to_json()\n                            )\n                            return respond(\n                                True,\n                                False,\n                                message=\"Successfully retrieved data\",\n                                data=feature_list,\n                            )\n                        else:\n                            offset = (page_num - 1) * items_per_page\n                            feature_list = json.loads(\n                                UseCase.objects(project=ref_project)\n                                .skip(offset)\n                                .limit(items_per_page)\n                                .to_json()\n                            )\n                            return respond(\n                                True,\n                                False,\n                                message=\"Successfully retrieved data\",\n                                data=feature_list,\n                            )\n                else:\n                    feature_list = json.loads(\n                        UseCase.objects(project=ref_project).to_json()\n                    )\n                    return respond(\n                        True,\n                        False,\n                        message=\"Successfully retrieved data\",\n                        data=feature_list,\n                    )\n    else:\n        return respond(False, True, message=\"Unable to find User Stories/Features\"), 404\n\n\n@app.route(\"/api/abuses/read\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/get-abuse.yml\")\ndef get_abuser_story():\n    data = request.get_json()\n    if \"user_story\" in data:\n        try:\n            ref_use_case = UseCase.objects.get(short_name=data.get(\"user_story\"))\n        except Exception:\n            return respond(False, True, message=\"User Story does not exist\"), 404\n\n        if \"short_name\" in data:\n            try:\n                ref_abuse = json.loads(\n                    AbuseCase.objects.get(\n                        short_name=data.get(\"short_name\"), use_case=ref_use_case\n                    ).to_json()\n                )\n                return respond(True, False, data=ref_abuse)\n            except Exception as e:\n                logger.exception(e)\n                return (\n                    respond(\n                        False,\n                        True,\n                        message=\"Unable to fetch the referenced abuser story\",\n                    ),\n                    404,\n                )\n        else:\n            if \"page\" in data:\n                page_num = data.get(\"page\")\n                num_pages = (AbuseCase.objects.count() % items_per_page) + 1\n                if num_pages > 1 and page_num:\n                    if page_num == 1:\n                        feature_list = json.loads(\n                            AbuseCase.objects(use_case=ref_use_case)\n                            .limit(items_per_page)\n                            .to_json()\n                        )\n                        return respond(\n                            True,\n                            False,\n                            message=\"Successfully retrieved data\",\n                            data=feature_list,\n                        )\n                    else:\n                        offset = (page_num - 1) * items_per_page\n                        feature_list = json.loads(\n                            AbuseCase.objects(use_case=ref_use_case)\n                            .skip(offset)\n                            .limit(items_per_page)\n                            .to_json()\n                        )\n                        return respond(\n                            True,\n                            False,\n                            message=\"Successfully retrieved data\",\n                            data=feature_list,\n                        )\n            else:\n                feature_list = json.loads(\n                    AbuseCase.objects(use_case=ref_use_case).to_json()\n                )\n                return respond(\n                    True,\n                    False,\n                    message=\"Successfully retrieved data\",\n                    data=feature_list,\n                )\n\n    return (\n        respond(\n            False,\n            True,\n            message=\"Unable to find Abuser Stories. You need to provide a reference feature/user story\",\n        ),\n        404,\n    )\n\n\n@app.route(\"/api/scenarios/read\", methods=[\"GET\", \"POST\"])\n@validate_user\n@swag_from(\"swagger/get-scenario.yml\")\ndef get_threat_scenario():\n    if request.method == \"GET\":\n        threat_scenario_list = json.loads(ThreatModel.objects().to_json())\n        return respond(True, False, data=threat_scenario_list)\n    elif request.method == \"POST\":\n        data = request.get_json()\n        if \"abuser_story\" in data:\n            try:\n                ref_abuse = AbuseCase.objects.get(short_name=data.get(\"abuser_story\"))\n            except Exception:\n                return respond(False, True, message=\"Abuser Story does not exist\"), 404\n\n            if \"name\" in data:\n                try:\n                    ref_scenario = json.loads(\n                        ThreatModel.objects.get(\n                            name=data.get(\"name\"), abuse_case=ref_abuse\n                        ).to_json()\n                    )\n                    return respond(True, False, data=ref_scenario)\n                except Exception as e:\n                    logger.exception(e)\n                    return (\n                        respond(\n                            False,\n                            True,\n                            message=\"Unable to fetch the referenced threat scenario\",\n                        ),\n                        404,\n                    )\n            else:\n                if \"page\" in data:\n                    page_num = data.get(\"page\")\n                    num_pages = (ThreatModel.objects.count() % items_per_page) + 1\n                    if num_pages > 1 and page_num:\n                        if page_num == 1:\n                            feature_list = json.loads(\n                                ThreatModel.objects(abuse_case=ref_abuse)\n                                .limit(items_per_page)\n                                .to_json()\n                            )\n                            return respond(\n                                True,\n                                False,\n                                message=\"Successfully retrieved data\",\n                                data=feature_list,\n                            )\n                        else:\n                            offset = (page_num - 1) * items_per_page\n                            feature_list = json.loads(\n                                ThreatModel.objects(abuse_case=ref_abuse)\n                                .skip(offset)\n                                .limit(items_per_page)\n                                .to_json()\n                            )\n                            return respond(\n                                True,\n                                False,\n                                message=\"Successfully retrieved data\",\n                                data=feature_list,\n                            )\n                else:\n                    feature_list = json.loads(\n                        ThreatModel.objects(abuse_case=ref_abuse).to_json()\n                    )\n                    return respond(\n                        True,\n                        False,\n                        message=\"Successfully retrieved data\",\n                        data=feature_list,\n                    )\n    else:\n        return respond(False, True, message=\"Unable to find Threat Scenarios\"), 404\n\n\n@app.route(\"/api/test/read\", methods=[\"POST\"])\n@validate_user\n@swag_from(\"swagger/get-tests.yml\")\ndef get_test_case():\n    data = request.get_json()\n    if \"scenario\" in data:\n        try:\n            ref_scenario = ThreatModel.objects.get(name=data.get(\"scenario\"))\n        except Exception:\n            return respond(False, True, message=\"Abuser Story does not exist\"), 404\n\n        if \"name\" in data:\n            try:\n                ref_test = json.loads(\n                    Test.objects.get(\n                        name=data.get(\"name\"), scenario=ref_scenario\n                    ).to_json()\n                )\n                return respond(True, False, data=ref_test)\n            except Exception as e:\n                logger.exception(e)\n                return (\n                    respond(\n                        False, True, message=\"Unable to fetch the referenced test-case\",\n                    ),\n                    404,\n                )\n        else:\n            if \"page\" in data:\n                page_num = data.get(\"page\")\n                num_pages = (Test.objects.count() % items_per_page) + 1\n                if num_pages > 1 and page_num:\n                    if page_num == 1:\n                        feature_list = json.loads(\n                            Test.objects(abuse_case=ref_scenario)\n                            .limit(items_per_page)\n                            .to_json()\n                        )\n                        return respond(\n                            True,\n                            False,\n                            message=\"Successfully retrieved data\",\n                            data=feature_list,\n                        )\n                    else:\n                        offset = (page_num - 1) * items_per_page\n                        feature_list = json.loads(\n                            Test.objects(abuse_case=ref_scenario)\n                            .skip(offset)\n                            .limit(items_per_page)\n                            .to_json()\n                        )\n                        return respond(\n                            True,\n                            False,\n                            message=\"Successfully retrieved data\",\n                            data=feature_list,\n                        )\n            else:\n                feature_list = json.loads(Test.objects(scenario=ref_scenario).to_json())\n                return respond(\n                    True,\n                    False,\n                    message=\"Successfully retrieved data\",\n                    data=feature_list,\n                )\n\n    return respond(False, True, message=\"Unable to find Threat Scenarios\"), 404\n\n\n@app.route(\"/api/scenario/vuln/\", methods=[\"POST\"])\n@validate_user\ndef map_threat_scenario_vul():\n    data = request.get_json()\n    if \"id\" not in data:\n        return respond(False, True, message=\"Mandatory param 'id' not in request\"), 400\n    else:\n        try:\n            ref_scenario = ThreatModel.objects.get(id=data.get(\"id\"))\n        except Exception:\n            return respond(False, True, message=\"Unable to find Threat Scenario\")\n\n        if ref_scenario.cwe:\n            ref_abuse = AbuseCase.objects.get(id=ref_scenario.abuse.id)\n            ref_use_case = UseCase.objects.get(id=ref_abuse.use_case.id)\n            ref_project = Project.objects.get(id=ref_use_case.project.id)\n            ref_targets = Target.objects(project=ref_project)\n            for single_target in ref_targets:\n                ref_vulns = Vulnerability.objects(target=single_target)\n            if ref_vulns:\n                return respond(\n                    True,\n                    False,\n                    message=\"successfully returned mapped objects\",\n                    data={\n                        \"threat_scenario\": json.loads(ref_scenario.to_json()),\n                        \"vulnerabilities\": json.loads(ref_vulns.to_json()),\n                    },\n                )\n\n\n@app.route(\"/api/scenario/severity\", methods=[\"GET\"])\n@validate_user\ndef threat_scenario_severity():\n    if request.method == \"GET\":\n        try:\n            scenario_severity_list = json.loads(\n                ThreatModel.objects().values_list(\"severity\").to_json()\n            )\n            return respond(\n                True,\n                False,\n                message=\"Successfully retrieved data\",\n                data=scenario_severity_list,\n            )\n        except Exception as e:\n            logger.exception(e)\n            return respond(False, True, message=\"Therat Scenario does not exist\"), 404\n    else:\n        return (\n            respond(False, True, message=\"Unable to find Threat Scenarios severity\"),\n            404,\n        )\n\n\n@app.route(\"/api/vulnerability/severity\", methods=[\"GET\"])\n@validate_user\ndef vulnerability_severity():\n    if request.method == \"GET\":\n        try:\n            scenario_severity_list = json.loads(\n                Vulnerability.objects().values_list(\"severity\").to_json()\n            )\n            return respond(\n                True,\n                False,\n                message=\"Successfully retrieved data\",\n                data=scenario_severity_list,\n            )\n        except Exception as e:\n            logger.exception(e)\n            return respond(False, True, message=\"Therat Scenario does not exist\"), 404\n    else:\n        return (\n            respond(False, True, message=\"Unable to find Threat Scenarios severity\"),\n            404,\n        )\n\n\n### Select APIs that we need\n# Get Vulnerabilities by Target\n\n\n@app.route(\"/api/target/read\", methods=[\"GET\", \"POST\"])\n@validate_user\ndef get_target(page_num=1):\n    if request.method == \"GET\":\n        num_pages = (Target.objects.count() % items_per_page) + 1\n        if num_pages > 1 and page_num:\n            if page_num == 1:\n                target_list = json.loads(Target.objects.limit(items_per_page).to_json())\n                return respond(\n                    True,\n                    False,\n                    message=\"Successfully retrieved data\",\n                    data=target_list,\n                )\n            else:\n                offset = (page_num - 1) * items_per_page\n                target_list = json.loads(\n                    Target.objects.skip(offset).limit(items_per_page).to_json()\n                )\n                return respond(\n                    True,\n                    False,\n                    message=\"Successfully retrieved data\",\n                    data=target_list,\n                )\n        else:\n            target_list = json.loads(Scan.objects().to_json())\n            return respond(True, False, data=scan_list)\n\n    if request.method == \"POST\":\n        data = request.get_json()\n        if \"project\" in data:\n            ref_project = Project.objects.get(name = data.get('project'))\n            targets_for_project = json.loads(\n                Target.objects(project=ref_project).to_json()\n            )\n            return respond(True, False, data = targets_for_project)\n         \n        if \"name\" in data:\n            specific_target = json.loads(Target.objects.get(name = data.get('name')).to_json())\n            return respond(True, False, data = specific_target)\n\n\n@app.route(\"/api/scan/read\", methods=[\"GET\", \"POST\"])\n@validate_user\ndef get_scan(page_num=1):\n    if request.method == \"GET\":\n        num_pages = (Scan.objects.count() % items_per_page) + 1\n        if num_pages > 1 and page_num:\n            if page_num == 1:\n                scan_list = json.loads(Scan.objects.limit(items_per_page).to_json())\n                return respond(\n                    True, False, message=\"Successfully retrieved data\", data=scan_list,\n                )\n            else:\n                offset = (page_num - 1) * items_per_page\n                scan_list = json.loads(\n                    Scan.objects.skip(offset).limit(items_per_page).to_json()\n                )\n                return respond(\n                    True, False, message=\"Successfully retrieved data\", data=scan_list,\n                )\n        else:\n            scan_list = json.loads(Scan.objects().to_json())\n            return respond(True, False, data=scan_list)\n\n    if request.method == \"POST\":\n        data = request.get_json()\n        if \"name\" in data:\n            try:\n                ref_scan = json.loads(Scan.objects.get(name=data.get(\"name\")).to_json())\n                return respond(True, False, data=ref_scan)\n            except Exception as e:\n                logger.exception(e)\n                return respond(False, True, message=\"Unable to find the scan\"), 404\n\n\n@app.route(\"/api/scenarios/project\", methods=[\"POST\"])\n@validate_user\ndef get_threat_scenario_by_project():\n    data = request.get_json()\n    if \"project\" in data:\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        user_story = UseCase.objects(project=ref_project).to_json()\n        d = json.loads(user_story)\n        try:\n            user_stories_list = [a.get(\"_id\").get(\"$oid\") for a in d]\n            ref_threatScenario = json.loads(\n                ThreatModel.objects.filter(use_case__in=user_stories_list).to_json()\n            )\n            return respond(True, False, data=ref_threatScenario)\n        except Exception as e:\n            return respond(False, True, message=\"Scenario does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"Scenario does not exist\"), 404\n\n\n@app.route(\"/api/vulnerability/read\", methods=[\"GET\", \"POST\"])\n@validate_user\ndef get_vulnerability(page_num=1):\n    if request.method == \"GET\":\n        num_pages = (Vulnerability.objects.count() % items_per_page) + 1\n        if num_pages > 1 and page_num:\n            if page_num == 1:\n                vul_list = json.loads(\n                    Vulnerability.objects.limit(items_per_page).to_json()\n                )\n                return respond(\n                    True, False, message=\"Successfully retrieved data\", data=vul_list,\n                )\n            else:\n                offset = (page_num - 1) * items_per_page\n                vul_list = json.loads(\n                    Vulnerability.objects.skip(offset).limit(items_per_page).to_json()\n                )\n                return respond(\n                    True, False, message=\"Successfully retrieved data\", data=vul_list,\n                )\n        else:\n            vul_list = json.loads(Vulnerability.objects().to_json())\n            return respond(True, False, data=vul_list)\n\n    if request.method == \"POST\":\n        data = request.get_json()\n        if \"name\" in data:\n            try:\n                ref_scan = json.loads(\n                    Vulnerability.objects.get(name=data.get(\"name\")).to_json()\n                )\n                return respond(True, False, data=ref_scan)\n            except Exception as e:\n                logger.exception(e)\n                return (\n                    respond(False, True, message=\"Unable to find the vulnerability\"),\n                    404,\n                )\n\n\n@app.route(\"/api/vulnerability/project\", methods=[\"POST\"])\n@validate_user\ndef get_vulnerability_by_project():\n    data = request.get_json()\n    if \"project\" in data:\n        vul_dict = {}\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        try:\n            target_obj = Target.objects(project=ref_project)\n        except Exception:\n            return respond(False, True, message=\"Target does not exist\"), 404\n        try:\n            for single_target in target_obj:\n                ref_vuls = json.loads(Vulnerability.objects(target=single_target).to_json())\n                vul_dict['data'] = ref_vuls\n                  \n            return respond(True, False, data=vul_dict)\n        except Exception as e:\n            return respond(False, True, message=\"Vulnerability does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"Vulnerability does not exist\"), 404\n\n\n@app.route(\"/api/scan/project\", methods=[\"POST\"])\n@validate_user\ndef get_scan_by_project():\n    data = request.get_json()\n    if \"project\" in data:\n        resp_dict = {}\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n            resp_dict['project'] = ref_project.name\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        try:\n            target_obj = Target.objects(project=ref_project)\n        except Exception:\n            return respond(False, True, message=\"Target does not exist\"), 404\n        try:\n            resp_dict['data'] = []\n            for single_target in target_obj:\n                ref_scans = Scan.objects(target=single_target)\n                for single_scan in ref_scans:\n                    data_dict = {\n                        \"name\": single_scan.name,\n                        \"target\": single_target.name,\n                        \"tool\": single_scan.tool\n                    }\n                    resp_dict['data'].append(data_dict)\n\n            return respond(True, False, data=resp_dict)\n        except Exception as e:\n            return respond(False, True, message=\"Scans does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"Scans does not exist\"), 404\n\n\n@app.route(\"/api/user-story/project\", methods=[\"POST\"])\n@validate_user\ndef get_user_story_tree_by_project():\n    data = request.get_json()\n    user_story_tree = []\n    if \"project\" in data:\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        try:\n            usecases_obj = UseCase.objects(project=ref_project.id)\n        except Exception:\n            return respond(False, True, message=\"Target does not exist\"), 404\n        for usecase in usecases_obj:\n            userStory_dict = {}\n            userStory_dict[\"name\"] = usecase.short_name\n            userStory_dict[\"description\"] = usecase.description\n            userStory_dict[\"children\"] = []\n            userStory_dict[\"type\"] = \"us\"\n            userStory_dict[\"title\"] = \"User Story\"\n            for abuses in usecase.abuses:\n                abuserStory_dict = {}\n                abuserStory_dict[\"name\"] = abuses.short_name\n                abuserStory_dict[\"description\"] = abuses.description\n                abuserStory_dict[\"children\"] = []\n                abuserStory_dict[\"type\"] = \"as\"\n                abuserStory_dict[\"title\"] = \"Abuser Story\"\n                userStory_dict[\"children\"].append(abuserStory_dict)\n                for scenario in abuses.scenarios:\n                    threat_scenario_dict = {}\n                    threat_scenario_dict[\"name\"] = scenario.name\n                    threat_scenario_dict[\"description\"] = scenario.description\n                    threat_scenario_dict[\"vul_name\"] = scenario.vul_name\n                    threat_scenario_dict[\"severity\"] = scenario.severity\n                    threat_scenario_dict[\"cwe\"] = scenario.cwe\n                    threat_scenario_dict[\"children\"] = []\n                    threat_scenario_dict[\"type\"] = \"sce\"\n                    threat_scenario_dict[\"title\"] = \"Threat Scenario\"\n                    abuserStory_dict[\"children\"].append(threat_scenario_dict)\n                    for test in scenario.tests:\n                        test_dict = {}\n                        test_dict[\"name\"] = test.name\n                        test_dict[\"test_case\"] = test.test_case\n                        test_dict[\"tools\"] = test.tools\n                        test_dict[\"test_type\"] = test.test_type\n                        test_dict[\"executed\"] = test.executed\n                        test_dict[\"type\"] = \"tc\"\n                        test_dict[\"title\"] = \"Test Case\"\n                        threat_scenario_dict[\"children\"].append(test_dict)\n            user_story_tree.append(userStory_dict)\n        try:\n            ref_scans = json.loads(json.dumps(user_story_tree))\n            return respond(True, False, data=ref_scans)\n        except Exception as e:\n            return respond(False, True, message=\"UserStory does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"UserStory does not exist\"), 404\n\n\n@app.route(\"/api/abuser-story/project\", methods=[\"POST\"])\n@validate_user\ndef get_abuser_story_tree_by_project():\n    data = request.get_json()\n    abuser_story_tree = []\n    if \"project\" in data:\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        try:\n            usecases_obj = UseCase.objects(project=ref_project.id)\n        except Exception:\n            return respond(False, True, message=\"Target does not exist\"), 404\n        for usecase in usecases_obj:\n            for abuses in usecase.abuses:\n                abuserStory_dict = {}\n                abuserStory_dict[\"name\"] = abuses.short_name\n                abuserStory_dict[\"description\"] = abuses.description\n                abuserStory_dict[\"children\"] = []\n                abuserStory_dict[\"type\"] = \"as\"\n                abuserStory_dict[\"title\"] = \"Abuser Story\"\n                # userStory_dict['children'].append(abuserStory_dict)\n                for scenario in abuses.scenarios:\n                    threat_scenario_dict = {}\n                    threat_scenario_dict[\"name\"] = scenario.name\n                    threat_scenario_dict[\"description\"] = scenario.description\n                    threat_scenario_dict[\"vul_name\"] = scenario.vul_name\n                    threat_scenario_dict[\"severity\"] = scenario.severity\n                    threat_scenario_dict[\"cwe\"] = scenario.cwe\n                    threat_scenario_dict[\"children\"] = []\n                    threat_scenario_dict[\"type\"] = \"sce\"\n                    threat_scenario_dict[\"title\"] = \"Threat Scenario\"\n                    abuserStory_dict[\"children\"].append(threat_scenario_dict)\n                    for test in scenario.tests:\n                        test_dict = {}\n                        test_dict[\"name\"] = test.name\n                        test_dict[\"test_case\"] = test.test_case\n                        test_dict[\"executed\"] = test.executed\n                        test_dict[\"tools\"] = test.tools\n                        test_dict[\"test_type\"] = test.test_type\n                        test_dict[\"type\"] = \"tc\"\n                        test_dict[\"title\"] = \"Test Case\"\n                        threat_scenario_dict[\"children\"].append(test_dict)\n                abuser_story_tree.append(abuserStory_dict)\n        try:\n            ref_scans = json.loads(json.dumps(abuser_story_tree))\n            return respond(True, False, data=ref_scans)\n        except Exception as e:\n            return respond(False, True, message=\"AbuserStory does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"AbuserStory does not exist\"), 404\n\n\n@app.route(\"/api/threat-scenario/project\", methods=[\"POST\"])\n@validate_user\ndef get_threat_scenario_tree_by_project():\n    data = request.get_json()\n    threat_scenario_tree = []\n    if \"project\" in data:\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        try:\n            usecases_obj = UseCase.objects(project=ref_project.id)\n        except Exception:\n            return respond(False, True, message=\"Target does not exist\"), 404\n        for usecase in usecases_obj:\n            for abuses in usecase.abuses:\n                for scenario in abuses.scenarios:\n                    threat_scenario_dict = {}\n                    threat_scenario_dict[\"name\"] = scenario.name\n                    threat_scenario_dict[\"description\"] = scenario.description\n                    threat_scenario_dict[\"vul_name\"] = scenario.vul_name\n                    threat_scenario_dict[\"severity\"] = scenario.severity\n                    threat_scenario_dict[\"cwe\"] = scenario.cwe\n                    threat_scenario_dict[\"children\"] = []\n                    threat_scenario_dict[\"type\"] = \"sce\"\n                    threat_scenario_dict[\"title\"] = \"Threat Scenario\"\n                    for test in scenario.tests:\n                        test_dict = {}\n                        test_dict[\"name\"] = test.name\n                        test_dict[\"test_case\"] = test.test_case\n                        test_dict[\"tools\"] = test.tools\n                        test_dict[\"test_type\"] = test.test_type\n                        test_dict[\"executed\"] = test.executed\n                        test_dict[\"type\"] = \"tc\"\n                        test_dict[\"title\"] = \"Test Case\"\n                        threat_scenario_dict[\"children\"].append(test_dict)\n                    threat_scenario_tree.append(threat_scenario_dict)\n        try:\n            ref_scans = json.loads(json.dumps(threat_scenario_tree))\n            return respond(True, False, data=ref_scans)\n        except Exception as e:\n            return respond(False, True, message=\"ThreatScenario does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"ThreatScenario does not exist\"), 404\n\n\n@app.route(\"/api/threatmap/project\", methods=[\"POST\"])\n@validate_user\ndef get_threatmap_by_project():\n    data = request.get_json()\n    threat_map = {}\n    if \"project\" in data:\n        try:\n            ref_project = Project.objects.get(name=data.get(\"project\"))\n            threat_map[\"name\"] = ref_project.name\n            threat_map[\"children\"] = []\n            threat_map[\"type\"] = \"Project\"\n            threat_map[\"id\"] = 1\n        except Exception:\n            return respond(False, True, message=\"Project does not exist\"), 404\n        try:\n            usecases_obj = UseCase.objects(project=ref_project.id)\n        except Exception:\n            return respond(False, True, message=\"Target does not exist\"), 404\n        for usecase in usecases_obj:\n            userStory_id = str(uuid.uuid4())\n            userStory_dict = {}\n            userStory_dict[\"id\"] = userStory_id\n            userStory_dict[\"name\"] = usecase.short_name\n            userStory_dict[\"title\"] = usecase.description\n            userStory_dict[\"type\"] = \"Feature\"\n            userStory_dict[\"children\"] = []\n            threat_map[\"children\"].append(userStory_dict)\n            for abuses in usecase.abuses:\n                abuserStory_id = str(uuid.uuid4())\n                abuserStory_dict = {}\n                abuserStory_dict[\"id\"] = abuserStory_id\n                abuserStory_dict[\"name\"] = abuses.short_name\n                abuserStory_dict[\"title\"] = abuses.description\n                abuserStory_dict[\"children\"] = []\n                abuserStory_dict[\"type\"] = \"Abuses\"\n                userStory_dict[\"children\"].append(abuserStory_dict)\n                for scenario in abuses.scenarios:\n                    scenario_id = str(uuid.uuid4())\n                    threat_scenario_dict = {}\n                    threat_scenario_dict[\"id\"] = scenario_id\n                    threat_scenario_dict[\"name\"] = scenario.name\n                    threat_scenario_dict[\"title\"] = scenario.description\n                    threat_scenario_dict[\"vul_name\"] = scenario.vul_name\n                    threat_scenario_dict[\"severity\"] = scenario.severity\n                    threat_scenario_dict[\"cwe\"] = scenario.cwe\n                    threat_scenario_dict[\"children\"] = []\n                    threat_scenario_dict[\"type\"] = \"Scenarios\"\n                    abuserStory_dict[\"children\"].append(threat_scenario_dict)\n                    for test in scenario.tests:\n                        test_id = str(uuid.uuid4())\n                        test_dict = {}\n                        test_dict[\"id\"] = test_id\n                        test_dict[\"name\"] = test.name\n                        test_dict[\"title\"] = test.test_case\n                        test_dict[\"tools\"] = test.tools\n                        test_dict[\"test_type\"] = test.test_type\n                        test_dict[\"executed\"] = test.executed\n                        test_dict[\"type\"] = \"Test Cases\"\n                        threat_scenario_dict[\"children\"].append(test_dict)\n        try:\n            ref_threatmap = json.loads(json.dumps(threat_map))\n            return respond(True, False, data=ref_threatmap)\n        except Exception as e:\n            return respond(False, True, message=\"THreatMap does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"THreatMap does not exist\"), 404\n\n\n@app.route(\"/api/scan-vuls/project\", methods=[\"POST\"])\n@validate_user\ndef get_individual_scan_vuls():\n    data = request.get_json()\n    if \"name\" in data:\n        try:\n            ref_scans = Scan.objects.get(name=data.get(\"name\"))\n            ref_vuls = json.loads(Vulnerability.objects(scan=ref_scans.id).to_json())\n            return respond(True, False, data=ref_vuls)\n        except Exception as e:\n            return respond(False, True, message=\"Scans does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n    return respond(False, True, message=\"Scans does not exist\"), 404\n\n\n@app.route(\"/api/asvs\", methods=[\"POST\"])\n@validate_user\ndef get_asvs_vuls():\n    data = request.get_json()\n    if \"cwe\" in data:\n        try:\n            ref_asvs = json.loads(ASVS.objects(cwe=data.get(\"cwe\")).to_json())\n            return respond(True, False, data=ref_asvs)\n        except Exception as e:\n            return respond(False, True, message=\"ASVS does not exist\"), 404\n    else:\n        return respond(False, True, message=\"Project does not exist\"), 404\n\n    return respond(False, True, message=\"ASVS does not exist\"), 404\n\n\n@app.route(\"/api/delete/feature\", methods=[\"POST\"])\n@validate_user\ndef delete_feature():\n    data = request.get_json()\n    if \"name\" not in data and \"project\" not in data:\n        return (\n            respond(\n                False,\n                True,\n                message=\"Mandatory fields 'name' and 'project' not in request\",\n            ),\n            400,\n        )\n\n    try:\n        ref_project = Project.objects.get(name=data.get(\"project\"))\n        ref_use_case = UseCase.objects.get(\n            short_name=data.get(\"name\"), project=ref_project\n        )\n        ref_use_case.delete()\n        return respond(\n            True,\n            False,\n            message=\"Successfully deleted Feature: {}\".format(data.get(\"name\")),\n        )\n    except Exception as del_e:\n        logger.error(del_e)\n        return respond(False, True, message=\"Unable to delete Use-Case\"), 500\n\n\n@app.route(\"/api/delete/abuser-story\", methods=[\"POST\"])\n@validate_user\ndef delete_abuse_case():\n    data = request.get_json()\n    if \"name\" not in data and \"feature\" not in data:\n        return (\n            respond(\n                False,\n                True,\n                message=\"Mandatory fields 'name' and 'feature' not in request\",\n            ),\n            400,\n        )\n\n    try:\n        ref_use_case = UseCase.objects.get(short_name=data.get(\"feature\"))\n        ref_abuse = AbuseCase.objects.get(\n            short_name=data.get(\"name\"), use_case=ref_use_case\n        )\n        ref_abuse.delete()\n        return respond(\n            True,\n            False,\n            message=\"Successfully deleted Abuser Story: {}\".format(data.get(\"name\")),\n        )\n    except Exception as del_e:\n        logger.error(del_e)\n        return respond(False, True, message=\"Unable to delete Abuser Story\"), 500\n\n\n@app.route(\"/api/delete/scenario\", methods=[\"POST\"])\n@validate_user\ndef delete_scenario():\n    data = request.get_json()\n    if \"name\" not in data and \"abuser_story\" not in data:\n        return (\n            respond(\n                False,\n                True,\n                message=\"Mandatory fields 'name' and 'abuser_story' not in request\",\n            ),\n            400,\n        )\n\n    try:\n        ref_abuse_case = AbuseCase.objects.get(short_name=data.get(\"abuser_story\"))\n        ref_scenario = ThreatModel.objects.get(\n            name=data.get(\"name\"), abuse_case=ref_abuse_case\n        )\n        ref_scenario.delete()\n        return respond(\n            True,\n            False,\n            message=\"Successfully deleted Threat Scenario: {}\".format(data.get(\"name\")),\n        )\n    except Exception as del_e:\n        logger.error(del_e)\n        return respond(False, True, message=\"Unable to delete Threat Scenario\"), 500\n\n\n@app.route(\"/api/delete/test\", methods=[\"POST\"])\n@validate_user\ndef delete_test():\n    data = request.get_json()\n    if \"name\" not in data and \"scenario\" not in data:\n        return (\n            respond(\n                False,\n                True,\n                message=\"Mandatory fields 'name' and 'scenario' not in request\",\n            ),\n            400,\n        )\n\n    try:\n        ref_scenario = ThreatModel.objects.get(name=data.get(\"scenario\"))\n        ref_test = Test.objects.get(name=data.get(\"name\"), scenario=ref_scenario)\n        ref_scenario.delete()\n        return respond(\n            True,\n            False,\n            message=\"Successfully deleted Test-Case: {}\".format(data.get(\"name\")),\n        )\n    except Exception as del_e:\n        logger.error(del_e)\n        return respond(False, True, message=\"Unable to delete Test Case\"), 500\n\n\n@app.route(\"/api/delete/project\", methods=[\"POST\"])\n@validate_user\ndef delete_project():\n    data = request.get_json()\n    if \"name\" not in data:\n        return (\n            respond(False, True, message=\"Mandatory fields 'name' not in request\"),\n            400,\n        )\n\n    try:\n        ref_project = Project.objects.get(name=data.get(\"name\"))\n        ref_project.delete()\n        return respond(\n            True,\n            False,\n            message=\"Successfully deleted Project {}\".format(data.get(\"name\")),\n        )\n    except Exception as del_e:\n        logger.error(del_e)\n        return respond(False, True, message=\"Unable to delete Project\"), 500\n\n\nif __name__ == \"__main__\":\n    app.run(host=\"0.0.0.0\", debug=True)\n\n"
  },
  {
    "path": "api/tp_api/asvs/asvs.csv",
    "content": "V1,Architecture,1.1.1,Verify the use of a secure software development lifecycle that addresses security in all stages of development. ([C1](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,,\r\nV1,Architecture,1.1.2,\"Verify the use of threat modeling for every design change or sprint planning to identify threats, plan for countermeasures, facilitate appropriate risk responses, and guide security testing.\",,X,X,1053,\r\nV1,Architecture,1.1.3,\"Verify that all user stories and features contain functional security constraints, such as \"\"As a user, I should be able to view and edit my profile. I should not be able to view or edit anyone else's profile\"\"\",,X,X,1110,\r\nV1,Architecture,1.1.4,\"Verify documentation and justification of all the application's trust boundaries, components, and significant data flows.\",,X,X,1059,\r\nV1,Architecture,1.1.5,Verify definition and security analysis of the application's high-level architecture and all connected remote services. ([C1](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,1059,\r\nV1,Architecture,1.1.6,\"Verify implementation of centralized, simple (economy of design), vetted, secure, and reusable security controls to avoid duplicate, missing, ineffective, or insecure controls. ([C10](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,637,\r\nV1,Architecture,1.1.7,\"Verify availability of a secure coding checklist, security requirements, guideline, or policy to all developers and testers.\",,X,X,637,\r\nV1,Architecture,1.10.1,\"Verify that a source code control system is in use, with procedures to ensure that check-ins are accompanied by issues or change tickets. The source code control system should have access control and identifiable users to allow traceability of any changes.\",,X,X,284,\r\nV1,Architecture,1.11.1,Verify the definition and documentation of all application components in terms of the business or security functions they provide.,,X,X,1059,\r\nV1,Architecture,1.11.2,\"Verify that all high-value business logic flows, including authentication, session management and access control, do not share unsynchronized state.\",,X,X,362,\r\nV1,Architecture,1.11.3,\"Verify that all high-value business logic flows, including authentication, session management and access control are thread safe and resistant to time-of-check and time-of-use race conditions.\",,,X,367,\r\nV1,Architecture,1.12.1,Verify that user-uploaded files are stored outside of the web root.,,X,X,552,\r\nV1,Architecture,1.12.2,\"Verify that user-uploaded files - if required to be displayed or downloaded from the application - are served by either octet stream downloads, or from an unrelated domain, such as a cloud file storage bucket. Implement a suitable content security policy to reduce the risk from XSS vectors or other attacks from the uploaded file.\",,X,X,646,\r\nV1,Architecture,1.14.1,\"Verify the segregation of components of differing trust levels through well-defined security controls, firewall rules, API gateways, reverse proxies, cloud-based security groups, or similar mechanisms.\",,X,X,923,\r\nV1,Architecture,1.14.2,\"Verify that if deploying binaries to untrusted devices makes use of binary signatures, trusted connections, and verified endpoints.\",,X,X,494,\r\nV1,Architecture,1.14.3,Verify that the build pipeline warns of out-of-date or insecure components and takes appropriate actions.,,X,X,1104,\r\nV1,Architecture,1.14.4,\"Verify that the build pipeline contains a build step to automatically build and verify the secure deployment of the application, particularly if the application infrastructure is software defined, such as cloud environment build scripts.\",,X,X,,\r\nV1,Architecture,1.14.5,\"Verify that application deployments adequately sandbox, containerize and/or isolate at the network level to delay and deter attackers from attacking other applications, especially when they are performing sensitive or dangerous actions such as deserialization. ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,265,\r\nV1,Architecture,1.14.6,\"Verify the application does not use unsupported, insecure, or deprecated client-side technologies such as NSAPI plugins, Flash, Shockwave, ActiveX, Silverlight, NACL, or client-side Java applets.\",,X,X,477,\r\nV1,Architecture,1.2.1,\"Verify the use of unique or special low-privilege operating system accounts for all application components, services, and servers. ([C3](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,250,\r\nV1,Architecture,1.2.2,\"Verify that communications between application components, including APIs, middleware and data layers, are authenticated. Components should have the least necessary privileges needed. ([C3](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,306,\r\nV1,Architecture,1.2.3,\"Verify that the application uses a single vetted authentication mechanism that is known to be secure, can be extended to include strong authentication, and has sufficient logging and monitoring to detect account abuse or breaches.\",,X,X,306,\r\nV1,Architecture,1.2.4,\"Verify that all authentication pathways and identity management APIs implement consistent authentication security control strength, such that there are no weaker alternatives per the risk of the application.\",,X,X,306,\r\nV1,Architecture,1.4.1,\"Verify that trusted enforcement points such as at access control gateways, servers, and serverless functions enforce access controls. Never enforce access controls on the client.\",,X,X,602,\r\nV1,Architecture,1.4.2,Verify that the chosen access control solution is flexible enough to meet the application's needs.,,X,X,284,\r\nV1,Architecture,1.4.3,\"Verify enforcement of the principle of least privilege in functions, data files, URLs, controllers, services, and other resources. This implies protection against spoofing and elevation of privilege.\",,X,X,272,\r\nV1,Architecture,1.4.4,Verify the application uses a single and well-vetted access control mechanism for accessing protected data and resources. All requests must pass through this single mechanism to avoid copy and paste or insecure alternative paths. ([C7](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,284,\r\nV1,Architecture,1.4.5,Verify that attribute or feature-based access control is used whereby the code checks the user's authorization for a feature/data item rather than just their role. Permissions should still be allocated using roles. ([C7](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,275,\r\nV1,Architecture,1.5.1,\"Verify that input and output requirements clearly define how to handle and process data based on type, content, and applicable laws, regulations, and other policy compliance.\",,X,X,1029,\r\nV1,Architecture,1.5.2,\"Verify that serialization is not used when communicating with untrusted clients. If this is not possible, ensure that adequate integrity controls (and possibly encryption if sensitive data is sent) are enforced to prevent deserialization attacks including object injection.\",,X,X,502,\r\nV1,Architecture,1.5.3,Verify that input validation is enforced on a trusted service layer. ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,602,\r\nV1,Architecture,1.5.4,Verify that output encoding occurs close to or by the interpreter for which it is intended. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,116,\r\nV1,Architecture,1.6.1,Verify that there is an explicit policy for management of cryptographic keys and that a cryptographic key lifecycle follows a key management standard such as NIST SP 800-57.,,X,X,320,\r\nV1,Architecture,1.6.2,Verify that consumers of cryptographic services protect key material and other secrets by using key vaults or API based alternatives.,,X,X,320,\r\nV1,Architecture,1.6.3,Verify that all keys and passwords are replaceable and are part of a well-defined process to re-encrypt sensitive data.,,X,X,320,\r\nV1,Architecture,1.6.4,\"Verify that symmetric keys, passwords, or API secrets generated by or shared with clients are used only in protecting low risk secrets, such as encrypting local storage, or temporary ephemeral uses such as parameter obfuscation. Sharing secrets with clients is clear-text equivalent and architecturally should be treated as such.\",,X,X,320,\r\nV1,Architecture,1.7.1,Verify that a common logging format and approach is used across the system.  ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,1009,\r\nV1,Architecture,1.7.2,\"Verify that logs are securely transmitted to a preferably remote system for analysis, detection, alerting, and escalation. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,,\r\nV1,Architecture,1.8.1,Verify that all sensitive data is identified and classified into protection levels.,,X,X,,\r\nV1,Architecture,1.8.2,\"Verify that all protection levels have an associated set of protection requirements, such as encryption requirements, integrity requirements, retention, privacy and other confidentiality requirements, and that these are applied in the architecture.\",,X,X,,\r\nV1,Architecture,1.9.1,\"Verify the application encrypts communications between components, particularly when these components are in different containers, systems, sites, or cloud providers. ([C3](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,319,\r\nV1,Architecture,1.9.2,\"Verify that application components verify the authenticity of each side in a communication link to prevent person-in-the-middle attacks. For example, application components should validate TLS certificates and chains.\",,X,X,295,\r\nV2,Authentication,2.1.1,Verify that user set passwords are at least 12 characters in length. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.10,Verify that there are no periodic credential rotation or password history requirements.,X,X,X,263,5.1.1.2\r\nV2,Authentication,2.1.11,\"Verify that \"\"paste\"\" functionality, browser password helpers, and external password managers are permitted.\",X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.12,\"Verify that the user can choose to either temporarily view the entire masked password, or temporarily view the last typed character of the password on platforms that do not have this as native functionality.\",X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.2,Verify that passwords 64 characters or longer are permitted. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.3,Verify that passwords can contain spaces and truncation is not performed. Consecutive multiple spaces MAY optionally be coalesced. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.4,\"Verify that Unicode characters are permitted in passwords. A single Unicode code point is considered a character, so 12 emoji or 64 kanji characters should be valid and permitted.\",X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.5,Verify users can change their password.,X,X,X,620,5.1.1.2\r\nV2,Authentication,2.1.6,Verify that password change functionality requires the user's current and new password.,X,X,X,620,5.1.1.2\r\nV2,Authentication,2.1.7,\"Verify that passwords submitted during account registration, login, and password change are checked against a set of breached passwords either locally (such as the top 1,000 or 10,000 most common passwords which match the system's password policy) or using an external API. If using an API a zero knowledge proof or other mechanism should be used to ensure that the plain text password is not sent or used in verifying the breach status of the password. If the password is breached, the application must require the user to set a new non-breached password. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.8,Verify that a password strength meter is provided to help users set a stronger password.,X,X,X,521,5.1.1.2\r\nV2,Authentication,2.1.9,Verify that there are no password composition rules limiting the type of characters permitted. There should be no requirement for upper or lower case or numbers or special characters. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,521,5.1.1.2\r\nV2,Authentication,2.10.1,\"Verify that integration secrets do not rely on unchanging passwords, such as API keys or shared privileged accounts.\",,OS assisted,HSM,287,5.1.1.1\r\nV2,Authentication,2.10.2,\"Verify that if passwords are required, the credentials are not a default account.\",,OS assisted,HSM,255,5.1.1.1\r\nV2,Authentication,2.10.3,\"Verify that passwords are stored with sufficient protection to prevent offline recovery attacks, including local system access.\",,OS assisted,HSM,522,5.1.1.1\r\nV2,Authentication,2.10.4,\"Verify passwords, integrations with databases and third-party systems, seeds and internal secrets, and API keys are managed securely and not included in the source code or stored within source code repositories. Such storage SHOULD resist offline attacks. The use of a secure software key store (L1), hardware trusted platform module (TPM), or a hardware security module (L3) is recommended for password storage.\",,OS assisted,HSM,798,\r\nV2,Authentication,2.2.1,\"Verify that anti-automation controls are effective at mitigating breached credential testing, brute force, and account lockout attacks. Such controls include blocking the most common breached passwords, soft lockouts, rate limiting, CAPTCHA, ever increasing delays between attempts, IP address restrictions, or risk-based restrictions such as location, first login on a device, recent attempts to unlock the account, or similar. Verify that no more than 100 failed attempts per hour is possible on a single account.\",X,X,X,307,5.2.2 / 5.1.1.2 / 5.1.4.2 / 5.1.5.2\r\nV2,Authentication,2.2.2,\"Verify that the use of weak authenticators (such as SMS and email) is limited to secondary verification and transaction approval and not as a replacement for more secure authentication methods. Verify that stronger methods are offered before weak methods, users are aware of the risks, or that proper measures are in place to limit the risks of account compromise.\",X,X,X,304,5.2.10\r\nV2,Authentication,2.2.3,\"Verify that secure notifications are sent to users after updates to authentication details, such as credential resets, email or address changes, logging in from unknown or risky locations. The use of push notifications - rather than SMS or email - is preferred, but in the absence of push notifications, SMS or email is acceptable as long as no sensitive information is disclosed in the notification.\",X,X,X,620,\r\nV2,Authentication,2.2.4,\"Verify impersonation resistance against phishing, such as the use of multi-factor authentication, cryptographic devices with intent (such as connected keys with a push to authenticate), or at higher AAL levels, client-side certificates.\",,,X,308,5.2.5\r\nV2,Authentication,2.2.5,\"Verify that where a credential service provider (CSP) and the application verifying authentication are separated, mutually authenticated TLS is in place between the two endpoints.\",,,X,319,5.2.6\r\nV2,Authentication,2.2.6,\"Verify replay resistance through the mandated use of OTP devices, cryptographic authenticators, or lookup codes.\",,,X,308,5.2.8\r\nV2,Authentication,2.2.7,Verify intent to authenticate by requiring the entry of an OTP token or user-initiated action such as a button press on a FIDO hardware key.,,,X,308,5.2.9\r\nV2,Authentication,2.3.1,\"Verify system generated initial passwords or activation codes SHOULD be securely randomly generated, SHOULD be at least 6 characters long, and MAY contain letters and numbers, and expire after a short period of time. These initial secrets must not be permitted to become the long term password.\",X,X,X,330,5.1.1.2 / A.3\r\nV2,Authentication,2.3.2,\"Verify that enrollment and use of subscriber-provided authentication devices are supported, such as a U2F or FIDO tokens.\",,X,X,308,6.1.3\r\nV2,Authentication,2.3.3,Verify that renewal instructions are sent with sufficient time to renew time bound authenticators.,,X,X,287,6.1.4\r\nV2,Authentication,2.4.1,\"Verify that passwords are stored in a form that is resistant to offline attacks. Passwords SHALL be salted and hashed using an approved one-way key derivation or password hashing function. Key derivation and password hashing functions take a password, a salt, and a cost factor as inputs when generating a password hash. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,916,5.1.1.2\r\nV2,Authentication,2.4.2,\"Verify that the salt is at least 32 bits in length and be chosen arbitrarily to minimize salt value collisions among stored hashes. For each credential, a unique salt value and the resulting hash SHALL be stored. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,916,5.1.1.2\r\nV2,Authentication,2.4.3,\"Verify that if PBKDF2 is used, the iteration count SHOULD be as large as verification server performance will allow, typically at least 100,000 iterations. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,916,5.1.1.2\r\nV2,Authentication,2.4.4,\"Verify that if bcrypt is used, the work factor SHOULD be as large as verification server performance will allow, typically at least 13. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,916,5.1.1.2\r\nV2,Authentication,2.4.5,\"Verify that an additional iteration of a key derivation function is performed, using a salt value that is secret and known only to the verifier. Generate the salt value using an approved random bit generator [SP 800-90Ar1] and provide at least the minimum security strength specified in the latest revision of SP 800-131A. The secret salt value SHALL be stored separately from the hashed passwords (e.g., in a specialized device like a hardware security module).\",,X,X,916,5.1.1.2\r\nV2,Authentication,2.5.1,Verify that a system generated initial activation or recovery secret is not sent in clear text to the user. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,640,5.1.1.2\r\nV2,Authentication,2.5.2,\"Verify password hints or knowledge-based authentication (so-called \"\"secret questions\"\") are not present.\",X,X,X,640,5.1.1.2\r\nV2,Authentication,2.5.3,Verify password credential recovery does not reveal the current password in any way. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,640,5.1.1.2\r\nV2,Authentication,2.5.4,\"Verify shared or default accounts are not present (e.g. \"\"root\"\", \"\"admin\"\", or \"\"sa\"\").\",X,X,X,16,5.1.1.2 / A.3\r\nV2,Authentication,2.5.5,\"Verify that if an authentication factor is changed or replaced, that the user is notified of this event.\",X,X,X,304,6.1.2.3\r\nV2,Authentication,2.5.6,\"Verify forgotten password, and other recovery paths use a secure recovery mechanism, such as TOTP or other soft token, mobile push, or another offline recovery mechanism. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,640,5.1.1.2\r\nV2,Authentication,2.5.7,\"Verify that if OTP or multi-factor authentication factors are lost, that evidence of identity proofing is performed at the same level as during enrollment.\",,X,X,308,6.1.2.3\r\nV2,Authentication,2.6.1,Verify that lookup secrets can be used only once.,,X,X,308,5.1.2.2\r\nV2,Authentication,2.6.2,\"Verify that lookup secrets have sufficient randomness (112 bits of entropy), or if less than 112 bits of entropy, salted with a unique and random 32-bit salt and hashed with an approved one-way hash.\",,X,X,330,5.1.2.2\r\nV2,Authentication,2.6.3,\"Verify that lookup secrets are resistant to offline attacks, such as predictable values.\",,X,X,310,5.1.2.2\r\nV2,Authentication,2.7.1,\"Verify that clear text out of band (NIST \"\"restricted\"\") authenticators, such as SMS or PSTN, are not offered by default, and stronger alternatives such as push notifications are offered first.\",X,X,X,287,5.1.3.2\r\nV2,Authentication,2.7.2,\"Verify that the out of band verifier expires out of band authentication requests, codes, or tokens after 10 minutes.\",X,X,X,287,5.1.3.2\r\nV2,Authentication,2.7.3,\"Verify that the out of band verifier authentication requests, codes, or tokens are only usable once, and only for the original authentication request.\",X,X,X,287,5.1.3.2\r\nV2,Authentication,2.7.4,Verify that the out of band authenticator and verifier communicates over a secure independent channel.,X,X,X,523,5.1.3.2\r\nV2,Authentication,2.7.5,Verify that the out of band verifier retains only a hashed version of the authentication code.,,X,X,256,5.1.3.2\r\nV2,Authentication,2.7.6,\"Verify that the initial authentication code is generated by a secure random number generator, containing at least 20 bits of entropy (typically a six digital random number is sufficient).\",,X,X,310,5.1.3.2\r\nV2,Authentication,2.8.1,Verify that time-based OTPs have a defined lifetime before expiring.,X,X,X,613,5.1.4.2 / 5.1.5.2\r\nV2,Authentication,2.8.2,\"Verify that symmetric keys used to verify submitted OTPs are highly protected, such as by using a hardware security module or secure operating system based key storage.\",,X,X,320,5.1.4.2 / 5.1.5.2\r\nV2,Authentication,2.8.3,\"Verify that approved cryptographic algorithms are used in the generation, seeding, and verification.\",,X,X,326,5.1.4.2 / 5.1.5.2\r\nV2,Authentication,2.8.4,Verify that time-based OTP can be used only once within the validity period.,,X,X,287,5.1.4.2 / 5.1.5.2\r\nV2,Authentication,2.8.5,\"Verify that if a time-based multi factor OTP token is re-used during the validity period, it is logged and rejected with secure notifications being sent to the holder of the device.\",,X,X,287,5.1.5.2\r\nV2,Authentication,2.8.6,\"Verify physical single factor OTP generator can be revoked in case of theft or other loss. Ensure that revocation is immediately effective across logged in sessions, regardless of location.\",,X,X,613,5.2.1\r\nV2,Authentication,2.8.7,Verify that biometric authenticators are limited to use only as secondary factors in conjunction with either something you have and something you know.,,o,X,308,5.2.3\r\nV2,Authentication,2.9.1,\"Verify that cryptographic keys used in verification are stored securely and protected against disclosure, such as using a TPM or HSM, or an OS service that can use this secure storage.\",,X,X,320,5.1.7.2\r\nV2,Authentication,2.9.2,\"Verify that the challenge nonce is at least 64 bits in length, and statistically unique or unique over the lifetime of the cryptographic device.\",,X,X,330,5.1.7.2\r\nV2,Authentication,2.9.3,\"Verify that approved cryptographic algorithms are used in the generation, seeding, and verification.\",,X,X,327,5.1.7.2\r\nV3,Session,3.1.1,Verify the application never reveals session tokens in URL parameters or error messages.,X,X,X,598,\r\nV3,Session,3.2.1,Verify the application generates a new session token on user authentication. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,384,7.1\r\nV3,Session,3.2.2,Verify that session tokens possess at least 64 bits of entropy. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,331,7.1\r\nV3,Session,3.2.3,Verify the application only stores session tokens in the browser using secure methods such as appropriately secured cookies (see section 3.4) or HTML 5 session storage.,X,X,X,539,7.1\r\nV3,Session,3.2.4,Verify that session token are generated using approved cryptographic algorithms. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,331,7.1\r\nV3,Session,3.3.1,\"Verify that logout and expiration invalidate the session token, such that the back button or a downstream relying party does not resume an authenticated session, including across relying parties. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,613,7.1\r\nV3,Session,3.3.2,\"If authenticators permit users to remain logged in, verify that re-authentication occurs periodically both when actively used or after an idle period. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",30 days,\"12 hours or 30 minutes of inactivity, 2FA optional\",\"12 hours or 15 minutes of inactivity, with 2FA\",613,7.2\r\nV3,Session,3.3.3,\"Verify that the application terminates all other active sessions after a successful password change, and that this is effective across the application, federated login (if present), and any relying parties.\",,X,X,613,\r\nV3,Session,3.3.4,Verify that users are able to view and log out of any or all currently active sessions and devices.,,X,X,613,7.1\r\nV3,Session,3.4.1,Verify that cookie-based session tokens have the 'Secure' attribute set. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,614,7.1.1\r\nV3,Session,3.4.2,Verify that cookie-based session tokens have the 'HttpOnly' attribute set. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,1004,7.1.1\r\nV3,Session,3.4.3,Verify that cookie-based session tokens utilize the 'SameSite' attribute to limit exposure to cross-site request forgery attacks. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,16,7.1.1\r\nV3,Session,3.4.4,\"Verify that cookie-based session tokens use \"\"__Host-\"\" prefix (see references) to provide session cookie confidentiality.\",X,X,X,16,7.1.1\r\nV3,Session,3.4.5,\"Verify that if the application is published under a domain name with other applications that set or use session cookies that might override or disclose the session cookies, set the path attribute in cookie-based session tokens using the most precise path possible. ([C6](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,16,7.1.1\r\nV3,Session,3.5.1,Verify the application does not treat OAuth and refresh tokens &mdash; on their own &mdash; as the presence of the subscriber and allows users to terminate trust relationships with linked applications.,,X,X,290,7.1.2\r\nV3,Session,3.5.2,\"Verify the application uses session tokens rather than static API secrets and keys, except with legacy implementations.\",,X,X,798,\r\nV3,Session,3.5.3,\"Verify that stateless session tokens use digital signatures, encryption, and other countermeasures to protect against tampering, enveloping, replay, null cipher, and key substitution attacks.\",,X,X,345,\r\nV3,Session,3.6.1,Verify that relying parties specify the maximum authentication time to CSPs and that CSPs re-authenticate the subscriber if they haven't used a session within that period.,,,X,613,7.2.1\r\nV3,Session,3.6.2,\"Verify that CSPs inform relying parties of the last authentication event, to allow RPs to determine if they need to re-authenticate the user.\",,,X,613,7.2.1\r\nV3,Session,3.7.1,Verify the application ensures a valid login session or requires re-authentication or secondary verification before allowing any sensitive transactions or account modifications.,X,X,X,778,\r\nV4,Access,4.1.1,\"Verify that the application enforces access control rules on a trusted service layer, especially if client-side access control is present and could be bypassed.\",X,X,X,602,\r\nV4,Access,4.1.2,Verify that all user and data attributes and policy information used by access controls cannot be manipulated by end users unless specifically authorized.,X,X,X,639,\r\nV4,Access,4.1.3,\"Verify that the principle of least privilege exists - users should only be able to access functions, data files, URLs, controllers, services, and other resources, for which they possess specific authorization. This implies protection against spoofing and elevation of privilege. ([C7](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,285,\r\nV4,Access,4.1.4,Verify that the principle of deny by default exists whereby new users/roles start with minimal or no permissions and users/roles do not receive access to new features until access is explicitly assigned.  ([C7](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,276,\r\nV4,Access,4.1.5,Verify that access controls fail securely including when an exception occurs. ([C10](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,285,\r\nV4,Access,4.2.1,\"Verify that sensitive data and APIs are protected against direct object attacks targeting creation, reading, updating and deletion of records, such as creating or updating someone else's record, viewing everyone's records, or deleting all records.\",X,X,X,639,\r\nV4,Access,4.2.2,\"Verify that the application or framework enforces a strong anti-CSRF mechanism to protect authenticated functionality, and effective anti-automation or anti-CSRF protects unauthenticated functionality.\",X,X,X,352,\r\nV4,Access,4.3.1,Verify administrative interfaces use appropriate multi-factor authentication to prevent unauthorized use.,X,X,X,419,\r\nV4,Access,4.3.2,\"Verify that directory browsing is disabled unless deliberately desired. Additionally, applications should not allow discovery or disclosure of file or directory metadata, such as Thumbs.db, .DS_Store, .git or .svn folders.\",X,X,X,548,\r\nV4,Access,4.3.3,\"Verify the application has additional authorization (such as step up or adaptive authentication) for lower value systems, and / or segregation of duties for high value applications to enforce anti-fraud controls as per the risk of application and past fraud.\",,X,X,732,\r\nV5,Validation,5.1.1,\"Verify that the application has defenses against HTTP parameter pollution attacks, particularly if the application framework makes no distinction about the source of request parameters (GET, POST, cookies, headers, or environment variables).\",X,X,X,235,\r\nV5,Validation,5.1.2,\"Verify that frameworks protect against mass parameter assignment attacks, or that the application has countermeasures to protect against unsafe parameter assignment, such as marking fields private or similar. ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,915,\r\nV5,Validation,5.1.3,\"Verify that all input (HTML form fields, REST requests, URL parameters, HTTP headers, cookies, batch files, RSS feeds, etc) is validated using positive validation (whitelisting). ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,20,\r\nV5,Validation,5.1.4,\"Verify that structured data is strongly typed and validated against a defined schema including allowed characters, length and pattern (e.g. credit card numbers or telephone, or validating that two related fields are reasonable, such as checking that suburb and zip/postcode match). ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,20,\r\nV5,Validation,5.1.5,\"Verify that URL redirects and forwards only allow whitelisted destinations, or show a warning when redirecting to potentially untrusted content.\",X,X,X,601,\r\nV5,Validation,5.2.1,Verify that all untrusted HTML input from WYSIWYG editors or similar is properly sanitized with an HTML sanitizer library or framework feature. ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,116,\r\nV5,Validation,5.2.2,Verify that unstructured data is sanitized to enforce safety measures such as allowed characters and length.,X,X,X,138,\r\nV5,Validation,5.2.3,Verify that the application sanitizes user input before passing to mail systems to protect against SMTP or IMAP injection.,X,X,X,147,\r\nV5,Validation,5.2.4,\"Verify that the application avoids the use of eval() or other dynamic code execution features. Where there is no alternative, any user input being included must be sanitized or sandboxed before being executed.\",X,X,X,95,\r\nV5,Validation,5.2.5,Verify that the application protects against template injection attacks by ensuring that any user input being included is sanitized or sandboxed.,X,X,X,94,\r\nV5,Validation,5.2.6,\"Verify that the application protects against SSRF attacks, by validating or sanitizing untrusted data or HTTP file metadata, such as filenames and URL input fields, use whitelisting of protocols, domains, paths and ports.\",X,X,X,918,\r\nV5,Validation,5.2.7,\"Verify that the application sanitizes, disables, or sandboxes user-supplied SVG scriptable content, especially as they relate to XSS resulting from inline scripts, and foreignObject.\",X,X,X,159,\r\nV5,Validation,5.2.8,\"Verify that the application sanitizes, disables, or sandboxes user-supplied scriptable or expression template language content, such as Markdown, CSS or XSL stylesheets, BBCode, or similar.\",X,X,X,94,\r\nV5,Validation,5.3.1,\"Verify that output encoding is relevant for the interpreter and context required. For example, use encoders specifically for HTML values, HTML attributes, JavaScript, URL Parameters, HTTP headers, SMTP, and others as the context requires, especially from untrusted inputs (e.g. names with Unicode or apostrophes, such as ねこ or O'Hara). ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,116,\r\nV5,Validation,5.3.10,Verify that the application protects against XPath injection or XML injection attacks. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,643,\r\nV5,Validation,5.3.2,\"Verify that output encoding preserves the user's chosen character set and locale, such that any Unicode character point is valid and safely handled. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,176,\r\nV5,Validation,5.3.3,\"Verify that context-aware, preferably automated - or at worst, manual - output escaping protects against reflected, stored, and DOM based XSS. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,79,\r\nV5,Validation,5.3.4,\"Verify that data selection or database queries (e.g. SQL, HQL, ORM, NoSQL) use parameterized queries, ORMs, entity frameworks, or are otherwise protected from database injection attacks. ([C3](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,89,\r\nV5,Validation,5.3.5,\"Verify that where parameterized or safer mechanisms are not present, context-specific output encoding is used to protect against injection attacks, such as the use of SQL escaping to protect against SQL injection. ([C3, C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,89,\r\nV5,Validation,5.3.6,\"Verify that the application projects against JavaScript or JSON injection attacks, including for eval attacks, remote JavaScript includes, CSP bypasses, DOM XSS, and JavaScript expression evaluation. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,830,\r\nV5,Validation,5.3.7,\"Verify that the application protects against LDAP Injection vulnerabilities, or that specific security controls to prevent LDAP Injection have been implemented. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,943,\r\nV5,Validation,5.3.8,Verify that the application protects against OS command injection and that operating system calls use parameterized OS queries or use contextual command line output encoding. ([C4](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,78,\r\nV5,Validation,5.3.9,Verify that the application protects against Local File Inclusion (LFI) or Remote File Inclusion (RFI) attacks.,X,X,X,829,\r\nV5,Validation,5.4.1,\"Verify that the application uses memory-safe string, safer memory copy and pointer arithmetic to detect or prevent stack, buffer, or heap overflows.\",,X,X,120,\r\nV5,Validation,5.4.2,\"Verify that format strings do not take potentially hostile input, and are constant.\",,X,X,134,\r\nV5,Validation,5.4.3,\"Verify that sign, range, and input validation techniques are used to prevent integer overflows.\",,X,X,190,\r\nV5,Validation,5.5.1,Verify that serialized objects use integrity checks or are encrypted to prevent hostile object creation or data tampering. ([C5](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,502,\r\nV5,Validation,5.5.2,Verify that the application correctly restricts XML parsers to only use the most restrictive configuration possible and to ensure that unsafe features such as resolving external entities are disabled to prevent XXE.,X,X,X,611,\r\nV5,Validation,5.5.3,\"Verify that deserialization of untrusted data is avoided or is protected in both custom code and third-party libraries (such as JSON, XML and YAML parsers).\",X,X,X,502,\r\nV5,Validation,5.5.4,\"Verify that when parsing JSON in browsers or JavaScript-based backends, JSON.parse is used to parse the JSON document. Do not use eval() to parse JSON.\",X,X,X,95,\r\nV6,Cryptography,6.1.1,\"Verify that regulated private data is stored encrypted while at rest, such as personally identifiable information (PII), sensitive personal information, or data assessed likely to be subject to EU's GDPR.\",,X,X,311,\r\nV6,Cryptography,6.1.2,\"Verify that regulated health data is stored encrypted while at rest, such as medical records, medical device details, or de-anonymized research records.\",,X,X,311,\r\nV6,Cryptography,6.1.3,\"Verify that regulated financial data is stored encrypted while at rest, such as financial accounts, defaults or credit history, tax records, pay history, beneficiaries, or de-anonymized market or research records.\",,X,X,311,\r\nV6,Cryptography,6.2.1,\"Verify that all cryptographic modules fail securely, and errors are handled in a way that does not enable Padding Oracle attacks.\",X,X,X,310,\r\nV6,Cryptography,6.2.2,\"Verify that industry proven or government approved cryptographic algorithms, modes, and libraries are used, instead of custom coded cryptography. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,327,\r\nV6,Cryptography,6.2.3,\"Verify that encryption initialization vector, cipher configuration, and block modes are configured securely using the latest advice.\",,X,X,326,\r\nV6,Cryptography,6.2.4,\"Verify that random number, encryption or hashing algorithms, key lengths, rounds, ciphers or modes, can be reconfigured, upgraded, or swapped at any time, to protect against cryptographic breaks. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,326,\r\nV6,Cryptography,6.2.5,\"Verify that known insecure block modes (i.e. ECB, etc.), padding modes (i.e. PKCS#1 v1.5, etc.), ciphers with small block sizes (i.e. Triple-DES, Blowfish, etc.), and weak hashing algorithms (i.e. MD5, SHA1, etc.) are not used unless required for backwards compatibility.\",,X,X,326,\r\nV6,Cryptography,6.2.6,\"Verify that nonces, initialization vectors, and other single use numbers must not be used more than once with a given encryption key. The method of generation must be appropriate for the algorithm being used.\",,X,X,326,\r\nV6,Cryptography,6.2.7,\"Verify that encrypted data is authenticated via signatures, authenticated cipher modes, or HMAC to ensure that ciphertext is not altered by an unauthorized party.\",,,X,326,\r\nV6,Cryptography,6.2.8,\"Verify that all cryptographic operations are constant-time, with no 'short-circuit' operations in comparisons, calculations, or returns, to avoid leaking information.\",,,X,385,\r\nV6,Cryptography,6.3.1,\"Verify that all random numbers, random file names, random GUIDs, and random strings are generated using the cryptographic module's approved cryptographically secure random number generator when these random values are intended to be not guessable by an attacker.\",,X,X,338,\r\nV6,Cryptography,6.3.2,\"Verify that random GUIDs are created using the GUID v4 algorithm, and a cryptographically-secure pseudo-random number generator (CSPRNG). GUIDs created using other pseudo-random number generators may be predictable.\",,X,X,338,\r\nV6,Cryptography,6.3.3,\"Verify that random numbers are created with proper entropy even when the application is under heavy load, or that the application degrades gracefully in such circumstances.\",,,X,338,\r\nV6,Cryptography,6.4.1,\"Verify that a secrets management solution such as a key vault is used to securely create, store, control access to and destroy secrets. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,798,\r\nV6,Cryptography,6.4.2,Verify that key material is not exposed to the application but instead uses an isolated security module like a vault for cryptographic operations. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,320,\r\nV7,Error,7.1.1,\"Verify that the application does not log credentials or payment details. Session tokens should only be stored in logs in an irreversible, hashed form. ([C9, C10](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,532,\r\nV7,Error,7.1.2,Verify that the application does not log other sensitive data as defined under local privacy laws or relevant security policy. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),X,X,X,532,\r\nV7,Error,7.1.3,\"Verify that the application logs security relevant events including successful and failed authentication events, access control failures, deserialization failures and input validation failures. ([C5, C7](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,778,\r\nV7,Error,7.1.4,Verify that each log event includes necessary information that would allow for a detailed investigation of the timeline when an event happens. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,778,\r\nV7,Error,7.2.1,\"Verify that all authentication decisions are logged, without storing sensitive session identifiers or passwords. This should include requests with relevant metadata needed for security investigations.\",,X,X,778,\r\nV7,Error,7.2.2,Verify that all access control decisions can be logged and all failed decisions are logged. This should include requests with relevant metadata needed for security investigations.,,X,X,285,\r\nV7,Error,7.3.1,Verify that the application appropriately encodes user-supplied data to prevent log injection. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,117,\r\nV7,Error,7.3.2,Verify that all events are protected from injection when viewed in log viewing software. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,117,\r\nV7,Error,7.3.3,Verify that security logs are protected from unauthorized access and modification. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,200,\r\nV7,Error,7.3.4,Verify that time sources are synchronized to the correct time and time zone. Strongly consider logging only in UTC if systems are global to assist with post-incident forensic analysis. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,,\r\nV7,Error,7.4.1,\"Verify that a generic message is shown when an unexpected or security sensitive error occurs, potentially with a unique ID which support personnel can use to investigate.  ([C10](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,210,\r\nV7,Error,7.4.2,Verify that exception handling (or a functional equivalent) is used across the codebase to account for expected and unexpected error conditions. ([C10](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,544,\r\nV7,Error,7.4.3,\"Verify that a \"\"last resort\"\" error handler is defined which will catch all unhandled exceptions. ([C10](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,460,\r\nV8,Data,8.1.1,Verify the application protects sensitive data from being cached in server components such as load balancers and application caches.,,X,X,524,\r\nV8,Data,8.1.2,Verify that all cached or temporary copies of sensitive data stored on the server are protected from unauthorized access or purged/invalidated after the authorized user accesses the sensitive data.,,X,X,524,\r\nV8,Data,8.1.3,\"Verify the application minimizes the number of parameters in a request, such as hidden fields, Ajax variables, cookies and header values.\",,X,X,233,\r\nV8,Data,8.1.4,\"Verify the application can detect and alert on abnormal numbers of requests, such as by IP, user, total per hour or day, or whatever makes sense for the application.\",,X,X,770,\r\nV8,Data,8.1.5,Verify that regular backups of important data are performed and that test restoration of data is performed.,,,X,19,\r\nV8,Data,8.1.6,Verify that backups are stored securely to prevent data from being stolen or corrupted.,,,X,19,\r\nV8,Data,8.2.1,Verify the application sets sufficient anti-caching headers so that sensitive data is not cached in modern browsers.,X,X,X,525,\r\nV8,Data,8.2.2,\"Verify that data stored in client side storage (such as HTML5 local storage, session storage, IndexedDB, regular cookies or Flash cookies) does not contain sensitive data or PII.\",X,X,X,922,\r\nV8,Data,8.2.3,\"Verify that authenticated data is cleared from client storage, such as the browser DOM, after the client or session is terminated.\",X,X,X,922,\r\nV8,Data,8.3.1,\"Verify that sensitive data is sent to the server in the HTTP message body or headers, and that query string parameters from any HTTP verb do not contain sensitive data.\",X,X,X,319,\r\nV8,Data,8.3.2,Verify that users have a method to remove or export their data on demand.,X,X,X,212,\r\nV8,Data,8.3.3,Verify that users are provided clear language regarding collection and use of supplied personal information and that users have provided opt-in consent for the use of that data before it is used in any way.,X,X,X,285,\r\nV8,Data,8.3.4,\"Verify that all sensitive data created and processed by the application has been identified, and ensure that a policy is in place on how to deal with sensitive data. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,200,\r\nV8,Data,8.3.5,\"Verify accessing sensitive data is audited (without logging the sensitive data itself), if the data is collected under relevant data protection directives or where logging of access is required.\",,X,X,532,\r\nV8,Data,8.3.6,\"Verify that sensitive information contained in memory is overwritten as soon as it is no longer required to mitigate memory dumping attacks, using zeroes or random data.\",,X,X,226,\r\nV8,Data,8.3.7,\"Verify that sensitive or private information that is required to be encrypted, is encrypted using approved algorithms that provide both confidentiality and integrity. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,327,\r\nV8,Data,8.3.8,\"Verify that sensitive personal information is subject to data retention classification, such that old or out of date data is deleted automatically, on a schedule, or as the situation requires.\",,X,X,285,\r\nV9,Communications,9.1.1,\"Verify that secured TLS is used for all client connectivity, and does not fall back to insecure or unencrypted protocols. ([C8](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,319,\r\nV9,Communications,9.1.2,\"Verify using online or up to date TLS testing tools that only strong algorithms, ciphers, and protocols are enabled, with the strongest algorithms and ciphers set as preferred.\",X,X,X,326,\r\nV9,Communications,9.1.3,\"Verify that old versions of SSL and TLS protocols, algorithms, ciphers, and configuration are disabled, such as SSLv2, SSLv3, or TLS 1.0 and TLS 1.1. The latest version of TLS should be the preferred cipher suite.\",X,X,X,326,\r\nV9,Communications,9.2.1,\"Verify that connections to and from the server use trusted TLS certificates. Where internally generated or self-signed certificates are used, the server must be configured to only trust specific internal CAs and specific self-signed certificates. All others should be rejected.\",,X,X,295,\r\nV9,Communications,9.2.2,\"Verify that encrypted communications such as TLS is used for all inbound and outbound connections, including for management ports, monitoring, authentication, API, or web service calls, database, cloud, serverless, mainframe, external, and partner connections. The server must not fall back to insecure or unencrypted protocols.\",,X,X,319,\r\nV9,Communications,9.2.3,Verify that all encrypted connections to external systems that involve sensitive information or functions are authenticated.,,X,X,287,\r\nV9,Communications,9.2.4,\"Verify that proper certification revocation, such as Online Certificate Status Protocol (OCSP) Stapling, is enabled and configured.\",,X,X,299,\r\nV9,Communications,9.2.5,Verify that backend TLS connection failures are logged.,,,X,544,\r\nV10,Malicious,10.1.1,\"Verify that a code analysis tool is in use that can detect potentially malicious code, such as time functions, unsafe file operations and network connections.\",,,X,749,\r\nV10,Malicious,10.2.1,\"Verify that the application source code and third party libraries do not contain unauthorized phone home or data collection capabilities. Where such functionality exists, obtain the user's permission for it to operate  before collecting any data.\",,X,X,359,\r\nV10,Malicious,10.2.2,\"Verify that the application does not ask for unnecessary or excessive permissions to privacy related features or sensors, such as contacts, cameras, microphones, or location.\",,X,X,272,\r\nV10,Malicious,10.2.3,\"Verify that the application source code and third party libraries do not contain back doors, such as hard-coded or additional undocumented accounts or keys, code obfuscation, undocumented binary blobs, rootkits, or anti-debugging, insecure debugging features, or otherwise out of date, insecure, or hidden functionality that could be used maliciously if discovered.\",,,X,507,\r\nV10,Malicious,10.2.4,Verify that the application source code and third party libraries does not contain time bombs by searching for date and time related functions.,,,X,511,\r\nV10,Malicious,10.2.5,\"Verify that the application source code and third party libraries does not contain malicious code, such as salami attacks, logic bypasses, or logic bombs.\",,,X,511,\r\nV10,Malicious,10.2.6,Verify that the application source code and third party libraries do not contain Easter eggs or any other potentially unwanted functionality.,,,X,507,\r\nV10,Malicious,10.3.1,\"Verify that if the application has a client or server auto-update feature, updates should be obtained over secure channels and digitally signed. The update code must validate the digital signature of the update before installing or executing the update.\",X,X,X,16,\r\nV10,Malicious,10.3.2,\"Verify that the application employs integrity protections, such as code signing or sub-resource integrity. The application must not load or execute code from untrusted sources, such as loading includes, modules, plugins, code, or libraries from untrusted sources or the Internet.\",X,X,X,353,\r\nV10,Malicious,10.3.3,\"Verify that the application has protection from sub-domain takeovers if the application relies upon DNS entries or DNS sub-domains, such as expired domain names, out of date DNS pointers or CNAMEs, expired projects at public source code repos, or transient cloud APIs, serverless functions, or storage buckets (autogen-bucket-id.cloud.example.com) or similar. Protections can include ensuring that DNS names used by applications are regularly checked for expiry or change.\",X,X,X,350,\r\nV11,BusLogic,11.1.1,Verify the application will only process business logic flows for the same user in sequential step order and without skipping steps.,X,X,X,841,\r\nV11,BusLogic,11.1.2,\"Verify the application will only process business logic flows with all steps being processed in realistic human time, i.e. transactions are not submitted too quickly.\",X,X,X,779,\r\nV11,BusLogic,11.1.3,Verify the application has appropriate limits for specific business actions or transactions which are correctly enforced on a per user basis.,X,X,X,770,\r\nV11,BusLogic,11.1.4,\"Verify the application has sufficient anti-automation controls to detect and protect against data exfiltration, excessive business logic requests, excessive file uploads or denial of service attacks.\",X,X,X,770,\r\nV11,BusLogic,11.1.5,\"Verify the application has business logic limits or validation to protect against likely business risks or threats, identified using threat modelling or similar methodologies.\",X,X,X,841,\r\nV11,BusLogic,11.1.6,\"Verify the application does not suffer from \"\"time of check to time of use\"\" (TOCTOU) issues or other race conditions for sensitive operations.\",,X,X,367,\r\nV11,BusLogic,11.1.7,\"Verify the application monitors for unusual events or activity from a business logic perspective. For example, attempts to perform actions out of order or actions which a normal user would never attempt. ([C9](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,754,\r\nV11,BusLogic,11.1.8,Verify the application has configurable alerting when automated attacks or unusual activity is detected.,,X,X,390,\r\nV12,Files,12.1.1,Verify that the application will not accept large files that could fill up storage or cause a denial of service attack.,X,X,X,400,\r\nV12,Files,12.1.2,\"Verify that compressed files are checked for \"\"zip bombs\"\" - small input files that will decompress into huge files thus exhausting file storage limits.\",,X,X,409,\r\nV12,Files,12.1.3,\"Verify that a file size quota and maximum number of files per user is enforced to ensure that a single user cannot fill up the storage with too many files, or excessively large files.\",,X,X,770,\r\nV12,Files,12.2.1,Verify that files obtained from untrusted sources are validated to be of expected type based on the file's content.,,X,X,434,\r\nV12,Files,12.3.1,Verify that user-submitted filename metadata is not used directly with system or framework file and URL API to protect against path traversal.,X,X,X,22,\r\nV12,Files,12.3.2,\"Verify that user-submitted filename metadata is validated or ignored to prevent the disclosure, creation, updating or removal of local files (LFI).\",X,X,X,73,\r\nV12,Files,12.3.3,\"Verify that user-submitted filename metadata is validated or ignored to prevent the disclosure or execution of remote files (RFI), which may also lead to SSRF.\",X,X,X,98,\r\nV12,Files,12.3.4,\"Verify that the application protects against reflective file download (RFD) by validating or ignoring user-submitted filenames in a JSON, JSONP, or URL parameter, the response Content-Type header should be set to text/plain, and the Content-Disposition header should have a fixed filename.\",X,X,X,641,\r\nV12,Files,12.3.5,\"Verify that untrusted file metadata is not used directly with system API or libraries, to protect against OS command injection.\",X,X,X,78,\r\nV12,Files,12.3.6,\"Verify that the application does not include and execute functionality from untrusted sources, such as unverified content distribution networks, JavaScript libraries, node npm libraries, or server-side DLLs.\",,X,X,829,\r\nV12,Files,12.4.1,\"Verify that files obtained from untrusted sources are stored outside the web root, with limited permissions, preferably with strong validation.\",X,X,X,922,\r\nV12,Files,12.4.2,Verify that files obtained from untrusted sources are scanned by antivirus scanners to prevent upload of known malicious content.,X,X,X,509,\r\nV12,Files,12.5.1,\"Verify that the web tier is configured to serve only files with specific file extensions to prevent unintentional information and source code leakage. For example, backup files (e.g. .bak), temporary working files (e.g. .swp), compressed files (.zip, .tar.gz, etc) and other extensions commonly used by editors should be blocked unless required.\",X,X,X,552,\r\nV12,Files,12.5.2,Verify that direct requests to uploaded files will never be executed as HTML/JavaScript content.,X,X,X,434,\r\nV12,Files,12.6.1,Verify that the web or application server is configured with a whitelist of resources or systems to which the server can send requests or load data/files from.,X,X,X,918,\r\nV13,API,13.1.1,Verify that all application components use the same encodings and parsers to avoid parsing attacks that exploit different URI or file parsing behavior that could be used in SSRF and RFI attacks.,X,X,X,116,\r\nV13,API,13.1.2,Verify that access to administration and management functions is limited to authorized administrators.,X,X,X,419,\r\nV13,API,13.1.3,\"Verify API URLs do not expose sensitive information, such as the API key, session tokens etc.\",X,X,X,598,\r\nV13,API,13.1.4,\"Verify that authorization decisions are made at both the URI, enforced by programmatic or declarative security at the controller or router, and at the resource level, enforced by model-based permissions.\",,X,X,285,\r\nV13,API,13.1.5,Verify that requests containing unexpected or missing content types are rejected with appropriate headers (HTTP response status 406 Unacceptable or 415 Unsupported Media Type).,,X,X,434,\r\nV13,API,13.2.1,\"Verify that enabled RESTful HTTP methods are a valid choice for the user or action, such as preventing normal users using DELETE or PUT on protected API or resources.\",X,X,X,650,\r\nV13,API,13.2.2,Verify that JSON schema validation is in place and verified before accepting input.,X,X,X,20,\r\nV13,API,13.2.3,\"Verify that RESTful web services that utilize cookies are protected from Cross-Site Request Forgery via the use of at least one or more of the following: triple or double submit cookie pattern (see [references](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet)), CSRF nonces, or ORIGIN request header checks.\",X,X,X,352,\r\nV13,API,13.2.4,\"Verify that REST services have anti-automation controls to protect against excessive calls, especially if the API is unauthenticated.\",,X,X,779,\r\nV13,API,13.2.5,\"Verify that REST services explicitly check the incoming Content-Type to be the expected one, such as application/xml or application/JSON.\",,X,X,436,\r\nV13,API,13.2.6,Verify that the message headers and payload are trustworthy and not modified in transit. Requiring strong encryption for transport (TLS only) may be sufficient in many cases as it provides both confidentiality and integrity protection. Per-message digital signatures can provide additional assurance on top of the transport protections for high-security applications but bring with them additional complexity and risks to weigh against the benefits.,,X,X,345,\r\nV13,API,13.3.1,\"Verify that XSD schema validation takes place to ensure a properly formed XML document, followed by validation of each input field before any processing of that data takes place.\",X,X,X,20,\r\nV13,API,13.3.2,Verify that the message payload is signed using WS-Security to ensure reliable transport between client and service.,,X,X,345,\r\nV13,API,13.4.1,\"Verify that query whitelisting or a combination of depth limiting and amount limiting should be used to prevent GraphQL or data layer expression denial of service (DoS) as a result of expensive, nested queries. For more advanced scenarios, query cost analysis should be used.\",,X,X,770,\r\nV13,API,13.4.2,Verify that GraphQL or other data layer authorization logic should be implemented at the business logic layer instead of the GraphQL layer.,,X,X,285,\r\nV14,Config,14.1.1,\"Verify that the application build and deployment processes are performed in a secure and repeatable way, such as CI / CD automation, automated configuration management, and automated deployment scripts.\",,X,X,,\r\nV14,Config,14.1.2,\"Verify that compiler flags are configured to enable all available buffer overflow protections and warnings, including stack randomization, data execution prevention, and to break the build if an unsafe pointer, memory, format string, integer, or string operations are found.\",,X,X,120,\r\nV14,Config,14.1.3,Verify that server configuration is hardened as per the recommendations of the application server and frameworks in use.,,X,X,16,\r\nV14,Config,14.1.4,\"Verify that the application, configuration, and all dependencies can be re-deployed using automated deployment scripts, built from a documented and tested runbook in a reasonable time, or restored from backups in a timely fashion.\",,X,X,,\r\nV14,Config,14.1.5,Verify that authorized administrators can verify the integrity of all security-relevant configurations to detect tampering.,,,X,,\r\nV14,Config,14.2.1,\"Verify that all components are up to date, preferably using a dependency checker during build or compile time. ([C2](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",X,X,X,1026,\r\nV14,Config,14.2.2,\"Verify that all unneeded features, documentation, samples, configurations are removed, such as sample applications, platform documentation, and default or example users.\",X,X,X,1002,\r\nV14,Config,14.2.3,\"Verify that if application assets, such as JavaScript libraries, CSS stylesheets or web fonts, are hosted externally on a content delivery network (CDN) or external provider, Subresource Integrity (SRI) is used to validate the integrity of the asset.\",X,X,X,714,\r\nV14,Config,14.2.4,\"Verify that third party components come from pre-defined, trusted and continually maintained repositories. ([C2](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering))\",,X,X,829,\r\nV14,Config,14.2.5,Verify that an inventory catalog is maintained of all third party libraries in use. ([C2](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,,\r\nV14,Config,14.2.6,Verify that the attack surface is reduced by sandboxing or encapsulating third party libraries to expose only the required behaviour into the application. ([C2](https://www.owasp.org/index.php/OWASP_Proactive_Controls#tab=Formal_Numbering)),,X,X,265,\r\nV14,Config,14.3.1,\"Verify that web or application server and framework error messages are configured to deliver user actionable, customized responses to eliminate any unintended security disclosures.\",X,X,X,209,\r\nV14,Config,14.3.2,\"Verify that web or application server and application framework debug modes are disabled in production to eliminate debug features, developer consoles, and unintended security disclosures.\",X,X,X,497,\r\nV14,Config,14.3.3,Verify that the HTTP headers or any part of the HTTP response do not expose detailed version information of system components.,X,X,X,200,\r\nV14,Config,14.4.1,\"Verify that every HTTP response contains a content type header specifying a safe character set (e.g., UTF-8, ISO 8859-1).\",X,X,X,173,\r\nV14,Config,14.4.2,\"Verify that all API responses contain Content-Disposition: attachment; filename=\"\"api.json\"\" (or other appropriate filename for the content type).\",X,X,X,116,\r\nV14,Config,14.4.3,\"Verify that a content security policy (CSPv2) is in place that helps mitigate impact for XSS attacks like HTML, DOM, JSON, and JavaScript injection vulnerabilities.\",X,X,X,1021,\r\nV14,Config,14.4.4,Verify that all responses contain X-Content-Type-Options: nosniff.,X,X,X,116,\r\nV14,Config,14.4.5,\"Verify that HTTP Strict Transport Security headers are included on all responses and for all subdomains, such as Strict-Transport-Security: max-age=15724800; includeSubdomains.\",X,X,X,523,\r\nV14,Config,14.4.6,\"Verify that a suitable \"\"Referrer-Policy\"\" header is included, such as \"\"no-referrer\"\" or \"\"same-origin\"\".\",X,X,X,116,\r\nV14,Config,14.4.7,Verify that a suitable X-Frame-Options or Content-Security-Policy: frame-ancestors header is in use for sites where content should not be embedded in a third-party site.,X,X,X,346,\r\nV14,Config,14.5.1,\"Verify that the application server only accepts the HTTP methods in use by the application or API, including pre-flight OPTIONS.\",X,X,X,749,\r\nV14,Config,14.5.2,\"Verify that the supplied Origin header is not used for authentication or access control decisions, as the Origin header can easily be changed by an attacker.\",X,X,X,346,\r\nV14,Config,14.5.3,\"Verify that the cross-domain resource sharing (CORS) Access-Control-Allow-Origin header uses a strict white-list of trusted domains to match against and does not support the \"\"null\"\" origin.\",X,X,X,346,\r\nV14,Config,14.5.4,\"Verify that HTTP headers added by a trusted proxy or SSO devices, such as a bearer token, are authenticated by the application.\",,X,X,306,"
  },
  {
    "path": "api/tp_api/models.py",
    "content": "from mongoengine import *\nimport datetime\nfrom uuid import uuid4\nfrom hashlib import sha256\nfrom mongoengine import signals\n\n\ndef random_scan_name():\n    return str(uuid4())\n\n\nclass Project(Document):\n    name = StringField(max_length=100, required=True, unique=True)\n    orchy_webhook = StringField(required=False)\n    features = ListField(ReferenceField(\"UseCase\"), required=False)\n\n\nclass RepoTestCase(Document):\n    name = StringField()\n    test_case = StringField()\n    executed = BooleanField(default=False)\n    tools = ListField(StringField())\n    type = StringField(max_length=20)\n    tags = ListField(StringField())\n\n\nclass Repo(Document):\n    short_name = StringField(required=True)\n    name = StringField(required=True)\n    cwe = IntField(required=True)\n    description = StringField()\n    variants = ListField(StringField())\n    categories = ListField(StringField())\n    mitigations = ListField(DictField())\n    risks = ListField(DictField())\n    tests = ListField(ReferenceField(RepoTestCase))\n    related_cwes = ListField(IntField())\n\n\nclass Interaction(Document):\n    nature_choices = ((\"I\", \"Internal\"), (\"E\", \"External\"))\n    nature = StringField(choices=nature_choices)\n    endpoint = StringField()\n    data_flow = StringField()\n    project = ReferenceField(Project, reverse_delete_rule=CASCADE)\n\n\nclass UseCase(Document):\n    short_name = StringField(unique=True)\n    description = StringField()\n    project = ReferenceField(Project, reverse_delete_rule=CASCADE, required=True)\n    relations = ListField(ReferenceField(Interaction))\n    boundary = StringField()\n    abuses = ListField(ReferenceField(\"AbuseCase\"))\n\n\nclass AbuseCase(Document):\n    short_name = StringField(max_length=100, unique=True)\n    description = StringField()\n    use_case = ReferenceField(UseCase, reverse_delete_rule=CASCADE, required=True)\n    scenarios = ListField(ReferenceField(\"ThreatModel\"), required=False)\n\n\nmodel_type_choices = ((\"repo\", \"repo\"), (\"inline\", \"inline\"))\n\n\nclass Mitigations(EmbeddedDocument):\n    phase = StringField()\n    strategy = StringField()\n    description = StringField()\n    code = StringField()\n\n\nclass Risk(EmbeddedDocument):\n    description = StringField()\n    phase = StringField()\n\n\nclass ThreatModel(Document):\n    # meta = {'collection': 'threat_model'}\n    name = StringField()\n    vul_name = StringField()\n    description = StringField(required=True)\n    severity = IntField()\n    model_type = StringField(max_length=6, choices=model_type_choices)\n    repo_vul_name = ReferenceField(Repo)\n    use_case = ReferenceField(UseCase, reverse_delete_rule=CASCADE)\n    abuse_case = ReferenceField(AbuseCase, reverse_delete_rule=CASCADE)\n    cwe = IntField()\n    risks = EmbeddedDocumentListField(Risk)\n    categories = ListField(StringField(max_length=30))\n    mitigations = EmbeddedDocumentListField(Mitigations)\n    tests = ListField(ReferenceField(\"Test\"))\n\n\nclass Test(Document):\n    name = StringField()\n    test_case = StringField()\n    executed = BooleanField(default=False)\n    tools = ListField(StringField())\n    test_type = StringField()\n    tags = ListField(StringField())\n    scenario = ReferenceField(ThreatModel, reverse_delete_rule=CASCADE)\n\n\nclass Risk(EmbeddedDocument):\n    consequence = StringField()\n    risk_type = StringField()\n\n\nclass VulnerabilityEvidence(Document):\n    evidence_type = StringField()\n    log = StringField()\n    url = StringField()\n    line_num = IntField()\n    param = StringField()\n    attack = StringField()\n    info = StringField()\n    vuln = ReferenceField(\"Vulnerability\")\n\n\nclass Vulnerability(Document):\n    severity_choices = ((3, \"High\"), (2, \"Medium\"), (1, \"Low\"), (0, \"Info\"))\n    tool = StringField()\n    name = StringField()\n    cwe = IntField()\n    severity = IntField(choices=severity_choices)\n    description = StringField()\n    observation = StringField()\n    remediation = StringField()\n    evidences = ListField(ReferenceField(VulnerabilityEvidence))\n    created_on = DateTimeField(default=datetime.datetime.utcnow)\n    scan = ReferenceField(\"Scan\")\n    target = ReferenceField(\"Target\")\n\n\nclass Scan(Document):\n    created_on = DateTimeField(default=datetime.datetime.utcnow)\n    name = StringField(unique=True)\n    vulnerabilities = ListField(ReferenceField(\"Vulnerability\"))\n    target = ReferenceField(\"Target\")\n    tool = StringField()\n    scan_type = StringField(\n        choices=(\n            (\"SAST\", \"Static Analysis\"),\n            (\"DAST\", \"Dynamic Analysis\"),\n            (\"SCA\", \"Source Composition Analysis\"),\n            (\"IAST\", \"Interactive Analysis\"),\n            (\"Manual\", \"Manual Scan\"),\n        )\n    )\n\n    @classmethod\n    def pre_save(cls, sender, document, **kwargs):\n        document.name = \"{}-scan-{}-{}@{}\".format(\n            document.tool,\n            document.target.name,\n            document.target.project.name,\n            datetime.datetime.utcnow().isoformat(),\n        )\n\n\nclass Target(Document):\n    name = StringField(unique=True)\n    url = StringField()\n    project = ReferenceField(Project, reverse_delete_rule=CASCADE)\n    scans = ListField(ReferenceField(Scan))\n\n\nclass User(Document):\n    user_type_choices = ((\"super\", \"superuser\"), (\"user\", \"user\"))\n    email = StringField(max_length=100, unique=True)\n    password = StringField(max_length=100)\n    user_type = StringField(choices=user_type_choices, max_length=6, default=\"user\")\n    default_password = BooleanField(default=True)\n\n\nclass Settings(Document):\n    orchy_url = StringField()\n    orchy_user = StringField()\n    orchy_password = StringField()\n\n\nclass ASVS(Document):\n    section = StringField()\n    name = StringField()\n    item = StringField()\n    description = StringField()\n    l1 = BooleanField(default=False)\n    l2 = BooleanField(default=False)\n    l3 = BooleanField(default=False)\n    cwe = IntField()\n    nist = StringField()\n\n\nsignals.pre_save.connect(Scan.pre_save, sender = Scan)"
  },
  {
    "path": "api/tp_api/repo/aws_s3.yaml",
    "content": "name: Misconfigured AWS S3 Bucket\ncwe: 16\ndescription: Misconfigured Amazon AWS S3 Bucket(s) might allow unauthorized users to read/write files in the specific\n  S3 buckets\nmitigations:\n- description: Ensure that IAM Policies are set for AWS S3 to protect against public/unauthorized access to unauthorized users\n  phase: Implementation\n- description: Consider implementation of encryption for data stored in AWS S3\n  phase: Implementation\nrisk:\n- consequence: Unauthorized Users may gain access to files with sensitive information in the AWS S3 bucket(s)\n  type: Confidentiality\n- consequence: Unauthorized Users may write/modify data in the AWS S3 bucket(s)\n  type: Integrity\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools to identify misconfigured AWS S3 buckets\n  tools: [scout2,prowler,weirdaal,burpsuite]\n  type: discovery\n- name: manual\n  test: test for misconfigured AWS S3 Buckets manually, as part of a Pentest or Bug-bounty\n  type: manual\ncategories: [cloud]\n"
  },
  {
    "path": "api/tp_api/repo/cert_validation.yaml",
    "content": "name: Improper Certificate Validation\ndescription: The software does not validate, or incorrectly validates, a certificate.\ncwe: 295\ncategories: [app_vulns,owasp]\nmitigations:\n- description: Certificates should be carefully managed and checked to assure that\n    data are encrypted with the intended owner's public key.\n  phase: Architecture and Design\n- description: Certificates should be deployed with strong CipherSuite Specs and Perfect Forward Secrecy for highest\n    levels of protection\n  phase: Implementation\nrisk:\n- consequence: Attacker may be able to leverage a weak SSL Implementation to compromise the master key/keying materials,\n    thereby compromising the transmission of sensitive information\n  type: Confidentiality\ntest-cases:\n- name: ssl-test\n  test: Check for SSL/TLS implementation with automated tools\n  tools: [ssllabs.com,testssl.sh,sslyze,sslscan,nmap]\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of misconfigured SSL/TLS Implementation or Plaintext Data Transmission\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances that relate to misconfigured SSL/TLS Implementation or Plaintext Data Transmission\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity]\n  type: sast"
  },
  {
    "path": "api/tp_api/repo/code_injection.yaml",
    "content": "name: Code Injection\ndescription: The software constructs all or part of a code segment using externally-influenced\n  input from an upstream component, but it does not neutralize or incorrectly neutralizes\n  special elements that could modify the syntax or behavior of the intended code segment.\ncategories: [app_vulns,owasp]\ncwe: 94\nmitigations:\n- description: Refactor your program so that you do not have to dynamically generate\n    code.\n  phase: Architecture and Design\n- description: To reduce the likelihood of code injection, use stringent whitelists\n    that limit which constructs are allowed. If you are dynamically constructing code\n    that invokes a function, then verifying that the input is alphanumeric might be\n    insufficient. An attacker might still be able to reference a dangerous function\n    that you did not intend to allow, such as system(), exec(), or exit().\n  phase: Implementation\n- description: Use automated static analysis tools that target this type of weakness.\n    Many modern techniques use data flow analysis to minimize the number of false\n    positives. This is not a perfect solution, since 100% accuracy and coverage are\n    not feasible.\n  phase: Testing\n- description: Use dynamic tools and techniques that interact with the software using\n    large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness\n    testing, and fault injection. The software's operation may slow down, but it should\n    not become unstable, crash, or generate incorrect results.\n  phase: Testing\n- description: Run the code in an environment that performs automatic taint propagation\n    and prevents any command execution that uses tainted variables, such as Perl's\n    \"-T\" switch. This will force the program to perform validation steps that remove\n    the taint, although you must be careful to correctly validate your inputs so that\n    you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).\n  phase: Operation\n- description: Identify vulnerabilities in underlying libraries with Source Composition Scanning\n  phase: Testing\n- description: Consider using low-logic templating systems, if you are using Templating Frameworks. Low-Logic\n    Templating Systems like Mustache cannot expand objects and data-structures, thereby ensuring that remote code\n    execution through Template Variables, does not happen\n  phase: Implementation\nrisk:\n- consequence: In some cases, injectable code controls authentication; this may lead\n    to a remote vulnerability.\n  type: Access_Control\n- consequence: Injected code can access resources that the attacker is directly prevented\n    from accessing.\n  type: Access_Control\n- consequence: Code injection attacks can lead to loss of data integrity in nearly\n    all cases as the control-plane data injected is always incidental to data recall\n    or writing. Additionally, code injection can often result in the execution of\n    arbitrary code.\n  type: Integrity\n- consequence: Often the actions performed by injected control code are unlogged.\n  type: Non-Repudiation\nvariants:\n- Server-Side Eval Injection\n- Server-Side Template Injection\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and its Injection payloads against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery\n- name: manual\n  test: test for Code Injection variants manually with pentesters, bug-bounty\n  type: manual\n- name: exploit\n  test: Run exploit tools to identify and exploit Code Injections in the application\n  type: exploit\n  tools: [sqlmap,netsparker,jsqli]\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of Code Injection\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances of dynamic queries or stored procedures that are vulnerable to Code Injection\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity]\n  type: sast\nrelated_cwes:\n- 95\n- 96"
  },
  {
    "path": "api/tp_api/repo/idor_pk.yaml",
    "content": "name: Insecure Direct Object Reference - Primary Key\ncwe: 639\ndescription: The system's authorization functionality does not prevent one user from\n  gaining access to another user's data or record by modifying the key value identifying\n  the data.\nmitigations:\n- description: For each and every data access, ensure that the user has sufficient\n    privilege to access the record that is being requested.\n  phase: Architecture and Design\n- description: Make sure that the key that is used in the lookup of a specific user's\n    record is not controllable externally by the user or that any tampering can be\n    detected.\n  phase: Architecture and Design\n- description: Use encryption in order to make it more difficult to guess other legitimate\n    values of the key or associate a digital signature with the key so that the server\n    can verify that there has been no tampering.\n  phase: Architecture and Design\nrisk:\n- consequence: Access control checks for specific user data or functionality can be\n    bypassed.\n  type: Access_Control\n- consequence: Horizontal escalation of privilege is possible (one user can view/modify\n    information of another user).\n  type: Access_Control\n- consequence: Vertical escalation of privilege is possible if the user-controlled\n    key is actually a flag that indicates administrator status, allowing the attacker\n    to gain administrative access.\n  type: Access_Control\ncategories: [app_vulns]\ntest-cases:\n- name: manual\n  test: test for Insecure Direct Object References variants manually with pentesters, bug-bounty\n  type: manual\n- name: fuzzing\n  test: test for IDORs with Fuzzing with Automated tools\n  tools: [burpsuite,owasp-zap,wfuzz,mitmproxy]\n  type: automated\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances of improper input validation and output encoding for Insecure Deserialization\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity]\n  type: sast\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of Insecure Deserialization\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\nrelated_cwes:\n- 284\n- 285\n\n"
  },
  {
    "path": "api/tp_api/repo/insecure_deserialization.yaml",
    "content": "name: Insecure Deserialization\ndescription: The application deserializes untrusted data without sufficiently verifying\n  that the resulting data will be valid.\ncwe: 502\nmitigations:\n- description: If available, use the signing/sealing features of the programming language\n    to assure that deserialized data has not been tainted. For example, a hash-based\n    message authentication code (HMAC) could be used to ensure that data has not been\n    modified.\n  phase: Architecture and Design\n- description: When deserializing data, populate a new object rather than just deserializing.\n    The result is that the data flows through safe input validation and that the functions\n    are safe.\n  phase: Implementation\n- description: An attempt to serialize and then deserialize a class containing transient\n    fields will result in NULLs where the transient data should be. This is an excellent\n    way to prevent time, environment-based, or sensitive variables from being carried\n    over and used improperly.\n  phase: Architecture and Design\n- description: Avoid having unnecessary types or gadgets available that can be leveraged\n    for malicious ends. This limits the potential for unintended or unauthorized types\n    and gadgets to be leveraged by the attacker. Whitelist acceptable classes. Note-\n    new gadgets are constantly being discovered, so this alone is not a sufficient\n    mitigation.\n  phase: Implementation\nrisk:\n- consequence: The consequences can vary widely, because it depends on which objects\n    or methods are being deserialized, and how they are used.\n- consequence: Attackers can modify unexpected objects or data that was assumed to\n    be safe from modification.\n  type: Integrity\n- consequence: If a function is making an assumption on when to terminate, based on\n    a sentry in a string, it could easily never terminate.\n  type: Availability\n- consequence: Code could potentially make the assumption that information in the\n    deserialized object is valid. Functions that make this dangerous assumption could\n    be exploited.\n  type: Authorization\ncategories: [app_vulns,owasp]\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and its Insecure Deserialization payloads against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery\n- name: manual\n  test: test for Insecure Deserialization variants manually with pentesters, bug-bounty\n  type: manual\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances of improper input validation and output encoding for Insecure Deserialization\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity,]\n  type: sast\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of Insecure Deserialization\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca"
  },
  {
    "path": "api/tp_api/repo/password-bruteforce.yaml",
    "content": "name: Bruteforce Passwords\ncwe: 307\ncategories: [attack]\ndescription: The application allows multiple/consecutive attempts at authentication (bruteforce).\nmitigations:\n- description: Ensure that users are locked out for a certain timeframe/till administrator's intervention when multiple\n    authentication attempts are encountered.\n  phase: Architecture and Design\n- description: Log invalid access attempts to ensure that potentially malicious bruteforce attempts are logged\n  phase: Architecture and Design\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and bruteforce against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery\n"
  },
  {
    "path": "api/tp_api/repo/plaintext-transmission.yaml",
    "content": "name: Plaintext transmission of sensitive data\ncwe: 319\ncategories: [app_vulns,owasp]\ndescription: The software transmits sensitive or security-critical data in cleartext\n  in a communication channel that can be sniffed by unauthorized actors.\nmitigations:\n- description: Encrypt the data with a reliable encryption scheme before transmitting.\n  phase: Architecture and Design\n- description: When using web applications with SSL, use SSL for the entire session\n    from login to logout, not just for the initial login page.\n  phase: Implementation\n- description: Use tools and techniques that require manual (human) analysis, such\n    as penetration testing, threat modeling, and interactive tools that allow the\n    tester to record and modify an active session. These may be more effective than\n    strictly automated techniques. This is especially the case with weaknesses that\n    are related to design and business rules.\n  phase: Testing\n- description: Configure servers to use encrypted channels for communication, which\n    may include SSL or other secure protocols.\n  phase: Operation\nrisk:\n- consequence: Anyone can read the information by gaining access to the channel being\n    used for communication.\n  type: Confidentiality\ntest-cases:\n- name: ssl-test\n  test: Check for SSL/TLS implementation with automated tools\n  tools: [ssllabs.com,testssl.sh,sslyze,sslscan,nmap]\n  type: discovery\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of misconfigured SSL/TLS Implementation or Plaintext Data Transmission\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances that relate to misconfigured SSL/TLS Implementation or Plaintext Data Transmission\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity]\n  type: sast\nrelated_cwes:\n- 311\n"
  },
  {
    "path": "api/tp_api/repo/sql_injection.yaml",
    "content": "name: SQL Injection\ncwe: 89\ndescription: The software constructs all or part of an SQL command using externally-influenced\n  input from an upstream component, but it does not neutralize or incorrectly neutralizes\n  special elements that could modify the intended SQL command when it is sent to a\n  downstream component.\nmitigations:\n- description: Consider using ORMs (Object to Relation Mappers) to protect against SQL Injection.\n    Nearly all of them perform Parameterized Queries and Query Encoding.\n  phase: Architecture and Design\n  strategy: Libraries or Frameworks\n- description: Process SQL queries using prepared statements, parameterized queries.\n    Do not dynamically construct and execute query strings within these features using \"exec\" or similar functionality,\n    since this may re-introduce the possibility of SQL injection.\n  phase: Implementation\n- description: Specifically, follow the principle of least privilege when creating\n    user accounts to a SQL database. The database users should only have the minimum\n    privileges necessary to use their account.\n  phase: Architecture and Design\n- description: In the context of SQL Injection, error messages revealing the structure\n    of a SQL query can help attackers tailor successful attack strings.\n  phase: Implementation\n- description: Use an application firewall that can detect attacks against this weakness.\n    It can be beneficial in cases in which the code cannot be fixed,as an emergency prevention measure while\n    more comprehensive software assurance measures are applied, or to provide defense in depth.\n  phase: Operation\nrisk:\n- consequence: Since SQL databases generally hold sensitive data, loss of confidentiality\n    is a frequent problem with SQL injection vulnerabilities.\n  type: Confidentiality\n- consequence: If poor SQL commands are used to check user names and passwords, it\n    may be possible to connect to a system as another user with no previous knowledge\n    of the password.\n  type: Access_Control\n- consequence: If authorization information is held in a SQL database, it may be possible\n    to change this information through the successful exploitation of a SQL injection\n    vulnerability.\n  type: Access_Control\n- consequence: Just as it may be possible to read sensitive information, it is also\n    possible to make changes or even delete this information with a SQL injection\n    attack.\n  type: Integrity\ncategories: [app_vulns,owasp]\nvariants:\n- Blind SQL Injection\n- Time-Based SQL Injection\n- Union-Based SQL Injection\n- Error-Based SQL Injection\n- Second-Order SQL Injection\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and its Injection payloads against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery\n- name: manual\n  test: test for SQL Injection variants manually with pentesters, bug-bounty\n  type: manual\n- name: exploit\n  test: Run exploit tools to identify and exploit SQL Injections in the application\n  type: exploit\n  tools: [sqlmap,netsparker,jsqli]\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of SQL Injection\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances of dynamic queries or stored procedures that are vulnerable to SQL Injection\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity]\n  type: sast"
  },
  {
    "path": "api/tp_api/repo/ssrf.yaml",
    "content": "name: Server-Side Request Forgery\ncwe: 918\ndescription: The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.\nmitigations:\n- description: Consider scanning dependencies for SSRF vulnerabilities, including infrastructure components like Apache\n  phase: Implementation\n- description: Consider implementing a URL whitelist to reduce the possibility of an attacker-controlled URL being resolved by your application\n  phase: Implementation\n- description: Consider implementing additional Header validation to sensitive paths like EC2 Metadata, etc to mitigate the effects of an existing SSRF flaw\n  phase: Implementation\nrisk:\n- consequence: Unauthorized users may be able to gain access to sensitive information in internal/protected system components\n  type: Confidentiality\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools to identify SSRF\n  tools: [burpsuite,zap]\n  type: discovery\n- name: manual\n  test: test for misconfigured AWS S3 Buckets manually, as part of a Pentest or Bug-bounty\n  type: manual\ncategories: [cloud]\n"
  },
  {
    "path": "api/tp_api/repo/weak-default-password.yaml",
    "content": "name: Weak/Default Passwords\ncwe: 521\ncategories: [app_vulns,owasp]\ndescription: The application allows the users to set default or weak passwords\nmitigations:\n- description: Ensure that passwords set in the application are mandatorily strong.\n  phase: Architecture and Design\n- description: Prevent Credential Stuffing by validating user passwords against Database of compromised passwords\n  phase: Architecture and Design\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and bruteforce against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery"
  },
  {
    "path": "api/tp_api/repo/xss.yaml",
    "content": "name: Cross-Site Scripting\ncwe: 79\ndescription: The software does not neutralize or incorrectly neutralizes user-controllable\n  input before it is placed in output that is used as a web page that is served to\n  other users.\nmitigations:\n- description: Examples of libraries and frameworks that make it easier to generate\n    properly encoded output include Microsoft's Anti-XSS library, the OWASP ESAPI\n    Encoding module, and Apache Wicket.\n  phase: Architecture and Design\n- description: Understand all the potential areas where untrusted inputs can enter\n    your software. Parameters or arguments, cookies, anything read from the network,\n    environment variables, reverse DNS lookups, query results, request headers, URL\n    components, e-mail, files, filenames, databases, and any external systems that\n    provide data to the application. Remember that such inputs may be obtained indirectly\n    through API calls.\n  phase: Architecture and Design\n- description: For any security checks that are performed on the client side, ensure\n    that these checks are duplicated on the server side.\n  phase: Architecture and Design\n- description: If available, use structured mechanisms that automatically enforce\n    the separation between data and code. These mechanisms may be able to provide\n    the relevant quoting, encoding, and validation automatically, instead of relying\n    on the developer to provide this capability at every point where output is generated.\n  phase: Architecture and Design\n- description: The problem of inconsistent output encodings often arises in web pages.\n    If an encoding is not specified in an HTTP header, web browsers often guess about\n    which encoding is being used. This can open up the browser to subtle XSS attacks.\n  phase: Implementation\n- description: To help mitigate XSS attacks against the user's session cookie, set\n    the session cookie to be HttpOnly. In browsers that support the HttpOnly feature\n    (such as more recent versions of Internet Explorer and Firefox), this attribute\n    can prevent the user's session cookie from being accessible to malicious client-side\n    scripts that use document.cookie. This is not a complete solution, since HttpOnly\n    is not supported by all browsers. More importantly, XMLHTTPRequest and other powerful\n    browser technologies provide read access to HTTP headers, including the Set-Cookie\n    header in which the HttpOnly flag is set.\n  phase: Implementation\n- description: Ensure that you perform input validation at well-defined interfaces\n    within the application. This will help protect the application even if a component\n    is reused or moved elsewhere.\n  phase: Implementation\n- description: When the set of acceptable objects, such as filenames or URLs, is limited\n    or known, create a mapping from a set of fixed input values (such as numeric IDs)\n    to the actual filenames or URLs, and reject all other inputs.\n  phase: Architecture and Design\n- description: Use an application firewall that can detect attacks against this weakness.\n    It can be beneficial in cases in which the code cannot be fixed (because it is\n    controlled by a third party), as an emergency prevention measure while more comprehensive\n    software assurance measures are applied, or to provide defense in depth.\n  phase: Operation\n- description: Use a Content-Security-Policy Header for your application that is honored by a modern browser.\n    Content Security Policy allows you to define specific execution scopes for attributes and elements that can be used\n    to perform Cross-Site Scripting.\n  phase: Implementation\n- description: Deploy a Cross-Origin-Resource Sharing implementation to prevent your application's front-end from accessing\n    unauthorized third-party URLs that may be part of an attacker's Cross-Site Scripting Attack\n  phase: Implementation\ncategories: [app_vulns,owasp]\nrisk:\n- consequence: The most common attack performed with cross-site scripting involves\n    the disclosure of information stored in user cookies. Typically, a malicious user\n    will craft a client-side script, which -- when parsed by a web browser -- performs\n    some activity (such as sending all site cookies to a given E-mail address). This\n    script will be loaded and run by each user visiting the web site. Since the site\n    requesting to run the script has access to the cookies in question, the malicious\n    script does also.\n  type: Access_Control\n- consequence: In some circumstances it may be possible to run arbitrary code on a\n    victim's computer when cross-site scripting is combined with other flaws.\n  type: Integrity\n- consequence: The consequence of an XSS attack is the same regardless of whether\n    it is stored or reflected. The difference is in how the payload arrives at the\n    server.\n  type: Confidentiality\nvariants:\n- Persistent Cross-Site Scripting\n- Reflected Cross-Site Scripting\n- DOM-Based Cross Site Scripting\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and its XSS payloads against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery\n- name: manual\n  test: test for XSS variants manually with pentesters, bug-bounty\n  type: manual\n- name: content-security-policy\n  test: Look for Content Security Policy headers in the Application and validate if the application enforces content-security-policy headers with optimal efficacy\n  type: recon\n- name: cors\n  test: Look for Cross-Origin Resource Sharing to ensure that the application is unable to make calls to URLs outside a specific set of whitelisted URLs and domains\n  type: discovery\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances of improper input validation and output encoding for Cross-Site Scripting\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity,]\n  type: sast\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of Cross-Site Scripting\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\nrelated_cwes:\n- 80\n- 116\n\n"
  },
  {
    "path": "api/tp_api/repo/xxe.yaml",
    "content": "name: XML External Entities\ncwe: 611\ndescription: The software processes an XML document that can contain XML entities\n  with URIs that resolve to documents outside of the intended sphere of control, causing\n  the product to embed incorrect documents into its output.\ncategories: [app_vulns,owasp]\nmitigations:\n- description: XML parsers and validators must be configured to disable external\n    entity expansion, general entities and parameter entity resolution\n  phase: Implementation\nrisk:\n- consequence: If the attacker is able to include a crafted DTD and a default entity\n    resolver is enabled, the attacker may be able to access arbitrary files on the\n    system.\n  type: Confidentiality\n- consequence: The DTD may include arbitrary HTTP requests that the server may execute.\n    This could lead to other attacks leveraging the server's trust relationship with\n    other entities.\n  type: Integrity\n- consequence: The software could consume excessive CPU cycles or memory using a URI\n    that points to a large file, or a device that always returns data such as /dev/random.\n    Alternately, the URI could reference a file that contains many nested or recursive\n    entity references to further slow down parsing.\n  type: Availability\ntest-cases:\n- name: automated-vulnerability-scanning\n  test: run automated vulnerability discovery tools and its XXE payloads against the application\n  tools: [zap,burpsuite,arachni,acunetix,netsparker,appspider,w3af]\n  type: discovery\n- name: manual\n  test: test for XXE variants manually with pentesters, bug-bounty\n  type: manual\n- name: source-composition-scanning\n  test: Run Source Composition Scanners against the libraries being used by the application, to identify instances of XXE\n  tools: [retirejs,npm-audit,owasp-dependency-checker,blackduck,whitesource,snyk,safety]\n  type: sca\n- name: static-analysis\n  test: Run Static Analysis tools to identify instances of dynamic queries or stored procedures that are vulnerable to XXE\n  tools: [checkmarx,brakeman,bandit,pyt,security-code-scan,veracode,nodejsscan,coverity]\n  type: sast"
  },
  {
    "path": "api/tp_api/swagger/abuse-create.yml",
    "content": "This is the API Endpoint that is used to create/update Abuser Stories linked to Feature/User Story\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Abuser Story\n      type: object\n      required: \n        - short_name\n        - description\n        - feature\n      properties: \n        short_name:\n          type: string\n        description: \n          type: string\n        feature:\n          type: string\nresponses:\n  200: \n    description: Abuser Story successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find Feature/User Story\n\n"
  },
  {
    "path": "api/tp_api/swagger/change-password.yml",
    "content": "This is the API Endpoint that is used to change an existing user's password in ThreatPlaybook\n---\nrequestBody:\n  required: true\n  content: \n    application/json:\n      schema:\n        type: object\n        properties: \n          email:\n            type: string\n          old_password: \n            type: string\n          new_password:\n            type: string\n          verify_password:\n            type: string\n\n\n"
  },
  {
    "path": "api/tp_api/swagger/feature-create.yml",
    "content": "This is the API Endpoint that is used to create and update a User Story/Feature.\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Feature\n      type: object\n      required: \n        - short_name\n        - description\n        - project\n      properties: \n        short_name:\n          type: string\n        description: \n          type: string\n        project:\n          type: string\nresponses:\n  200: \n    description: Feature/User Story successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find Project\n\n"
  },
  {
    "path": "api/tp_api/swagger/get-abuse.yml",
    "content": "This is the API Endpoint that is used retrieve a single Abuser Story or multiple Abuser Stories\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Abuser Story\n      type: object\n      required:\n        - feature\n      properties: \n        name: \n          type: string\n        page:\n          type: integer\n        feature:\n          type: string\n\nresponses:\n  200: \n    description: Project or Projects successfully retrieved\n  404:\n    description: Unable to find Scan or Target\n\n"
  },
  {
    "path": "api/tp_api/swagger/get-feature.yml",
    "content": "This is the API Endpoint that is used retrieve a single Feature/User Story or multiple Features/User Stories\n---\nparameters:\n  - name: body\n    in: body\n    schema:\n      id: Feature\n      type: object\n      properties: \n        name: \n          type: string\n        page:\n          type: integer\n        project:\n          type: string\n\nresponses:\n  200: \n    description: Project or Projects successfully retrieved\n  404:\n    description: Unable to find Scan or Target\n\n"
  },
  {
    "path": "api/tp_api/swagger/get-project.yml",
    "content": "This is the API Endpoint that is used retrieve a single Project or multiple Projects\n---\nparameters:\n  - name: body\n    in: body\n    schema:\n      id: Project\n      type: object\n      properties: \n        name: \n          type: string\n\nresponses:\n  200: \n    description: Project or Projects successfully retrieved\n  404:\n    description: Unable to find Scan or Target\n\n"
  },
  {
    "path": "api/tp_api/swagger/get-scenario.yml",
    "content": "This is the API Endpoint that is used retrieve a single Abuser Story or multiple Abuser Stories\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Threat Scenario\n      type: object\n      required:\n        - abuser_story\n      properties: \n        name: \n          type: string\n        page:\n          type: integer\n        abuser_story:\n          type: string\n\nresponses:\n  200: \n    description: Threat Scenario or Scenarios successfully retrieved\n  404:\n    description: Unable to find Threat Scenario or Abuser Story\n\n"
  },
  {
    "path": "api/tp_api/swagger/get-tests.yml",
    "content": "This is the API Endpoint that is used retrieve a single Abuser Story or multiple Abuser Stories\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Security Test Case\n      type: object\n      required:\n        - scenario\n      properties: \n        name: \n          type: string\n        page:\n          type: integer\n        scenario:\n          type: string\n\nresponses:\n  200: \n    description: Project or Projects successfully retrieved\n  404:\n    description: Unable to find Threat Scenario or Test Cases\n\n"
  },
  {
    "path": "api/tp_api/swagger/scan-create.yml",
    "content": "This is the API Endpoint that is used to create a scan for storing Vulnerability Results in the Database\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Scan\n      type: object\n      required: \n        - tool\n        - target\n      properties: \n        tool:\n          type: string\n        target: \n          type: string\n        scan_type:\n          type: string\nresponses:\n  200: \n    description: Scan successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find Target\n\n"
  },
  {
    "path": "api/tp_api/swagger/scenario-inline.yml",
    "content": "This is the API Endpoint that is used to create and update Inline Threat Scenarios that are NOT linked to existing Vulnerability Repositories\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Threat Scenario\n      type: object\n      required: \n        - name\n        - abuser_story\n        - feature\n        - type\n        - cwe\n        - description\n        - severity\n        - vul_name\n      properties: \n        name:\n          type: string\n        description: \n          type: string\n        feature:\n          type: string\n        abuser_story:\n          type: string\n        type:\n          type: string\n        vul_name:\n          type: string\n        severity:\n          type: integer\n        cwe:\n          type: integer\nresponses:\n  200: \n    description: Threat Scenario successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find User Story OR Abuser Story OR Repo Item\n\n"
  },
  {
    "path": "api/tp_api/swagger/scenario-repo.yml",
    "content": "This is the API Endpoint that is used to create and update Threat Scenarios that are linked to existing Vulnerability Repositories\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Threat Scenario\n      type: object\n      required: \n        - name\n        - abuser_story\n        - feature\n        - type\n        - repo_name\n        - description\n      properties: \n        name:\n          type: string\n        description: \n          type: string\n        feature:\n          type: string\n        abuser_story:\n          type: string\n        type:\n          type: string\n        repo_name:\n          type: string\nresponses:\n  200: \n    description: Threat Scenario successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find User Story OR Abuser Story OR Repo Item\n\n"
  },
  {
    "path": "api/tp_api/swagger/target-create-update.yml",
    "content": "This is the API Endpoint to create and update Targets for Vulnerability Scanning and Management\n---\nsecuritySchemes: \n  bearerAuth: \n    type: http\n    scheme: bearer\n    format: JWT\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Target\n      type: object\n      required: \n        - name\n        - url\n        - project\n      properties: \n        name:\n          type: string\n        url:\n          type: string\n        project:\n          type: string\n\nresponses:\n  200: \n    description: Target successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find Project\n\n"
  },
  {
    "path": "api/tp_api/swagger/test-case-create.yml",
    "content": "This is the API Endpoint to create and update Security Test Cases a.k.a Test Cases\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Security Test Case\n      type: object\n      required: \n        - test_case\n        - name\n        - threat_scenario\n        - tools\n        - tags\n        - executed\n        - test_type\n      properties: \n        name:\n          type: string\n        test_case: \n          type: string\n        threat_scenario:\n          type: string\n        tools:\n          type: array\n          items: \n            type: string\n        tags:\n          type: array\n          items: \n            type: string\n        executed:\n          type: boolean\n        test_type:\n          type: string\nresponses:\n  200: \n    description: Test Case successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find threat scenario\n\n"
  },
  {
    "path": "api/tp_api/swagger/vulnerability-create.yml",
    "content": "This is the API Endpoint that is used to create a scan for storing Vulnerability Results in the Database\n---\nparameters:\n  - name: body\n    in: body\n    required: true\n    schema:\n      id: Vulnerability\n      type: object\n      required: \n        - scan\n        - name\n        - vul_name\n        - cwe \n      properties: \n        scan:\n          type: string\n        name: \n          type: string\n        description:\n          type: string\n        remediation:\n          type: string\n        observation:\n          type: string\n        vul_name:\n          type: string\n        cwe:\n          type: integer\n        evidences:\n          type: array\n          items:\n            type: object\n            properties:\n              log:\n                type: string\n              url:\n                type: string\n              param:\n                type: string\n              line_num:\n                type: integer\n              attack:\n                type: string\n              info:\n                type: string\n\nresponses:\n  200: \n    description: Vulnerability successfully created\n  400:\n    description: Input Validation Errors or other client Errors\n  404:\n    description: Unable to find Scan or Target\n\n"
  },
  {
    "path": "api/tp_api/utils.py",
    "content": "from mongoengine import *\nfrom loguru import logger\nfrom sys import exit\nimport os\nfrom models import *\nfrom glob import glob\nimport ntpath\nimport yaml\nimport bcrypt\nimport csv\nfrom flask import jsonify\n\nlogger.add(\"logs/output.log\", backtrace=True, diagnose=True)\n\n\ndef respond(success, error, message=\"\", data=None):\n    respond_dict = {\n        \"success\": success,\n        \"error\": error,\n    }\n    if message:\n        respond_dict[\"message\"] = message\n\n    if data:\n        respond_dict[\"data\"] = data\n\n    return jsonify(respond_dict)\n\n\ndef connect_db():\n    if \"MONGO_USER\" not in os.environ:\n        db = connect(os.environ.get(\"MONGO_DB\", \"threat_playbook\"))\n    else:\n        try:\n            db = connect(\n                username=os.environ.get(\"MONGO_USER\"),\n                password=os.environ.get(\"MONGO_PASS\"),\n                host=os.environ.get(\"MONGO_HOST\", \"127.0.0.1\"),\n                db=os.environ.get(\"MONGO_DB\", \"threat_playbook\"),\n                port=int(os.environ.get(\"MONGO_PORT\", 27017)),\n            )\n        except Exception as e:\n            logger.exception(e)\n            print(\"Unable to connect to Database. Please see log for exception\")\n            exit(1)\n\n    return db\n\n\ndef load_reload_asvs_db():\n    if not ASVS.objects:\n        asvs_file = os.path.join(os.path.abspath(os.path.curdir), \"asvs/asvs.csv\")\n        if os.path.isfile(asvs_file):\n            with open(asvs_file, \"rt\") as asvs_file:\n                data = csv.reader(asvs_file)\n                for row in data:\n                    cwe = row[7]\n                    if not cwe:\n                        cwe = 0\n                    else:\n                        cwe = int(row[7])\n                    new_item = ASVS(\n                        section=row[0],\n                        name=row[1],\n                        item=row[2],\n                        description=row[3],\n                        l1=row[4] or False,\n                        l2=row[5] or False,\n                        l3=row[6] or False,\n                        cwe=cwe,\n                        nist=row[8] or \"\",\n                    ).save()\n\n\ndef load_reload_repo_db():\n    if not Repo.objects:\n        print(\"No Repo items found. Loading...\")\n        repo_path = os.path.join(os.path.abspath(os.path.curdir), \"repo/\")\n        for single in glob(repo_path + \"*.yaml\"):\n            single_name = ntpath.basename(single).split(\".\")[0]\n            with open(single, \"r\") as rfile:\n                rval = rfile.read()\n\n            rcon = yaml.safe_load(rval)\n            test_case_list = []\n            test_case_load = rcon.get(\"test-cases\", [])\n            try:\n                if test_case_load:\n                    for single in test_case_load:\n                        new_test_case = RepoTestCase(\n                            name=single.get(\"name\", \"\"),\n                            test_case=single.get(\"test\", \"\"),\n                            tools=single.get(\"tools\", []),\n                            type=single.get(\"type\", \"\"),\n                            tags=single.get(\"tags\", []),\n                        ).save()\n                        test_case_list.append(new_test_case.id)\n                new_repo_object = Repo(\n                    short_name=single_name,\n                    name=rcon[\"name\"],\n                    cwe=rcon[\"cwe\"],\n                    description=rcon.get(\"description\", \"\"),\n                    mitigations=rcon.get(\"mitigations\", []),\n                    risks=rcon.get(\"mitigations\", []),\n                    categories=rcon.get(\"categories\", []),\n                    variants=rcon.get(\"variants\", []),\n                    related_cwes=rcon.get(\"related_cwes\", []),\n                    tests=test_case_list,\n                ).save()\n            except Exception as e:\n                logger.exception(e)\n                print(\"Unable to load Repo Objects. Please see log\")\n\n\ndef initialize_superuser():\n    if not User.objects or not User.objects(user_type=\"super\"):\n        if \"SUPERUSER_EMAIL\" not in os.environ:\n            print(\"Mandatory variable SUPERUSER_EMAIL not present\")\n            exit(1)\n        else:\n            admin_pass = os.environ.get(\"SUPERUSER_PASS\", \"pl@yb00k1234\")\n            hash_pass = bcrypt.hashpw(admin_pass.encode(), bcrypt.gensalt()).decode()\n            User(\n                email=os.environ.get(\"SUPERUSER_EMAIL\"),\n                password=hash_pass,\n                user_type=\"super\",\n            ).save()\n            print(\"Initialized SuperUser with default password\")\n"
  },
  {
    "path": "api/tp_api/wait-for",
    "content": "#!/bin/sh\n\nTIMEOUT=90\nQUIET=0\n\nechoerr() {\n  if [ \"$QUIET\" -ne 1 ]; then printf \"%s\\n\" \"$*\" 1>&2; fi\n}\n\nusage() {\n  exitcode=\"$1\"\n  cat << USAGE >&2\nUsage:\n  $cmdname host:port [-t timeout] [-- command args]\n  -q | --quiet                        Do not output any status messages\n  -t TIMEOUT | --timeout=timeout      Timeout in seconds, zero for no timeout\n  -- COMMAND ARGS                     Execute command with args after the test finishes\nUSAGE\n  exit \"$exitcode\"\n}\n\nwait_for() {\n  for i in `seq $TIMEOUT` ; do\n    nc -z \"$HOST\" \"$PORT\" > /dev/null 2>&1\n\n    result=$?\n    if [ $result -eq 0 ] ; then\n      if [ $# -gt 0 ] ; then\n        exec \"$@\"\n      fi\n      exit 0\n    fi\n    sleep 1\n  done\n  echo \"Operation timed out\" >&2\n  exit 1\n}\n\nwhile [ $# -gt 0 ]\ndo\n  case \"$1\" in\n    *:* )\n    HOST=$(printf \"%s\\n\" \"$1\"| cut -d : -f 1)\n    PORT=$(printf \"%s\\n\" \"$1\"| cut -d : -f 2)\n    shift 1\n    ;;\n    -q | --quiet)\n    QUIET=1\n    shift 1\n    ;;\n    -t)\n    TIMEOUT=\"$2\"\n    if [ \"$TIMEOUT\" = \"\" ]; then break; fi\n    shift 2\n    ;;\n    --timeout=*)\n    TIMEOUT=\"${1#*=}\"\n    shift 1\n    ;;\n    --)\n    shift\n    break\n    ;;\n    --help)\n    usage 0\n    ;;\n    *)\n    echoerr \"Unknown argument: $1\"\n    usage 1\n    ;;\n  esac\ndone\n\nif [ \"$HOST\" = \"\" -o \"$PORT\" = \"\" ]; then\n  echoerr \"Error: you need to provide a host and port to test.\"\n  usage 2\nfi\n\nwait_for \"$@\"\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "version: '3'\nservices:\n  nginx:\n    image: we45/threatplaybook-nginx:latest\n    ports:\n        - \"80:80\"\n    depends_on:\n        - api\n    links:\n        - api\n  mongo_db:\n    image: 'docker.io/bitnami/mongodb:4.2-debian-10'\n    volumes:\n      - './playbook:/bitnami/mongodb' \n    environment:\n      - MONGODB_USERNAME=threatplaybook\n      - MONGODB_PASSWORD=password123\n      - MONGODB_DATABASE=threat_playbook\n    expose:\n      - \"27017\"\n  api:\n    image: we45/threatplaybook-server:latest\n    expose:\n      - \"5000\"\n    environment:\n      - MONGO_HOST=mongo_db\n      - MONGO_USER=threatplaybook\n      - MONGO_PASS=password123\n      - MONGO_PORT=27017\n      - MONGO_DB=threat_playbook\n      - SUPERUSER_EMAIL=admin@admin.com\n      - SUPERUSER_PASS=supersecret\n      - JWT_PASS=VGCxqDnhsN6vNQVqmXtrNVVe1AS36ZMQKTq6lYpj0ygHiuWunMOkFi2j17cHSbG-WId9x_yJpeSqy0TTFjs06Q\n      - WAIT_HOSTS=mongo_db:27017\n    links:\n      - mongo_db\n    depends_on:\n      - mongo_db\n    command: sh -c \"/app/wait-for mongo_db:27017 -- /usr/local/bin/python /app/app.py\"\n  frontend:\n    image: we45/threatplaybook-frontend:latest\n    environment:\n      - VUE_APP_API_URL=http://api\n    links:\n      - api\n    depends_on:\n      - api"
  },
  {
    "path": "documentation/.gitignore",
    "content": "# Dependencies\n/node_modules\n\n# Production\n/build\n\n# Generated files\n.docusaurus\n.cache-loader\n\n# Misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "documentation/README.md",
    "content": "# Website\n\nThis website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.\n\n### Installation\n\n```\n$ yarn\n```\n\n### Local Development\n\n```\n$ yarn start\n```\n\nThis command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.\n\n### Build\n\n```\n$ yarn build\n```\n\nThis command generates static content into the `build` directory and can be served using any static contents hosting service.\n\n### Deployment\n\n```\n$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy\n```\n\nIf you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.\n"
  },
  {
    "path": "documentation/babel.config.js",
    "content": "module.exports = {\n  presets: [require.resolve('@docusaurus/core/lib/babel/preset')],\n};\n"
  },
  {
    "path": "documentation/docs/client-ui.md",
    "content": "---\nid: client-ui\ntitle: Web UI\nsidebar_label: Web UI\n---\n\n#### Open Addressable IP Address on the browser\n\n![Image](/img/login.png)\n\n\n>**Note:** Login using credentials\n\n\n##### Once you logged in you should see a dashboard of Threat Playbook\n\n![Image](/img/dashboard.png)"
  },
  {
    "path": "documentation/docs/configure-cli.md",
    "content": "---\nid: configure-cli\ntitle: Configure CLI\nsidebar_label: Configure CLI\n---\n\n\n##### Create a Project Directory\n```\nmkdir -p /your/project/directory\n```\n\n##### `cd` into your project directory\n```\ncd /your/project/directory\n```\n\n##### Configure\n\n```\nplaybook configure -e <your-email> -u <host-info> -p <port>\n```\n\n> Please ensure that you substitute the following: \n>   * `your-email` enter any email address, eample: admin@admin.com\n>   * `host-info` for your addressable IP Address, example: 192.168.1.17\n>   * `port` for the nginx port, example: 80\n\n\n\n\n\n\n\n\n\n"
  },
  {
    "path": "documentation/docs/create-project.md",
    "content": "---\nid: create-project\ntitle: Create Project\nsidebar_label: Create Project\n---\n\n```\nplaybook apply project -n test-project\n```\n>**Note:** `test-project` is the name of the project.\n\n### Create a single Feature with Threat Model\n\n* Now you'll be loading a story-driven threat model. It starts with the Feature/User-Story. \n* Each Feature/UserStory can have multiple Abuser Stories. \n* Each Abuser Story can have multiple Threat Scenarios\n* Each Threat Scenario can have multiple Test Cases and Mitigations\n\n\n#### Download example feature\n```\nwget -O feature.yaml https://raw.githubusercontent.com/we45/ThreatPlaybook-ClientV3/master/create-upload.yaml\n```\n\n#### Upload the features into `test-project`\n```\nplaybook apply feature -f feature.yaml -p test-project\n```\n\nAnd that's it! You've created your first every Threat Model in ThreatPlaybook.\n\n##### Of course, this is not all that ThreatPlaybook has to offer. It has: \n* A useful WebUI for viewing the Features/UserStories -> Abuser Stories -> Threat Models, Scans and more\n* Features for processing and managing Vulnerability Results\n\n\n\n\n\n\n\n\n\n"
  },
  {
    "path": "documentation/docs/install-client.md",
    "content": "---\nid: client-install\ntitle: Install Client\nsidebar_label: Install Client\n---\n\n##### Mac\n\n```\nwget -O playbook https://github.com/we45/ThreatPlaybook-ClientV3/raw/master/dist/playbook_darwin64 && chmod +x playbook && mv playbook /usr/local/bin\n```\n\n##### Linux\n\n```\nwget -O https://github.com/we45/ThreatPlaybook-ClientV3/raw/master/dist/playbook_linux64 playbook && chmod +x playbook && mv playbook /usr/bin\n```\n\n##### Windows\n\n```\nhttps://github.com/we45/ThreatPlaybook-ClientV3/raw/master/dist/playbook_windows64.exe\n```\n\n> Please note that the CLI hasn't been tested on Windows OS \n\n\n\n#### Verify the cli installation\n\n```\nplaybook -h\n```\n"
  },
  {
    "path": "documentation/docs/overview.md",
    "content": "---\nid: overview\ntitle: Overview\nsidebar_label: Overview\n---\n\n#### Threat Playbook has 3 components\n1. Threat Playbook Server\n2. Threat Playbook Client\n3. Threat Playbook WebUI\n\n\n\n#### Prerequisite\n* Docker and Docker-Compose\n\n#### Container Images \n\n* API Container Image - Python Flask\n* MongoDB Container Image\n* VueJS Front-end Container Image\n* Nginx Reverse Proxy\n"
  },
  {
    "path": "documentation/docs/quick-installation.md",
    "content": "---\nid: installation\ntitle: Install Server\nsidebar_label: Install Server\n---\n\n##### Download docker-compose file\n```\ngit clone https://github.com/we45/ThreatPlaybook.git\n```\n\n##### `cd` into the downloaded directory\n```\ncd ThreatPlaybook\n```\n\n> For Linux users, you might have to add another set of permissions for the MongoDB to work correctly. \n> \n> `sudo chown -R 1001 $PWD/playbook`\n\n##### Run the Playbook server\n```\ndocker-compose up -d\n```\n\n\n\n\n\n\n"
  },
  {
    "path": "documentation/docs/story-driven.md",
    "content": "---\nid: story-driven\ntitle: Story-Driven Threat Modeling with ThreatPlaybook\nsidebar_label: Story-Driven Threat Modeling\n---\n\n## Objective\nIn this tutorial, you will learn how you can create a story-driven threat model with ThreatPlaybook\n\n## What is a Story-Driven Threat Model?\n### User-Story Driven Threat Modeling\nStory-Driven Threat Modeling is different from System-Driven Threat Modeling that we are largely used to. Story-driven threat modeling starts with modeling user-stories (or feature definitions). The primary reasons behind story-driven threat modeling are: \n* **Speed** - Your Threat Models are able to keep pace with the Engineering Team's SDLC rather than a long-drawn system-wide threat model being performed on a periodic basis\n* **Focus** - The focus of your threat model in case of a story-driven threat model is the user-story itself. You waste little/no time on analyzing too many tangents\n* **Iterative** - Story-driven threat modeling evolves with the story. If the story changes, the threat model might change. It lends itself to more scalability and elasticity\n\n#### User Story/Feature\nThe User Story is a Description of the Functionality. This concept is very popular in the world of Agile Development, where an Agile Team picks a bunch of user stories to get done in a sprint. It is a Unit of Work to be completed in a sprint. A user story typically looks like this\n> As a user (salesperson), I should be able to access my customer's profile to be able to log call information with the customer \n\n#### Abuser Story\nAn Abuser Story is an \"evil user's version\" of a user story. An Abuser Story captures (at a high level) WHAT a threat actor can do to abuse the feature enumerated in the User Story. For example\n> As a rival salesperson, I will access other salespeople's customers in the application to poach customers from my colleagues\n\n#### Threat Model/Scenario\nA Threat Model/Scenario is a description of HOW a threat actor can bring the abuser story to life. This is a scenario detailing the Attack Vector (primary technique for attack) and approach to bringing the Abuser Story to life. One can use STRIDE as an approach to capture various threats and use DREAD/CVSSv3 to capture impact of said attack. For example: \n\n> Abuser Story: As a rival salesperson, I will access other salespeople's customers in the application to poach customers from my colleagues\n> \n> Threat Models: \n> * Attacker performs SQL Injection, to gain access to the Database of other customers in the System\n> * Attacker attempts to perform Insecure Direct Object Reference attacks, by incrementing the customer's ID value, gaining access to another customer's account\n> * Attacker steals a rival's session tokens by performing a Man-in-the-Middle Attack\n> ....\n\n## Story-Driven Threat Modeling with ThreatPlaybook\n\n### Start by making sure that you have your Server and CLI setup\n\n> Follow Steps 1 and 2 in the Quick Start Guide here\n\n### Let's configure the CLI first\n\n> Currently, the CLI or the REST API are the only ways that data can be loaded into ThreatPlaybook. WebUI is view-only\n\n##### Create a Project Directory\n```\nmkdir -p /your/project/directory\n```\n\n##### `cd` into your project directory\n```\ncd /your/project/directory\n```\n\n##### Configure\n\n```\nplaybook configure -e <your-email> -u <host-info> -p <port>\n```\n\n> Please ensure that you substitute the following: \n>   * `your-email` enter any email address, eample: admin@admin.com\n>   * `host-info` for your addressable IP Address, example: 192.168.1.17\n>   * `port` for the nginx port, example: 80\n\nAfter this, the CLI prompts you for a password, which is the super-admin password that you've setup in Step 1\n\n### Let's create a Project\n\n> A Project is typically an application that you want to Threat Model. In the case of a micro-service, you may want to use either a single project or multiple projects if they are modeled and managed separately\n\n```bash\nplaybook apply project -n test-project\n```\n> `test-project` is the name of the project, in this case\n\n### Let's create our User-Story/Feature YAML file\n\nIn ThreatPlaybook, each user-story/feature is captured \"as-code\" in a single YAML file. \n\nThe YAML file typically has a structure of: \n* Feature/User-Story\n    * Abuser-Stories under the Feature/User-Story\n        * Threat Scenarios under the Abuser Story\n            * Test Cases for the Threat Scenario\n\nLet's look at a sample user-story/feature yaml\n\n```yaml\nobjectType: Feature #this is the user story\nname: create_upload_expense\ndescription: As a user, I am able to create and upload expenses within project limit that have been incurred by me for processing/payment by my manager, so I can get reimbursed\nabuse_cases:\n  - name: manipulate expense information #this is an abuser story\n    description: As a malicious user, I will manipulate expense management process to get larger or bogus expenses into the system.\n    threat_scenarios: # these are the list of threat scenarios for the abuser story\n    - name: sql injection expense limit bypass\n      type: repo # repo type threat scenario\n      description: Perform SQL Injection to compromise the Database, and raise project budget limits or bypass expense controls\n      reference: {name: sql_injection, severity: 3}\n    - name: upload-malware\n      type: inline # inline type threat scenario\n      description: I will upload malware as an expense to the system and compromise the application and create a DoS condition\n      type: inline\n      vul_name: Malicious File Upload\n      severity: 3\n      cwe: 434\n      test-cases:\n      - name: manual-pentesting\n        test: upload files with reverse-shell and CSV injection payloads and attempt to trigger remote code execution on Project Manager's Computer\n        type: exploit\n        tools: manual\n```\n\n#### Let's examine this YAML file in more detail and some tips\n\n* ThreatPlaybook is name-based, so its important that you name your features/abuser-stories/threat-scenarios uniquely\n* Threat Scenarios can either be `repo` type or `inline` type: \n    * **Repo Type**: ThreatPlaybook has a list of canned Vulnerability Definitions already pre-loaded in the system. Of course, you can create your own definitions as well. These form a repository or `repo`. So, when you want to declare a threat scenario is a `repo` type threat scenario, all you have to do is refer to the name of your canned vulnerability, and ThreatPlaybook automatically enumerates the following from the repo: \n        * CWE\n        * Mitigations\n        * Test cases\n        * other metadata fields\n    * **Inline type**: When you declare and use inline threat scenarios, you are defining and declaring the threat scenario `inline` with the YAML. In this case, there's no canned vulnerability and you are declaring that vulnerability definition on the fly. Here, you need to declare all these attributes yourself: \n        * name\n        * cwe\n        * vul_name\n        * test-cases\n        * severity\n        * description\n        * test cases\n\n### Push YAML to ThreatPlaybook server\n\nWhen you're done defining your YAML, all you have to do is to push the Story-driven threat model to the ThreatPlaybook Server. This can be done with: \n\n```bash\nplaybook apply feature -f <path to the yaml file> -p test-project\n```\n\n> You'll need to provide the absolute (full) path to the yaml file. Relative paths wont work\n\nIf everything has worked, you should see a string of success messages of having created objects in ThreatPlaybook"
  },
  {
    "path": "documentation/docs/tutorial-client-ui.md",
    "content": "---\nid: tutorial-client-ui\ntitle: Web UI\nsidebar_label: Web UI\n---\n\n#### Open Addressable IP Address on the browser\n\n![Image](/img/login.png)\n\n\n>**Note:** Login using credentials\n\n\n##### Once you logged in you should see a dashboard of Threat Playbook\n\n![Image](/img/dashboard.png)"
  },
  {
    "path": "documentation/docs/tutorial.md",
    "content": "---\nid: tutorial\ntitle: Tutorial - Installation, Configuration and Extension\nsidebar_label: Installation and Configuration\n---\n\n##### Download docker-compose file\n```\ngit clone https://github.com/we45/ThreatPlaybook.git\n```\n\n##### `cd` into the downloaded directory\n```\ncd ThreatPlaybook\n```\n\nThe ThreatPlaybook `docker-compose.yml` file has been written to get you up and running quickly. However, its not the best/most ideal configuration for running ThreatPlaybook, especially in prod.\n\n> Its meant only for experimental deployments on user's local machine\n\n### Analyzing the Docker-Compose File\n\n```yml\nversion: '3'\nservices:\n  nginx:\n    image: we45/threatplaybook-nginx:latest\n    ports:\n        - \"80:80\"\n    depends_on:\n        - api\n    links:\n        - api\n  mongo_db:\n    image: 'docker.io/bitnami/mongodb:4.2-debian-10'\n    volumes:\n      - '/tmp/playbook:/bitnami/mongodb'\n    environment:\n      - MONGODB_USERNAME=threatplaybook\n      - MONGODB_PASSWORD=password123\n      - MONGODB_DATABASE=threat_playbook\n    expose:\n      - \"27017\"\n  api:\n    image: we45/threatplaybook-server:latest\n    expose:\n      - \"5000\"\n    environment:\n      - MONGO_HOST=mongo_db\n      - MONGO_USER=threatplaybook\n      - MONGO_PASS=password123\n      - MONGO_PORT=27017\n      - MONGO_DB=threat_playbook\n      - SUPERUSER_EMAIL=admin@admin.com\n      - SUPERUSER_PASS=supersecret\n      - JWT_PASS=VGCxqDnhsN6vNQVqmXtrNVVe1AS36ZMQKTq6lYpj0ygHiuWunMOkFi2j17cHSbG-WId9x_yJpeSqy0TTFjs06Q\n      - WAIT_HOSTS=mongo_db:27017\n    links:\n      - mongo_db\n    depends_on:\n      - mongo_db\n    command: sh -c \"/app/wait-for mongo_db:27017 -- /usr/local/bin/python /app/app.py\"\n  frontend:\n    image: we45/threatplaybook-frontend:latest\n    environment:\n      - VUE_APP_API_URL=http://api\n    links:\n      - api\n    depends_on:\n      - api\n```\n\n### Change the Default Password!\n\n* The value set in the `SUPERUSER_EMAIL` and `SUPERUSER_PASS` are the values that ThreatPlaybook uses as the default values for the Superuser Account within ThreatPlaybook.\n\n> This is clearly a default password that you SHOULD NOT use as a permanent password to access the super-admin account on ThreatPlaybook. \n> \n> Please use `playbook change-password` feature in the CLI to change your default password. You have been warned!\n\n### Logs\n\nThere's a single output log that is generated in the `/app` directory within the container. If you want the logs to persist on a more permanent file-system, you'll need to volume mount a src path on your machine to the `/app/logs` path within the container. \n\n```\n# inside the container\n/app/logs # cat output.log \n2020-06-21 10:41:01.282 | INFO     | __main__:login:158 - User 'admin@admin.com' successfully logged in\n2020-06-21 10:41:27.442 | INFO     | __main__:create_project:191 - Successfully created project my-new-test\n2020-06-21 10:41:40.753 | INFO     | __main__:create_user_story:236 - Successfully created user-story/feature 'create_upload_expense'\n```"
  },
  {
    "path": "documentation/docusaurus.config.js",
    "content": "module.exports = {\n  title: \"Threat Playbook\",\n  tagline:\n    \"A (relatively) Unopinionated framework that faciliates Threat Modeling as Code married with Application Security Automation on a single Fabric\",\n  url: \"https://your-docusaurus-test-site.com\",\n  baseUrl: \"/\",\n  favicon: \"img/favicon.ico\",\n  organizationName: \"we45\",\n  projectName: \"ThreatPlaybook\",\n  themeConfig: {\n    navbar: {\n      logo: {\n        alt: \"Logo\",\n        src: \"img/logo.png\",\n      },\n      links: [\n        {\n          to: \"docs\",\n          activeBasePath: \"/\",\n          label: \"Documentation\",\n          position: \"left\",\n        },\n      ],\n    },\n    footer: {\n      style: \"dark\",\n      links: [\n        {\n          title: \"Community\",\n          items: [\n            {\n              label: \"Twitter\",\n              href: \"https://twitter.com/we45\",\n            },\n          ],\n        },\n        {\n          title: \"More\",\n          items: [\n            {\n              label: \"GitHub\",\n              href: \"https://github.com/we45/ThreatPlaybook\",\n            },\n          ],\n        },\n      ],\n      copyright: `Copyright © ${new Date().getFullYear()} we45, Inc. Built with Docusaurus.`,\n    },\n  },\n  presets: [\n    [\n      \"@docusaurus/preset-classic\",\n      {\n        docs: {\n          homePageId: \"overview\",\n          sidebarPath: require.resolve(\"./sidebars.js\"),\n        },\n        theme: {\n          customCss: require.resolve(\"./src/css/custom.css\"),\n        },\n      },\n    ],\n  ],\n};\n"
  },
  {
    "path": "documentation/package.json",
    "content": "{\n  \"name\": \"documentation\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"start\": \"docusaurus start\",\n    \"build\": \"docusaurus build\",\n    \"swizzle\": \"docusaurus swizzle\",\n    \"deploy\": \"docusaurus deploy\"\n  },\n  \"dependencies\": {\n    \"@docusaurus/core\": \"^2.0.0-alpha.58\",\n    \"@docusaurus/preset-classic\": \"^2.0.0-alpha.58\",\n    \"clsx\": \"^1.1.1\",\n    \"react\": \"^16.8.4\",\n    \"react-dom\": \"^16.8.4\"\n  },\n  \"browserslist\": {\n    \"production\": [\n      \">0.2%\",\n      \"not dead\",\n      \"not op_mini all\"\n    ],\n    \"development\": [\n      \"last 1 chrome version\",\n      \"last 1 firefox version\",\n      \"last 1 safari version\"\n    ]\n  }\n}"
  },
  {
    "path": "documentation/sidebars.js",
    "content": "module.exports = {\n  someSidebar: {\n    QuickStart: [\n      \"overview\",\n      \"installation\",\n      \"client-install\",\n      \"configure-cli\",\n      \"create-project\",\n      \"client-ui\",\n    ],\n    Tutorial: [\"tutorial\", \"story-driven\", \"tutorial-client-ui\"],\n  },\n};\n"
  },
  {
    "path": "documentation/src/css/custom.css",
    "content": "/* stylelint-disable docusaurus/copyright-header */\n/**\n * Any CSS included here will be global. The classic template\n * bundles Infima by default. Infima is a CSS framework designed to\n * work well for content-centric websites.\n */\n\n/* You can override the default Infima variables here. */\n:root {\n  --ifm-color-primary: #25c2a0;\n  --ifm-color-primary-dark: rgb(33, 175, 144);\n  --ifm-color-primary-darker: rgb(31, 165, 136);\n  --ifm-color-primary-darkest: rgb(26, 136, 112);\n  --ifm-color-primary-light: rgb(70, 203, 174);\n  --ifm-color-primary-lighter: rgb(102, 212, 189);\n  --ifm-color-primary-lightest: rgb(146, 224, 208);\n  --ifm-code-font-size: 95%;\n}\n\n.docusaurus-highlight-code-line {\n  background-color: rgb(72, 77, 91);\n  display: block;\n  margin: 0 calc(-1 * var(--ifm-pre-padding));\n  padding: 0 var(--ifm-pre-padding);\n}\n"
  },
  {
    "path": "documentation/src/pages/index.js",
    "content": "import React from 'react';\nimport clsx from 'clsx';\nimport Layout from '@theme/Layout';\nimport Link from '@docusaurus/Link';\nimport useDocusaurusContext from '@docusaurus/useDocusaurusContext';\nimport useBaseUrl from '@docusaurus/useBaseUrl';\nimport styles from './styles.module.css';\n\nconst features = [\n  {\n    title: <>Easy to Use</>,\n    imageUrl: 'img/undraw_docusaurus_mountain.svg',\n    description: (\n      <>\n        Docusaurus was designed from the ground up to be easily installed and\n        used to get your website up and running quickly.\n      </>\n    ),\n  },\n  {\n    title: <>Focus on What Matters</>,\n    imageUrl: 'img/undraw_docusaurus_tree.svg',\n    description: (\n      <>\n        Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go\n        ahead and move your docs into the <code>docs</code> directory.\n      </>\n    ),\n  },\n  {\n    title: <>Powered by React</>,\n    imageUrl: 'img/undraw_docusaurus_react.svg',\n    description: (\n      <>\n        Extend or customize your website layout by reusing React. Docusaurus can\n        be extended while reusing the same header and footer.\n      </>\n    ),\n  },\n];\n\nfunction Feature({imageUrl, title, description}) {\n  const imgUrl = useBaseUrl(imageUrl);\n  return (\n    <div className={clsx('col col--4', styles.feature)}>\n      {imgUrl && (\n        <div className=\"text--center\">\n          <img className={styles.featureImage} src={imgUrl} alt={title} />\n        </div>\n      )}\n      <h3>{title}</h3>\n      <p>{description}</p>\n    </div>\n  );\n}\n\nfunction Home() {\n  const context = useDocusaurusContext();\n  const {siteConfig = {}} = context;\n  return (\n    <Layout\n      title={`Hello from ${siteConfig.title}`}\n      description=\"Description will go into a meta tag in <head />\">\n      <header className={clsx('hero hero--primary', styles.heroBanner)}>\n        <div className=\"container\">\n          <h1 className=\"hero__title\">{siteConfig.title}</h1>\n          <p className=\"hero__subtitle\">{siteConfig.tagline}</p>\n          <div className={styles.buttons}>\n            <Link\n              className={clsx(\n                'button button--outline button--secondary button--lg',\n                styles.getStarted,\n              )}\n              to={useBaseUrl('docs/')}>\n              Get Started\n            </Link>\n          </div>\n        </div>\n      </header>\n      {/* <main>\n        {features && features.length > 0 && (\n          <section className={styles.features}>\n            <div className=\"container\">\n              <div className=\"row\">\n                {features.map((props, idx) => (\n                  <Feature key={idx} {...props} />\n                ))}\n              </div>\n            </div>\n          </section>\n        )}\n      </main> */}\n    </Layout>\n  );\n}\n\nexport default Home;\n"
  },
  {
    "path": "documentation/src/pages/styles.module.css",
    "content": "/* stylelint-disable docusaurus/copyright-header */\n\n/**\n * CSS files with the .module.css suffix will be treated as CSS modules\n * and scoped locally.\n */\n\n.heroBanner {\n  padding: 4rem 0;\n  text-align: center;\n  position: relative;\n  overflow: hidden;\n}\n\n@media screen and (max-width: 966px) {\n  .heroBanner {\n    padding: 2rem;\n  }\n}\n\n.buttons {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n\n.features {\n  display: flex;\n  align-items: center;\n  padding: 2rem 0;\n  width: 100%;\n}\n\n.featureImage {\n  height: 200px;\n  width: 200px;\n}\n"
  },
  {
    "path": "documentation/static/.nojekyll",
    "content": ""
  },
  {
    "path": "frontend/Playbook-Frontend/.babelrc",
    "content": "{\n  \"env\": {\n    \"test\": {\n      \"presets\": [\n        [\n          \"@babel/preset-env\",\n          {\n            \"targets\": {\n              \"node\": \"current\"\n            }\n          }\n        ]\n      ]\n    }\n  }\n}\n"
  },
  {
    "path": "frontend/Playbook-Frontend/.editorconfig",
    "content": "# editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "frontend/Playbook-Frontend/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Node template\n# Logs\n/logs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# next.js build output\n.next\n\n# nuxt.js build output\n.nuxt\n\n# Nuxt generate\ndist\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless\n\n# IDE / Editor\n.idea\n\n# Service worker\nsw.*\n\n# macOS\n.DS_Store\n\n# Vim swap files\n*.swp\n"
  },
  {
    "path": "frontend/Playbook-Frontend/Dockerfile",
    "content": "FROM node:12\n\nCOPY dist ./dist\n\nRUN npm install -g serve\nENV PORT=80\nCMD serve -s dist -p 80\n"
  },
  {
    "path": "frontend/Playbook-Frontend/README.md",
    "content": "# Playbook-Frontend\n\n> My swell Nuxt.js project\n\n## Build Setup\n\n```bash\n# install dependencies\n$ yarn install\n\n# serve with hot reload at localhost:3000\n$ yarn dev\n\n# build for production and launch server\n$ yarn build\n$ yarn start\n\n# generate static project\n$ yarn generate\n```\n\nFor detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).\n"
  },
  {
    "path": "frontend/Playbook-Frontend/assets/variables.scss",
    "content": "// Ref: https://github.com/nuxt-community/vuetify-module#customvariables\n//\n// The variables you want to modify\n// $font-size-root: 20px;\n// assets/variables.scss\n\n// Variables you want to modify\n$btn-border-radius: 0px;\n\n// If you need to extend Vuetify SASS lists\n// $material-light: ( cards: blue );\n@import '~vuetify/src/styles/styles.sass';"
  },
  {
    "path": "frontend/Playbook-Frontend/components/Logo.vue",
    "content": "<template>\n  <div class=\"VueToNuxtLogo\">\n    <div class=\"Triangle Triangle--two\" />\n    <div class=\"Triangle Triangle--one\" />\n    <div class=\"Triangle Triangle--three\" />\n    <div class=\"Triangle Triangle--four\" />\n  </div>\n</template>\n\n<style>\n.VueToNuxtLogo {\n  display: inline-block;\n  animation: turn 2s linear forwards 1s;\n  transform: rotateX(180deg);\n  position: relative;\n  overflow: hidden;\n  height: 180px;\n  width: 245px;\n}\n\n.Triangle {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 0;\n  height: 0;\n}\n\n.Triangle--one {\n  border-left: 105px solid transparent;\n  border-right: 105px solid transparent;\n  border-bottom: 180px solid #41b883;\n}\n\n.Triangle--two {\n  top: 30px;\n  left: 35px;\n  animation: goright 0.5s linear forwards 3.5s;\n  border-left: 87.5px solid transparent;\n  border-right: 87.5px solid transparent;\n  border-bottom: 150px solid #3b8070;\n}\n\n.Triangle--three {\n  top: 60px;\n  left: 35px;\n  animation: goright 0.5s linear forwards 3.5s;\n  border-left: 70px solid transparent;\n  border-right: 70px solid transparent;\n  border-bottom: 120px solid #35495e;\n}\n\n.Triangle--four {\n  top: 120px;\n  left: 70px;\n  animation: godown 0.5s linear forwards 3s;\n  border-left: 35px solid transparent;\n  border-right: 35px solid transparent;\n  border-bottom: 60px solid #fff;\n}\n\n@keyframes turn {\n  100% {\n    transform: rotateX(0deg);\n  }\n}\n\n@keyframes godown {\n  100% {\n    top: 180px;\n  }\n}\n\n@keyframes goright {\n  100% {\n    left: 70px;\n  }\n}\n</style>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/components/README.md",
    "content": "# COMPONENTS\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThe components directory contains your Vue.js Components.\n\n_Nuxt.js doesn't supercharge these components._\n"
  },
  {
    "path": "frontend/Playbook-Frontend/components/VuetifyLogo.vue",
    "content": "<template>\n  <img class=\"VuetifyLogo\" alt=\"Vuetify Logo\" src=\"/vuetify-logo.svg\" />\n</template>\n\n<style>\n.VuetifyLogo {\n  height: 180px;\n  width: 180px;\n  transform: rotateY(560deg);\n  animation: turn 3.5s ease-out forwards 1s;\n}\n\n@keyframes turn {\n  100% {\n    transform: rotateY(0deg);\n  }\n}\n</style>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/components/project/Content.vue",
    "content": "<template>\n  <div>\n    <v-row>\n      <v-col cols=\"6\">\n        <v-card>\n          <v-card-title class=\"subtitle-1\"\n            >Vulnerabilities by Severity</v-card-title\n          >\n          <v-card-text>\n            <apexchart\n              type=\"pie\"\n              :options=\"pieOptions\"\n              :series=\"pieSeries\"\n              height=\"300\"\n            ></apexchart>\n          </v-card-text>\n        </v-card>\n      </v-col>\n      <v-col cols=\"6\">\n        <v-card>\n          <v-card-title class=\"subtitle-1\">List of Scans</v-card-title>\n          <v-card-text>\n            <v-simple-table height=\"300px\">\n              <template v-slot:default>\n                <thead>\n                  <tr>\n                    <th class=\"text-left\">Name</th>\n                  </tr>\n                </thead>\n                <tbody>\n                  <tr v-for=\"item in scanData\" :key=\"item.name\">\n                    <td>{{ item.name }}</td>\n                    <td>\n                      <v-btn\n                        color=\"primary\"\n                        small\n                        @click=\"viewScanPage(item.name)\"\n                        >View</v-btn\n                      >\n                    </td>\n                  </tr>\n                </tbody>\n              </template>\n            </v-simple-table>\n          </v-card-text>\n        </v-card>\n      </v-col>\n    </v-row>\n  </div>\n</template>\n<script>\nexport default {\n  name: 'Content',\n  props: {\n    pieSeries: {\n      required: false,\n      type: Array\n    },\n    scanData: {\n      required: false,\n      type: Array\n    }\n  },\n  data() {\n    return {\n      pieOptions: {\n        labels: ['High', 'Medium', 'Low'],\n        colors: ['#d11d55', '#ff9c2c', '#008b8f']\n      }\n    }\n  },\n  methods: {\n    viewScanPage(data) {\n      this.$router.push('/scan/' + data)\n    }\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/components/project/Header.vue",
    "content": "<template>\n  <div>\n    <v-card>\n      <v-card-title\n        class=\"display-2 justify-center\"\n        v-text=\"name\"\n      ></v-card-title>\n      <v-card-text class=\"grey lighten-5 text-right\">\n        <v-btn color=\"primary\" @click=\"viewThreatMap()\">Threat Map</v-btn>\n      </v-card-text>\n    </v-card>\n    <br />\n    <v-row>\n      <v-col cols=\"3\">\n        <v-card @click.native=\"viewUserStory()\">\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'User Stories'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"userstorycount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n      <!-- Abuser Stories -->\n      <v-col cols=\"3\">\n        <v-card @click.native=\"viewAbuserStory()\">\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Abuser Stories'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"abusecount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n      <!-- Threat Scenario -->\n      <v-col cols=\"3\">\n        <v-card @click.native=\"viewThreatScenario()\">\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Threat Scenarios'\"\n              ></v-card-title>\n              <h2\n                class=\"display-1 text-center\"\n                v-text=\"threatscenariocount\"\n              ></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n      <!-- Test Cases -->\n      <!-- <v-col cols=\"2\">\n        <v-card @click.native=\"viewTestCases()\">\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Test Cases'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"testCaseCount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col> -->\n      <!-- Scans -->\n      <!-- <v-col cols=\"2\">\n        <v-card>\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title class=\"subtitle-1\" v-text=\"'Scans'\"></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"scanCount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col> -->\n      <!-- Vulnerabilities -->\n      <v-col cols=\"3\">\n        <v-card @click.native=\"viewVulnerabilities()\">\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Vulnerabilities'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"vulcount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n    </v-row>\n  </div>\n</template>\n<script>\nexport default {\n  name: 'Header',\n  props: {\n    name: {\n      required: true,\n      type: String\n    },\n    userstorycount: {\n      required: true,\n      type: Number,\n      default: 0\n    },\n    abusecount: {\n      required: true,\n      type: Number,\n      default: 0\n    },\n    threatscenariocount: {\n      required: true,\n      type: Number,\n      default: 0\n    },\n    testcasecount: {\n      required: true,\n      type: Number,\n      default: 0\n    },\n    scancount: {\n      required: true,\n      type: Number,\n      default: 0\n    },\n    vulcount: {\n      required: true,\n      type: Number,\n      default: 0\n    }\n  },\n  methods: {\n    viewThreatMap() {\n      this.$emit('viewThreatMap', { view: true })\n      // this.$router.push('/projects/' + name + '/threat-map')\n    },\n    viewUserStory() {\n      this.$emit('viewUserStory', { view: true })\n    },\n    viewAbuserStory() {\n      this.$emit('viewAbuserStory', { view: true })\n    },\n    viewThreatScenario() {\n      this.$emit('viewThreatScenario', { view: true })\n    },\n    // viewTestCases() {\n    //   this.$emit('viewTestCases', { view: true })\n    // },\n    viewVulnerabilities() {\n      this.$emit('viewVulnerabilities', { view: true })\n    }\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/components/projects/ProjectsPage.vue",
    "content": "<template>\n  <v-card>\n    <v-card-title>\n      Projects\n      <v-spacer></v-spacer>\n      <v-text-field\n        v-model=\"search\"\n        append-icon=\"mdi-magnify\"\n        label=\"Search\"\n        single-line\n        hide-details\n      ></v-text-field>\n      <v-spacer></v-spacer>\n      <v-dialog v-model=\"dialog\" max-width=\"500px\">\n        <!-- <template v-slot:activator=\"{ on }\">\n          <v-btn color=\"primary\" dark class=\"mb-2\" v-on=\"on\">New Project</v-btn>\n        </template> -->\n        <v-card>\n          <v-card-title>\n            <span class=\"headline\">{{ formTitle }}</span>\n          </v-card-title>\n\n          <v-card-text>\n            <v-container>\n              <v-row>\n                <v-col cols=\"12\" sm=\"12\" md=\"12\">\n                  <v-text-field\n                    v-model=\"editedItem.name\"\n                    label=\"Project name\"\n                  ></v-text-field>\n                </v-col>\n              </v-row>\n            </v-container>\n          </v-card-text>\n\n          <v-card-actions>\n            <v-spacer></v-spacer>\n            <v-btn color=\"blue darken-1\" text @click=\"close\">Cancel</v-btn>\n            <v-btn color=\"blue darken-1\" text @click=\"save\">Save</v-btn>\n          </v-card-actions>\n        </v-card>\n      </v-dialog>\n    </v-card-title>\n    <v-data-table\n      :headers=\"headers\"\n      :items=\"getProjectData\"\n      :search=\"search\"\n      class=\"elevation-1\"\n      :loading=\"isPageLoading\"\n      loading-text=\"Loading... Please wait\"\n    >\n      <template v-slot:item.actions=\"{ item }\">\n        <!-- <v-icon small class=\"mr-2\" @click=\"openProjectPage(item)\"\n          >mdi-open-in-new</v-icon\n        > -->\n        <v-btn color=\"primary\" small @click=\"openProjectPage(item)\">View</v-btn>\n        <!-- <v-icon small class=\"mr-2\" @click=\"editItem(item)\">mdi-pencil</v-icon>\n        <v-icon small @click=\"deleteItem(item)\">mdi-delete</v-icon> -->\n      </template>\n      <template v-slot:no-data>\n        <v-btn color=\"primary\" @click=\"initialize\">Refresh</v-btn>\n      </template>\n    </v-data-table>\n  </v-card>\n</template>\n\n<script>\nimport { mapGetters, mapActions } from 'vuex'\n\nexport default {\n  data() {\n    return {\n      dialog: false,\n      search: '',\n      loading: false,\n      headers: [\n        {\n          text: 'Name',\n          align: 'start',\n          sortable: true,\n          value: 'name'\n        },\n        { text: 'Actions', value: 'actions', sortable: false }\n      ],\n      editedIndex: -1,\n      editedItem: {\n        name: ''\n      },\n      defaultItem: {\n        name: ''\n      }\n    }\n  },\n  computed: {\n    formTitle() {\n      return this.editedIndex === -1 ? 'New Project' : 'Edit Project'\n    },\n    ...mapGetters('projects', {\n      isPageLoading: 'isPageLoading',\n      getProjectData: 'getProjectData'\n    })\n  },\n  watch: {\n    dialog(val) {\n      val || this.close()\n    }\n  },\n  mounted() {\n    this.initialize()\n  },\n  methods: {\n    ...mapActions('projects', ['showPageLoading', 'fetchProjectData']),\n    initialize() {\n      this.showPageLoading(true)\n      this.fetchProjectData()\n    },\n    openProjectPage(item) {\n      this.$router.push('/projects/' + item.name + '/project')\n    },\n\n    editItem(item) {\n      this.editedIndex = this.desserts.indexOf(item)\n      this.editedItem = Object.assign({}, item)\n      this.dialog = true\n    },\n\n    deleteItem(item) {\n      this.desserts.indexOf(item)\n    },\n\n    close() {\n      this.dialog = false\n    },\n\n    save() {\n      if (this.editedIndex > -1) {\n        Object.assign(this.desserts[this.editedIndex], this.editedItem)\n      } else {\n        this.desserts.push(this.editedItem)\n      }\n      this.close()\n    }\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/jest.config.js",
    "content": "module.exports = {\n  moduleNameMapper: {\n    '^@/(.*)$': '<rootDir>/$1',\n    '^~/(.*)$': '<rootDir>/$1',\n    '^vue$': 'vue/dist/vue.common.js'\n  },\n  moduleFileExtensions: [\n    'js',\n    'vue',\n    'json'\n  ],\n  transform: {\n    '^.+\\\\.js$': 'babel-jest',\n    '.*\\\\.(vue)$': 'vue-jest'\n  },\n  collectCoverage: true,\n  collectCoverageFrom: [\n    '<rootDir>/components/**/*.vue',\n    '<rootDir>/pages/**/*.vue'\n  ]\n}\n"
  },
  {
    "path": "frontend/Playbook-Frontend/jsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./*\"],\n      \"@/*\": [\"./*\"],\n      \"~~/*\": [\"./*\"],\n      \"@@/*\": [\"./*\"]\n    }\n  },\n  \"exclude\": [\"node_modules\", \".nuxt\", \"dist\"]\n}\n"
  },
  {
    "path": "frontend/Playbook-Frontend/layouts/default.vue",
    "content": "<template>\n  <v-app light>\n    <v-content>\n      <v-container class=\"fill-height\" fluid>\n        <nuxt />\n      </v-container>\n    </v-content>\n    <v-footer :fixed=\"true\" app>\n      <span>&copy; {{ new Date().getFullYear() }}</span>\n    </v-footer>\n  </v-app>\n</template>\n\n<script>\nexport default {\n  name: 'Default'\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/layouts/error.vue",
    "content": "<template>\n  <v-app dark>\n    <h1 v-if=\"error.statusCode === 404\">{{ pageNotFound }}</h1>\n    <h1 v-else>{{ otherError }}</h1>\n    <NuxtLink to=\"/\">Home page</NuxtLink>\n  </v-app>\n</template>\n\n<script>\nexport default {\n  layout: 'empty',\n  props: {\n    error: {\n      type: Object,\n      default: null\n    }\n  },\n  data() {\n    return {\n      pageNotFound: '404 Not Found',\n      otherError: 'An error occurred'\n    }\n  },\n  head() {\n    const title =\n      this.error.statusCode === 404 ? this.pageNotFound : this.otherError\n    return {\n      title\n    }\n  }\n}\n</script>\n\n<style scoped>\nh1 {\n  font-size: 20px;\n}\n</style>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/layouts/main.vue",
    "content": "<template>\n  <v-app id=\"inspire\">\n    <v-navigation-drawer\n      v-model=\"drawer\"\n      :clipped=\"$vuetify.breakpoint.lgAndUp\"\n      app\n    >\n      <v-list dense>\n        <template v-for=\"item in items\">\n          <v-row v-if=\"item.heading\" :key=\"item.heading\" align=\"center\">\n            <v-col cols=\"6\">\n              <v-subheader v-if=\"item.heading\">{{ item.heading }}</v-subheader>\n            </v-col>\n            <v-col cols=\"6\" class=\"text-center\">\n              <a href=\"#!\" class=\"body-2 black--text\">EDIT</a>\n            </v-col>\n          </v-row>\n          <v-list-group\n            v-else-if=\"item.children\"\n            :key=\"item.text\"\n            v-model=\"item.model\"\n            :prepend-icon=\"item.model ? item.icon : item['icon-alt']\"\n            append-icon\n          >\n            <template v-slot:activator>\n              <v-list-item-content>\n                <v-list-item-title>{{ item.text }}</v-list-item-title>\n              </v-list-item-content>\n            </template>\n            <v-list-item v-for=\"(child, i) in item.children\" :key=\"i\" link>\n              <v-list-item-action v-if=\"child.icon\">\n                <v-icon>{{ child.icon }}</v-icon>\n              </v-list-item-action>\n              <v-list-item-content>\n                <v-list-item-title>{{ child.text }}</v-list-item-title>\n              </v-list-item-content>\n            </v-list-item>\n          </v-list-group>\n          <v-list-item v-else :key=\"item.text\" :to=\"item.link\" link>\n            <v-list-item-action>\n              <v-icon>{{ item.icon }}</v-icon>\n            </v-list-item-action>\n            <v-list-item-content>\n              <v-list-item-title>{{ item.text }}</v-list-item-title>\n            </v-list-item-content>\n          </v-list-item>\n        </template>\n      </v-list>\n    </v-navigation-drawer>\n\n    <v-app-bar\n      :clipped-left=\"$vuetify.breakpoint.lgAndUp\"\n      app\n      color=\"blue darken-3\"\n      dark\n    >\n      <v-app-bar-nav-icon @click.stop=\"drawer = !drawer\" />\n      <v-toolbar-title style=\"width: 300px\" class=\"ml-0 pl-4\">\n        <span class=\"hidden-sm-and-down\">\n          <!-- <v-avatar size=\"32px\" item>\n          <v-img src=\"/tp-logo.png\" alt=\"ThreatPlaybook\" /> </v-avatar>-->\n          Threat Playbook\n        </span>\n      </v-toolbar-title>\n      <v-spacer />\n      <v-menu>\n        <template v-slot:activator=\"{ on }\">\n          <v-btn icon large v-on=\"on\">\n            <v-avatar color=\"indigo\">\n              <v-icon dark>mdi-account-circle</v-icon>\n            </v-avatar>\n          </v-btn>\n        </template>\n        <v-card class=\"mx-auto\" max-width=\"300\" tile>\n          <v-list shaped>\n            <!-- <v-subheader>Tilak T</v-subheader> -->\n            <v-divider></v-divider>\n            <v-list-item-group color=\"primary\">\n              <v-list-item v-for=\"(item, i) in userMenu\" :key=\"i\">\n                <v-list-item-icon>\n                  <v-icon v-text=\"item.icon\"></v-icon>\n                </v-list-item-icon>\n                <v-list-item-content>\n                  <v-list-item-title\n                    @click=\"logout(item.text)\"\n                    v-text=\"item.text\"\n                  ></v-list-item-title>\n                </v-list-item-content>\n              </v-list-item>\n            </v-list-item-group>\n          </v-list>\n        </v-card>\n      </v-menu>\n    </v-app-bar>\n    <v-content>\n      <v-container fluid>\n        <nuxt />\n      </v-container>\n    </v-content>\n  </v-app>\n</template>\n\n<script>\nexport default {\n  data() {\n    return {\n      dialog: false,\n      drawer: true,\n      items: [\n        { icon: 'mdi-home', text: 'Dashboard', link: '/home' },\n        { icon: 'mdi-note-multiple', text: 'Projects', link: '/projects' }\n      ],\n      userMenu: [\n        // { text: 'Profile', icon: 'mdi-face-profile' },\n        { text: 'Logout', icon: 'mdi-logout' }\n      ]\n    }\n  },\n  methods: {\n    logout(name) {\n      if (name === 'Logout') {\n        localStorage.removeItem('token')\n        this.$router.push('/')\n      }\n    }\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/middleware/README.md",
    "content": "# MIDDLEWARE\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains your application middleware.\nMiddleware let you define custom functions that can be run before rendering either a page or a group of pages.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).\n"
  },
  {
    "path": "frontend/Playbook-Frontend/nuxt.config.js",
    "content": "import colors from \"vuetify/es5/util/colors\";\nexport default {\n  mode: \"universal\",\n  /*\n   ** Headers of the page\n   */\n  head: {\n    titleTemplate: \"%s - \" + process.env.npm_package_name,\n    title: process.env.npm_package_name || \"\",\n    meta: [\n      { charset: \"utf-8\" },\n      { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n      {\n        hid: \"description\",\n        name: \"description\",\n        content: process.env.npm_package_description || \"\"\n      }\n    ],\n    link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }]\n  },\n  /*\n   ** Customize the progress-bar color\n   */\n  env: {\n    VUE_APP_API_URL: process.env.VUE_APP_API_URL\n  },\n\n  loading: { color: \"#fff\" },\n  /*\n   ** Global CSS\n   */\n  css: [],\n  /*\n   ** Plugins to load before mounting the App\n   */\n  plugins: [\n    { src: \"~plugins/vue-apexchart.js\", ssr: false },\n    { src: \"~plugins/vue-organization-chart.js\", ssr: false }\n  ],\n  /*\n   ** Nuxt.js dev-modules\n   */\n  buildModules: [\"@nuxtjs/vuetify\"],\n  /*\n   ** Nuxt.js modules\n   */\n  modules: [\n    // Doc: https://axios.nuxtjs.org/usage\n    \"@nuxtjs/axios\",\n    \"@nuxtjs/auth\"\n  ],\n  /*\n   ** Axios module configuration\n   ** See https://axios.nuxtjs.org/options\n   */\n  axios: {\n    baseURL: process.env.VUE_APP_API_URL\n  },\n\n\n  /*\n   ** vuetify module configuration\n   ** https://github.com/nuxt-community/vuetify-module\n   */\n  vuetify: {\n    customVariables: [\"~/assets/variables.scss\"],\n    theme: {\n      // disable: true,\n      dark: false,\n      themes: {\n        dark: {\n          primary: colors.blue.darken2,\n          accent: colors.grey.darken3,\n          secondary: colors.amber.darken3,\n          info: colors.teal.lighten1,\n          warning: colors.amber.base,\n          error: colors.deepOrange.accent4,\n          success: colors.green.accent3\n        }\n      }\n    }\n  },\n  /*\n   ** Build configuration\n   */\n  build: {\n    vendor: [\"vue-apexchart\"],\n    /*\n     ** You can extend webpack config here\n     */\n    extend(config, ctx) {\n      const vueLoader = config.module.rules.find(\n        rule => rule.loader === \"vue-loader\"\n      );\n      vueLoader.options.transformToRequire = {\n        img: \"src\",\n        image: \"xlink:href\",\n        \"b-img\": \"src\",\n        \"b-img-lazy\": [\"src\", \"blank-src\"],\n        \"b-card\": \"img-src\",\n        \"b-card-img\": \"img-src\",\n        \"b-carousel-slide\": \"img-src\",\n        \"b-embed\": \"src\"\n      };\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/package.json",
    "content": "{\n  \"name\": \"Playbook-Frontend\",\n  \"version\": \"1.0.0\",\n  \"description\": \"My swell Nuxt.js project\",\n  \"author\": \"Tilak T\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"nuxt\",\n    \"build\": \"nuxt build\",\n    \"start\": \"nuxt start\",\n    \"generate\": \"nuxt generate\",\n    \"test\": \"jest\"\n  },\n  \"dependencies\": {\n    \"@nuxtjs/auth\": \"^4.9.1\",\n    \"@nuxtjs/axios\": \"^5.3.6\",\n    \"apexcharts\": \"^3.19.0\",\n    \"nuxt\": \"^2.0.0\",\n    \"uuid\": \"^8.0.0\",\n    \"vue-apexcharts\": \"^1.5.3\",\n    \"vue-organization-chart\": \"^1.1.6\",\n    \"vuelidate\": \"^0.7.5\"\n  },\n  \"devDependencies\": {\n    \"@nuxtjs/vuetify\": \"^1.0.0\",\n    \"@vue/test-utils\": \"^1.0.0-beta.27\",\n    \"babel-jest\": \"^24.1.0\",\n    \"jest\": \"^24.1.0\",\n    \"vue-jest\": \"^4.0.0-0\"\n  }\n}\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/home/index.vue",
    "content": "<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-row>\n      <v-col cols=\"3\">\n         <v-card>\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Projects'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"getProjectCount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n      <v-col cols=\"3\">\n         <v-card>\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'User Stories'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"getUserStoryCount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n      <v-col cols=\"3\">\n         <v-card>\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Threat Scenarios'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"getThreatScenarioCount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n      <v-col cols=\"3\">\n         <v-card>\n          <div class=\"d-flex flex-no-wrap justify-space-between\">\n            <div>\n              <v-card-title\n                class=\"subtitle-1\"\n                v-text=\"'Scans'\"\n              ></v-card-title>\n              <h2 class=\"display-1 text-center\" v-text=\"getScanCount\"></h2>\n              <br />\n            </div>\n          </div>\n        </v-card>\n      </v-col>\n    </v-row>\n    <br />\n    <v-row>\n      <v-col cols=\"6\">\n        <v-card>\n          <v-card-title class=\"subtitle-1\">Threat model severity</v-card-title>\n          <v-card-text>\n            <apexchart\n              type=\"donut\"\n              :options=\"donutOptions\"\n              :series=\"getThreatScenarioSevData\"\n              height=\"300\"\n            ></apexchart>\n          </v-card-text>\n        </v-card>\n      </v-col>\n      <v-col cols=\"6\">\n        <v-card>\n          <v-card-title class=\"subtitle-1\"\n            >Vulnerabilities by Severity</v-card-title\n          >\n          <v-card-text>\n            <apexchart\n              type=\"pie\"\n              :options=\"pieOptions\"\n              :series=\"getVulnerabilitySevData\"\n              height=\"300\"\n            ></apexchart>\n          </v-card-text>\n        </v-card>\n      </v-col>\n    </v-row>\n\n    <v-overlay :value=\"isPageLoading\">\n      <v-progress-circular indeterminate size=\"64\"></v-progress-circular>\n    </v-overlay>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  name: 'Home',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          disabled: false,\n          to: '/home'\n        }\n      ],\n      donutOptions: {\n        labels: ['High', 'Medium', 'Low'],\n        colors: ['#d11d55', '#ff9c2c', '#008b8f']\n      },\n      pieOptions: {\n        labels: ['High', 'Medium', 'Low'],\n        colors: ['#d11d55', '#ff9c2c', '#008b8f'],\n        noData: {\n          text: 'Loading...'\n        }\n      },\n      noData: {\n        text: 'Loading...'\n      }\n    }\n  },\n  mounted() {\n    this.showPageLoading(true)\n    this.fetchData()\n    this.fetchProjectData()\n    this.fetchUserStoryData()\n    this.fetchThreatScenarioData()\n    this.fetchScanData()\n    this.fetchThreatScenarioSevData()\n    this.fetchVulnerabilitySevData()\n  },\n  // async asyncData(){\n  //   this.showPageLoading(true)\n  //   this.fetchData()\n  // },\n  methods: {\n    ...mapActions('home', ['showPageLoading', 'fetchData']),\n    ...mapActions('projects', ['fetchProjectData']),\n    ...mapActions('userStory', ['fetchUserStoryData']),\n    ...mapActions('threatScenario', ['fetchThreatScenarioData', 'fetchThreatScenarioSevData']),\n    ...mapActions('scan', ['fetchScanData']),\n    ...mapActions('vulnerability', ['fetchVulnerabilitySevData'])\n  },\n  computed: {\n    ...mapGetters('home', {\n      isPageLoading: 'isPageLoading',\n      fetchThreatScenarioSevChartData: 'fetchThreatScenarioSevChartData',\n      fetchSeverityChartData: 'fetchSeverityChartData'\n    }),\n    ...mapGetters('projects', {\n      getProjectCount: 'getProjectCount'\n    }),\n    ...mapGetters('userStory', {\n      getUserStoryCount: 'getUserStoryCount'\n    }),\n    ...mapGetters('threatScenario', {\n      getThreatScenarioCount: 'getThreatScenarioCount',\n      getThreatScenarioSevData: 'getThreatScenarioSevData'\n    }),\n    ...mapGetters('scan', {\n      getScanCount: 'getScanCount'\n    }),\n    ...mapGetters('vulnerability', {\n      getVulnerabilitySevData: 'getVulnerabilitySevData'\n    })\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/index.vue",
    "content": "<template>\n  <v-row align=\"center\" justify=\"center\">\n    <v-col cols=\"12\" sm=\"8\" md=\"4\">\n      <center>\n        <img src=\"/threat_logo.png\" alt=\"Threat Playbook\" />\n      </center>\n      <v-alert\n        v-if=\"isLoginError\"\n        type=\"error\"\n        v-text=\"loginErrorMessage\"\n      ></v-alert>\n      <v-card class=\"elevation-12\">\n        <v-toolbar color=\"primary\" dark flat>\n          <v-toolbar-title>Login</v-toolbar-title>\n          <v-spacer />\n        </v-toolbar>\n        <v-card-text>\n          <v-form @keyup.native.enter=\"onSubmit\">\n            <v-text-field\n              id=\"email\"\n              v-model=\"email\"\n              :error-messages=\"emailErrors\"\n              label=\"Email\"\n              name=\"email\"\n              prepend-icon=\"mdi-face\"\n              type=\"email\"\n              required\n              @input=\"$v.email.$touch()\"\n              @blur=\"$v.email.$touch()\"\n            />\n            <v-text-field\n              id=\"password\"\n              v-model=\"password\"\n              label=\"Password\"\n              name=\"password\"\n              prepend-icon=\"mdi-lock\"\n              type=\"password\"\n              :error-messages=\"passwordErrors\"\n              required\n              @input=\"$v.password.$touch()\"\n              @blur=\"$v.password.$touch()\"\n            />\n          </v-form>\n        </v-card-text>\n        <v-card-actions>\n          <v-spacer />\n          <v-btn\n            v-if=\"!isPageLoading\"\n            type=\"submit\"\n            color=\"primary\"\n            @click=\"onSubmit()\"\n            >Login</v-btn\n          >\n          <v-btn\n            v-if=\"isPageLoading\"\n            type=\"submit\"\n            color=\"primary\"\n            disabled\n            @click=\"onSubmit()\"\n          >\n            <v-progress-circular\n              indeterminate\n              color=\"primary\"\n            ></v-progress-circular>\n          </v-btn>\n        </v-card-actions>\n      </v-card>\n    </v-col>\n  </v-row>\n</template>\n\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nimport { validationMixin } from 'vuelidate'\nimport { required, email } from 'vuelidate/lib/validators'\nexport default {\n  mixins: [validationMixin],\n  data() {\n    return {\n      email: '',\n      password: ''\n    }\n  },\n  validations: {\n    email: { required, email },\n    password: { required }\n  },\n  computed: {\n    emailErrors() {\n      const errors = []\n      if (!this.$v.email.$dirty) return errors\n      !this.$v.email.email && errors.push('Must be a valid e-mail')\n      !this.$v.email.required && errors.push('E-mail is required')\n      return errors\n    },\n    passwordErrors() {\n      const errors = []\n      if (!this.$v.password.$dirty) return errors\n      !this.$v.password.required && errors.push('Password is required')\n      return errors\n    },\n    ...mapGetters('login', {\n      isPageLoading: 'isPageLoading',\n      loginErrorMessage: 'loginErrorMessage',\n      isLoginError: 'isLoginError'\n    })\n  },\n  watch: {\n    email: {\n      handler() {\n        if (this.loginErrorMessage) {\n          this.pageLoadingError(false)\n        }\n      }\n    },\n    password: {\n      handler() {\n        if (this.loginErrorMessage) {\n          this.pageLoadingError(false)\n        }\n      }\n    }\n  },\n  methods: {\n    ...mapActions('login', ['pageLoading', 'loginUser', 'pageLoadingError']),\n    onSubmit() {\n      this.$v.$touch()\n      if (!this.$v.$invalid) {\n        const data = {\n          email: this.email,\n          password: this.password\n        }\n        this.pageLoading(true)\n        this.loginUser(data)\n      }\n    }\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/_name/abuser-story.vue",
    "content": "/* eslint-disable no-var */\n<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-card>\n      <v-card-title\n        class=\"display-2 justify-center\"\n        v-text=\"'Abuser Story of ' + projectName\"\n      ></v-card-title>\n    </v-card>\n    <br />\n    <v-card>\n      <v-treeview\n        v-model=\"tree\"\n        hoverable\n        :items=\"getAbuserStoryProjectTree\"\n        activatable\n        item-key=\"name\"\n      >\n        <template slot=\"label\" slot-scope=\"{ item }\">\n          <a @click=\"openDialog(item)\">{{ item.name }}</a>\n        </template>\n      </v-treeview>\n    </v-card>\n    <v-navigation-drawer v-model=\"drawer\" absolute temporary right width=\"70%\">\n      <br />\n      <h4 class=\"display-1 text-center\" v-text=\"title\"></h4>\n      <!-- <v-list-item>\n        <v-list-item-content>\n          <v-list-item-title>{{ title }}</v-list-item-title>\n        </v-list-item-content>\n      </v-list-item>-->\n\n      <br />\n      <v-divider></v-divider>\n      <v-card>\n        <v-card-title\n          class=\"display-1 justify-center\"\n          v-text=\"name\"\n        ></v-card-title>\n        <v-card-text v-if=\"description\">{{ description }}</v-card-text>\n        <v-divider></v-divider>\n        <v-card-text v-if=\"type === 'sce'\">\n          <v-row>\n            <v-col cols=\"10\">\n              <h4 v-if=\"vulName\" class=\"headline\">{{ vulName }}</h4>\n              <br />\n              <p v-if=\"vulName\" class=\"subtitle-1\">CWE : {{ cwe }}</p>\n            </v-col>\n            <v-col cols=\"2\">\n              <v-chip\n                v-if=\"sev === 'High'\"\n                class=\"ma-2\"\n                color=\"#d11d55\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n              <v-chip\n                v-if=\"sev === 'Medium'\"\n                class=\"ma-2\"\n                color=\"#ff9c2c\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n              <v-chip\n                v-if=\"sev === 'Low'\"\n                class=\"ma-2\"\n                color=\"#008b8f\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n            </v-col>\n          </v-row>\n          <p v-if=\"getASVSData.length > 0\" class=\"title\">ASVS</p>\n          <v-simple-table v-if=\"getASVSData.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Level</th>\n                  <th class=\"text-left\">Description</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in getASVSData\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.l1\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L1</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l2\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L2</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l3\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L3</v-chip\n                    >\n                  </td>\n                  <td>{{ item.description }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n          <p v-if=\"relatedVuls.length > 0\" class=\"title\">\n            Vulnerabilities linked with threat scenario\n          </p>\n          <v-simple-table v-if=\"relatedVuls.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Severity</th>\n                  <th class=\"text-left\">Tool</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in relatedVuls\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.severity === 3\"\n                      class=\"ma-2\"\n                      color=\"#d11d55\"\n                      text-color=\"white\"\n                      >High</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 2\"\n                      class=\"ma-2\"\n                      color=\"#ff9c2c\"\n                      text-color=\"white\"\n                      >Medium</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 1\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 0\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                  </td>\n                  <td>{{ item.tool }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n          <!-- <p class=\"title\" v-if=\"mitigations.length > 0\">Mitigation</p>\n          <v-simple-table v-if=\"mitigations.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Phase</th>\n                  <th class=\"text-left\">Strategy</th>\n                  <th class=\"text-left\">Description</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in mitigations\" :key=\"item.id\">\n                  <td>{{ item.phase }}</td>\n                  <td>{{ item.strategy }}</td>\n                  <td>{{ item.description }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>-->\n          <!-- <p v-if=\"mitigations.length > 0\" class=\"subtitle-1\">\n            Mitigations: {{ mitigations }}\n          </p>-->\n        </v-card-text>\n        <!-- Test Cases -->\n        <v-card v-if=\"type === 'tc'\">\n          <v-card-text>\n            <p v-if=\"testCase\" class=\"subtitle-1 text-center\">{{ testCase }}</p>\n            <p v-if=\"testType\" class=\"title\">\n              Type :\n              <v-chip class=\"ma-2\" color=\"indigo\" text-color=\"white\">\n                {{ testType }}\n              </v-chip>\n            </p>\n            <p v-if=\"tools.length > 0\" class=\"title\">\n              Tools : {{ tools.toString() }}\n            </p>\n            <v-chip class=\"ma-2\" color=\"green\" text-color=\"white\" v-if=\"isExecuted\">\n                Test Case Excuted\n              </v-chip>\n          </v-card-text>\n        </v-card>\n      </v-card>\n    </v-navigation-drawer>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ],\n      chartData: [],\n      drawer: false,\n      items: [\n        { title: 'Home', icon: 'dashboard' },\n        { title: 'About', icon: 'question_answer' }\n      ],\n      type: '',\n      title: '',\n      description: '',\n      vulName: '',\n      sev: '',\n      cwe: '',\n      mitigations: [],\n      relatedVuls: [],\n      testCase: '',\n      testType: '',\n      tools: [],\n      asvsData: [],\n      isExecuted: false\n    }\n  },\n  created() {\n    this.projectName = this.$route.params.name\n    const data = {\n      project : this.projectName\n    }\n    this.fetchAbuserStoryTreeByProject(data)\n  },\n  methods: {\n    ...mapActions('abuserStory', ['fetchAbuserStoryTreeByProject']),\n    ...mapActions('vulnerability', ['fetchASVSbyProject']),\n    openDialog(event) {\n      if (!this.drawer) {\n        this.drawer = true\n      }\n      this.type = ''\n      this.title = ''\n      this.name = ''\n      this.vulName = ''\n      this.sev = ''\n      this.cwe = ''\n      this.mitigations = []\n      this.relatedVuls = []\n      this.asvsData = []\n      this.testType = ''\n      this.tools = ''\n      this.type = event.type\n      this.title = event.title\n      this.name = event.name\n      this.description = event.description\n      if (event.type === 'sce') {\n        if (event.vul_name) {\n          this.vulName = event.vul_name\n        }\n        if (event.severity === 3) {\n          this.sev = 'High'\n        } else if (event.severity === 2) {\n          this.sev = 'Medium'\n        } else {\n          this.sev = 'Low'\n        }\n        this.cwe = event.cwe\n          const data = {\n            cwe: parseInt(event.cwe)\n          }\n          this.fetchASVSbyProject(data)\n        if (event.mitigations) {\n          this.mitigations = event.mitigations\n        }\n      }\n      if (event.type === 'tc') {\n        if (event.test_case) {\n          this.testCase = event.test_case\n        }\n        if (event.test_type) {\n          this.testType = event.test_type\n        }\n        if (event.tools) {\n          this.tools = event.tools\n        }\n        this.isExecuted = event.executed\n      }\n    },\n  },\n  computed: {\n    ...mapGetters('abuserStory', {\n      getAbuserStoryProjectTree: 'getAbuserStoryProjectTree'\n    }),\n    ...mapGetters('vulnerability', {\n      getASVSData: 'getASVSData'\n    }),\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/_name/project.vue",
    "content": "<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <Header\n      :name=\"this.$route.params.name\"\n      :vulcount=\"getVulnerabilityProjectCount\"\n      :userstorycount=\"getUserStoryProjectCount\"\n      :abusecount=\"getAbuserStoryProjectCount\"\n      :threatscenariocount=\"get_project_scenario_count\"\n      :testcasecount=\"testCaseCount.length\"\n      :scancount=\"scanCount.length\"\n      @viewThreatMap=\"threatMapPage($event)\"\n      @viewUserStory=\"userStoryPage($event)\"\n      @viewAbuserStory=\"abuserStoryPage($event)\"\n      @viewThreatScenario=\"threatScenarioPage($event)\"\n      @viewVulnerabilities=\"vulnerabilitiesPage($event)\"\n    ></Header>\n    <Content :pie-series=\"getVulnerabilityProjectSev\" :scanData=\"getScanProjectData\"></Content>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nimport Header from '@/components/project/Header'\nimport Content from '@/components/project/Content'\nexport default {\n  layout: 'main',\n  components: {\n    Header,\n    Content\n  },\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ],\n      userStoryCount: [],\n      abuseCount: [],\n      threatScenarioCount: [],\n      testCaseCount: [],\n      scanCount: [],\n      vulCount: [],\n      scanData: [],\n      pieSeries: []\n    }\n  },\n  mounted() {\n    this.projectName = this.$route.params.name\n    const data = {\n      project: this.projectName\n    }\n    this.fetchUserStoryByProject(data)\n    this.fetchProjectThreatScenarioData(data)\n    this.fetchVulnerabilitybyProject(data)\n    this.fetchScanbyProject(data)\n  },\n  methods: {\n     ...mapActions('userStory', ['fetchUserStoryByProject']),\n     ...mapActions('threatScenario', ['fetchProjectThreatScenarioData']),\n     ...mapActions('vulnerability', ['fetchVulnerabilitybyProject']),\n     ...mapActions('scan', ['fetchScanbyProject']),\n    threatMapPage(event) {\n      if (event.view) {\n        this.$router.push('/projects/' + this.projectName + '/threat-map')\n      }\n    },\n    userStoryPage(event) {\n      if (event.view) {\n        this.$router.push('/projects/' + this.projectName + '/user-story')\n      }\n    },\n    abuserStoryPage(event) {\n      if (event.view) {\n        this.$router.push('/projects/' + this.projectName + '/abuser-story')\n      }\n    },\n    threatScenarioPage(event) {\n      if (event.view) {\n        this.$router.push('/projects/' + this.projectName + '/threat-scenario')\n      }\n    },\n    vulnerabilitiesPage(event) {\n      if (event.view) {\n        this.$router.push('/projects/' + this.projectName + '/vulnerabilities')\n      }\n    }\n  },\n  computed: {\n    ...mapGetters('userStory', {\n      getUserStoryProjectCount: 'getUserStoryProjectCount',\n      getAbuserStoryProjectCount: 'getAbuserStoryProjectCount',\n      getUserStoryProjectdata: 'getUserStoryProjectdata',\n      getUserStoryProjectID: 'getUserStoryProjectID'\n    }),\n    ...mapGetters('threatScenario', {\n      get_project_scenario_count: 'get_project_scenario_count'\n    }),\n    ...mapGetters('vulnerability', {\n      getVulnerabilityProjectCount: 'getVulnerabilityProjectCount',\n      getVulnerabilityProjectSev: 'getVulnerabilityProjectSev'\n    }),\n    ...mapGetters('scan', {\n      getScanProjectData: 'getScanProjectData'\n    }),\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/_name/threat-map.vue",
    "content": "<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-card>\n      <v-card-title\n        class=\"display-2 justify-center\"\n        v-text=\"projectName\"\n      ></v-card-title>\n    </v-card>\n    <br />\n    <v-row>\n      <v-col cols=\"12\">\n        <organization-chart\n          :datasource=\"getThreatMapProjectData\"\n          :pan=\"true\"\n          :zoom=\"true\"\n          @node-click=\"nodeClick($event)\"\n        ></organization-chart>\n      </v-col>\n    </v-row>\n    <v-navigation-drawer v-model=\"drawer\" absolute temporary right width=\"70%\">\n      <v-card>\n        <v-card-title\n          class=\"display-1 justify-center\"\n          v-text=\"dialogData.type\"\n        ></v-card-title>\n        <v-card-text v-if=\"dialogData.name\">\n          <h4 class=\"title\">{{ dialogData.name }}</h4>\n        </v-card-text>\n        <v-divider></v-divider>\n        <v-card-text>{{ dialogData.title }}</v-card-text>\n        <v-card-text v-if=\"dialogData.type === 'Scenarios'\">\n          <v-row>\n            <v-col cols=\"10\">\n              <h4 v-if=\"dialogData.vul_name\" class=\"headline\">\n                {{ dialogData.vul_name }}\n              </h4>\n              <br />\n              <p v-if=\"dialogData.cwe\" class=\"subtitle-1\">\n                CWE : {{ dialogData.cwe }}\n              </p>\n            </v-col>\n            <v-col cols=\"2\">\n              <v-chip\n                v-if=\"dialogData.severity === 3\"\n                class=\"ma-2\"\n                color=\"#d11d55\"\n                text-color=\"white\"\n                >High</v-chip\n              >\n              <v-chip\n                v-if=\"dialogData.severity === 2\"\n                class=\"ma-2\"\n                color=\"#ff9c2c\"\n                text-color=\"white\"\n                >Medium</v-chip\n              >\n              <v-chip\n                v-if=\"dialogData.severity === 1\"\n                class=\"ma-2\"\n                color=\"#008b8f\"\n                text-color=\"white\"\n                >Low</v-chip\n              >\n              <v-chip\n                v-if=\"dialogData.severity === 0\"\n                class=\"ma-2\"\n                color=\"#008b8f\"\n                text-color=\"white\"\n                >Low</v-chip\n              >\n            </v-col>\n          </v-row>\n          <p v-if=\"getASVSData.length > 0\" class=\"title\">ASVS</p>\n          <v-simple-table v-if=\"getASVSData.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Level</th>\n                  <th class=\"text-left\">Description</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in getASVSData\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.l1\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L1</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l2\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L2</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l3\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L3</v-chip\n                    >\n                  </td>\n                  <td>{{ item.description }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n          <p v-if=\"relatedVuls.length > 0\" class=\"title\">\n            Vulnerabilities linked with threat scenario\n          </p>\n          <v-simple-table v-if=\"relatedVuls.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Severity</th>\n                  <th class=\"text-left\">Tool</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in relatedVuls\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.severity === 3\"\n                      class=\"ma-2\"\n                      color=\"#d11d55\"\n                      text-color=\"white\"\n                      >High</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 2\"\n                      class=\"ma-2\"\n                      color=\"#ff9c2c\"\n                      text-color=\"white\"\n                      >Medium</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 1\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 0\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                  </td>\n                  <td>{{ item.tool }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n        </v-card-text>\n        <!-- Test Cases -->\n        <v-card v-if=\"dialogData.type === 'Test Cases'\">\n          <v-card-text>\n            <p v-if=\"dialogData.test_case\" class=\"subtitle-1 text-center\">\n              {{ dialogData.test_case }}\n            </p>\n            <p v-if=\"dialogData.test_type\" class=\"title\">\n              Type :\n              <v-chip class=\"ma-2\" color=\"indigo\" text-color=\"white\">\n                {{ dialogData.test_type }}\n              </v-chip>\n            </p>\n            <p v-if=\"dialogData.tools.length > 0\" class=\"title\">\n              Tools : {{ dialogData.tools.toString() }}\n            </p>\n            <v-chip class=\"ma-2\" color=\"green\" text-color=\"white\" v-if=\"dialogData.executed\">\n                Test Case Excuted\n              </v-chip>\n          </v-card-text>\n        </v-card>\n      </v-card>\n    </v-navigation-drawer>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  name: 'ThreatMap',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ],\n      drawer: false,\n      chartData: {},\n      dialogData: '',\n      asvsData: [],\n      relatedVuls: []\n    }\n  },\n  created() {\n    this.projectName = this.$route.params.name\n     const data = {\n      project : this.projectName\n    }\n    this.fetchThreatMapbyProject(data)\n    // this.fetchThreatMapInfo()\n  },\n  methods: {\n    ...mapActions('threatmap', ['fetchThreatMapbyProject']),\n    ...mapActions('vulnerability', ['fetchASVSbyProject']),\n    nodeClick(event) {\n      if (!this.drawer) {\n        this.drawer = true\n      }\n      this.dialogData = ''\n      this.asvsData = []\n      this.relatedVuls = []\n      this.dialogData = event\n      if (event.type === 'Scenarios') {\n          const data = {\n            cwe: parseInt(event.cwe)\n          }\n          this.fetchASVSbyProject(data)\n      }\n    },\n    \n  },\n  computed: {\n    ...mapGetters('threatmap', {\n      getThreatMapProjectData: 'getThreatMapProjectData'\n    }),\n    ...mapGetters('vulnerability', {\n      getASVSData: 'getASVSData'\n    }),\n  }\n}\n</script>\n<style>\n.orgchart-container {\n  height: 620px;\n  width: calc(100% - 24px);\n  border: none;\n}\n</style>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/_name/threat-scenario.vue",
    "content": "/* eslint-disable no-var */\n<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-card>\n      <v-card-title\n        class=\"display-2 justify-center\"\n        v-text=\"'Threat Scenarios of ' + projectName\"\n      ></v-card-title>\n    </v-card>\n    <br />\n    <v-card>\n      <v-treeview\n        v-model=\"tree\"\n        hoverable\n        :items=\"getThreatScenarioProjectTree\"\n        activatable\n        item-key=\"name\"\n      >\n        <template slot=\"label\" slot-scope=\"{ item }\">\n          <a @click=\"openDialog(item)\">{{ item.name }}</a>\n        </template>\n      </v-treeview>\n    </v-card>\n    <v-navigation-drawer v-model=\"drawer\" absolute temporary right width=\"70%\">\n      <br />\n      <h4 class=\"display-1 text-center\" v-text=\"title\"></h4>\n      <br />\n      <v-divider></v-divider>\n      <v-card>\n        <v-card-title\n          class=\"display-1 justify-center\"\n          v-text=\"name\"\n        ></v-card-title>\n        <v-card-text v-if=\"description\">{{ description }}</v-card-text>\n        <v-divider></v-divider>\n        <v-card-text v-if=\"type === 'sce'\">\n          <v-row>\n            <v-col cols=\"10\">\n              <h4 v-if=\"vulName\" class=\"headline\">{{ vulName }}</h4>\n              <br />\n              <p v-if=\"vulName\" class=\"subtitle-1\">CWE : {{ cwe }}</p>\n            </v-col>\n            <v-col cols=\"2\">\n              <v-chip\n                v-if=\"sev === 'High'\"\n                class=\"ma-2\"\n                color=\"#d11d55\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n              <v-chip\n                v-if=\"sev === 'Medium'\"\n                class=\"ma-2\"\n                color=\"#ff9c2c\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n              <v-chip\n                v-if=\"sev === 'Low'\"\n                class=\"ma-2\"\n                color=\"#008b8f\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n            </v-col>\n          </v-row>\n          <p v-if=\"getASVSData.length > 0\" class=\"title\">ASVS</p>\n          <v-simple-table v-if=\"getASVSData.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Level</th>\n                  <th class=\"text-left\">Description</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in getASVSData\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.l1\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L1</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l2\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L2</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l3\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L3</v-chip\n                    >\n                  </td>\n                  <td>{{ item.description }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n          <p v-if=\"relatedVuls.length > 0\" class=\"title\">\n            Vulnerabilities linked with threat scenario\n          </p>\n          <v-simple-table v-if=\"relatedVuls.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Severity</th>\n                  <th class=\"text-left\">Tool</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in relatedVuls\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.severity === 3\"\n                      class=\"ma-2\"\n                      color=\"#d11d55\"\n                      text-color=\"white\"\n                      >High</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 2\"\n                      class=\"ma-2\"\n                      color=\"#ff9c2c\"\n                      text-color=\"white\"\n                      >Medium</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 1\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 0\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                  </td>\n                  <td>{{ item.tool }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n          <!-- <p class=\"title\" v-if=\"mitigations.length > 0\">Mitigation</p>\n          <v-simple-table v-if=\"mitigations.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Phase</th>\n                  <th class=\"text-left\">Strategy</th>\n                  <th class=\"text-left\">Description</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in mitigations\" :key=\"item.id\">\n                  <td>{{ item.phase }}</td>\n                  <td>{{ item.strategy }}</td>\n                  <td>{{ item.description }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>-->\n          <!-- <p v-if=\"mitigations.length > 0\" class=\"subtitle-1\">\n            Mitigations: {{ mitigations }}\n          </p>-->\n        </v-card-text>\n        <!-- Test Cases -->\n        <v-card v-if=\"type === 'tc'\">\n          <v-card-text>\n            <p v-if=\"testCase\" class=\"subtitle-1 text-center\">{{ testCase }}</p>\n            <p v-if=\"testType\" class=\"title\">\n              Type :\n              <v-chip class=\"ma-2\" color=\"indigo\" text-color=\"white\">\n                {{ testType }}\n              </v-chip>\n            </p>\n            <p v-if=\"tools.length > 0\" class=\"title\">\n              Tools : {{ tools.toString() }}\n            </p>\n            <v-chip class=\"ma-2\" color=\"green\" text-color=\"white\" v-if=\"isExecuted\">\n                Test Case Excuted\n              </v-chip>\n          </v-card-text>\n        </v-card>\n      </v-card>\n    </v-navigation-drawer>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ],\n      chartData: [],\n      drawer: false,\n      items: [\n        { title: 'Home', icon: 'dashboard' },\n        { title: 'About', icon: 'question_answer' }\n      ],\n      type: '',\n      title: '',\n      description: '',\n      vulName: '',\n      sev: '',\n      cwe: '',\n      mitigations: [],\n      relatedVuls: [],\n      testCase: '',\n      testType: '',\n      tools: [],\n      asvsData: [],\n      isExecuted: false\n    }\n  },\n  created() {\n    this.projectName = this.$route.params.name\n    const data = {\n      project : this.projectName\n    }\n    this.fetchThreatScenarioTreeByProject(data)\n  },\n  methods: {\n    ...mapActions('threatScenario', ['fetchThreatScenarioTreeByProject']),\n    ...mapActions('vulnerability', ['fetchASVSbyProject']),\n    openDialog(event) {\n      if (!this.drawer) {\n        this.drawer = true\n      }\n      this.type = ''\n      this.title = ''\n      this.name = ''\n      this.vulName = ''\n      this.sev = ''\n      this.cwe = ''\n      this.mitigations = []\n      this.relatedVuls = []\n      this.asvsData = []\n      this.testType = ''\n      this.tools = ''\n      this.type = event.type\n      this.title = event.title\n      this.name = event.name\n      this.description = event.description\n      if (event.type === 'sce') {\n        if (event.vul_name) {\n          this.vulName = event.vul_name\n        }\n        if (event.severity === 3) {\n          this.sev = 'High'\n        } else if (event.severity === 2) {\n          this.sev = 'Medium'\n        } else {\n          this.sev = 'Low'\n        }\n        this.cwe = event.cwe\n          const data = {\n            cwe: parseInt(event.cwe)\n          }\n          this.fetchASVSbyProject(data)\n        if (event.mitigations) {\n          this.mitigations = event.mitigations\n        }\n      }\n      if (event.type === 'tc') {\n        if (event.test_case) {\n          this.testCase = event.test_case\n        }\n        if (event.test_type) {\n          this.testType = event.test_type\n        }\n        if (event.tools) {\n          this.tools = event.tools\n        }\n        this.isExecuted = event.executed\n      }\n    },\n  },\n  computed: {\n    ...mapGetters('threatScenario', {\n      getThreatScenarioProjectTree: 'getThreatScenarioProjectTree'\n    }),\n    ...mapGetters('vulnerability', {\n      getASVSData: 'getASVSData'\n    }),\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/_name/user-story.vue",
    "content": "/* eslint-disable no-var */\n<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-card>\n      <v-card-title\n        class=\"display-2 justify-center\"\n        v-text=\"'User Story of ' + projectName\"\n      ></v-card-title>\n    </v-card>\n    <br />\n    <v-card>\n      <v-treeview\n        v-model=\"tree\"\n        hoverable\n        :items=\"getUserStoryProjectTree\"\n        activatable\n        item-key=\"name\"\n      >\n        <template slot=\"label\" slot-scope=\"{ item }\">\n          <a @click=\"openDialog(item)\">{{ item.name }}</a>\n        </template>\n      </v-treeview>\n    </v-card>\n    <v-navigation-drawer v-model=\"drawer\" absolute temporary right width=\"70%\">\n      <br />\n      <h4 class=\"display-1 text-center\" v-text=\"title\"></h4>\n      <br />\n      <v-divider></v-divider>\n      <v-card>\n        <v-card-title\n          class=\"display-1 justify-center\"\n          v-text=\"name\"\n        ></v-card-title>\n        <v-card-text v-if=\"description\">{{ description }}</v-card-text>\n        <v-divider></v-divider>\n        <v-card-text v-if=\"type === 'sce'\">\n          <v-row>\n            <v-col cols=\"10\">\n              <h4 v-if=\"vulName\" class=\"headline\">{{ vulName }}</h4>\n              <br />\n              <p v-if=\"vulName\" class=\"subtitle-1\">CWE : {{ cwe }}</p>\n            </v-col>\n            <v-col cols=\"2\">\n              <v-chip\n                v-if=\"sev === 'High'\"\n                class=\"ma-2\"\n                color=\"#d11d55\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n              <v-chip\n                v-if=\"sev === 'Medium'\"\n                class=\"ma-2\"\n                color=\"#ff9c2c\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n              <v-chip\n                v-if=\"sev === 'Low'\"\n                class=\"ma-2\"\n                color=\"#008b8f\"\n                text-color=\"white\"\n                >{{ sev }}</v-chip\n              >\n            </v-col>\n          </v-row>\n          <p v-if=\"getASVSData.length > 0\" class=\"title\">ASVS</p>\n          <v-simple-table v-if=\"getASVSData.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Level</th>\n                  <th class=\"text-left\">Description</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in getASVSData\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.l1\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L1</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l2\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L2</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.l3\"\n                      class=\"ma-2\"\n                      color=\"indigo\"\n                      text-color=\"white\"\n                      small\n                      >L3</v-chip\n                    >\n                  </td>\n                  <td>{{ item.description }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n          <p v-if=\"relatedVuls.length > 0\" class=\"title\">\n            Vulnerabilities linked with threat scenario\n          </p>\n          <v-simple-table v-if=\"relatedVuls.length > 0\">\n            <template v-slot:default>\n              <thead>\n                <tr>\n                  <th class=\"text-left\">Name</th>\n                  <th class=\"text-left\">CWE</th>\n                  <th class=\"text-left\">Severity</th>\n                  <th class=\"text-left\">Tool</th>\n                </tr>\n              </thead>\n              <tbody>\n                <tr v-for=\"item in relatedVuls\" :key=\"item.id\">\n                  <td>{{ item.name }}</td>\n                  <td>{{ item.cwe }}</td>\n                  <td>\n                    <v-chip\n                      v-if=\"item.severity === 3\"\n                      class=\"ma-2\"\n                      color=\"#d11d55\"\n                      text-color=\"white\"\n                      >High</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 2\"\n                      class=\"ma-2\"\n                      color=\"#ff9c2c\"\n                      text-color=\"white\"\n                      >Medium</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 1\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                    <v-chip\n                      v-if=\"item.severity === 0\"\n                      class=\"ma-2\"\n                      color=\"#008b8f\"\n                      text-color=\"white\"\n                      >Low</v-chip\n                    >\n                  </td>\n                  <td>{{ item.tool }}</td>\n                </tr>\n              </tbody>\n            </template>\n          </v-simple-table>\n        </v-card-text>\n        <!-- Test Cases -->\n        <v-card v-if=\"type === 'tc'\">\n          <v-card-text>\n            <p v-if=\"testCase\" class=\"subtitle-1 text-center\">{{ testCase }}</p>\n            <p v-if=\"testType\" class=\"title\">\n              Type :\n              <v-chip class=\"ma-2\" color=\"indigo\" text-color=\"white\">\n                {{ testType }}\n              </v-chip>\n            </p>\n            <p v-if=\"tools.length > 0\" class=\"title\">\n              Tools : {{ tools.toString() }}\n            </p>\n            <v-chip class=\"ma-2\" color=\"green\" text-color=\"white\" v-if=\"isExecuted\">\n                Test Case Excuted\n              </v-chip>\n          </v-card-text>\n        </v-card>\n      </v-card>\n    </v-navigation-drawer>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ],\n      chartData: [{\n            name: 'sadasd',\n            description: 'asdasd',\n            children: [\n              {\n                name: 'asdasdasd',\n                description: 'asasd',\n                children: [],\n                type: 'as',\n                title: 'Abuser Story'\n              }\n            ],\n            type: 'us',\n            title: 'User Story'\n          },\n          {\n            name: 'hellosodas',\n            description: 'asdasd',\n            children: [{\n                name: 'asdasdasd',\n                description: 'asasd',\n                children: [],\n                type: 'as',\n                title: 'Abuser Story'\n              }],\n            type: 'us',\n            title: 'User Story'\n          }],\n      drawer: false,\n      items: [\n        { title: 'Home', icon: 'dashboard' },\n        { title: 'About', icon: 'question_answer' }\n      ],\n      type: '',\n      title: '',\n      description: '',\n      vulName: '',\n      sev: '',\n      cwe: '',\n      mitigations: [],\n      relatedVuls: [],\n      testCase: '',\n      testType: '',\n      tools: [],\n      asvsData: [],\n      isExecuted: false\n    }\n  },\n  created() {\n    this.projectName = this.$route.params.name\n    const data = {\n      project: this.projectName\n    }\n    this.fetchUserStoryTreeByProject(data)\n  },\n  methods: {\n    ...mapActions('userStory', ['fetchUserStoryTreeByProject']),\n    ...mapActions('vulnerability', ['fetchASVSbyProject']),\n    openDialog(event) {\n      if (!this.drawer) {\n        this.drawer = true\n      }\n      this.type = ''\n      this.title = ''\n      this.name = ''\n      this.vulName = ''\n      this.sev = ''\n      this.cwe = ''\n      this.mitigations = []\n      this.relatedVuls = []\n      this.asvsData = []\n      this.testType = ''\n      this.tools = ''\n      this.type = event.type\n      this.title = event.title\n      this.name = event.name\n      this.description = event.description\n      if (event.type === 'sce') {\n        if (event.vul_name) {\n          this.vulName = event.vul_name\n        }\n        if (event.severity === 3) {\n          this.sev = 'High'\n        } else if (event.severity === 2) {\n          this.sev = 'Medium'\n        } else {\n          this.sev = 'Low'\n        }\n          this.cwe = event.cwe\n          const data = {\n            cwe: parseInt(event.cwe)\n          }\n          this.fetchASVSbyProject(data)\n        if (event.mitigations) {\n          this.mitigations = event.mitigations\n        }\n      }\n      if (event.type === 'tc') {\n        if (event.test_case) {\n          this.testCase = event.test_case\n        }\n        if (event.test_type) {\n          this.testType = event.test_type\n        }\n        if (event.tools) {\n          this.tools = event.tools\n        }\n        this.isExecuted = event.executed\n      }\n    },\n  },\n  computed: {\n    ...mapGetters('userStory', {\n      getUserStoryProjectTree: 'getUserStoryProjectTree'\n    }),\n    ...mapGetters('vulnerability', {\n      getASVSData: 'getASVSData'\n    }),\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/_name/vulnerabilities.vue",
    "content": "/* eslint-disable no-var */\n<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-card>\n      <v-card-title\n        class=\"display-2 justify-center\"\n        v-text=\"'Vulnerabilities of ' + projectName\"\n      ></v-card-title>\n    </v-card>\n    <br />\n    <v-card>\n      <v-simple-table v-if=\"getVulnerabilityProjectData.length > 0\">\n        <template v-slot:default>\n          <thead>\n            <tr>\n              <th class=\"text-left\">Name</th>\n              <th class=\"text-left\">CWE</th>\n              <th class=\"text-left\">Severity</th>\n              <th class=\"text-left\">Description</th>\n            </tr>\n          </thead>\n          <tbody>\n            <tr v-for=\"item in getVulnerabilityProjectData\" :key=\"item.id\">\n              <td>{{ item.name }}</td>\n              <td>{{ item.cwe }}</td>\n              <td>\n                <v-chip\n                  v-if=\"item.severity === 3\"\n                  class=\"ma-2\"\n                  color=\"#d11d55\"\n                  text-color=\"white\"\n                  >High</v-chip\n                >\n                <v-chip\n                  v-if=\"item.severity === 2\"\n                  class=\"ma-2\"\n                  color=\"#ff9c2c\"\n                  text-color=\"white\"\n                  >Medium</v-chip\n                >\n                <v-chip\n                  v-if=\"item.severity === 1\"\n                  class=\"ma-2\"\n                  color=\"#008b8f\"\n                  text-color=\"white\"\n                  >Low</v-chip\n                >\n                <v-chip\n                  v-if=\"item.severity === 0\"\n                  class=\"ma-2\"\n                  color=\"#008b8f\"\n                  text-color=\"white\"\n                  >Low</v-chip\n                >\n              </td>\n              <td>{{ item.description }}</td>\n            </tr>\n          </tbody>\n        </template>\n      </v-simple-table>\n    </v-card>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ]\n    }\n  },\n  created() {\n    this.projectName = this.$route.params.name\n    const data = {\n      project : this.projectName\n    }\n    this.fetchVulnerabilitybyProject(data)\n  },\n  methods: {\n    ...mapActions('vulnerability', ['fetchVulnerabilitybyProject']),\n  },\n  computed: {\n    ...mapGetters('vulnerability', {\n      getVulnerabilityProjectData: 'getVulnerabilityProjectData'\n    }),\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/projects/index.vue",
    "content": "<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <ProjectsPage></ProjectsPage>\n  </div>\n</template>\n<script>\nimport { mapActions } from 'vuex'\nimport ProjectsPage from '@/components/projects/ProjectsPage'\nexport default {\n  layout: 'main',\n  name: 'Project',\n  components: {\n    ProjectsPage\n  },\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          disabled: false,\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          disabled: false,\n          to: '/projects'\n        }\n      ]\n    }\n  },\n  mounted() {\n    this.showPageLoading(true)\n    this.fetchProjectData()\n  },\n  methods: {\n    ...mapActions('projects', ['showPageLoading', 'fetchProjectData'])\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/pages/scan/_name.vue",
    "content": "/* eslint-disable no-var */\n<template>\n  <div>\n    <v-breadcrumbs :items=\"breadcrumbData\">\n      <template v-slot:divider>\n        <v-icon>mdi-forward</v-icon>\n      </template>\n    </v-breadcrumbs>\n    <v-card>\n      <v-card-title\n        class=\"title justify-center\"\n        v-text=\"'Vulnerabilities of ' + scanName\"\n      ></v-card-title>\n    </v-card>\n    <br />\n    <v-card>\n      <v-simple-table v-if=\"getScanIndividualData.length > 0\">\n        <template v-slot:default>\n          <thead>\n            <tr>\n              <th class=\"text-left\">Name</th>\n              <th class=\"text-left\">CWE</th>\n              <th class=\"text-left\">Severity</th>\n              <!-- <th class=\"text-left\">Tool</th> -->\n              <th class=\"text-left\">Description</th>\n            </tr>\n          </thead>\n          <tbody>\n            <tr v-for=\"item in getScanIndividualData\" :key=\"item.id\">\n              <td>{{ item.name }}</td>\n              <td>{{ item.cwe }}</td>\n              <td>\n                <v-chip\n                  v-if=\"item.severity === 3\"\n                  class=\"ma-2\"\n                  color=\"#d11d55\"\n                  text-color=\"white\"\n                  >High</v-chip\n                >\n                <v-chip\n                  v-if=\"item.severity === 2\"\n                  class=\"ma-2\"\n                  color=\"#ff9c2c\"\n                  text-color=\"white\"\n                  >Medium</v-chip\n                >\n                <v-chip\n                  v-if=\"item.severity === 1\"\n                  class=\"ma-2\"\n                  color=\"#008b8f\"\n                  text-color=\"white\"\n                  >Low</v-chip\n                >\n                <v-chip\n                  v-if=\"item.severity === 0\"\n                  class=\"ma-2\"\n                  color=\"#008b8f\"\n                  text-color=\"white\"\n                  >Low</v-chip\n                >\n              </td>\n              <td>{{ item.description }}</td>\n            </tr>\n          </tbody>\n        </template>\n      </v-simple-table>\n    </v-card>\n  </div>\n</template>\n<script>\nimport { mapActions, mapGetters } from 'vuex'\nexport default {\n  layout: 'main',\n  data() {\n    return {\n      breadcrumbData: [\n        {\n          text: 'Home',\n          to: '/home'\n        },\n        {\n          text: 'Project',\n          to: '/projects'\n        }\n      ],\n      vulnerabilityData: []\n    }\n  },\n  created() {\n    this.scanName = this.$route.params.name\n    const data = {\n      name: this.scanName\n    }\n    this.fetchIndividualScanData(data)\n  },\n  methods: {\n    ...mapActions('scan', ['fetchIndividualScanData']),\n  },\n  computed: {\n    ...mapGetters('scan', {\n      getScanIndividualData: 'getScanIndividualData'\n    }),\n  }\n}\n</script>\n"
  },
  {
    "path": "frontend/Playbook-Frontend/plugins/README.md",
    "content": "# PLUGINS\n\n**This directory is not required, you can delete it if you don't want to use it.**\n\nThis directory contains Javascript plugins that you want to run before mounting the root Vue.js application.\n\nMore information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).\n"
  },
  {
    "path": "frontend/Playbook-Frontend/plugins/vue-apexchart.js",
    "content": "import Vue from \"vue\";\nimport VueApexCharts from \"vue-apexcharts\";\n\nVue.use({\n  install(Vue, options) {\n    Vue.component(\"apexchart\", VueApexCharts);\n  }\n});\n"
  },
  {
    "path": "frontend/Playbook-Frontend/plugins/vue-organization-chart.js",
    "content": "import Vue from \"vue\";\nimport OrganizationChart from \"vue-organization-chart\";\nimport \"vue-organization-chart/dist/orgchart.css\";\n\nVue.use({\n  install(Vue, options) {\n    Vue.component(\"OrganizationChart\", OrganizationChart);\n  }\n});\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/abuserStory.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  projectAbuserStoryTree: []\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_PROJECT_ABUSER_STORY_TREE(state, data) {\n    state.projectAbuserStoryTree = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchAbuserStoryTreeByProject({ commit }, payload) {\n    axios\n      .post(loginUrl+\"/api/abuser-story/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(res => {\n        if (res.data.success) {\n          commit(\"FETCH_PROJECT_ABUSER_STORY_TREE\", res.data.data);\n        }\n        commit(\"IS_FETCHING\", false);\n      })\n      .catch(error => {\n        commit(\"IS_FETCHING\", false);\n        if (error.response.status === 401) {\n        }\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getAbuserStoryProjectTree(state) {\n    if (state.projectAbuserStoryTree) {\n      return state.projectAbuserStoryTree;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/home.js",
    "content": "export const state = () => ({\n  isLoading: false,\n  data: [],\n  projectCount: 0,\n  userStoriesCount: 0,\n  threatScenarioCount: 0,\n  scanCount: 0,\n  threatScenarioSevChart: [],\n  severityChart: []\n})\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data\n  },\n  FETCH_DATA(state, data) {\n    state.data = data\n  },\n  FETCH_PROJECT_COUNT(state, data) {\n    state.projectCount = data\n  },\n  FETCH_USER_STORIES_COUNT(state, data) {\n    state.userStoriesCount = data\n  },\n  FETCH_THREAT_SCENARIO_COUNT(state, data) {\n    state.threatScenarioCount = data\n  },\n  FETCH_SCAN_COUNT(state, data) {\n    state.scanCount = data\n  },\n  FETCH_THREAT_SCENARIO_SEVERITY_CHART(state, data) {\n    state.threatScenarioSevChart = data\n  },\n  FETCH_SEVERITY_CHART(state, data) {\n    state.severityChart = data\n  }\n}\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit('IS_PAGE_LOADING', data)\n  },\n  fetchData({ commit }) {\n    commit(\"IS_PAGE_LOADING\", false);\n  }    \n}\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading\n  },\n  getProjectCount(state) {\n    if (state.projectCount) {\n      return state.projectCount\n    }\n  },\n  getUserStoriesCount(state) {\n    if (state.userStoriesCount) {\n      return state.userStoriesCount\n    }\n  },\n  getThreatScenarioCount(state) {\n    if (state.threatScenarioCount) {\n      return state.threatScenarioCount\n    }\n  },\n  getScanCount(state) {\n    if (state.scanCount) {\n      return state.scanCount\n    }\n  },\n  getCountList(state) {\n    if (state.data) {\n      return state.data\n    }\n  },\n  fetchThreatScenarioSevChartData(state) {\n    if (state.threatScenarioSevChart) {\n      return state.threatScenarioSevChart\n    }\n  },\n  fetchSeverityChartData(state) {\n    if (state.severityChart) {\n      return state.severityChart\n    }\n  }\n}\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/index.js",
    "content": "export const state = () => ({})\nexport const getters = {}\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/login.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  token: \"\",\n  errorMessage: \"\",\n  isError: false\n});\n\nexport const mutations = {\n  PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  STORE_TOKEN(state, data) {\n    state.token = data;\n    localStorage.setItem(\"token\", data);\n  },\n  ERROR_MESSAGE(state, data) {\n    state.errorMessage = data;\n  },\n  ERROR_MESSAGE_STATUS(state, data) {\n    state.isError = data;\n  }\n};\n\nexport const actions = {\n  pageLoadingError({ commit }, data) {\n    commit(\"ERROR_MESSAGE_STATUS\", data);\n  },\n  pageLoading({ commit }, data) {\n    commit(\"PAGE_LOADING\", data);\n  },\n  loginUser({ commit }, data) {\n    axios\n      .post(\"/api/login\", data)\n      .then(response => {\n        if (response.data.success) {\n          commit(\"STORE_TOKEN\", response.data.data.token);\n          commit(\"PAGE_LOADING\", false);\n          this.$router.push(\"/home\");\n        } else {\n          localStorage.removeItem(\"token\");\n          commit(\"PAGE_LOADING\", false);\n          commit(\"ERROR_MESSAGE_STATUS\", true);\n          this.$router.push(\"/\");\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n          commit(\"ERROR_MESSAGE\", \"Invalid credentials\");\n          commit(\"ERROR_MESSAGE_STATUS\", true);\n        }\n        if (error.response.status === 502) {\n          commit(\"PAGE_LOADING\", false);\n          commit(\"ERROR_MESSAGE\", \"Bad Gateway\");\n          commit(\"ERROR_MESSAGE_STATUS\", true);\n        }\n        if (error.response.status === 404) {\n          commit(\"PAGE_LOADING\", false);\n          commit(\"ERROR_MESSAGE\", \"Page  Not found\");\n          commit(\"ERROR_MESSAGE_STATUS\", true);\n        }\n        if (error.response.status === 403) {\n          commit(\"PAGE_LOADING\", false);\n          commit(\"ERROR_MESSAGE\", \"Invalid credentials\");\n          commit(\"ERROR_MESSAGE_STATUS\", true);\n        }\n        commit(\"PAGE_LOADING\", false);\n        commit(\"ERROR_MESSAGE_STATUS\", true);\n        localStorage.removeItem(\"token\");\n        this.$router.push(\"/\");\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    if (state.isLoading) {\n      return state.isLoading;\n    }\n  },\n  userToken(state) {\n    if (state.token) {\n      return state.token;\n    }\n  },\n  loginErrorMessage(state) {\n    if (state.errorMessage) {\n      return state.errorMessage;\n    }\n  },\n  isLoginError(state) {\n    if (state.isError) {\n      return state.isError;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/projects.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  data: []\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_DATA(state, data) {\n    state.data = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchProjectData({ commit }) {\n    axios\n      .get(\"/api/project/read\", {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const projectData = [];\n          for (const data of response.data.data) {\n            projectData.push({ name: data.name });\n          }\n          commit(\"FETCH_DATA\", projectData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getProjectCount(state) {\n    if (state.data) {\n      return state.data.length;\n    }\n  },\n  getProjectData(state) {\n    if (state.data) {\n      return state.data;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/scan.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  data: [],\n  projectScanData: [],\n  individualScanData: []\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_DATA(state, data) {\n    state.data = data;\n  },\n  FETCH_SCAN_DATA_PROJECT(state, data) {\n    state.projectScanData = data;\n  },\n  FETCH_INDIVIDUAL_DATA(state, data) {\n    state.individualScanData = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchScanData({ commit }) {\n    axios\n      .get(\"/api/scan/read\", {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const scanData = [];\n          for (const data of response.data.data) {\n            scanData.push({ name: data.name });\n          }\n          commit(\"FETCH_DATA\", scanData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n  fetchIndividualScanData({ commit }, payload) {\n    axios\n      .post(\"/api/scan-vuls/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const scanData = [];\n          for (const data of response.data.data) {\n            scanData.push({\n              name: data.name,\n              cwe: data.cwe,\n              severity: data.severity,\n              description: data.description\n            });\n          }\n          commit(\"FETCH_INDIVIDUAL_DATA\", scanData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n  fetchScanbyProject({ commit }, payload) {\n    axios\n      .post(\"/api/scan/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const scanData = [];\n          for (const scan of response.data.data.data) {\n            scanData.push({\n              name: scan.name,\n              scan_type: scan.scan_type,\n              tool: scan.tool\n            });\n          }\n          commit(\"FETCH_SCAN_DATA_PROJECT\", scanData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getScanCount(state) {\n    if (state.data) {\n      return state.data.length;\n    }\n  },\n  getScanProjectData(state) {\n    if (state.projectScanData) {\n      return state.projectScanData;\n    }\n  },\n  getScanIndividualData(state) {\n    if (state.individualScanData) {\n      return state.individualScanData;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/threatScenario.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  data: [],\n  sevData: [],\n  projectScenarioData: [],\n  projectScenarioTree: []\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_DATA(state, data) {\n    state.data = data;\n  },\n  FETCH_SEV_DATA(state, data) {\n    state.sevData = data;\n  },\n  FETCH_PROJECT_THREAT_SCENARIO_DATA(state, data) {\n    state.projectScenarioData = data;\n  },\n  FETCH_PROJECT_THREAT_SCENARIO_TREE(state, data) {\n    state.projectScenarioTree = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchThreatScenarioData({ commit }) {\n    axios\n      .get(\"/api/scenarios/read\", {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const threatScenarioData = [];\n          for (const data of response.data.data) {\n            threatScenarioData.push({ name: data.name });\n          }\n          commit(\"FETCH_DATA\", threatScenarioData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n  fetchThreatScenarioSevData({ commit }) {\n    axios\n      .get(\"/api/scenario/severity\", {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const donutSeries = [];\n          const highCount = [];\n          const mediumCount = [];\n          const lowCount = [];\n          for (const data of response.data.data) {\n            if (data.severity === 3) {\n              highCount.push(data.severity);\n            } else if (data.severity === 2) {\n              mediumCount.push(data.severity);\n            } else {\n              lowCount.push(data.severity);\n            }\n          }\n          donutSeries.push(highCount.length);\n          donutSeries.push(mediumCount.length);\n          donutSeries.push(lowCount.length);\n          commit(\"FETCH_SEV_DATA\", donutSeries);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n  fetchProjectThreatScenarioData({ commit }, payload) {\n    axios\n      .post(\"/api/scenarios/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const threatScenarioData = [];\n          for (const data of response.data.data) {\n            threatScenarioData.push({\n              name: data.name\n            });\n          }\n          commit(\"FETCH_PROJECT_THREAT_SCENARIO_DATA\", threatScenarioData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n  fetchThreatScenarioTreeByProject({ commit }, payload) {\n    axios\n      .post(\"/api/threat-scenario/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(res => {\n        if (res.data.success) {\n          commit(\"FETCH_PROJECT_THREAT_SCENARIO_TREE\", res.data.data);\n        }\n        commit(\"IS_FETCHING\", false);\n      })\n      .catch(error => {\n        commit(\"IS_FETCHING\", false);\n        if (error.response.status === 401) {\n        }\n      });\n  }\n};\nexport const getters = {\n  get_project_scenario_count(state) {\n    if (state.projectScenarioData) {\n      return state.projectScenarioData.length;\n    }\n  },\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getThreatScenarioCount(state) {\n    if (state.data) {\n      return state.data.length;\n    }\n  },\n  getThreatScenarioSevData(state) {\n    if (state.sevData) {\n      return state.sevData;\n    }\n  },\n  getThreatScenarioProjectTree(state) {\n    if (state.projectScenarioTree) {\n      return state.projectScenarioTree;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/threatmap.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  threatMapDataProject: []\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_THREAT_MAP_PROJECT(state, data) {\n    state.threatMapDataProject = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchThreatMapbyProject({ commit }, payload) {\n    axios\n      .post(\"/api/threatmap/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          commit(\"FETCH_THREAT_MAP_PROJECT\", response.data.data);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getThreatMapProjectData(state) {\n    if (state.threatMapDataProject) {\n      return state.threatMapDataProject;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/userStory.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  data: [],\n  userStorydata: [],\n  projecytuserStorydata: [],\n  projecytuserStoryID: [],\n  projecytuserStoryTree: [],\n  abuserStoryCount: 0\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_DATA(state, data) {\n    state.data = data;\n  },\n  FETCH_PROJECT_USER_STORY_DATA(state, data) {\n    state.projecytuserStorydata = data;\n  },\n  FETCH_PROJECT_ABUSER_STORY_COUNT(state, data) {\n    state.abuserStoryCount = data;\n  },\n  FETCH_PROJECT_USER_STORY_ID(state, data) {\n    state.projecytuserStoryID = data;\n  },\n  FETCH_PROJECT_USER_STORY_TREE(state, data) {\n    state.projecytuserStoryTree = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchUserStoryData({ commit }) {\n    axios\n      .get(\"/api/feature/read\", {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const UserStoryData = [];\n          for (const data of response.data.data) {\n            UserStoryData.push({\n              name: data.short_name\n            });\n          }\n          commit(\"FETCH_DATA\", UserStoryData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n  fetchUserStoryByProject({ commit }, payload) {\n    axios\n      .post(\"/api/feature/read\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(res => {\n        if (res.data.success) {\n          const uStoryData = [];\n          const aStoryData = [];\n          const uStoryid = [];\n          for (const u of res.data.data) {\n            uStoryData.push({\n              name: u.short_name\n            });\n            uStoryid.push(u._id.$oid);\n            for (const c in u.abuses) {\n              aStoryData.push(c.$oid);\n            }\n          }\n          commit(\"FETCH_PROJECT_ABUSER_STORY_COUNT\", aStoryData.length);\n          commit(\"FETCH_PROJECT_USER_STORY_DATA\", uStoryData);\n          commit(\"FETCH_PROJECT_USER_STORY_ID\", uStoryid);\n        }\n        commit(\"IS_FETCHING\", false);\n      })\n      .catch(error => {\n        commit(\"IS_FETCHING\", false);\n        if (error.response.status === 401) {\n        }\n      });\n  },\n  fetchUserStoryTreeByProject({ commit }, payload) {\n    axios\n      .post(\"/api/user-story/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(res => {\n        if (res.data.success) {\n          commit(\"FETCH_PROJECT_USER_STORY_TREE\", res.data.data);\n        }\n        commit(\"IS_FETCHING\", false);\n      })\n      .catch(error => {\n        commit(\"IS_FETCHING\", false);\n        if (error.response.status === 401) {\n        }\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getUserStoryCount(state) {\n    if (state.data) {\n      return state.data.length;\n    }\n  },\n  getUserStoryProjectCount(state) {\n    if (state.projecytuserStorydata) {\n      return state.projecytuserStorydata.length;\n    }\n  },\n  getUserStoryProjectdata(state) {\n    if (state.projecytuserStorydata) {\n      return state.projecytuserStorydata;\n    }\n  },\n  getAbuserStoryProjectCount(state) {\n    if (state.abuserStoryCount) {\n      return state.abuserStoryCount;\n    }\n  },\n  getUserStoryProjectID(state) {\n    if (state.projecytuserStoryID) {\n      return state.projecytuserStoryID;\n    }\n  },\n  getUserStoryProjectTree(state) {\n    if (state.projecytuserStoryTree) {\n      return state.projecytuserStoryTree;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/store/vulnerability.js",
    "content": "import axios from \"axios\";\nconst loginUrl = process.env.VUE_APP_API_URL;\n\nexport const state = () => ({\n  isLoading: false,\n  data: [],\n  sevData: [],\n  projectVuls: [],\n  projectVulSevs: [],\n  projectVulData: [],\n  asvsData: []\n});\nexport const mutations = {\n  IS_PAGE_LOADING(state, data) {\n    state.isLoading = data;\n  },\n  FETCH_DATA(state, data) {\n    state.data = data;\n  },\n  FETCH_SEV_DATA(state, data) {\n    state.sevData = data;\n  },\n  FETCH_VULS_PROJECT(state, data) {\n    state.projectVuls = data;\n  },\n  FETCH_VULS_SEV_PROJECT(state, data) {\n    state.projectVulSevs = data;\n  },\n  FETCH_ASVS_DATA(state, data) {\n    state.asvsData = [];\n    state.asvsData = data;\n  }\n};\nexport const actions = {\n  showPageLoading({ commit }, data) {\n    commit(\"IS_PAGE_LOADING\", data);\n  },\n  fetchVulnerabilitySevData({ commit }) {\n    axios\n      .get(\"/api/vulnerability/severity\", {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const pieChart = [];\n          const highCount = [];\n          const mediumCount = [];\n          const lowCount = [];\n          for (const data of response.data.data) {\n            if (data.severity === 3) {\n              highCount.push(data.severity);\n            } else if (data.severity === 2) {\n              mediumCount.push(data.severity);\n            } else {\n              lowCount.push(data.severity);\n            }\n          }\n          pieChart.push(highCount.length);\n          pieChart.push(mediumCount.length);\n          pieChart.push(lowCount.length);\n          commit(\"FETCH_SEV_DATA\", pieChart);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n\n  fetchVulnerabilitybyProject({ commit }, payload) {\n    axios\n      .post(\"/api/vulnerability/project\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const vulData = [];\n          const pieSeries = [];\n          const highPieCount = [];\n          const mediumPieCount = [];\n          const lowPieCount = [];\n          for (const vul of response.data.data.data) {\n            vulData.push({\n              name: vul.name,\n              cwe: vul.cwe,\n              severity: vul.severity,\n              description: vul.description\n            });\n            if (vul.severity === 3) {\n              highPieCount.push(vul.severity);\n            } else if (vul.severity === 2) {\n              mediumPieCount.push(vul.severity);\n            } else {\n              lowPieCount.push(vul.severity);\n            }\n          }\n          pieSeries.push(highPieCount.length);\n          pieSeries.push(mediumPieCount.length);\n          pieSeries.push(lowPieCount.length);\n          commit(\"FETCH_VULS_PROJECT\", vulData);\n          commit(\"FETCH_VULS_SEV_PROJECT\", pieSeries);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  },\n\n  fetchASVSbyProject({ commit }, payload) {\n    axios\n      .post(\"/api/asvs\", payload, {\n        headers: {\n          Authorization: localStorage.getItem(\"token\")\n        }\n      })\n      .then(response => {\n        if (response.data.success) {\n          const vulData = [];\n          for (const vul of response.data.data) {\n            vulData.push({\n              name: vul.name,\n              cwe: vul.cwe,\n              item: vul.item,\n              description: vul.description,\n              l1: vul.l1,\n              l2: vul.l2,\n              l3: vul.l3,\n              section: vul.section\n            });\n          }\n          commit(\"FETCH_ASVS_DATA\", vulData);\n          commit(\"IS_PAGE_LOADING\", false);\n        }\n        commit(\"PAGE_LOADING\", false);\n      })\n      .catch(error => {\n        if (error.response.status === 401) {\n          commit(\"PAGE_LOADING\", false);\n        }\n      });\n  }\n};\nexport const getters = {\n  isPageLoading(state) {\n    return state.isLoading;\n  },\n  getVulnerabilitySevData(state) {\n    if (state.sevData) {\n      return state.sevData;\n    }\n  },\n  getVulnerabilityProjectCount(state) {\n    if (state.projectVuls) {\n      return state.projectVuls.length;\n    }\n  },\n  getVulnerabilityProjectSev(state) {\n    if (state.projectVulSevs) {\n      return state.projectVulSevs;\n    }\n  },\n  getVulnerabilityProjectData(state) {\n    if (state.projectVuls) {\n      return state.projectVuls;\n    }\n  },\n  getASVSData(state) {\n    if (state.asvsData) {\n      return state.asvsData;\n    }\n  }\n};\n"
  },
  {
    "path": "frontend/Playbook-Frontend/test/Logo.spec.js",
    "content": "import { mount } from '@vue/test-utils'\nimport Logo from '@/components/Logo.vue'\n\ndescribe('Logo', () => {\n  test('is a Vue instance', () => {\n    const wrapper = mount(Logo)\n    expect(wrapper.isVueInstance()).toBeTruthy()\n  })\n})\n"
  },
  {
    "path": "nginx/Dockerfile",
    "content": "FROM ubuntu:16.04\n\nRUN apt-get update && apt-get install -y nginx && apt-get clean && rm -rf /var/lib/apt/lists/*\n\nRUN echo \"daemon off;\" >> /etc/nginx/nginx.conf\nRUN rm /etc/nginx/sites-enabled/default\n\nADD sites-enabled/ /etc/nginx/sites-enabled/\n\nEXPOSE 5000\nEXPOSE 80\n\nCMD [\"/usr/sbin/nginx\"]\n"
  },
  {
    "path": "nginx/alpine.df",
    "content": "FROM nginx:latest\n\nRUN echo \"daemon off;\" >> /etc/nginx/nginx.conf\nRUN rm /etc/nginx/sites-enabled/*\n\nADD sites-enabled/ /etc/nginx/sites-enabled/\n\nEXPOSE 5000\nEXPOSE 80\n\nCMD [\"/usr/sbin/nginx\"]\n"
  },
  {
    "path": "nginx/sites-enabled/tp_nginx",
    "content": "upstream frontend_server {\n    server frontend:80 fail_timeout=1000;\n}\n\nserver {\n    listen 80;\n    listen 5000;\n    server_name 127.0.0.1;\n    client_max_body_size 10G;\n\n    autoindex off;\n\n    gzip on;\n    gzip_types text/plain text/css application/javascript;\n\n    location /api {\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        fastcgi_hide_header X-Powered-By;\n        proxy_set_header Host $http_host;\n        proxy_read_timeout 1000s;\n        proxy_connect_timeout 1000s;\n        proxy_send_timeout 1000s;\n        proxy_pass http://api:5000;\n    }\n\n    location / {\n\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\n        fastcgi_hide_header X-Powered-By;\n\n        proxy_set_header Host $http_host;\n        proxy_read_timeout 1000s;\n        proxy_connect_timeout 1000s;\n        proxy_send_timeout 1000s;\n        proxy_redirect off;\n\n        if (!-f $request_filename) {\n            proxy_pass http://frontend_server;\n            break;\n        }\n    }\n}\n"
  }
]