https://github.com/secure-software-engineering/swan
Security methods for WeAkNess detection
https://github.com/secure-software-engineering/swan
Last synced: 8 months ago
JSON representation
Security methods for WeAkNess detection
- Host: GitHub
- URL: https://github.com/secure-software-engineering/swan
- Owner: secure-software-engineering
- License: bsd-3-clause
- Created: 2019-01-29T16:43:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-02-27T14:43:50.000Z (12 months ago)
- Last Synced: 2025-04-11T08:51:44.577Z (10 months ago)
- Language: Java
- Size: 188 MB
- Stars: 20
- Watchers: 7
- Forks: 7
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SWAN (Security methods for WeAkNess detection)
SWAN is a machine-learning approach that detects security-relevant methods (SRM) in Java programs.
SWAN should be used in combination with other static analyses tools and it helps the users to create a set of relevant methods required as an input for static analyses, e.g. taint- and type-state analysis.
The tool currently detects four types of security relevant methods, namely: source, sink, sanitizer, and authentication methods.
SWAN also labels methods as relevant for 7 [Common Weakness Enumeration (CWE)](https://cwe.mitre.org/), namely: [CWE78 OS Command Injection](https://cwe.mitre.org/data/definitions/78.html), [CWE79 Cross-site Scripting](https://cwe.mitre.org/data/definitions/79.html), [CWE89 SQL Injection](https://cwe.mitre.org/data/definitions/89.html), [CWE306 Missing Authentication](https://cwe.mitre.org/data/definitions/306.html), [CWE601 Open Redirect](https://cwe.mitre.org/data/definitions/601.html), [CWE862 Missing Authorisation](https://cwe.mitre.org/data/definitions/862.html), and
[CWE863 Incorrect Authorisation](https://cwe.mitre.org/data/definitions/863.html).
The project is divided into two main components: the command line tool [**swan-cmd**](https://github.com/secure-software-engineering/swan/tree/master/swan-cmd) and the IntelliJ plugin [**dev-assist**](https://github.com/secure-software-engineering/swan/tree/master/dev-assist) that provides a GUI for SWAN.
1. **swan-cmd** is the command line implementation for SWAN with components for data collection, feature engineering, model selection and SRM prediction. The command line tool uses the following Maven modules:
- **training-data-jars** contains dependencies from which the training examples are extracted.
- Java Doclets to process and export software documentation
- **coverage-doclet** calculates the software documentation coverage of Java programs based on the presence of doc comments for classes, methods, and other objects.
- **xml-doclet** exports doc comments to XML files so that they can be analyzed by the Natural Language Processing (NLP) module
2. **dev-assist** provides GUI support for SWAN and enables active machine learning.
How do I get started with SWAN?
-------------
To run SWAN, you will need to provide a path to the Java project to be analyzed (JAR files or compiled classes) as well an output directory where SWAN will export its results. The easiest way to get started with SWAN is to use the pre-built binary from the newest release. After downloading the necessary files from the most recent release, SWAN can be executed on the command line with the following command:
**java -jar swan-cmd-3.x.x.jar -test** */path/to/project/files* **-o** */output/directory*
This command runs the application and exports the detected security-relevant methods to a JSON file in the provided output directory. This command uses the following default settings: training dataset -in [dataset](/swan-cmd/src/main/resources/dataset), code features -f code, and the MEKA toolkit -t meka. The remaining default options are found in [CLIRunner](/swan-cmd/src/main/java/de/fraunhofer/iem/swan/cli/CliRunner.java). The available command line options can be found in the Wiki or by using the -help command line option.
How do I build SWAN?
-------------
If you cloned the project or downloaded SWAN as a compressed release (e.g. .zip or .tar.gz), you can use mvn package to package the project. The commands provided above can then be used to run the generated JAR file. Alternatively, you can import the project directly into your IDE from the repository and package the project via the terminal or the Maven plugin in your IDE.
Contributors
-------------
The following persons have contributed to SWAN: Goran Piskachev (gpiskach@amazon.de), Lisa Nguyen (lisa.nguyen@uni-paderborn.de), Oshando Johnson (oshando.johnson@iem.fraunhofer.de), Eric Bodden (eric.bodden@uni-paderborn.de).