diff --git a/createreadmes.py b/createreadmes.py index 05fcf55..8baf2b1 100644 --- a/createreadmes.py +++ b/createreadmes.py @@ -375,16 +375,14 @@ def write_model_readmes(dataset: Dataset): model_file = model_path / f"{model_id}.py" with model_file.open("r") as f: model = f.read() + security_rules = None try: with security_rules_file.open('r') as f: - security_rules = yaml.safe_load(f) - security_rules = check_security_rules(security_rules) + security_rules = check_security_rules(yaml.safe_load(f)) except FileNotFoundError: warning("Security rules file not found at {}".format(security_rules_file)) - security_rules = {} except Exception as e: warning("Security rules file at {} is invalid: {}".format(security_rules_file, e)) - security_rules = {} print(f"Writing readme file {readme}") dir.mkdir(exist_ok=True) with readme.open('w', encoding="utf-8") as f: @@ -440,56 +438,52 @@ Formats: ![Data Flow Diagram](../../dataset/{model_id}/{model_id}/{model_id}.svg) -{write_security_rules(info, security_rules)} +{"" if security_rules is None else write_security_rules(info, security_rules)} """) def write_root_readme(dataset: Dataset): + overview_dir = output_path / 'overview' + index_file = Path('index.md') + print(f"Writing main readme file") - with open('index.md', 'w', encoding="utf-8") as f: + with index_file.open('w', encoding="utf-8") as f: f.write(f"""--- title: code2DFD Documentation keywords: code2DFD introduction -tags: [] +tags: [overview] sidebar: datasetdoc_sidebar permalink: index.html summary: Dataset of dataflow diagrams of microservice applications. +toc: false --- -# code2DFD +# DaFD {{% include image.html file="TUHH_logo-wortmarke_en_rgb.svg" alt="TUHH Logo" max-width="350" %}} - -This project is developed by the Institute of Software Security at Hamburg University of Technology. - {{% include image.html file="company_logo_big.png" alt="SoftSec Institute Logo" max-width="350" %}} -This is a description. Duis proident aliqua laborum reprehenderit duis nostrud sint duis anim Lorem anim ut. +This is DaFD, a dataset containing Dataflow Diagrams (DFDs) of microservices written in Java. The models correspond to actual implementation code of open-source applications found on GitHub. +The DFDs are presented in multiple formats and contain full traceability of all model items to code, indicating the evidence for their implementation. Additionally to the models themselves, we present a mapping to a list of 17 architectural security best-practices, i.e. a table indicating whether each rules is followed or not. For those that are not followed, we created model variants that do follow the rule. These variants were crafted purely on the model-level and the added items do not correspond to code anymore. All artifacts were created manually by researchers of the Institute of Software Security at Hamburg University of Technology. -## DFD Items - -Do culpa deserunt est excepteur amet. Non pariatur ea elit ad eiusmod veniam exercitation nulla. Commodo do adipisicing amet et. Voluptate laboris commodo dolor eu mollit ipsum. Amet reprehenderit velit eu culpa amet exercitation. Elit esse ullamco duis mollit quis. Eiusmod qui reprehenderit sunt cupidatat Lorem anim occaecat enim sint eiusmod tempor. - -## Use-Cases - -Veniam culpa nostrud id laborum deserunt consectetur consectetur voluptate. Sint aute cupidatat velit irure elit laboris anim labore esse labore. Quis ullamco ut consequat amet. Enim sit laboris deserunt veniam duis aliqua irure proident. +{{% include toc.html %}} """) + + models_file = overview_dir / 'models.md' print(f"Writing models readme file") - with open('dataset.md', 'w', encoding="utf-8") as f: + with models_file.open('w', encoding="utf-8") as f: f.write(f"""--- -title: code2DFD Dataset +title: Models keywords: dataset models -tags: [] +tags: [overview] sidebar: datasetdoc_sidebar -permalink: dataset.html +permalink: models.html summary: Dataset of dataflow diagrams of microservice applications. datatable: true --- -# Dataset of Dataflow Diagrams +The following table presents the models in this dataset. It shows some properties about their popularity and size of the models. Column `Source` links directly to the corresponding repository on GitHub. If you click on the name of an entry, you will be referred to the model and all artifacts. -This repository contains of {len(dataset)} manually created dataflow diagrams (DFDs) of microservice applications found on GitHub. The dataset is published as an additional contribution to "Automatic Extraction of Security-Rich Dataflow Diagrams for Microservice Applications written in Java" [Simon Schneider, Riccardo Scandariato]. Each folder in the [`dataset`](dataset/) directory contains one DFD in a [CodeableModels](https://github.com/uzdun/CodeableModels)-format that can be executed to generate PNG, SVG and TXT files for the DFD. Each model refers to stereotypes and metaclasses from the [metamodel](microservice_dfds_metamodel.py) which needs to be imported. This repository already contains rendered versions for each model, thus setup and rendering is only necessary once changes to the models are made. - -## Models +Please select a model in column `Name`