-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backend/frontend] Support custom injector contracts
- Loading branch information
1 parent
b7eef6a
commit 0a4febe
Showing
33 changed files
with
462 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
openbas-api/src/main/java/io/openbas/migration/V2_91__Custom_inject_contracts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.openbas.migration; | ||
|
||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.sql.Statement; | ||
|
||
@Component | ||
public class V2_91__Custom_inject_contracts extends BaseJavaMigration { | ||
|
||
@Override | ||
public void migrate(Context context) throws Exception { | ||
Statement select = context.getConnection().createStatement(); | ||
// Exercise | ||
|
||
select.execute("ALTER TABLE injectors_contracts ADD injector_contract_custom bool default false;"); | ||
select.execute("ALTER TABLE injectors DROP injector_contract_template;"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../main/java/io/openbas/rest/injector_contract/form/InjectorContractUpdateMappingInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.openbas.rest.injector_contract.form; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static io.openbas.config.AppConfig.MANDATORY_MESSAGE; | ||
|
||
@Getter | ||
@Setter | ||
public class InjectorContractUpdateMappingInput { | ||
@Getter | ||
@JsonProperty("contract_attack_patterns_ids") | ||
private List<String> attackPatternsIds = new ArrayList<>(); | ||
|
||
public List<String> getAttackPatternsIds() { | ||
return attackPatternsIds; | ||
} | ||
|
||
public void setAttackPatternsIds(List<String> attackPatternsIds) { | ||
this.attackPatternsIds = attackPatternsIds; | ||
} | ||
} |
Submodule openbas-collectors
updated
from f01636 to 55b18e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,6 @@ public enum ContractType { | |
Asset, | ||
@JsonProperty("asset-group") | ||
AssetGroup, | ||
@JsonProperty("payload") | ||
Payload, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
openbas-framework/src/main/java/io/openbas/contract/fields/ContractPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.openbas.contract.fields; | ||
|
||
import io.openbas.contract.ContractCardinality; | ||
import io.openbas.contract.ContractType; | ||
|
||
public class ContractPayload extends ContractCardinalityElement { | ||
|
||
public ContractPayload(String key, String label, ContractCardinality cardinality) { | ||
super(key, label, cardinality); | ||
} | ||
|
||
public static ContractPayload payloadField(String key, String label, ContractCardinality cardinality) { | ||
return new ContractPayload(key, label, cardinality); | ||
} | ||
|
||
@Override | ||
public ContractType getType() { | ||
return ContractType.Payload; | ||
} | ||
} |
Oops, something went wrong.