Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": "array"
},
"CONNECTOR_TYPE": {
"const": "EXTERNAL_IMPORT",
"default": "EXTERNAL_IMPORT",
"description": "Should always be set to EXTERNAL_IMPORT for this connector.",
"type": "string"
Expand Down Expand Up @@ -91,4 +92,4 @@
"OPENCTI_TOKEN"
],
"additionalProperties": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

from connectors_sdk import ListFromString
from models.configs import ConfigBaseSettings
from pydantic import (
Field,
HttpUrl,
PlainSerializer,
field_validator,
)
from pydantic import Field, HttpUrl, PlainSerializer

LogLevelToLower = Annotated[
Literal["debug", "info", "warn", "warning", "error"],
Expand Down Expand Up @@ -38,7 +33,7 @@
name: str
scope: ListFromString

type: str = Field(
type: Literal["EXTERNAL_IMPORT"] = Field(

Check warning on line 36 in external-import/cisa-known-exploited-vulnerabilities/src/models/configs/connector_configs.py

View workflow job for this annotation

GitHub Actions / Lint external-import/cisa-known-exploited-vulnerabilities

VC303: Connector type hardcoded via Pydantic field
default="EXTERNAL_IMPORT",
description="Should always be set to EXTERNAL_IMPORT for this connector.",
)
Expand All @@ -50,7 +45,3 @@
default="P2D",
description="Duration between two scheduled runs of the connector (ISO 8601 format).",
)

@field_validator("type")
def force_value_for_type_to_be_external_import(cls, value):
return "EXTERNAL_IMPORT"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": "array"
},
"CONNECTOR_TYPE": {
"const": "EXTERNAL_IMPORT",
"default": "EXTERNAL_IMPORT",
"description": "Should always be set to EXTERNAL_IMPORT for this connector.",
"type": "string"
Expand Down Expand Up @@ -115,4 +116,4 @@
"CVE_API_KEY"
],
"additionalProperties": true
}
}
13 changes: 2 additions & 11 deletions external-import/cve/src/models/configs/connector_configs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from typing import Annotated, Literal

from connectors_sdk import ListFromString
from pydantic import (
Field,
HttpUrl,
PlainSerializer,
field_validator,
)
from pydantic import Field, HttpUrl, PlainSerializer
from src.models.configs import ConfigBaseSettings

LogLevelToLower = Annotated[
Expand Down Expand Up @@ -37,15 +32,11 @@
name: str
scope: ListFromString

type: str = Field(
type: Literal["EXTERNAL_IMPORT"] = Field(

Check warning on line 35 in external-import/cve/src/models/configs/connector_configs.py

View workflow job for this annotation

GitHub Actions / Lint external-import/cve

VC303: Connector type hardcoded via Pydantic field
default="EXTERNAL_IMPORT",
description="Should always be set to EXTERNAL_IMPORT for this connector.",
)
log_level: LogLevelToLower = Field(
default="error",
description="Determines the verbosity of the logs.",
)

@field_validator("type")
def force_value_for_type_to_be_external_import(cls, value):
return "EXTERNAL_IMPORT"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Below is an exhaustive enumeration of all configurable parameters available, eac
| CONNECTOR_TYPE | `const` | | `EXTERNAL_IMPORT` | `"EXTERNAL_IMPORT"` | The type of the connector. |
| CONNECTOR_SCOPE | `array` | | string | `["email-intel-imap"]` | The scope of the connector. |
| CONNECTOR_DURATION_PERIOD | `string` | | Format: [`duration`](https://json-schema.org/understanding-json-schema/reference/string#built-in-formats) | `"PT1H"` | The period of time to await between two runs of the connector. |
| CONNECTOR_LOG_LEVEL | `string` | | `debug` `info` `warning` `error` `critical` | `"error"` | The minimum level of logs to display. |
| CONNECTOR_LOG_LEVEL | `string` | | `debug` `info` `warn` `warning` `error` | `"error"` | The minimum level of logs to display. |
| EMAIL_INTEL_IMAP_TLP_LEVEL | `string` | | `white` `clear` `green` `amber` `amber+strict` `red` | `"amber+strict"` | Traffic Light Protocol (TLP) level to apply on objects imported into OpenCTI. |
| EMAIL_INTEL_IMAP_RELATIVE_IMPORT_START_DATE | `string` | | Format: [`duration`](https://json-schema.org/understanding-json-schema/reference/string#built-in-formats) | `"P30D"` | The relative start date to import emails in ISO 8601 duration format (e.g. P30D for 30 days). |
| EMAIL_INTEL_IMAP_PORT | `integer` | | integer | `993` | IMAP server port number |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"enum": [
"debug",
"info",
"warn",
"warning",
"error",
"critical"
"error"
],
"type": "string",
"default": "error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
class LogLevelType(StrEnum):
DEBUG = "debug"
INFO = "info"
WARN = "warn" # alias
WARNING = "warning"
ERROR = "error"
CRITICAL = "critical"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Below is an exhaustive enumeration of all configurable parameters available, eac
| CONNECTOR_TYPE | `const` | | `EXTERNAL_IMPORT` | `"EXTERNAL_IMPORT"` | |
| CONNECTOR_SCOPE | `array` | | string | `["email-intel-microsoft"]` | |
| CONNECTOR_DURATION_PERIOD | `string` | | Format: [`duration`](https://json-schema.org/understanding-json-schema/reference/string#built-in-formats) | `"PT1H"` | |
| CONNECTOR_LOG_LEVEL | `string` | | `debug` `info` `warning` `error` `critical` | `"error"` | |
| CONNECTOR_LOG_LEVEL | `string` | | `debug` `info` `warn` `warning` `error` | `"error"` | |
| EMAIL_INTEL_MICROSOFT_TLP_LEVEL | `string` | | `white` `clear` `green` `amber` `amber+strict` `red` | `"amber+strict"` | |
| EMAIL_INTEL_MICROSOFT_RELATIVE_IMPORT_START_DATE | `string` | | Format: [`duration`](https://json-schema.org/understanding-json-schema/reference/string#built-in-formats) | `"P30D"` | |
| EMAIL_INTEL_MICROSOFT_MAILBOX | `string` | | string | `"INBOX"` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"enum": [
"debug",
"info",
"warn",
"warning",
"error",
"critical"
"error"
],
"type": "string",
"default": "error"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
class LogLevelType(StrEnum):
DEBUG = "debug"
INFO = "info"
WARN = "warn" # alias
WARNING = "warning"
ERROR = "error"
CRITICAL = "critical"
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": "array"
},
"CONNECTOR_TYPE": {
"const": "EXTERNAL_IMPORT",
"default": "EXTERNAL_IMPORT",
"description": "Should always be set to EXTERNAL_IMPORT for this connector.",
"type": "string"
Expand Down Expand Up @@ -85,4 +86,4 @@
"FEEDLY_API_KEY"
],
"additionalProperties": true
}
}
Loading
Loading