Skip to content

Commit

Permalink
Fix edge and timeedge type deprecations (SYN-7775)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cisphyx committed Jan 20, 2025
1 parent 2f5c32b commit 7914d5a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changes/15f2326e94fb0c6a0dff8325285ef354.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
desc: Fixed an issue where the deprecated types ``edge`` and ``timeedge`` were not annotated
as such by the ``getModelDict()`` API.
prs: []
type: bug
...
5 changes: 5 additions & 0 deletions changes/4dc8e5d43f4cd25953b363a3ef469d7a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
desc: Deprecated ``$lib.infosec.cvss.calculate()`` and ``$lib.infosec.cvss.calculateFromProps()``.
prs: []
type: deprecation
...
4 changes: 2 additions & 2 deletions synapse/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,11 @@ def __init__(self, core=None):
item = s_types.Array(self, 'array', info, {'type': 'int'})
self.addBaseType(item)

info = {'doc': 'An digraph edge base type.'}
info = {'doc': 'An digraph edge base type.', 'deprecated': True}
item = s_types.Edge(self, 'edge', info, {})
self.addBaseType(item)

info = {'doc': 'An digraph edge base type with a unique time.'}
info = {'doc': 'An digraph edge base type with a unique time.', 'deprecated': True}
item = s_types.TimeEdge(self, 'timeedge', info, {})
self.addBaseType(item)

Expand Down
2 changes: 2 additions & 0 deletions synapse/lib/stormlib/infosec.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ class CvssLib(s_stormtypes.Lib):
'''
_storm_locals = (
{'name': 'calculate', 'desc': 'Calculate the CVSS score values for an input risk:vuln node.',
'deprecated': {'eolvers': 'v3.0.0'},
'type': {'type': 'function', '_funcname': 'calculate',
'args': (
{'name': 'node', 'type': 'node',
Expand All @@ -527,6 +528,7 @@ class CvssLib(s_stormtypes.Lib):
'returns': {'type': 'dict', 'desc': 'A dictionary containing the computed score and subscores.', }
}},
{'name': 'calculateFromProps', 'desc': 'Calculate the CVSS score values from a props dict.',
'deprecated': {'eolvers': 'v3.0.0'},
'type': {'type': 'function', '_funcname': 'calculateFromProps',
'args': (
{'name': 'props', 'type': 'dict',
Expand Down
5 changes: 4 additions & 1 deletion synapse/tests/test_cortex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ async def test_cortex_coreinfo(self):

depr = [x for x in coreinfo['stormdocs']['libraries'] if x['path'] == ('lib', 'infosec', 'cvss')]
self.len(1, depr)
self.len(2, [x for x in depr[0]['locals'] if x.get('deprecated')])
self.len(4, [x for x in depr[0]['locals'] if x.get('deprecated')])

async def test_cortex_model_dict(self):

Expand Down Expand Up @@ -3107,6 +3107,9 @@ async def test_cortex_model_dict(self):
self.nn(model['univs'].get('.created'))
self.nn(model['univs'].get('.seen'))

self.true(model['types']['edge'].get('deprecated'))
self.true(model['types']['timeedge'].get('deprecated'))

async def test_storm_graph(self):

async with self.getTestCoreAndProxy() as (core, prox):
Expand Down

0 comments on commit 7914d5a

Please sign in to comment.