Skip to content

Commit 9a8f9af

Browse files
committed
fix: Misc fixes
1 parent 22e0f89 commit 9a8f9af

6 files changed

Lines changed: 8 additions & 27 deletions

File tree

shared/connector_linter/connector_linter/checks/vc3xx_code/_helpers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@ def find_field_defaults(
328328
(
329329
b.id
330330
if isinstance(b, ast.Name)
331-
else b.attr
332-
if isinstance(b, ast.Attribute)
333-
else ""
331+
else b.attr if isinstance(b, ast.Attribute) else ""
334332
)
335333
for b in node.bases
336334
]

shared/connector_linter/connector_linter/checks/vc3xx_code/vc303_connector_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def check_connector_type_hardcoded(ctx: ConnectorContext) -> list[CheckFinding]:
158158
CheckFinding(
159159
message="Connector type hardcoded",
160160
severity=Severity.WARNING,
161+
suggestion="Consider using connectors-sdk base config classes to set the connector type via inheritance.",
161162
file_path=file_path,
162163
line=line,
163164
),
@@ -170,6 +171,7 @@ def check_connector_type_hardcoded(ctx: ConnectorContext) -> list[CheckFinding]:
170171
CheckFinding(
171172
message="Connector type hardcoded via Pydantic field",
172173
severity=Severity.WARNING,
174+
suggestion="Consider using connectors-sdk base config classes to set the connector type via inheritance.",
173175
file_path=file_path,
174176
line=line,
175177
),

shared/connector_linter/connector_linter/checks/vc3xx_code/vc304_markings_checked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def check_markings_checked(ctx: ConnectorContext) -> list[CheckFinding]:
110110
f"TLP extraction found in {file_path}:{line} "
111111
"but check_max_tlp is not called"
112112
),
113-
severity=Severity.WARNING,
113+
severity=Severity.ERROR,
114114
file_path=file_path,
115115
line=line,
116116
suggestion=(

shared/connector_linter/connector_linter/checks/vc3xx_code/vc306_log_level_default.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Accepted values for the "error" log level.
2222
# Both "error" and "err" are valid — some logging frameworks use the short form.
2323
# ---------------------------------------------------------------------------
24-
_ERROR_VALUES = {"error", "err"}
24+
_ERROR_VALUES = "error"
2525

2626

2727
@CheckRegistry.register(
@@ -54,7 +54,7 @@ def check_log_level_default(ctx: ConnectorContext) -> list[CheckFinding]:
5454

5555
if field_defaults:
5656
fd = field_defaults[0]
57-
if fd.default_value and fd.default_value in _ERROR_VALUES:
57+
if fd.default_value and fd.default_value == _ERROR_VALUES:
5858
return [
5959
CheckFinding(
6060
message=f"Log level defaults to '{fd.default_value}'",

shared/connector_linter/connector_linter/checks/vc3xx_code/vc313_pycti_generate_id.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,7 @@
5858
_STIX_SRO_TYPES = frozenset({"Relationship", "Sighting"})
5959

6060
# Combined set for checking
61-
_STIX_TYPES_NEEDING_ID = _STIX_SDO_TYPES | _STIX_SRO_TYPES
62-
63-
# ---------------------------------------------------------------------------
64-
# Custom OpenCTI types — these are OpenCTI-specific extensions that also
65-
# need explicit id= for deterministic deduplication (not part of STIX 2.1
66-
# but follow the same pattern).
67-
# ---------------------------------------------------------------------------
68-
_CUSTOM_OCTI_TYPES = frozenset(
69-
{
70-
"CustomObjectCaseIncident",
71-
"CustomObjectTask",
72-
"CustomObjectChannel",
73-
"CustomObservableCryptocurrencyWallet",
74-
"CustomObservableHostname",
75-
"CustomObservableMediaContent",
76-
"CustomObservableUserAgent",
77-
},
78-
)
79-
80-
_ALL_TYPES_NEEDING_ID = _STIX_TYPES_NEEDING_ID | _CUSTOM_OCTI_TYPES
61+
_ALL_TYPES_NEEDING_ID = _STIX_SDO_TYPES | _STIX_SRO_TYPES
8162

8263

8364
def _get_stix2_imported_names(trees: dict[Path, ast.Module]) -> dict[Path, set[str]]:

shared/connector_linter/connector_linter/checks/vc3xx_code/vc314_auto_backpressure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def check_auto_backpressure(ctx: ConnectorContext) -> list[CheckFinding]:
111111
results.append(
112112
CheckFinding(
113113
message="Uses while True loop instead of scheduler",
114-
severity=Severity.WARNING,
114+
severity=Severity.ERROR,
115115
file_path=file_path,
116116
line=line_no,
117117
suggestion=(

0 commit comments

Comments
 (0)