Skip to content

Commit

Permalink
[backend] Add payload elevation required
Browse files Browse the repository at this point in the history
  • Loading branch information
savacano28 authored Sep 17, 2024
1 parent 5d61515 commit 6652873
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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 V3_37__Add_column_elevation_required_payload extends BaseJavaMigration {

@Override
public void migrate(final Context context) throws Exception {
final Statement select = context.getConnection().createStatement();
select.execute("ALTER TABLE payloads ADD payload_elevation_required bool default false;");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public class PayloadUpsertInput {

@JsonProperty("payload_attack_patterns")
private List<String> attackPatternsExternalIds = new ArrayList<>();

@JsonProperty("payload_elevation_required")
private boolean elevationRequired;
}


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UuidGenerator;
Expand Down Expand Up @@ -94,6 +95,11 @@ public enum PAYLOAD_STATUS {
@JsonProperty("payload_cleanup_command")
private String cleanupCommand;

@Getter
@Column(name = "payload_elevation_required")
@JsonProperty("payload_elevation_required")
private boolean elevationRequired;

@Setter
@Type(JsonType.class)
@Column(name = "payload_arguments")
Expand Down Expand Up @@ -159,7 +165,7 @@ public enum PAYLOAD_STATUS {

@JsonProperty("payload_collector_type")
private String getCollectorType() {
return this.getCollector() != null ? this.getCollector().getType() : null;
return this.collector != null ? this.collector.getType() : null;
}

@Override
Expand Down

0 comments on commit 6652873

Please sign in to comment.