Skip to content

Commit

Permalink
[backend] add label and isFilterable from ingestion (#4939)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Dec 21, 2023
1 parent efef574 commit 24938b2
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ const INGESTION_RSS_DEFINITION: ModuleDefinition<StoreEntityIngestionRss, StixIn
},
},
attributes: [
{ name: 'name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'description', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'uri', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'user_id', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true },
{ name: 'report_types', type: 'string', mandatoryType: 'external', editDefault: true, multiple: true, upsert: true },
{ name: 'created_by_ref', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'object_marking_refs', type: 'string', mandatoryType: 'external', editDefault: true, multiple: true, upsert: true },
{ name: 'current_state_date', type: 'date', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'ingestion_running', type: 'boolean', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'name', label: 'Name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'description', label: 'Description', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'uri', label: 'URI', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'user_id', label: 'User ID', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true, isFilterable: true },
{ name: 'report_types', label: 'Report types', type: 'string', mandatoryType: 'external', editDefault: true, multiple: true, upsert: true, isFilterable: true },
{ name: 'created_by_ref', label: 'Created by', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: false },
{ name: 'object_marking_refs', label: 'Marking', type: 'string', mandatoryType: 'external', editDefault: true, multiple: true, upsert: true, isFilterable: false },
{ name: 'current_state_date', label: 'Current state date', type: 'date', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'ingestion_running', label: 'Ingestion running', type: 'boolean', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
],
relations: [],
representative: (stix: StixIngestionRss) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ const INGESTION_DEFINITION: ModuleDefinition<StoreEntityIngestionTaxii, StixInge
},
},
attributes: [
{ name: 'name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'description', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'uri', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'version', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: true },
{ name: 'collection', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: true },
{ name: 'authentication_type', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true },
{ name: 'authentication_value', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true },
{ name: 'user_id', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true },
{ name: 'report_types', type: 'string', mandatoryType: 'external', editDefault: true, multiple: true, upsert: true },
{ name: 'created_by_ref', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'object_marking_refs', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'added_after_start', type: 'date', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'current_state_cursor', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'ingestion_running', type: 'boolean', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'name', label: 'Name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'description', label: 'Description', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'uri', label: 'URI', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'version', label: 'Version', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: true, isFilterable: true },
{ name: 'collection', label: 'Collection', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: true, isFilterable: true },
{ name: 'authentication_type', label: 'Authentication type', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true, isFilterable: true },
{ name: 'authentication_value', label: 'Authentication value', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true, isFilterable: true },
{ name: 'user_id', label: 'User ID', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: true, isFilterable: true },
{ name: 'report_types', label: 'Report types', type: 'string', mandatoryType: 'external', editDefault: true, multiple: true, upsert: true, isFilterable: true },
{ name: 'created_by_ref', label: 'Created by', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: false },
{ name: 'object_marking_refs', label: 'Marking', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: false },
{ name: 'added_after_start', label: 'Added after', type: 'date', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'current_state_cursor', label: 'Current state cursor', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'ingestion_running', label: 'Running', type: 'boolean', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
],
relations: [],
representative: (stix: StixIngestionTaxii) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const CSV_MAPPER_DEFINITION: ModuleDefinition<StoreEntityCsvMapper, StixCsvMappe
},
},
attributes: [
{ name: 'name', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'has_header', type: 'boolean', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'separator', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'representations', type: 'json', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'skipLineChar', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: false },
{ name: 'name', label: 'Name', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
{ name: 'has_header', label: 'Header', type: 'boolean', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
{ name: 'separator', label: 'Separator', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
{ name: 'representations', label: 'Representations', type: 'json', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: false },
{ name: 'skipLineChar', label: 'Skip line character', type: 'string', mandatoryType: 'no', editDefault: false, multiple: false, upsert: false, isFilterable: true },
],
relations: [],
representative: (instance: StixCsvMapper) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { AttributeDefinition } from '../../../schema/attribute-definition';
// Register at minimum lastModified attribute
// This way the search engine is able to order by lastModified
const attributes: Array<AttributeDefinition> = [
{ name: 'lastModified', type: 'date', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'lastModified', label: 'Last modification date', type: 'date', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
];

schemaAttributesDefinition.registerAttributes(ENTITY_TYPE_INTERNAL_FILE, attributes);
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const LANGUAGE_DEFINITION: ModuleDefinition<StoreEntityLanguage, StixLanguage> =
},
},
attributes: [
{ name: 'name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'name', label: 'Name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
],
relations: [], // All relations are from the other side
representative: (stix: StixLanguage) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ const MALWARE_ANALYSIS_DEFINITION: ModuleDefinition<StoreEntityMalwareAnalysis,
resolvers: {}
},
attributes: [
{ name: 'product', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'version', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'configuration_version', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, label: 'Configuration version' },
{ name: 'modules', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: true, upsert: true },
{ name: 'analysis_engine_version', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, label: 'Analysis engine version' },
{ name: 'analysis_definition_version', mandatoryType: 'customizable', editDefault: true, type: 'string', multiple: false, upsert: true, label: 'Analysis definition version' },
{ name: 'submitted', type: 'date', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, label: 'Submission date' },
{ name: 'analysis_started', type: 'date', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, label: 'Analysis started' },
{ name: 'analysis_ended', type: 'date', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, label: 'Analysis ended' },
{ name: 'result_name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, label: 'Result name' },
{ name: 'result', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'product', label: 'Product', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'version', label: 'Version', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'configuration_version', label: 'Configuration version', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'modules', label: 'Modules', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: true, upsert: true, isFilterable: true },
{ name: 'analysis_engine_version', label: 'Analysis engine version', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'analysis_definition_version', label: 'Analysis definition version', mandatoryType: 'customizable', editDefault: true, type: 'string', multiple: false, upsert: true, isFilterable: true },
{ name: 'submitted', label: 'Submission date', type: 'date', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'analysis_started', label: 'Analysis started', type: 'date', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'analysis_ended', label: 'Analysis ended', type: 'date', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'result_name', label: 'Result name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'result', label: 'Result', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
],
converter: convertMalwareAnalysisToStix,
representative: (stix: StixMalwareAnalysis) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const MANAGER_CONFIGURATION_DEFINITION: ModuleDefinition<StoreEntityManagerConfi
},
},
attributes: [
{ name: 'manager_id', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'manager_running', type: 'boolean', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'manager_setting', type: 'json', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'last_run_start_date', type: 'date', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'last_run_end_date', type: 'date', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false },
{ name: 'manager_id', label: 'Manager ID', type: 'string', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: false },
{ name: 'manager_running', label: 'Running', type: 'boolean', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
{ name: 'manager_setting', label: 'Setting', type: 'json', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: false },
{ name: 'last_run_start_date', label: 'Last run start date', type: 'date', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
{ name: 'last_run_end_date', label: 'Last run end date', type: 'date', mandatoryType: 'internal', editDefault: false, multiple: false, upsert: false, isFilterable: true },
],
relations: [],
representative: (stix: StixManagerConfiguration) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const NARRATIVE_DEFINITION: ModuleDefinition<StoreEntityNarrative, StixNarrative
},
},
attributes: [
{ name: 'name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true },
{ name: 'description', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true },
{ name: 'narrative_types', type: 'string', mandatoryType: 'no', editDefault: false, multiple: true, upsert: true, label: 'Narrative types' },
{ name: 'name', label: 'Name', type: 'string', mandatoryType: 'external', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'description', label: 'Description', type: 'string', mandatoryType: 'customizable', editDefault: true, multiple: false, upsert: true, isFilterable: true },
{ name: 'narrative_types', label: 'Narrative types', type: 'string', mandatoryType: 'no', editDefault: false, multiple: true, upsert: true, isFilterable: true },
],
relations: [
{
Expand Down
Loading

0 comments on commit 24938b2

Please sign in to comment.