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
|
@@ -10,6 +10,7 @@ from unittest.mock import patch
|
|
|
10
10
|
|
|
11
11
|
import synapse.lib.base as s_base
|
|
12
12
|
import synapse.lib.const as s_const
|
|
13
|
+
import synapse.lib.msgpack as s_msgpack
|
|
13
14
|
import synapse.lib.lmdbslab as s_lmdbslab
|
|
14
15
|
import synapse.lib.thisplat as s_thisplat
|
|
15
16
|
|
|
@@ -1618,6 +1619,35 @@ class LmdbSlabTest(s_t_utils.SynTest):
|
|
|
1618
1619
|
subkv2 = subkv1.getSubKeyVal('pref2')
|
|
1619
1620
|
self.eq(list(subkv2.keys()), ['wow'])
|
|
1620
1621
|
|
|
1622
|
+
async def test_lmdbslab_scan_grow(self):
|
|
1623
|
+
with self.getTestDir() as dirn:
|
|
1624
|
+
|
|
1625
|
+
path = os.path.join(dirn, 'test.lmdb')
|
|
1626
|
+
|
|
1627
|
+
mapsize = s_const.kibibyte * 32
|
|
1628
|
+
async with await s_lmdbslab.Slab.anit(path, map_size=mapsize) as slab:
|
|
1629
|
+
|
|
1630
|
+
self.eq(slab.mapsize, mapsize)
|
|
1631
|
+
|
|
1632
|
+
def slabset(key, valu):
|
|
1633
|
+
slab.replace(s_msgpack.en(key), s_msgpack.en(valu))
|
|
1634
|
+
|
|
1635
|
+
def slabitems():
|
|
1636
|
+
for lkey, lval in slab.scanByFull():
|
|
1637
|
+
yield s_msgpack.un(lkey), s_msgpack.un(lval)
|
|
1638
|
+
|
|
1639
|
+
slabset('one', [1, 2, 3])
|
|
1640
|
+
slabset('two', [2, 3, 4])
|
|
1641
|
+
|
|
1642
|
+
seen = set()
|
|
1643
|
+
for key, valu in slabitems():
|
|
1644
|
+
self.notin(key, seen)
|
|
1645
|
+
seen.add(key)
|
|
1646
|
+
|
|
1647
|
+
valu += ('A' * mapsize,)
|
|
1648
|
+
slabset(key, valu)
|
|
1649
|
+
|
|
1650
|
+
self.gt(slab.mapsize, mapsize)
|
|
1621
1651
|
|
|
1622
1652
|
class LmdbSlabMemLockTest(s_t_utils.SynTest):
|
|
1623
1653
|
|
|
@@ -1630,14 +1630,14 @@ class ModelRevTest(s_tests.SynTest):
|
|
|
1630
1630
|
sources: ['008af0047a8350287cde7abe31a7c706', 'a7a4739e0a52674df0fa3a8226de0c3f']
|
|
1631
1631
|
refs:
|
|
1632
1632
|
layer: {fork01layr}
|
|
1633
|
-
- it:prod:soft:cpe (iden: 9742664e24fe1a3a37d871b1f62af27453c2945b98f421d753db8436e9a44cc9
|
|
1634
|
-
- _ext:model:form:cpe (iden: 16e3289346a258c3e3073affad490c1d6ebf1d01295aacc489cdb24658ebc6e7
|
|
1635
|
-
- inet:flow:dst:cpes (iden: 7d4c31f1364aaf0b4cfaf4b57bb60157f2e86248391ce8ec75d6b7e3cd5f35b7
|
|
1636
|
-
- inet:flow:src:cpes (iden: 7d4c31f1364aaf0b4cfaf4b57bb60157f2e86248391ce8ec75d6b7e3cd5f35b7
|
|
1637
|
-
- meta:seen:node (iden: 81973208bc0f5b99250e4cda7889c66e0573c0573bc2a279083d23426ba3c74d
|
|
1638
|
-
- meta:seen:node (iden: 85bfc442d87a64a8e75d4ff2831281fb156317767612eef9b75c271ff162c4d9
|
|
1633
|
+
- it:prod:soft:cpe (iden: 9742664e24fe1a3a37d871b1f62af27453c2945b98f421d753db8436e9a44cc9)
|
|
1634
|
+
- _ext:model:form:cpe (iden: 16e3289346a258c3e3073affad490c1d6ebf1d01295aacc489cdb24658ebc6e7)
|
|
1635
|
+
- inet:flow:dst:cpes (iden: 7d4c31f1364aaf0b4cfaf4b57bb60157f2e86248391ce8ec75d6b7e3cd5f35b7)
|
|
1636
|
+
- inet:flow:src:cpes (iden: 7d4c31f1364aaf0b4cfaf4b57bb60157f2e86248391ce8ec75d6b7e3cd5f35b7)
|
|
1637
|
+
- meta:seen:node (iden: 81973208bc0f5b99250e4cda7889c66e0573c0573bc2a279083d23426ba3c74d)
|
|
1638
|
+
- meta:seen:node (iden: 85bfc442d87a64a8e75d4ff2831281fb156317767612eef9b75c271ff162c4d9)
|
|
1639
1639
|
layer: {fork00layr}
|
|
1640
|
-
- risk:vulnerable:node (iden: 5fddf1b5fa06aa8a39a1eb297712cecf9ca146764c4d6e5c79296b9e9978d2c3
|
|
1640
|
+
- risk:vulnerable:node (iden: 5fddf1b5fa06aa8a39a1eb297712cecf9ca146764c4d6e5c79296b9e9978d2c3)
|
|
1641
1641
|
edges:
|
|
1642
1642
|
-(refs)> f0315900f365f45f2e027edc66ed8477d8661dad501d51f3ac8067c36565f07c
|
|
1643
1643
|
<(seen)- 051d93252abe655e43265b89149b6a2d5a8f5f2df33b56c986ab8671c081e394
|
|
@@ -125,6 +125,8 @@ class SpooledTest(s_test.SynTest):
|
|
|
125
125
|
|
|
126
126
|
async with await s_spooled.Dict.anit(size=2) as sd0:
|
|
127
127
|
await runtest(sd0)
|
|
128
|
+
self.true(sd0.fallback)
|
|
128
129
|
|
|
129
130
|
async with await s_spooled.Dict.anit(size=1000) as sd1:
|
|
130
131
|
await runtest(sd1)
|
|
132
|
+
self.false(sd1.fallback)
|
|
@@ -473,6 +473,19 @@ class StormHttpTest(s_test.SynTest):
|
|
|
473
473
|
data = resp.get('result')
|
|
474
474
|
self.eq(data.get('params'), {'foo': ['bar', 'baz'], 'key': ["('valu',)"]})
|
|
475
475
|
|
|
476
|
+
# headers are safe to serialize
|
|
477
|
+
q = '''
|
|
478
|
+
$headers = ({'Foo': 'Bar'})
|
|
479
|
+
$resp = $lib.inet.http.request(GET, $url, headers=$headers, ssl_verify=$lib.false)
|
|
480
|
+
return ( ($lib.json.save($resp.headers), $lib.json.save($resp.request_headers)) )
|
|
481
|
+
'''
|
|
482
|
+
resp = await core.callStorm(q, opts=opts)
|
|
483
|
+
(headers, req_headers) = resp
|
|
484
|
+
headers = s_json.loads(headers)
|
|
485
|
+
self.eq(headers.get('Content-Type'), 'application/json; charset=UTF-8')
|
|
486
|
+
req_headers = s_json.loads(req_headers)
|
|
487
|
+
self.eq(req_headers.get('Foo'), 'Bar')
|
|
488
|
+
|
|
476
489
|
async def test_storm_http_post(self):
|
|
477
490
|
|
|
478
491
|
async with self.getTestCore() as core:
|
|
@@ -216,7 +216,7 @@ Connection information:
|
|
|
216
216
|
|
|
217
217
|
# PeerGenr
|
|
218
218
|
resp = await core00.callStorm('''
|
|
219
|
-
$resps =
|
|
219
|
+
$resps = ()
|
|
220
220
|
$todo = $lib.utils.todo('getTasks')
|
|
221
221
|
for ($name, $info) in $lib.aha.callPeerGenr(cell..., $todo) {
|
|
222
222
|
$resps.append(($name, $info))
|
|
@@ -226,7 +226,7 @@ Connection information:
|
|
|
226
226
|
self.len(0, resp)
|
|
227
227
|
|
|
228
228
|
resp = await core00.callStorm('''
|
|
229
|
-
$resps =
|
|
229
|
+
$resps = ()
|
|
230
230
|
$todo = $lib.utils.todo('getNexusChanges', (0), wait=(false))
|
|
231
231
|
for ($name, $info) in $lib.aha.callPeerGenr(cell..., $todo) {
|
|
232
232
|
$resps.append(($name, $info))
|
|
@@ -237,7 +237,7 @@ Connection information:
|
|
|
237
237
|
|
|
238
238
|
cell00_rid = (await cell00.getCellInfo())['cell']['run']
|
|
239
239
|
resp = await core00.callStorm('''
|
|
240
|
-
$resps =
|
|
240
|
+
$resps = ()
|
|
241
241
|
$todo = $lib.utils.todo('getNexusChanges', (0), wait=(false))
|
|
242
242
|
for $info in $lib.aha.callPeerGenr(cell..., $todo, skiprun=$skiprun) {
|
|
243
243
|
$resps.append($info)
|
|
@@ -253,7 +253,7 @@ Connection information:
|
|
|
253
253
|
|
|
254
254
|
# PeerApi
|
|
255
255
|
resp = await core00.callStorm('''
|
|
256
|
-
$resps =
|
|
256
|
+
$resps = ()
|
|
257
257
|
$todo = $lib.utils.todo('getCellInfo')
|
|
258
258
|
for ($name, $info) in $lib.aha.callPeerApi(cell..., $todo) {
|
|
259
259
|
$resps.append(($name, $info))
|
|
@@ -266,7 +266,7 @@ Connection information:
|
|
|
266
266
|
self.isinstance(resp[0][1][1], dict)
|
|
267
267
|
|
|
268
268
|
resp = await core00.callStorm('''
|
|
269
|
-
$resps =
|
|
269
|
+
$resps = ()
|
|
270
270
|
$todo = $lib.utils.todo(getCellInfo)
|
|
271
271
|
for ($name, $info) in $lib.aha.callPeerApi(cell..., $todo) {
|
|
272
272
|
$resps.append(($name, $info))
|
|
@@ -276,7 +276,7 @@ Connection information:
|
|
|
276
276
|
self.len(2, resp)
|
|
277
277
|
|
|
278
278
|
resp = await core00.callStorm('''
|
|
279
|
-
$resps =
|
|
279
|
+
$resps = ()
|
|
280
280
|
$todo = $lib.utils.todo(getCellInfo)
|
|
281
281
|
for ($name, $info) in $lib.aha.callPeerApi(cell..., $todo, skiprun=$skiprun) {
|
|
282
282
|
$resps.append(($name, $info))
|
|
@@ -286,7 +286,7 @@ Connection information:
|
|
|
286
286
|
self.len(1, resp)
|
|
287
287
|
|
|
288
288
|
resp = await core00.callStorm('''
|
|
289
|
-
$resps =
|
|
289
|
+
$resps = ()
|
|
290
290
|
$todo = $lib.utils.todo('getCellInfo')
|
|
291
291
|
for ($name, $info) in $lib.aha.callPeerApi(cell..., $todo, timeout=(10)) {
|
|
292
292
|
$resps.append(($name, $info))
|