Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Threat Intel Feed Config Model #1028

Conversation

jowg-amazon
Copy link
Collaborator

@jowg-amazon jowg-amazon commented May 15, 2024

Description

  1. Refactors threat intel folder to include transport, resthandler, service, util, and model folders.
  2. Adds the threat intel feed config model and threat intel feed dto config model
  3. Adds interfaces that will be used for sa commons

Files changed outside of refactoring:
threat_intel_job_mapping.json
TIFConfig
TIFConfigDto
SATIFConfig
SATIFConfigDto
TIFJobState

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

import java.util.Locale;
import java.util.Map;

public class SATIFConfig implements TIFConfig, Writeable, ScheduledJobParameter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javadocs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added javadocs

public Instant lastRefreshedTime;
public String lastRefreshedUser;
private Boolean isEnabled;
private Map<String, Object> iocMapStore;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the map that shows where we are storing the IOCs per feed. For opensearch it would be something like Map: Ip: , DNS:

);
}

public static TIFJobState toState(String stateName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use enum inbuilt function

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The states are an enum, changed the function to use switch case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not scalable

use valueOf(String name) which returns enum and wrap with try catch where catch returns null and logs error that couldnt parse enum

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to use valueOf

import java.util.Map;

/**
* Threat intel config interface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename entity to TIFSource Config

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to TIFSourceConfig

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
private Long version;
private String feedName;
private String feedFormat;
private Boolean prepackaged;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's have feed type instead of this

LICENSED
OPEN-SOURCED
CUSTOM
INTERNAL

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enum class for these fields

@@ -33,5 +33,10 @@ public enum TIFJobState {
/**
* tif job is being deleted
*/
DELETING
DELETING,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REFRESHING?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added REFRESHING as a state

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
@jowg-amazon jowg-amazon merged commit a99ca4d into opensearch-project:feature/threat_intel May 22, 2024
2 checks passed
eirsep pushed a commit that referenced this pull request Jun 3, 2024
jowg-amazon added a commit to jowg-amazon/security-analytics that referenced this pull request Jun 4, 2024
eirsep pushed a commit to eirsep/security-analytics that referenced this pull request Jun 6, 2024
eirsep pushed a commit that referenced this pull request Jun 6, 2024
AWSHurneyt pushed a commit to AWSHurneyt/security-analytics that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants