├── .java-version ├── src ├── main │ ├── resources │ │ ├── version │ │ ├── report-templates │ │ │ ├── html │ │ │ │ ├── threat-model-report-entry-separator │ │ │ │ ├── threat-model-report-footer │ │ │ │ └── threat-model-report-entry │ │ │ └── json │ │ │ │ ├── threat-model-report-entry-separator │ │ │ │ ├── threat-model-report-footer │ │ │ │ ├── threat-model-report-header │ │ │ │ └── threat-model-report-entry │ │ └── help-info │ └── java │ │ └── com │ │ └── github │ │ └── rusakovichma │ │ └── tictaac │ │ ├── provider │ │ ├── reader │ │ │ ├── MitigationsFilter.java │ │ │ ├── ThreatModelFilter.java │ │ │ ├── Reader.java │ │ │ ├── ExternalReader.java │ │ │ ├── ClassPathReader.java │ │ │ └── UnifiedReader.java │ │ ├── model │ │ │ ├── ThreatModelProvider.java │ │ │ └── StandardThreatModelProvider.java │ │ ├── rules │ │ │ ├── ThreatRulesProvider.java │ │ │ └── StandardThreatRulesProvider.java │ │ └── mitigation │ │ │ ├── MitigationLibraryProvider.java │ │ │ ├── Mitigator.java │ │ │ ├── DullMitigator.java │ │ │ └── StandardMitigationProvider.java │ │ ├── correction │ │ ├── Guesser.java │ │ ├── Corrector.java │ │ ├── ElementNameCorrector.java │ │ ├── ProcessGuesser.java │ │ ├── DatabaseGuesser.java │ │ ├── ProxyServerGuesser.java │ │ ├── ExternalServiceGuesser.java │ │ ├── WebserverGuesser.java │ │ ├── InternalServiceGuesser.java │ │ ├── InteractorGuesser.java │ │ ├── DataFlowTitleCorrector.java │ │ ├── ElementGuesser.java │ │ └── UniversalElementGuesser.java │ │ ├── engine │ │ ├── el │ │ │ ├── parser │ │ │ │ ├── ParseException.java │ │ │ │ ├── ExternalContext.java │ │ │ │ ├── ExpressionPreProcessor.java │ │ │ │ ├── ExpressionParser.java │ │ │ │ ├── EvaluationTemplate.java │ │ │ │ ├── DefaultEvaluationTemplate.java │ │ │ │ ├── SimpleExternalContext.java │ │ │ │ ├── ExpressionSegregator.java │ │ │ │ ├── ExpressionEntitySeparator.java │ │ │ │ └── StringHashReplacer.java │ │ │ ├── expression │ │ │ │ ├── Expression.java │ │ │ │ ├── ValueComparable.java │ │ │ │ ├── ParametrableExpression.java │ │ │ │ ├── ContextAware.java │ │ │ │ ├── ExpressionAware.java │ │ │ │ ├── AbstractExpression.java │ │ │ │ ├── EqualsExpression.java │ │ │ │ ├── OrExpression.java │ │ │ │ ├── AndExpression.java │ │ │ │ ├── ParamComparableExpression.java │ │ │ │ ├── CompoundExpression.java │ │ │ │ ├── ParamEqualsExpression.java │ │ │ │ ├── ParamContainExpression.java │ │ │ │ └── ParamWithinExpression.java │ │ │ ├── EvaluationContext.java │ │ │ └── DefaultEvaluationContext.java │ │ ├── ThreatEngine.java │ │ └── EngineContext.java │ │ ├── mapper │ │ ├── ModelMapper.java │ │ ├── ThreatModelMapper.java │ │ ├── ThreatsLibraryMapper.java │ │ ├── MitigationsLibraryMapper.java │ │ └── ThreatRuleMapper.java │ │ ├── validation │ │ ├── Validator.java │ │ ├── Required.java │ │ ├── RequiresAtLeast.java │ │ ├── ValidationErrors.java │ │ └── ValidationException.java │ │ ├── reporter │ │ ├── chart │ │ │ ├── ChartPlotter.java │ │ │ └── XChartPlotter.java │ │ ├── dfd │ │ │ └── DataFlowRender.java │ │ ├── ReportFormat.java │ │ ├── ThreatsReporter.java │ │ ├── ReportHeader.java │ │ ├── FileStreamThreatsReporter.java │ │ └── analytics │ │ │ └── ThreatAnalytics.java │ │ ├── model │ │ ├── threatmodel │ │ │ ├── dataflow │ │ │ │ ├── Encryption.java │ │ │ │ ├── Authorization.java │ │ │ │ ├── AccountManagement.java │ │ │ │ └── AuthenticationMethod.java │ │ │ ├── asset │ │ │ │ └── AssetSensitivity.java │ │ │ ├── annotation │ │ │ │ ├── Id.java │ │ │ │ ├── Exclude.java │ │ │ │ ├── FlowSource.java │ │ │ │ ├── FlowTarget.java │ │ │ │ ├── RootCollection.java │ │ │ │ ├── Ref.java │ │ │ │ └── DefaultValue.java │ │ │ ├── element │ │ │ │ └── ElementType.java │ │ │ ├── boundary │ │ │ │ └── BoundaryCategory.java │ │ │ ├── Asset.java │ │ │ └── Boundary.java │ │ ├── ThreatSeverity.java │ │ ├── mitigation │ │ │ ├── MitigationStatus.java │ │ │ ├── ThreatRef.java │ │ │ └── MitigationsLibrary.java │ │ ├── exception │ │ │ └── QualityGateFailed.java │ │ ├── ThreatCategory.java │ │ ├── ThreatRisk.java │ │ ├── ThreatsCollection.java │ │ ├── ThreatsLibrary.java │ │ ├── risk │ │ │ └── RiskFactor.java │ │ └── OwaspCategory.java │ │ ├── parser │ │ ├── NodeParser.java │ │ └── model │ │ │ ├── NodeTree.java │ │ │ └── NodeHelper.java │ │ ├── risk │ │ └── RiskCalculationStrategy.java │ │ └── util │ │ ├── InputStreamUtil.java │ │ ├── ResourceUtil.java │ │ ├── ImageUtils.java │ │ └── ClassUtil.java └── test │ ├── resources │ ├── threat-model-minimized-validation-test.yml │ ├── mitigations-for-tests.yml │ ├── threat-model-validation-test.yml │ ├── threats-provider-test.yml │ ├── threats-provider-engine-context-test.yml │ ├── threat-model-test.yml │ ├── threat-model-engine-context-test.yml │ ├── data-flow-render-test.yml │ └── threat-model-test-with-comments.yml │ └── java │ └── com │ └── github │ └── rusakovichma │ └── tictaac │ ├── provider │ ├── reader │ │ └── ThreatModelFilterTest.java │ └── mitigation │ │ └── StandardMitigationProviderTest.java │ ├── parser │ ├── model │ │ ├── NodeHelperTest.java │ │ └── NodeTypeTest.java │ └── impl │ │ └── NodeTreeParserTest.java │ ├── util │ ├── ReflectionUtilTest.java │ ├── StringUtilsTest.java │ └── FileUtilTest.java │ ├── risk │ └── PlainMatrixRiskStrategyTest.java │ ├── correction │ └── UniversalElementGuesserTest.java │ ├── reporter │ ├── dfd │ │ └── GraphvizDataFlowRenderTest.java │ └── StreamThreatsReporterTest.java │ ├── mapper │ ├── ThreatsLibraryMapperTest.java │ └── ThreatModelMapperTest.java │ ├── validation │ └── ValidatorImplTest.java │ └── engine │ └── StandardEngineContextTest.java ├── etc ├── tic-taac-logo.png ├── tic-taac-logo-40per.png └── threat-modeling-report-example.png ├── .gitignore ├── RELEASE_NOTES.md ├── NOTICE.txt ├── SECURITY.md ├── CONTRIBUTORS ├── .github └── workflows │ ├── ci.yml │ └── tests.yml ├── expl ├── mitigations.yml ├── simpest-threat-model.yml └── intermediate-threat-model.yml ├── push-docker.sh ├── cicd └── Jenkinsfile └── Dockerfile /.java-version: -------------------------------------------------------------------------------- 1 | 11 -------------------------------------------------------------------------------- /src/main/resources/version: -------------------------------------------------------------------------------- 1 | Version: 1.3.0 -------------------------------------------------------------------------------- /src/main/resources/report-templates/html/threat-model-report-entry-separator: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/report-templates/json/threat-model-report-entry-separator: -------------------------------------------------------------------------------- 1 | , -------------------------------------------------------------------------------- /src/main/resources/report-templates/json/threat-model-report-footer: -------------------------------------------------------------------------------- 1 | ] 2 | } -------------------------------------------------------------------------------- /src/main/resources/report-templates/html/threat-model-report-footer: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /etc/tic-taac-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rusakovichma/TicTaaC/HEAD/etc/tic-taac-logo.png -------------------------------------------------------------------------------- /etc/tic-taac-logo-40per.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rusakovichma/TicTaaC/HEAD/etc/tic-taac-logo-40per.png -------------------------------------------------------------------------------- /etc/threat-modeling-report-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rusakovichma/TicTaaC/HEAD/etc/threat-modeling-report-example.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven 2 | target/ 3 | 4 | # Eclipse 5 | .classpath 6 | .project 7 | .settings 8 | 9 | .idea 10 | *.iml 11 | 12 | # Sonar 13 | .sonar -------------------------------------------------------------------------------- /src/main/resources/report-templates/json/threat-model-report-header: -------------------------------------------------------------------------------- 1 | { 2 | "threat-model-name": "%s", 3 | "version": "%s", 4 | "date": "%s", 5 | "threats":[ -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | # Release Notes 2 | 3 | ## [Version 1.2.3](https://github.com/rusakovichma/TicTaaC/releases/tag/1.2.3) (2022-07-03) 4 | 5 | **Changes** 6 | 7 | - Bug fixes. 8 | - Multiple Threat Modeling files support and files scan ([see #1](https://github.com/rusakovichma/TicTaaC/issues/1)). -------------------------------------------------------------------------------- /src/test/resources/threat-model-minimized-validation-test.yml: -------------------------------------------------------------------------------- 1 | name: Threat Model Name 2 | version: 0.0.1 3 | assets: 4 | elements: 5 | - legitimate-user 6 | type: interactor 7 | - web-server 8 | type: web-server 9 | boundaries: 10 | data-flows: 11 | - legitimate-user -> web-server -------------------------------------------------------------------------------- /src/main/resources/report-templates/html/threat-model-report-entry: -------------------------------------------------------------------------------- 1 |
{
21 |
22 | public P getParameter(String parameterName);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/engine/el/expression/ValueComparable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.engine.el.expression;
19 |
20 | public interface ValueComparable {
21 |
22 | public void setParameter(P value);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/engine/el/parser/ExpressionPreProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.engine.el.parser;
19 |
20 | public interface ExpressionPreProcessor {
21 |
22 | public String preProcess(String expression);
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/reporter/chart/ChartPlotter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.reporter.chart;
19 |
20 | public interface ChartPlotter {
21 |
22 | public void addSeries(String name, int value);
23 |
24 | public byte[] getImageBytes();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/com/github/rusakovichma/tictaac/provider/mitigation/StandardMitigationProviderTest.java:
--------------------------------------------------------------------------------
1 | package com.github.rusakovichma.tictaac.provider.mitigation;
2 |
3 | import com.github.rusakovichma.tictaac.model.mitigation.MitigationsLibrary;
4 | import org.junit.jupiter.api.Test;
5 |
6 | import static org.junit.jupiter.api.Assertions.*;
7 |
8 | class StandardMitigationProviderTest {
9 |
10 | @Test
11 | void getMitigations() {
12 | String path = "src/test/resources/mitigations-for-tests.yml";
13 |
14 | StandardMitigationProvider provider = new StandardMitigationProvider(path);
15 | MitigationsLibrary library = provider.getMitigations();
16 | assertTrue(library != null);
17 |
18 | assertTrue(library.getMitigated().size() == 3);
19 | assertTrue(library.getAvoided().size() == 2);
20 |
21 | assertTrue(library.getMitigated().get(0).getComment().equals("already mitigated"));
22 |
23 | assertTrue(library.getNotApplicable().size() == 1);
24 | }
25 | }
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/provider/reader/Reader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.provider.reader;
19 |
20 | import com.github.rusakovichma.tictaac.parser.model.NodeTree;
21 |
22 | public interface Reader {
23 |
24 | public NodeTree read(String path);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/com/github/rusakovichma/tictaac/parser/model/NodeTypeTest.java:
--------------------------------------------------------------------------------
1 | package com.github.rusakovichma.tictaac.parser.model;
2 |
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static org.junit.jupiter.api.Assertions.*;
6 |
7 | class NodeTypeTest {
8 |
9 | @Test
10 | void getTypeTest() {
11 | assertTrue(NodeType.getType("\t- personal-data") == NodeType.element);
12 | assertTrue(NodeType.getType("\t-personal-data") == NodeType.element);
13 |
14 | assertTrue(NodeType.getType("\t- proxy-server -> web-server") == NodeType.flow);
15 | assertTrue(NodeType.getType("\t-proxy-server->web-server") == NodeType.flow);
16 |
17 | assertTrue(NodeType.getType("\t\taccount-management: external-sso") == NodeType.property);
18 | assertTrue(NodeType.getType("\t\taccount-management:external-sso") == NodeType.property);
19 |
20 | assertTrue(NodeType.getType(" dfgsd s dfgs dfgs") == NodeType.unknown);
21 | assertTrue(NodeType.getType(null) == NodeType.unknown);
22 | }
23 | }
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/engine/el/expression/ContextAware.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.engine.el.expression;
19 |
20 | public interface ContextAware {
21 |
22 | public void setContextParam(Object contextObject);
23 |
24 | public String getContextParamName();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/provider/model/ThreatModelProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.provider.model;
19 |
20 | import com.github.rusakovichma.tictaac.model.ThreatModel;
21 |
22 | public interface ThreatModelProvider {
23 |
24 | public ThreatModel getModel();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/expl/simpest-threat-model.yml:
--------------------------------------------------------------------------------
1 | name: Simplest Data Flow for Threat Modeling
2 | version: 1.0.0
3 | assets: #We know nothing about application's data
4 | elements: #Here we describe the main elements of the data flow
5 | - user-browser #Application's User
6 | - application-web-server #Web application's server
7 | - database #Application's Database
8 | boundaries: #Here we define the data flow diagram boundaries and the context
9 | - internet #Users connect to the application from the Internet
10 | elements:
11 | - user-browser # Reference to the user element
12 | - amazon-vpc #Our application in Amazon VPC, for example
13 | elements: #Application's components references. In VPC we have...
14 | - application-web-server #Web-server element ...
15 | - database # ... and the database
16 | data-flows: #Section for the flows between the elements
17 | - user-browser -> application-web-server #User's Browser connects to the application flow
18 | - application-web-server -> database #The application connects to the database to fetch data
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/engine/el/expression/ExpressionAware.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.engine.el.expression;
19 |
20 | public interface ExpressionAware {
21 |
22 | public void setExprOne(Expression exprOne);
23 |
24 | public void setExprAnother(Expression exprAnother);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/provider/rules/ThreatRulesProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.provider.rules;
19 |
20 | import com.github.rusakovichma.tictaac.model.ThreatsLibrary;
21 |
22 | public interface ThreatRulesProvider {
23 |
24 | public ThreatsLibrary getThreatsLibrary();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/com/github/rusakovichma/tictaac/risk/PlainMatrixRiskStrategyTest.java:
--------------------------------------------------------------------------------
1 | package com.github.rusakovichma.tictaac.risk;
2 |
3 | import com.github.rusakovichma.tictaac.model.ThreatRisk;
4 | import com.github.rusakovichma.tictaac.model.ThreatSeverity;
5 | import com.github.rusakovichma.tictaac.model.threatmodel.boundary.BoundaryCategory;
6 | import org.junit.jupiter.api.Test;
7 |
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 | class PlainMatrixRiskStrategyTest {
11 |
12 | @Test
13 | void calc() {
14 | PlainMatrixRiskStrategy strategy = new PlainMatrixRiskStrategy();
15 |
16 | ThreatRisk risk = strategy.calc(ThreatSeverity.Medium, BoundaryCategory.corporateNetwork);
17 | assertTrue(risk == ThreatRisk.Medium);
18 |
19 | risk = strategy.calc(ThreatSeverity.Low, BoundaryCategory.globalNetwork);
20 | assertTrue(risk == ThreatRisk.Medium);
21 |
22 | risk = strategy.calc(ThreatSeverity.Low, BoundaryCategory.undefined);
23 | assertTrue(risk == ThreatRisk.Undefined);
24 | }
25 | }
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/engine/el/parser/ExpressionParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.engine.el.parser;
19 |
20 | import com.github.rusakovichma.tictaac.engine.el.expression.Expression;
21 |
22 | public interface ExpressionParser {
23 |
24 | public Expression parse(String expression);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/model/threatmodel/dataflow/Encryption.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.model.threatmodel.dataflow;
19 |
20 | public enum Encryption {
21 | no,
22 | yes,
23 | undefined;
24 |
25 | @Override
26 | public String toString() {
27 | return this.name();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/com/github/rusakovichma/tictaac/correction/UniversalElementGuesserTest.java:
--------------------------------------------------------------------------------
1 | package com.github.rusakovichma.tictaac.correction;
2 |
3 | import com.github.rusakovichma.tictaac.model.threatmodel.Element;
4 | import com.github.rusakovichma.tictaac.model.threatmodel.element.ElementType;
5 | import org.junit.jupiter.api.Test;
6 |
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | class UniversalElementGuesserTest {
10 |
11 | @Test
12 | void guess() {
13 | Element element = new Element();
14 | element.setId("some-gateway-to-guess");
15 |
16 | UniversalElementGuesser guesser = new UniversalElementGuesser();
17 | guesser.tryToCorrect(element);
18 |
19 | assertTrue(element.getType() == ElementType.proxyServer);
20 | }
21 |
22 | @Test
23 | void guessNull() {
24 | Element element = new Element();
25 |
26 | UniversalElementGuesser guesser = new UniversalElementGuesser();
27 | guesser.tryToCorrect(element);
28 |
29 | assertTrue(element.getType() == null);
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/engine/el/parser/EvaluationTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.engine.el.parser;
19 |
20 | public interface EvaluationTemplate {
21 |
22 | public static final String DELIMITER = " ";
23 |
24 | public String getEvaluationStart();
25 |
26 | public String getEvaluationEnd();
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/provider/mitigation/MitigationLibraryProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.provider.mitigation;
19 |
20 | import com.github.rusakovichma.tictaac.model.mitigation.MitigationsLibrary;
21 |
22 | public interface MitigationLibraryProvider {
23 |
24 | public MitigationsLibrary getMitigations();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/provider/mitigation/Mitigator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.provider.mitigation;
19 |
20 | import com.github.rusakovichma.tictaac.model.Threat;
21 |
22 | import java.util.Collection;
23 |
24 | public interface Mitigator {
25 |
26 | public void setMitigationStrategy(Collection {
23 |
24 | protected V valueToCompare;
25 | protected P parameter;
26 |
27 | public ParamComparableExpression(EvaluationContext context) {
28 | super(context);
29 | }
30 |
31 | @Override
32 | public void setValueToCompare(V valueToCompare) {
33 | this.valueToCompare = valueToCompare;
34 | }
35 |
36 | public V getValueToCompare() {
37 | return valueToCompare;
38 | }
39 |
40 | public P getParameter() {
41 | return parameter;
42 | }
43 |
44 | public void setParameter(P parameter) {
45 | this.parameter = parameter;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/github/rusakovichma/tictaac/correction/ElementGuesser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of TicTaaC.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * Copyright (c) 2022 Mikhail Rusakovich. All Rights Reserved.
17 | */
18 | package com.github.rusakovichma.tictaac.correction;
19 |
20 | import com.github.rusakovichma.tictaac.model.threatmodel.Element;
21 | import com.github.rusakovichma.tictaac.model.threatmodel.element.ElementType;
22 |
23 | import java.util.List;
24 |
25 | abstract class ElementGuesser implements Guesser