Command-line tools
SPARTA provides two command-line tools, built on the standalone libraries (see SPARTA Standalone libraries):
sparta-cliA tool for the threat elicitation and risk analysis of a SPARTA model from the command line, with exports of the threats to CSV, XLSX, text files, a statistics report or a LaTeX report, or a submission to a server that is not part of SPARTA.
sparta-ciA tool for continuous integration pipelines, configured with a
.sparta.ymlfile, that analyzes a model and submits the threats and the model to a server that is not part of SPARTA.
Both tools use the threat elicitation and risk analysis engine of sparta-core, with the threat type catalogs that the model references.
Obtaining the tools
Each tool is a single runnable jar that contains all its dependencies (EMF, VIATRA, …):
Tool |
Maven coordinates |
Runnable jar |
Main class |
|---|---|---|---|
sparta-cli |
|
|
|
sparta-ci |
|
|
|
The jars without classifier (sparta-cli-2026.3.0.jar and sparta-ci-2026.3.0.jar) are library jars and cannot be run with java -jar (see Using sparta-cli as a library).
Download the runnable jars from the GitHub release page, or from the SPARTA Maven repository with the Maven coordinates above, for example https://maven.sparta.distrinet-research.be/be/kuleuven/cs/distrinet/sparta/sparta-cli/2026.3.0/sparta-cli-2026.3.0-shaded.jar.
Put them in a folder without spaces in its path (see Known limitations in 2026.3).
You can also build the jars from source.
Building the whole repository with mvn clean package from the repository root (see Building SPARTA from source) produces them in the target folders of the standalone modules:
standalone/sparta-cli/target/sparta-cli-2026.3.0-shaded.jarstandalone/sparta-ci/target/sparta-ci-2026.3.0-shaded.jar
The tools need Java 21 or later.
Run them with java -jar, for example:
java -jar sparta-cli-2026.3.0-shaded.jar -i MyModel.sparta --outcsv threats.csv
sparta-cli
Usage
sparta-cli loads one model, runs threat elicitation and risk analysis, and passes the resulting threats to every exporter whose option you give, so a single run can produce several outputs.
-h prints the following help to standard output (the usage line always shows the name sparta-cli-2026.3.0-shaded.jar, also when you rename the jar):
Usage: java -jar sparta-cli-2026.3.0-shaded.jar [-hv] [--about] [--version]
[--aird=<file>] [--commitid=<id>] [-i=<model>] [--outcsv=<file>]
[--outreport=<dir>] [--outstatistics=<file>] [--outtxt=<dir>]
[--outxlsx=<file>] [--server=<url>] [--token=<token>]
Automated SPARTA threat analysis of EMF models from the command line.
-i, --input=<model> Model to analyze
-v, --verbose Provide verbose output (debug logging)
--outcsv=<file> CSV export file
--outxlsx=<file> XLSX export file
--outtxt=<dir> TXT export directory (one file per threat)
--outstatistics=<file>
Output txt file with threat statistics
--outreport=<dir> LaTeX report output directory
--aird=<file> Sirius .aird file whose diagram layout is reused in
the report (optional; auto-detected next to the
model when omitted)
--server=<url> Server submission url (requires --token and
--commitid)
--token=<token> Server submission token
--commitid=<id> Server submission commit id
--about About SPARTA
-h, --help Show this help message and exit
--version Print the version and exit
Exit codes:
0 analysis and all requested exports succeeded
1 the analysis, an export or the server submission failed
2 usage or input error (unknown option, missing input model, ...)
A run proceeds as follows:
The arguments are parsed. An unknown option, an option without its argument or an option given more than once prints an error to standard error, followed by the usage or by a list of similar options (
Possible solutions: ...), and ends the run with exit status 2.-hand--versionprint the help or the version to standard output and end the run with exit status 0, also when you give other options:-h -i MyModel.spartaprints the help and does not analyze the model.--aboutprints a short description of the tool to standard output.If you give one or two of
--server,--tokenand--commitid, but not all three, the run ends withsparta-cli: server submission requires --server, --token and --commitid together.and exit status 2.Without
-i, the run ends: with exit status 0 after--about, and otherwise with the usage on standard error and exit status 2. If the-ifile does not exist or is not a file, the run ends withsparta-cli: input model '<path>' does not exist or is not a file.and exit status 2.The model is loaded and analyzed, and the exporters run in this order: CSV, XLSX, text files, statistics, LaTeX report, server submission. An exporter that fails logs an error, and the next exporters still run; at the end, the run logs
One or more exports failed.and exits with status 1.
Changed in version 2026.3: The command line is parsed with picocli instead of Apache Commons CLI: usage and input errors end the run with exit status 2, a run without -i is an error, and the option --codequalityreport was removed.
What this means for scripts written for 2026.2 is described in Upgrading from 2026.2.
Options
No option is required and no option has a default value.
Give an option’s argument as the next argument or after =, for example --outcsv threats.csv or --outcsv=threats.csv, and give each option at most once.
Only -h, -i and -v have a short form; use the long form of all other options.
Short |
Long |
Argument |
Description |
|---|---|---|---|
|
|
file |
Model to analyze: a |
|
file |
Write the threats to a CSV file. |
|
|
file |
Write the threats to an Excel (XLSX) file. |
|
|
directory |
Write one text file per threat into this directory. |
|
|
file |
Write a plain-text statistics report. |
|
|
directory |
Write a LaTeX report into this directory. |
|
|
file |
Sirius representations file ( |
|
|
URL |
Submit the threats to this |
|
|
token |
Value of the |
|
|
commit id |
Value of the |
|
|
|
Print the help to standard output, without analyzing a model. |
|
|
Print the version to standard output, for example |
||
|
Print a short description of the tool to standard output. |
||
|
|
Log at level |
Input model
The
-ipath is resolved against the working directory, unless it is absolute.Files with the extensions
.sparta,.securitydfd(the legacy name) and.spartamodelare loaded as SPARTA models. A file with another extension is read as a generic XMI file, which works if it contains a SPARTA model. A file that cannot be loaded as a model ends the run with a stack trace and exit status 1.After loading the model,
sparta-cliloads every resource the model references, such as the threat type catalogs and solution catalogs that are linked to it (see Pairing existing threat type catalogs). Relative references are resolved against the location of the model file, so the catalog files must be at the same relative location as in your workspace. Catalog files that the model does not reference are not loaded, and there is no option to add catalogs or pattern files.If a referenced catalog cannot be loaded, for example because the file is missing or the reference is an Eclipse workspace URI (
platform:/resource/...), the run still succeeds, without a warning, but finds no threats from that catalog (no threats at all if no catalog could be loaded).Risk is calculated with a Monte Carlo simulation of 1000 samples and no fixed seed, so risk values differ slightly between runs. The order of the threats is not stable either.
Exports
After the analysis, sparta-cli passes the threats to every exporter whose option you give; you can combine several.
The first five exporters below write the threats to files; the server submission sends them to a server instead.
For the files:
Output paths are relative to the working directory, unless they are absolute.
--outtxtand--outreportcreate their directory, including missing parent directories. For--outcsv,--outxlsxand--outstatistics, missing parent directories are not created: the exporter logs an error, for exampleError writing csv: out/threats.csvwith aNoSuchFileException, and the run exits with status 1 after the other exporters.Existing files are overwritten, except two files of the LaTeX report (see LaTeX report (–outreport, –aird)).
Text files (CSV, text files, statistics and LaTeX report) are written in UTF-8.
The CSV, XLSX, text file and statistics exports fail for a threat whose risk was not calculated (see Known limitations in 2026.3).
CSV (--outcsv)
One header line followed by one line per threat.
Fields are separated by ; and every field is enclosed in double quotes; a double quote inside a value is written twice.
A value that starts with =, +, -, @, a tab or a carriage return gets a leading ', so that spreadsheet programs do not run it as a formula.
The file has the same 19 columns as the CSV export of the ThreatAnalysis view, which Analysis results and exports describes:
Type, Name, Location, Flow From, Data Flow, Flow To, Vulnerability, Risk, Risk (lower), Risk (upper), Risk (potential), Crosses Trust Boundary, Trust Boundary Depth (min), Trust Boundary Depth (max), Flow From Parent, Flow To Parent, Flow From Trust Boundaries, Flow To Trust Boundaries and Mitigating Solutions.
For legacy key-based threat types (see Writing threat type patterns), Type and Name are both the name of the threat type.
For threats of patterns without a data flow, Flow From, Data Flow, Flow To, Crosses Trust Boundary and the parent and trust boundary columns are empty, and the trust boundary depths are those of the threatened element.
Numbers have at most 4 decimals, a decimal point and no grouping separator, whatever the locale of the JVM, for example 7848.8351.
"Type";"Name";"Location";"Flow From";"Data Flow";"Flow To";"Vulnerability";"Risk";"Risk (lower)";"Risk (upper)";"Risk (potential)";"Crosses Trust Boundary";"Trust Boundary Depth (min)";"Trust Boundary Depth (max)";"Flow From Parent";"Flow To Parent";"Flow From Trust Boundaries";"Flow To Trust Boundaries";"Mitigating Solutions"
"Repudiation";"Contoso repudiates action";"Contoso";"Contoso";"Responses";"Browser";"1";"7848.8351";"139.3304";"47705.2219";"7848.8351";"true";"0";"1";"Contoso Trust Boundary";"";"Contoso Trust Boundary";"";""
Changed in version 2026.3: The columns from Crosses Trust Boundary to Mitigating Solutions were added after the 11 columns of 2026.2, numbers no longer have a grouping separator (7848.8351 instead of 7,848.8351), and values that start with a formula character get a leading '.
XLSX (--outxlsx)
One sheet with a header row and the same 19 columns as the CSV file.
Numbers are numeric cells with their full precision, and Crosses Trust Boundary is a Boolean cell.
Missing values, such as the flow columns of threats of patterns without a data flow, are empty cells.
Changed in version 2026.3: The columns from Crosses Trust Boundary to Mitigating Solutions were added, and missing values are empty cells instead of the text null.
Text files (--outtxt)
Creates the directory, including missing parent directories, and writes one file per threat, with one line for each of the first 11 CSV columns: the column name, a colon, a tab character, and the value:
Type: Denial of Service
Name: Browser disrupted
Location: Browser
Flow From: Browser
Data Flow: Commands
Flow To: Contoso
Vulnerability: 1
Risk: 1463.3779
Risk (lower): 0.5695
Risk (upper): 18240.1478
Risk (potential): 1463.3779
Numbers are formatted as in the CSV file.
For threats of patterns without a data flow, the lines Flow From, Data Flow and Flow To contain null.
The file name joins the Type (for catalog patterns, the top-level threat type group, such as Denial of Service), the threatened element name and the data flow name with _, replaces every run of other characters than ASCII letters, digits and _ with one space, and appends .txt.
For example, the threat above is written to Denial of Service_Browser_Commands.txt, and a threat without a data flow on the same element to Denial of Service_Browser_.txt.
Threats with the same Type, element and data flow get the same file name (see Known limitations in 2026.3).
Changed in version 2026.3: The file name starts with the Type instead of the raw name of the threat type, and threats without a data flow no longer make the export fail.
Statistics (--outstatistics)
Writes a plain-text report with statistics over all threats, computed with ThreatAggregationAnalysis (see Aggregated risk analyses):
the number of threats, threat types and element types;
the total risk reduction by the countermeasures;
the average number of threats per threatened element;
the risk reduction per threat type and per element type;
the number of threats per threat type and per element type, with their share of all threats.
For example:
SPARTA Threat Statistics Report
===============================
55 threats encountered (9 threat types, 3 element types)
Risk reduction: 13.33% (389262.23/449107.86)
Average threat count: 9.17
Threat Type Reduction Progress
------------------------------
<$location$> spoofed
42.82% (42323.46/74013.39)
...
Element Type Reduction Progress
-------------------------------
Process
14.47% (277608.07/324559.27)
...
Threat Type Threat Counts
-------------------------
<$location$> spoofed
10 (18.18%)
...
Element Type Threat Counts
--------------------------
Process
44 (80.00%)
...
The totals are sums of the expected risk values of the threats. The numbers in parentheses are residual risk / potential risk; the percentage is the reduction, 1 - residual / potential.
“Average threat count” is the average number of threats per threatened element.
Threat types are listed with their raw names (placeholders are not replaced), and element types by class name (
Process,DataFlow,DataStore,ExternalEntity, …).The order of the entries within a section is unspecified.
Unlike the other exports, the statistics report formats numbers with the default locale of the JVM, for example
13,33%instead of13.33%with a Belgian locale. To choose the locale, set-Duser.languageand-Duser.country, for examplejava -Duser.language=en -Duser.country=US -jar ....
LaTeX report (--outreport, --aird)
Writes the LaTeX report that the ThreatAnalysis view also exports (see Analysis results and exports) into the directory given with --outreport:
report.tex, the main document, andintroduction.tex, an introduction for you to complete. If these files already exist, they are not overwritten: the new versions are written toreport-empty.texandintroduction-empty.texinstead, so your edits are kept.description.tex, the description of the system with its data flow diagram, andthreatcatalog.tex, the threats; both are overwritten on every export.SPARTA.png,tufte-book-local.tex,tikz/dfdstyle.tex,tikz/flow_template.texandtikz/styles.tex.
sparta-cli only writes the LaTeX sources: compile report.tex yourself, as described in Analysis results and exports.
The report also contains threats without a data flow, and threats whose risk was not calculated, with -- as their risk.
description.tex draws the data flow diagram of the model in TikZ.
sparta-cli takes the positions of the elements from a Sirius representations file (.aird), which it reads without Eclipse or Sirius:
With
--aird <file>, it uses that file. If the file does not exist, it logs the warning--aird file <path> does not exist; generating the report without the diagram.Without
--aird, it uses an.airdfile in the directory of the model, and logsUsing diagram layout from <path>. If that directory contains several.airdfiles, which one it uses is not defined, so pass--airdin that case.If it finds no
.airdfile, or the--airdfile does not exist, it logsNo .aird found; report will be generated without the data flow diagram. Despite this message, the report then still contains the data flow diagram, with an automatic layout of the elements.
If writing the report fails, the exporter logs Report export failed: <message>, and the run exits with status 1.
Server submission (--server, --token, --commitid)
Note
The server is not part of SPARTA: to use the submission, you need a server of your own that accepts the request described below.
Sends the threats as JSON to a server, together with a token and a commit id.
--server gives the URL of the server, --token the token and --commitid the commit id.
Give all three options, or none of them: with only one or two, the run ends before the analysis with sparta-cli: server submission requires --server, --token and --commitid together. and exit status 2.
The URL must use https, so that the token is not sent in the clear: any other protocol is refused with the error Refusing to submit to SPARTA server over insecure protocol '<protocol>'; ....
sparta-cli sends POST <url> with the headers Content-Type: application/json; utf-8, token: <token> and commitId: <commit id>, and a body in UTF-8.
The connection times out after 30 seconds, and reading the response after 60 seconds.
The body is a JSON array with one object per threat, with these properties:
threatTypeName, threatName, description, vulnerability, risk, potentialRisk, threatenedElementName, threatenedElementTypeName, threatenedElementId, dataFlowName, dataFlowFromName and dataFlowToName.
The columns from Crosses Trust Boundary to Mitigating Solutions of the CSV file are not part of it.
For example, one object of the array:
{"dataFlowName":"Write","dataFlowToName":"Database","dataFlowFromName":"Contoso","risk":7803.1698230017455,
"description":"Contoso claims not to have written to Database.","vulnerability":1.0,"threatName":"Contoso repudiates action",
"threatTypeName":"Repudiation","potentialRisk":7803.1698230017455,"threatenedElementTypeName":"Process",
"threatenedElementId":"_S4cWwMk6EeeheeqXVGLgxA","threatenedElementName":"Contoso"}
threatenedElementId is the ID of the threatened element in the model file (its xmi:id), so it is the same in every run.
If the server answers with an HTTP status below 400, sparta-cli logs the response body and SPARTA Server submission successful (HTTP <status>).
An HTTP status of 400 or higher is logged as SPARTA Server submission failed (HTTP <status>): <response body>, and connection errors and timeouts are logged as errors as well.
In all these error cases, and for a URL that is not https, the submission counts as a failed export, so the run exits with status 1.
Logging
sparta-cli logs to standard error at level INFO, in the form [main] INFO <logger> - <message>.
Standard output only carries the help, the version and the --about text.
-v (--verbose) sets the log level to debug: the log then shows the working directory, the name of the loaded model and one Threat: ... line per threat.
Give -v as a separate argument: in a group of short options, such as -vi MyModel.sparta, it does not change the log level.
You can also set the log level with a system property, which takes precedence over -v.
At level trace, the log also lists the threat types and threat specifications that were loaded:
java -Dorg.slf4j.simpleLogger.defaultLogLevel=trace -jar sparta-cli-2026.3.0-shaded.jar -i MyModel.sparta
Write errors of the CSV, XLSX, text file and statistics exporters are logged with their stack trace.
Exit status
sparta-cli exits with status 0 when the run succeeds, with status 1 when the analysis, an export or the server submission fails, and with status 2 for a usage or input error.
- Exit status 0
The run succeeded.
-hor--versionwas given, also together with other options, or--aboutwithout-i.The referenced catalogs were not found, so the run found no threats.
- Exit status 1
An exporter failed, for example because of a missing output directory, a server URL that is not
https, an HTTP error or a timeout; the log showsOne or more exports failed.The model cannot be loaded (uncaught exception).
--outcsv,--outxlsx,--outtxtor--outstatisticsgot a threat whose risk was not calculated, or the path of the jar contains a space (uncaught exception, see Known limitations in 2026.3).
- Exit status 2
No arguments, or no
-i(except with--about).An unknown option (including
--codequalityreportand the removed short options such as-oc), an option without its argument, or an option given more than once.The
-ifile does not exist or is not a file.Only one or two of
--server,--tokenand--commitid.
There is no option to fail on a risk threshold.
Examples
Analyze Contoso.sparta in the working directory and write a CSV file, an XLSX file, text files, a statistics report and a LaTeX report:
java -jar sparta-cli-2026.3.0-shaded.jar -i Contoso.sparta --outcsv threats.csv --outxlsx threats.xlsx --outtxt txt --outstatistics stats.txt --outreport report
The same with --input, writing into an existing directory out, with the diagram layout of representations.aird:
java -jar sparta-cli-2026.3.0-shaded.jar --input Contoso.sparta --outcsv out/threats.csv --outtxt out/threats --outstatistics out/statistics.txt --outreport out/report --aird representations.aird
Submit the threats to a server:
java -jar sparta-cli-2026.3.0-shaded.jar -i Contoso.sparta --server https://server.example.org/api/submit --token <token> --commitid <commit id>
The first example logs the following, when there is no .aird file next to the model:
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.runtime.StandaloneRuntime - LS: false
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.runtime.StandaloneRuntime - Rete: true
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.runtime.StandaloneRuntime - Running SPARTA Analysis ...
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportCSV - Exporting to csv
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportXLSX - Exporting to xlsx files
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportTXT - Exporting to txt files
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportStatistics - Exporting threat statistics
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportReport - Exporting LaTeX report
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportReport - No .aird found; report will be generated without the data flow diagram
[main] INFO be.kuleuven.cs.distrinet.sparta.cli.cmd.export.ExportReport - Exported LaTeX report to report
sparta-ci
Note
The server that sparta-ci submits to is not part of SPARTA: you need a server of your own that accepts the request described below and in Server submission (–server, –token, –commitid).
sparta-ci analyzes the model configured in .sparta.yml and submits the threats, together with the model, to a server.
It writes no output files, except the converted model of a .txt model (see Text models (.txt)), and ignores all command-line arguments (including --help).
Run it in the directory that contains .sparta.yml:
java -jar sparta-ci-2026.3.0-shaded.jar
A run proceeds as follows:
sparta-cireads.sparta.ymlfrom the working directory.It looks for a git repository, starting from the directory of
.sparta.ymland searching upward (theGIT_DIRenvironment variable is honored). If it finds one, the commit id ofHEADbecomes the commit id of the submission; a detachedHEAD, as in many CI checkouts, works as well.It checks that the configuration contains the required keys (see Configuration file), and logs the model and the server URL.
It analyzes the model exactly like
sparta-cli, so the same Input model rules apply. A.txtmodel is converted first.It builds a self-contained copy of the model: the catalogs and other SPARTA resources that the model references are copied into the model, and the legacy key-based
patternsandtypesmaps of threat types and threat specifications are cleared. The VQL patterns of the catalogs are kept. This copy is serialized as XMI (UTF-8).It submits the results in the same way as
sparta-cli(see Server submission (–server, –token, –commitid)):POST <server.url>overhttps, with the headersContent-Type: application/json; utf-8,token: <server.token>andcommitId: <commit id>, a UTF-8 body, and the same timeouts and messages.
When a run fails, sparta-ci ends with a single line on standard error that starts with sparta-ci:, after the log messages, and an exit status for the kind of failure (see Exit status).
Because the URL is only checked when the results are submitted, a server.url that is not https is reported after the whole analysis.
Changed in version 2026.3: server.token is required, the configuration is checked before the analysis, and each kind of failure has its own exit status and sparta-ci: message; .txt models work.
Configuration file
.sparta.yml has the following keys.
Unknown keys are ignored.
Key |
Required |
Meaning |
|---|---|---|
|
yes |
Path of the model, relative to the working directory or absolute ( |
|
yes |
|
|
yes |
Value of the |
|
no |
Commit id to send when no git repository is found. Inside a git repository, the |
|
no |
An integer. Read but not used in 2026.3. |
For example:
version: 1
input:
model: Contoso.sparta
server:
url: https://server.example.org/api/submit
token: <submission token>
overrideCommit: deadbeef # only used outside a git repository
sparta-ci checks the required keys in the order input.model, server.url, server.token, and reports the first one that is missing or empty, for example sparta-ci: invalid .sparta.yml: missing required 'server.token'.
An empty file, a file with only comments, or a file that is not valid YAML is reported as sparta-ci: could not read .sparta.yml: ..., followed by the reason.
Warning
Because the token is read literally from the file, do not commit a real token to your repository.
Text models (.txt)
If input.model ends with .txt, sparta-ci reads it as a simple YAML description of a data flow diagram, converts it into the model dfd.sparta in the working directory (an existing file is overwritten), and analyzes that model:
processes: [Web Server, Auth Service]
dataStores: [User DB]
externalEntities: [Browser]
dataFlows:
- "Browser->Web Server"
- "Web Server->User DB"
Each entry of
dataFlowscontains exactly one->, between the names of two elements of the same file.The converter turns each entry into a pair of data flows, one in each direction, and names each data flow after its sender and recipient. In the example, the entry
"Browser->Web Server"gives a data flowBrowser->Web ServerfromBrowsertoWeb Serverand a data flowWeb Server->Browserback, so the converted model has four data flows.The working directory must contain a file
ThreatSpecification.spartawith a legacy threat specification catalog (ThreatSpecificationCatalog, see Legacy key-based threat types), which the converted model references. A threat type catalog in that file is not used.A missing
ThreatSpecification.sparta, or a data flow entry with an unknown element, makes the analysis fail (exit status 3).
Payload
The request body is a JSON object with two properties:
threatListThe threats, with the same properties as the
sparta-cliserver submission (see Server submission (–server, –token, –commitid)).modelThe self-contained model as an XMI string.
{"threatList":[{"dataFlowName":"Write", ... }, ...],"model":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<spartamodel:DFDModel ...>"}
Exit status
sparta-ci exits with status 0 only when the server accepted the submission, so a failed run fails a pipeline job.
The other exit statuses tell the kinds of failure apart:
- Exit status 0
The server answered with an HTTP status below 400. The log shows
SPARTA Server submission successful (HTTP <status>).- Exit status 1
There is no
.sparta.ymlin the working directory. Standard error showssparta-ci: no .sparta.yml configuration found in <directory>.- Exit status 2
.sparta.ymlis empty or not valid YAML, orinput.model,server.urlorserver.tokenis missing or empty. Standard error showssparta-ci: could not read .sparta.yml: ...orsparta-ci: invalid .sparta.yml: missing required '<key>'.- Exit status 3
The model was not found or cannot be loaded, the model file contains no DFD model, the conversion of a
.txtmodel failed, or the analysis failed, for example because the path of the jar contains a space (see Known limitations in 2026.3). Standard error showssparta-ci: analysis failed: <reason>orsparta-ci: analysis failed; see the log for details.- Exit status 4
The submission failed:
server.urlis nothttps, the server is unreachable, the request timed out, or the server answered with an HTTP status of 400 or higher. Standard error showssparta-ci: submission to <url> failed.
Using the tools in a CI pipeline
The SPARTA 2026.3 repository contains no ready-made pipeline configuration for analyzing threat models.
You can run the tools in any CI system that can run Java.
For example, the following GitLab CI job runs sparta-cli on a model.
It assumes that the shaded jar and the model, with its catalogs at the referenced relative paths, are available in the job’s working directory:
threat-model:
image: eclipse-temurin:21-jre
script:
- java -jar sparta-cli-2026.3.0-shaded.jar -i model/MySystem.sparta --outcsv threats.csv --outstatistics threat-statistics.txt --outreport report
artifacts:
paths: [threats.csv, threat-statistics.txt, report/]
sparta-cli exits with a non-zero status when an option is wrong or an export fails, so the job fails without extra checks.
It does not fail when the analysis finds no threats (for example when catalogs are missing): the CSV then contains only the header line.
To use sparta-ci instead, commit a .sparta.yml in the directory the job runs from and run java -jar sparta-ci-2026.3.0-shaded.jar.
The commit id is then taken from the checked-out commit, and the exit status tells the kind of failure (see Exit status).
Keep in mind that sparta-ci requires the token in the file; with sparta-cli, you can pass the token on the command line (--token) from a protected CI variable, but sparta-cli does not send the model.
Troubleshooting
Unknown option: '-oc'(or another option of two or three letters)The script still uses a short option of 2026.1 or earlier. Use the long form instead, for example
--outcsvinstead of-oc(see Options).Unknown options: '--codequalityreport', ...The script still uses the code-quality report, which was removed in 2026.3; remove the option (see Upgrading from 2026.2).
- No threats found
The catalogs referenced by the model were not found. Check that the catalog files exist at the relative paths stored in the model, and that the model does not reference them with
platform:/resource/...URIs. See Input model.- Risk values differ between runs
The risk calculation uses Monte Carlo sampling without a fixed seed. Small differences between runs on the same model are expected; the order of the threats can also differ.
- Unexpected number format in the statistics report
The statistics report uses the default locale of the JVM. Set
-Duser.languageand-Duser.countryto choose a locale.
Known limitations in 2026.3
- Exports fail for threats whose risk was not calculated
SPARTA does not calculate the risk of a threat without a threatened element, for example from a catalog pattern without a
locationparameter (see Writing threat type patterns). For such a threat,--outcsv,--outxlsx,--outtxtand--outstatisticsfail with an exception, such asIllegalStateException: risk not yet calculated for this threat: ..., and the run ends with exit status 1; the exporters that come after the failing one do not run. The server submission fails as well. Only the LaTeX report (--outreport) handles these threats.- Text files overwrite each other
--outtxtgives threats with the sameType, threatened element and data flow the same file name, so only the last one is kept, without a message. For catalog patterns, theTypeis the top-level threat type group, so this happens when two threat types of the same group match the same element and data flow. Use--outcsvor--outxlsxif you need every threat.ProvisionExceptionwhen the analysis startsWhen the path of the jar contains a space, for example
C:\Users\Jane Doe\tools\sparta-cli-2026.3.0-shaded.jar, both tools abort afterRunning SPARTA Analysis ....sparta-cliends with acom.google.inject.ProvisionExceptionand exit status 1; the cause is aNoSuchFileExceptionfor the jar itself, with the space written as%20.sparta-ciends withsparta-ci: analysis failed: Unable to provision, see the following errors:and exit status 3. Put the jar in a folder without spaces in its path.