synapse 2.205.0__py311-none-any.whl → 2.207.0__py311-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/axon.py +8 -8
- synapse/cortex.py +14 -1
- synapse/lib/aha.py +13 -8
- synapse/lib/httpapi.py +196 -97
- synapse/lib/lmdbslab.py +2 -0
- synapse/lib/modelrev.py +3 -3
- synapse/lib/schemas.py +11 -0
- synapse/lib/spooled.py +2 -1
- synapse/lib/stormhttp.py +6 -6
- synapse/lib/stormlib/aha.py +5 -1
- synapse/lib/stormlib/model.py +1 -1
- synapse/lib/stormtypes.py +53 -17
- synapse/lib/version.py +2 -2
- synapse/models/base.py +9 -0
- synapse/models/inet.py +9 -1
- synapse/models/infotech.py +5 -0
- synapse/models/telco.py +10 -0
- synapse/tests/test_axon.py +52 -41
- synapse/tests/test_cortex.py +18 -6
- synapse/tests/test_lib_aha.py +17 -0
- synapse/tests/test_lib_cell.py +5 -3
- synapse/tests/test_lib_httpapi.py +225 -33
- synapse/tests/test_lib_lmdbslab.py +30 -0
- synapse/tests/test_lib_modelrev.py +7 -7
- synapse/tests/test_lib_spooled.py +2 -0
- synapse/tests/test_lib_stormhttp.py +13 -0
- synapse/tests/test_lib_stormlib_aha.py +7 -7
- synapse/tests/test_lib_stormlib_cortex.py +61 -60
- synapse/tests/test_lib_stormtypes.py +8 -0
- synapse/tests/test_model_infotech.py +2 -0
- synapse/tests/test_model_telco.py +4 -1
- synapse/tools/aha/easycert.py +4 -0
- synapse/tools/aha/mirror.py +6 -4
- {synapse-2.205.0.dist-info → synapse-2.207.0.dist-info}/METADATA +1 -1
- {synapse-2.205.0.dist-info → synapse-2.207.0.dist-info}/RECORD +38 -38
- {synapse-2.205.0.dist-info → synapse-2.207.0.dist-info}/WHEEL +0 -0
- {synapse-2.205.0.dist-info → synapse-2.207.0.dist-info}/licenses/LICENSE +0 -0
- {synapse-2.205.0.dist-info → synapse-2.207.0.dist-info}/top_level.txt +0 -0
synapse/axon.py
CHANGED
|
@@ -138,8 +138,8 @@ class AxonFileHandler(AxonHandlerMixin, s_httpapi.Handler):
|
|
|
138
138
|
|
|
139
139
|
self.blobsize = await self.getAxon().size(sha256b)
|
|
140
140
|
if self.blobsize is None:
|
|
141
|
-
self.
|
|
142
|
-
|
|
141
|
+
self.sendRestErr('NoSuchFile', f'SHA-256 not found: {s_common.ehex(sha256b)}',
|
|
142
|
+
status_code=s_httpapi.HTTPStatus.NOT_FOUND)
|
|
143
143
|
return False
|
|
144
144
|
|
|
145
145
|
status = 200
|
|
@@ -260,8 +260,8 @@ class AxonHttpBySha256V1(AxonFileHandler):
|
|
|
260
260
|
|
|
261
261
|
sha256b = s_common.uhex(sha256)
|
|
262
262
|
if not await self.getAxon().has(sha256b):
|
|
263
|
-
self.
|
|
264
|
-
|
|
263
|
+
self.sendRestErr('NoSuchFile', f'SHA-256 not found: {sha256}',
|
|
264
|
+
status_code=s_httpapi.HTTPStatus.NOT_FOUND)
|
|
265
265
|
return
|
|
266
266
|
|
|
267
267
|
resp = await self.getAxon().del_(sha256b)
|
|
@@ -1659,7 +1659,7 @@ class Axon(s_cell.Cell):
|
|
|
1659
1659
|
'code': resp.status,
|
|
1660
1660
|
'body': await resp.read(),
|
|
1661
1661
|
'reason': s_common.httpcodereason(resp.status),
|
|
1662
|
-
'headers':
|
|
1662
|
+
'headers': {str(k): v for k, v in resp.headers.items()},
|
|
1663
1663
|
}
|
|
1664
1664
|
return info
|
|
1665
1665
|
|
|
@@ -1706,7 +1706,7 @@ class Axon(s_cell.Cell):
|
|
|
1706
1706
|
'url': str(resp.url),
|
|
1707
1707
|
'code': resp.status,
|
|
1708
1708
|
'reason': s_common.httpcodereason(resp.status),
|
|
1709
|
-
'headers':
|
|
1709
|
+
'headers': {str(k): v for k, v in resp.headers.items()},
|
|
1710
1710
|
}
|
|
1711
1711
|
return info
|
|
1712
1712
|
|
|
@@ -1736,11 +1736,11 @@ class Axon(s_cell.Cell):
|
|
|
1736
1736
|
'ok': True,
|
|
1737
1737
|
'url': str(resp.real_url),
|
|
1738
1738
|
'code': resp.status,
|
|
1739
|
-
'headers':
|
|
1739
|
+
'headers': {str(k): v for k, v in resp.headers.items()},
|
|
1740
1740
|
'reason': s_common.httpcodereason(resp.status),
|
|
1741
1741
|
'request': {
|
|
1742
1742
|
'url': str(resp.request_info.real_url),
|
|
1743
|
-
'headers':
|
|
1743
|
+
'headers': {str(k): v for k, v in resp.request_info.headers.items()},
|
|
1744
1744
|
'method': str(resp.request_info.method),
|
|
1745
1745
|
}
|
|
1746
1746
|
}
|
synapse/cortex.py
CHANGED
|
@@ -815,7 +815,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
|
|
|
815
815
|
},
|
|
816
816
|
'modules': {
|
|
817
817
|
'default': [],
|
|
818
|
-
'description': 'A list of module classes to load.',
|
|
818
|
+
'description': 'Deprecated. A list of module classes to load.',
|
|
819
819
|
'type': 'array'
|
|
820
820
|
},
|
|
821
821
|
'storm:log': {
|
|
@@ -1397,6 +1397,16 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
|
|
|
1397
1397
|
{'perm': ('node', 'del', '<form>'), 'gate': 'layer',
|
|
1398
1398
|
'desc': 'Controls removing a specific form of node in a layer.'},
|
|
1399
1399
|
|
|
1400
|
+
{'perm': ('node', 'edge', 'add'), 'gate': 'layer',
|
|
1401
|
+
'desc': 'Controls adding light edges to a node.'},
|
|
1402
|
+
{'perm': ('node', 'edge', 'del'), 'gate': 'layer',
|
|
1403
|
+
'desc': 'Controls adding light edges to a node.'},
|
|
1404
|
+
|
|
1405
|
+
{'perm': ('node', 'edge', 'add', '<verb>'), 'gate': 'layer',
|
|
1406
|
+
'desc': 'Controls adding a specific light edge to a node.'},
|
|
1407
|
+
{'perm': ('node', 'edge', 'del', '<verb>'), 'gate': 'layer',
|
|
1408
|
+
'desc': 'Controls adding a specific light edge to a node.'},
|
|
1409
|
+
|
|
1400
1410
|
{'perm': ('node', 'tag'), 'gate': 'layer',
|
|
1401
1411
|
'desc': 'Controls editing any tag on any node in a layer.'},
|
|
1402
1412
|
{'perm': ('node', 'tag', 'add'), 'gate': 'layer',
|
|
@@ -6372,6 +6382,9 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
|
|
|
6372
6382
|
if isinstance(ctor, (list, tuple)):
|
|
6373
6383
|
ctor, conf = ctor
|
|
6374
6384
|
|
|
6385
|
+
if not ctor.startswith(('synapse.tests', 'synapse.models')):
|
|
6386
|
+
s_common.deprecated("'modules' Cortex config value", curv='2.206.0')
|
|
6387
|
+
|
|
6375
6388
|
modu = self._loadCoreModule(ctor, conf=conf)
|
|
6376
6389
|
if modu is None:
|
|
6377
6390
|
return
|
synapse/lib/aha.py
CHANGED
|
@@ -79,12 +79,9 @@ class AhaProvisionServiceV1(s_httpapi.Handler):
|
|
|
79
79
|
url = await self.cell.addAhaSvcProv(name, provinfo=provinfo)
|
|
80
80
|
except asyncio.CancelledError: # pragma: no cover
|
|
81
81
|
raise
|
|
82
|
-
except
|
|
83
|
-
logger.exception(f'Error provisioning {name}')
|
|
84
|
-
return self.sendRestErr(e.__class__.__name__, e.get('mesg', str(e)))
|
|
85
|
-
except Exception as e: # pragma: no cover
|
|
82
|
+
except Exception as e:
|
|
86
83
|
logger.exception(f'Error provisioning {name}')
|
|
87
|
-
return self.
|
|
84
|
+
return self.sendRestExc(e, status_code=s_httpapi.HTTPStatus.BAD_REQUEST)
|
|
88
85
|
return self.sendRestRetn({'url': url})
|
|
89
86
|
|
|
90
87
|
_getAhaSvcSchema = {
|
|
@@ -175,6 +172,7 @@ class AhaApi(s_cell.CellApi):
|
|
|
175
172
|
if network is None:
|
|
176
173
|
await self._reqUserAllowed(('aha', 'service', 'get'))
|
|
177
174
|
else:
|
|
175
|
+
s_common.deprecated('getAhaSvcs() network argument', curv='v2.206.0')
|
|
178
176
|
await self._reqUserAllowed(('aha', 'service', 'get', network))
|
|
179
177
|
|
|
180
178
|
async for info in self.cell.getAhaSvcs(network=network):
|
|
@@ -187,6 +185,8 @@ class AhaApi(s_cell.CellApi):
|
|
|
187
185
|
NOTE: In order for the service to remain marked "up" a caller
|
|
188
186
|
must maintain the telepath link.
|
|
189
187
|
'''
|
|
188
|
+
if network is not None:
|
|
189
|
+
s_common.deprecated('addAhaSvc() network argument', curv='v2.206.0')
|
|
190
190
|
svcname, svcnetw, svcfull = self.cell._nameAndNetwork(name, network)
|
|
191
191
|
|
|
192
192
|
await self._reqUserAllowed(('aha', 'service', 'add', svcnetw, svcname))
|
|
@@ -253,26 +253,31 @@ class AhaApi(s_cell.CellApi):
|
|
|
253
253
|
'''
|
|
254
254
|
Remove an AHA service entry.
|
|
255
255
|
'''
|
|
256
|
+
if network is not None:
|
|
257
|
+
s_common.deprecated('delAhaSvc() network argument', curv='v2.206.0')
|
|
256
258
|
svcname, svcnetw, svcfull = self.cell._nameAndNetwork(name, network)
|
|
257
259
|
await self._reqUserAllowed(('aha', 'service', 'del', svcnetw, svcname))
|
|
258
260
|
return await self.cell.delAhaSvc(name, network=network)
|
|
259
261
|
|
|
260
262
|
async def getCaCert(self, network):
|
|
261
|
-
|
|
263
|
+
s_common.deprecated('getCaCert() will no longer accept a network argument', curv='v2.206.0')
|
|
262
264
|
await self._reqUserAllowed(('aha', 'ca', 'get'))
|
|
263
265
|
return await self.cell.getCaCert(network)
|
|
264
266
|
|
|
265
267
|
async def genCaCert(self, network):
|
|
266
|
-
|
|
268
|
+
s_common.deprecated('genCaCert()', curv='v2.206.0')
|
|
267
269
|
await self._reqUserAllowed(('aha', 'ca', 'gen'))
|
|
268
270
|
return await self.cell.genCaCert(network)
|
|
269
271
|
|
|
270
272
|
async def signHostCsr(self, csrtext, signas=None, sans=None):
|
|
271
|
-
|
|
273
|
+
if signas is not None:
|
|
274
|
+
s_common.deprecated('signHostCsr() signas argument', curv='v2.206.0')
|
|
272
275
|
await self._reqUserAllowed(('aha', 'csr', 'host'))
|
|
273
276
|
return await self.cell.signHostCsr(csrtext, signas=signas, sans=sans)
|
|
274
277
|
|
|
275
278
|
async def signUserCsr(self, csrtext, signas=None):
|
|
279
|
+
if signas is not None:
|
|
280
|
+
s_common.deprecated('signUserCsr() signas argument', curv='v2.206.0')
|
|
276
281
|
await self._reqUserAllowed(('aha', 'csr', 'user'))
|
|
277
282
|
return await self.cell.signUserCsr(csrtext, signas=signas)
|
|
278
283
|
|