synapse 2.179.0__py311-none-any.whl → 2.180.1__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/cortex.py +4 -4
- synapse/lib/ast.py +84 -54
- synapse/lib/certdir.py +4 -4
- synapse/lib/layer.py +1 -1
- synapse/lib/lmdbslab.py +2 -0
- synapse/lib/modelrev.py +5 -1
- synapse/lib/node.py +14 -4
- synapse/lib/schemas.py +58 -0
- synapse/lib/snap.py +19 -4
- synapse/lib/storm.py +6 -4
- synapse/lib/stormlib/stix.py +4 -0
- synapse/lib/version.py +2 -2
- synapse/models/auth.py +2 -0
- synapse/models/geopol.py +3 -0
- synapse/models/inet.py +1 -0
- synapse/models/infotech.py +109 -91
- synapse/models/person.py +5 -2
- synapse/models/telco.py +3 -0
- synapse/tests/test_lib_aha.py +2 -1
- synapse/tests/test_lib_ast.py +231 -0
- synapse/tests/test_lib_cell.py +1 -0
- synapse/tests/test_lib_certdir.py +9 -0
- synapse/tests/test_lib_layer.py +22 -0
- synapse/tests/test_lib_modelrev.py +7 -0
- synapse/tests/test_lib_node.py +12 -1
- synapse/tests/test_lib_storm.py +32 -7
- synapse/tests/test_lib_stormlib_stix.py +1 -1
- synapse/tests/test_model_geopol.py +2 -0
- synapse/tests/test_model_inet.py +10 -1
- synapse/tests/test_model_person.py +2 -0
- synapse/tests/test_model_telco.py +2 -1
- {synapse-2.179.0.dist-info → synapse-2.180.1.dist-info}/METADATA +2 -2
- {synapse-2.179.0.dist-info → synapse-2.180.1.dist-info}/RECORD +36 -36
- {synapse-2.179.0.dist-info → synapse-2.180.1.dist-info}/WHEEL +1 -1
- {synapse-2.179.0.dist-info → synapse-2.180.1.dist-info}/LICENSE +0 -0
- {synapse-2.179.0.dist-info → synapse-2.180.1.dist-info}/top_level.txt +0 -0
synapse/tests/test_lib_ast.py
CHANGED
|
@@ -4100,3 +4100,234 @@ class AstTest(s_test.SynTest):
|
|
|
4100
4100
|
q = 'media:news=(m0,) [-:published]'
|
|
4101
4101
|
msgs = await core.stormlist(q, opts=aslow)
|
|
4102
4102
|
self.stormIsInErr('must have permission node.prop.del.media:news.published', msgs)
|
|
4103
|
+
|
|
4104
|
+
async def test_ast_path_links(self):
|
|
4105
|
+
|
|
4106
|
+
async with self.getTestCore() as core: # type: s_cortex.Cortex
|
|
4107
|
+
guid = s_common.guid()
|
|
4108
|
+
opts = {'vars': {'guid': guid}}
|
|
4109
|
+
|
|
4110
|
+
burr = (await core.nodes('[test:comp=(1234, burrito)]'))[0]
|
|
4111
|
+
guid = (await core.nodes('[test:guid=$guid :size=176 :tick=now]', opts=opts))[0]
|
|
4112
|
+
edge = (await core.nodes('[test:edge=(("test:guid", $guid), ("test:str", abcd))]', opts=opts))[0]
|
|
4113
|
+
comp = (await core.nodes('[test:complexcomp=(1234, STUFF) +#foo.bar]'))[0]
|
|
4114
|
+
tstr = (await core.nodes('[test:str=foobar :bar=(test:ro, "ackbar") :ndefs=((test:guid, $guid), (test:auto, "auto"))]', opts=opts))[0]
|
|
4115
|
+
arry = (await core.nodes('[test:arrayprop=* :ints=(3245, 678) :strs=("foo", "bar", "foobar")]'))[0]
|
|
4116
|
+
ostr = (await core.nodes('test:str=foo [ :bar=(test:ro, "ackbar") :ndefs=((test:int, 176), )]'))[0]
|
|
4117
|
+
pstr = (await core.nodes('test:str=bar [ :ndefs=((test:guid, $guid), (test:auto, "auto"), (test:ro, "ackbar"))]', opts=opts))[0]
|
|
4118
|
+
(await core.nodes('[test:arrayform=(1234, 176)]'))[0]
|
|
4119
|
+
(await core.nodes('[test:arrayform=(3245, 678)]'))[0]
|
|
4120
|
+
|
|
4121
|
+
await core.nodes('test:int=176 [ <(seen)+ { test:guid } ]')
|
|
4122
|
+
await core.nodes('test:int=176 [ <(someedge)+ { test:guid } ]')
|
|
4123
|
+
await core.nodes('test:complexcomp [ <(refs)+ { test:arrayprop } ]')
|
|
4124
|
+
await core.nodes('test:complexcomp [ +(concerns)> { test:ro } ]')
|
|
4125
|
+
await core.nodes('test:edge [ <(seen)+ { test:guid } ]')
|
|
4126
|
+
|
|
4127
|
+
small = (await core.nodes('test:int=176'))[0]
|
|
4128
|
+
large = (await core.nodes('test:int=1234'))[0]
|
|
4129
|
+
auto = (await core.nodes('test:auto'))[0]
|
|
4130
|
+
basetag = (await core.nodes('syn:tag=foo'))[0]
|
|
4131
|
+
tag = (await core.nodes('syn:tag=foo.bar'))[0]
|
|
4132
|
+
ro = (await core.nodes('test:ro'))[0]
|
|
4133
|
+
|
|
4134
|
+
def _assert_edge(msgs, src, edge, nidx=0, eidx=0):
|
|
4135
|
+
nodes = [m[1] for m in msgs if m[0] == 'node']
|
|
4136
|
+
links = nodes[nidx][1].get('links')
|
|
4137
|
+
self.nn(links)
|
|
4138
|
+
self.lt(eidx, len(links))
|
|
4139
|
+
self.eq(links[eidx], (src.iden(), edge))
|
|
4140
|
+
|
|
4141
|
+
opts = {'links': True}
|
|
4142
|
+
|
|
4143
|
+
# non-runtsafe lift could be anything
|
|
4144
|
+
msgs = await core.stormlist('test:str=foobar $newform=$node.props.bar.0 *$newform', opts={'links': True, 'vars': {'form': 'inet:ipv4'}})
|
|
4145
|
+
_assert_edge(msgs, tstr, {'type': 'runtime'}, nidx=1)
|
|
4146
|
+
|
|
4147
|
+
# FormPivot
|
|
4148
|
+
# -> baz:ndef
|
|
4149
|
+
msgs = await core.stormlist('test:guid -> test:edge:n1', opts=opts)
|
|
4150
|
+
_assert_edge(msgs, guid, {'type': 'prop', 'prop': 'n1', 'reverse': True})
|
|
4151
|
+
|
|
4152
|
+
# plain old pivot
|
|
4153
|
+
msgs = await core.stormlist('test:int=176 -> test:guid:size', opts=opts)
|
|
4154
|
+
_assert_edge(msgs, small, {'type': 'prop', 'prop': 'size', 'reverse': True})
|
|
4155
|
+
|
|
4156
|
+
# graph edge dest form uses n1 automagically
|
|
4157
|
+
msgs = await core.stormlist('test:guid -> test:edge', opts=opts)
|
|
4158
|
+
_assert_edge(msgs, guid, {'type': 'prop', 'prop': 'n1', 'reverse': True})
|
|
4159
|
+
|
|
4160
|
+
# <syn:tag> -> <form>
|
|
4161
|
+
msgs = await core.stormlist('syn:tag=foo.bar -> test:complexcomp', opts=opts)
|
|
4162
|
+
_assert_edge(msgs, tag, {'type': 'tag', 'tag': 'foo.bar', 'reverse': True})
|
|
4163
|
+
|
|
4164
|
+
# source node is a graph edge, use n2
|
|
4165
|
+
msgs = await core.stormlist('test:edge -> test:str', opts=opts)
|
|
4166
|
+
_assert_edge(msgs, edge, {'type': 'prop', 'prop': 'n2'})
|
|
4167
|
+
|
|
4168
|
+
# refs out - prop
|
|
4169
|
+
msgs = await core.stormlist('test:complexcomp -> test:int', opts=opts)
|
|
4170
|
+
_assert_edge(msgs, comp, {'type': 'prop', 'prop': 'foo'})
|
|
4171
|
+
|
|
4172
|
+
# refs out - array
|
|
4173
|
+
msgs = await core.stormlist('test:arrayprop -> test:int', opts=opts)
|
|
4174
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'})
|
|
4175
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'}, nidx=1)
|
|
4176
|
+
|
|
4177
|
+
# refs out - ndef
|
|
4178
|
+
msgs = await core.stormlist('test:str -> test:ro', opts=opts)
|
|
4179
|
+
_assert_edge(msgs, pstr, {'type': 'prop', 'prop': 'ndefs'})
|
|
4180
|
+
_assert_edge(msgs, ostr, {'type': 'prop', 'prop': 'bar'}, nidx=1)
|
|
4181
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'bar'}, nidx=2)
|
|
4182
|
+
|
|
4183
|
+
# refs out - ndefarray
|
|
4184
|
+
msgs = await core.stormlist('test:str -> test:auto', opts=opts)
|
|
4185
|
+
_assert_edge(msgs, pstr, {'type': 'prop', 'prop': 'ndefs'})
|
|
4186
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'ndefs'}, nidx=1)
|
|
4187
|
+
|
|
4188
|
+
# reverse prop refs
|
|
4189
|
+
msgs = await core.stormlist('test:int -> test:complexcomp', opts=opts)
|
|
4190
|
+
_assert_edge(msgs, large, {'type': 'prop', 'prop': 'foo', 'reverse': True})
|
|
4191
|
+
|
|
4192
|
+
# reverse array refs
|
|
4193
|
+
msgs = await core.stormlist('test:int -> test:arrayprop', opts=opts)
|
|
4194
|
+
sixer = (await core.nodes('test:int=678'))[0]
|
|
4195
|
+
thou = (await core.nodes('test:int=3245'))[0]
|
|
4196
|
+
_assert_edge(msgs, sixer, {'type': 'prop', 'prop': 'ints', 'reverse': True})
|
|
4197
|
+
_assert_edge(msgs, thou, {'type': 'prop', 'prop': 'ints', 'reverse': True}, nidx=1)
|
|
4198
|
+
|
|
4199
|
+
# reverse ndef refs
|
|
4200
|
+
msgs = await core.stormlist('test:ro -> test:str', opts=opts)
|
|
4201
|
+
_assert_edge(msgs, ro, {'type': 'prop', 'prop': 'bar', 'reverse': True})
|
|
4202
|
+
|
|
4203
|
+
# reverse ndefarray refs
|
|
4204
|
+
msgs = await core.stormlist('test:auto -> test:str', opts=opts)
|
|
4205
|
+
_assert_edge(msgs, auto, {'type': 'prop', 'prop': 'ndefs', 'reverse': True})
|
|
4206
|
+
|
|
4207
|
+
# PivotOut syn:tag
|
|
4208
|
+
msgs = await core.stormlist('syn:tag -> *', opts=opts)
|
|
4209
|
+
_assert_edge(msgs, basetag, {'type': 'tag', 'tag': 'foo', 'reverse': True})
|
|
4210
|
+
_assert_edge(msgs, tag, {'type': 'tag', 'tag': 'foo.bar', 'reverse': True}, nidx=1)
|
|
4211
|
+
|
|
4212
|
+
# PivotOut edge uses n2 automatically
|
|
4213
|
+
msgs = await core.stormlist('test:edge -> *', opts=opts)
|
|
4214
|
+
_assert_edge(msgs, edge, {'type': 'prop', 'prop': 'n2'})
|
|
4215
|
+
|
|
4216
|
+
# PivotOut prop
|
|
4217
|
+
msgs = await core.stormlist('test:guid -> *', opts=opts)
|
|
4218
|
+
_assert_edge(msgs, guid, {'type': 'prop', 'prop': 'size'})
|
|
4219
|
+
|
|
4220
|
+
# PivotOut prop array
|
|
4221
|
+
msgs = await core.stormlist('test:arrayprop -> *', opts=opts)
|
|
4222
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'})
|
|
4223
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'}, nidx=1)
|
|
4224
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'strs'}, nidx=2)
|
|
4225
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'strs'}, nidx=3)
|
|
4226
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'strs'}, nidx=4)
|
|
4227
|
+
|
|
4228
|
+
# PivotOut prop ndef and ndef array
|
|
4229
|
+
msgs = await core.stormlist('test:str=foobar -> *', opts=opts)
|
|
4230
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'bar'})
|
|
4231
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'ndefs'}, nidx=1)
|
|
4232
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'ndefs'}, nidx=2)
|
|
4233
|
+
|
|
4234
|
+
# PivotToTags
|
|
4235
|
+
msgs = await core.stormlist('test:complexcomp -> #', opts=opts)
|
|
4236
|
+
_assert_edge(msgs, comp, {'type': 'tag', 'tag': 'foo.bar'})
|
|
4237
|
+
|
|
4238
|
+
# PivotIn prop
|
|
4239
|
+
msgs = await core.stormlist('test:int=176 <- *', opts=opts)
|
|
4240
|
+
_assert_edge(msgs, small, {'type': 'prop', 'prop': 'size', 'reverse': True})
|
|
4241
|
+
|
|
4242
|
+
# PivotIn array prop
|
|
4243
|
+
msgs = await core.stormlist('test:str=foobar <- *', opts=opts)
|
|
4244
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'strs', 'reverse': True})
|
|
4245
|
+
|
|
4246
|
+
# PivotIn edge uses n1 automatically
|
|
4247
|
+
msgs = await core.stormlist('test:edge <- *', opts=opts)
|
|
4248
|
+
_assert_edge(msgs, edge, {'type': 'prop', 'prop': 'n1', 'reverse': True})
|
|
4249
|
+
|
|
4250
|
+
# PivotIn ndef
|
|
4251
|
+
msgs = await core.stormlist('test:ro <- *', opts=opts)
|
|
4252
|
+
_assert_edge(msgs, ro, {'type': 'prop', 'prop': 'bar', 'reverse': True})
|
|
4253
|
+
|
|
4254
|
+
# PivotIn array ndef
|
|
4255
|
+
msgs = await core.stormlist('test:auto <- *', opts=opts)
|
|
4256
|
+
_assert_edge(msgs, auto, {'type': 'prop', 'prop': 'ndefs', 'reverse': True})
|
|
4257
|
+
|
|
4258
|
+
# PivotInFrom "<- edge"
|
|
4259
|
+
abcd = (await core.nodes('test:str=abcd'))[0]
|
|
4260
|
+
msgs = await core.stormlist('test:str <- test:edge', opts=opts)
|
|
4261
|
+
_assert_edge(msgs, abcd, {'type': 'prop', 'prop': 'n2', 'reverse': True})
|
|
4262
|
+
|
|
4263
|
+
# PivotInFrom "edge <- form"
|
|
4264
|
+
msgs = await core.stormlist('test:edge <- test:guid', opts=opts)
|
|
4265
|
+
_assert_edge(msgs, edge, {'type': 'prop', 'prop': 'n1', 'reverse': True})
|
|
4266
|
+
|
|
4267
|
+
# PropPivotOut prop
|
|
4268
|
+
msgs = await core.stormlist('test:guid :size -> *', opts=opts)
|
|
4269
|
+
_assert_edge(msgs, guid, {'type': 'prop', 'prop': 'size'})
|
|
4270
|
+
|
|
4271
|
+
# PropPivotOut ndef
|
|
4272
|
+
msgs = await core.stormlist('test:str=foobar :bar -> *', opts=opts)
|
|
4273
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'bar'})
|
|
4274
|
+
|
|
4275
|
+
# PropPivotOut array
|
|
4276
|
+
msgs = await core.stormlist('test:arrayprop :ints -> *', opts=opts)
|
|
4277
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'})
|
|
4278
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'}, nidx=1)
|
|
4279
|
+
|
|
4280
|
+
# PropPivotOut array ndef
|
|
4281
|
+
msgs = await core.stormlist('test:str=foobar :ndefs -> *', opts=opts)
|
|
4282
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'ndefs'})
|
|
4283
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'ndefs'}, nidx=1)
|
|
4284
|
+
|
|
4285
|
+
# PropPivot prop to form
|
|
4286
|
+
msgs = await core.stormlist('test:guid :size -> test:int', opts=opts)
|
|
4287
|
+
_assert_edge(msgs, guid, {'type': 'prop', 'prop': 'size'})
|
|
4288
|
+
|
|
4289
|
+
# PropPivot ndef prop
|
|
4290
|
+
msgs = await core.stormlist('test:str :bar -> test:ro', opts=opts)
|
|
4291
|
+
_assert_edge(msgs, ostr, {'type': 'prop', 'prop': 'bar'})
|
|
4292
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'bar'}, nidx=1)
|
|
4293
|
+
|
|
4294
|
+
# PropPivot array
|
|
4295
|
+
msgs = await core.stormlist('test:arrayprop :ints -> test:int', opts=opts)
|
|
4296
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'})
|
|
4297
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'}, nidx=1)
|
|
4298
|
+
|
|
4299
|
+
# PropPivot dst array primary prop
|
|
4300
|
+
msgs = await core.stormlist('test:guid :size -> test:arrayform', opts=opts)
|
|
4301
|
+
_assert_edge(msgs, guid, {'type': 'prop', 'prop': 'size'})
|
|
4302
|
+
|
|
4303
|
+
# PropPivot oops all arrays
|
|
4304
|
+
msgs = await core.stormlist('test:arrayprop :ints -> test:arrayform', opts=opts)
|
|
4305
|
+
_assert_edge(msgs, arry, {'type': 'prop', 'prop': 'ints'})
|
|
4306
|
+
|
|
4307
|
+
# PropPivot src ndef array
|
|
4308
|
+
msgs = await core.stormlist('test:str=foobar :ndefs -> test:guid', opts=opts)
|
|
4309
|
+
_assert_edge(msgs, tstr, {'type': 'prop', 'prop': 'ndefs'})
|
|
4310
|
+
|
|
4311
|
+
# prop to prop
|
|
4312
|
+
msgs = await core.stormlist('test:comp :hehe -> test:complexcomp:foo', opts=opts)
|
|
4313
|
+
_assert_edge(msgs, burr, {'type': 'prop', 'prop': 'hehe', 'dest': 'test:complexcomp:foo'})
|
|
4314
|
+
|
|
4315
|
+
# N1Walk
|
|
4316
|
+
msgs = await core.stormlist('test:arrayprop -(*)> *', opts=opts)
|
|
4317
|
+
_assert_edge(msgs, arry, {'type': 'edge', 'verb': 'refs'})
|
|
4318
|
+
|
|
4319
|
+
# N2Walk
|
|
4320
|
+
msgs = await core.stormlist('test:edge <(*)- *', opts=opts)
|
|
4321
|
+
_assert_edge(msgs, edge, {'type': 'edge', 'verb': 'seen', 'reverse': True})
|
|
4322
|
+
|
|
4323
|
+
# N1WalkNPivo
|
|
4324
|
+
msgs = await core.stormlist('test:complexcomp --> *', opts=opts)
|
|
4325
|
+
_assert_edge(msgs, comp, {'type': 'prop', 'prop': 'foo'})
|
|
4326
|
+
_assert_edge(msgs, comp, {'type': 'edge', 'verb': 'concerns'}, nidx=1)
|
|
4327
|
+
|
|
4328
|
+
# N2WalNkPivo
|
|
4329
|
+
msgs = await core.stormlist('test:int=176 <-- *', opts=opts)
|
|
4330
|
+
_assert_edge(msgs, small, {'type': 'prop', 'prop': 'size', 'reverse': True})
|
|
4331
|
+
_assert_edge(msgs, small, {'type': 'prop', 'prop': 'ndefs', 'reverse': True}, nidx=1)
|
|
4332
|
+
_assert_edge(msgs, small, {'type': 'edge', 'verb': 'seen', 'reverse': True}, nidx=2)
|
|
4333
|
+
_assert_edge(msgs, small, {'type': 'edge', 'verb': 'someedge', 'reverse': True}, nidx=3)
|
synapse/tests/test_lib_cell.py
CHANGED
|
@@ -356,6 +356,9 @@ class CertDirTest(s_t_utils.SynTest):
|
|
|
356
356
|
with self.raises(s_exc.CryptoErr) as cm:
|
|
357
357
|
cdir.genCaCert('')
|
|
358
358
|
|
|
359
|
+
with self.raises(s_exc.CryptoErr) as cm:
|
|
360
|
+
cdir.genCaCert('V' * 63 + 'ॐ')
|
|
361
|
+
|
|
359
362
|
def test_certdir_hosts(self):
|
|
360
363
|
with self.getCertDir() as cdir:
|
|
361
364
|
caname = 'syntest'
|
|
@@ -581,6 +584,9 @@ class CertDirTest(s_t_utils.SynTest):
|
|
|
581
584
|
with self.raises(s_exc.CryptoErr) as cm:
|
|
582
585
|
cdir.genHostCsr('')
|
|
583
586
|
|
|
587
|
+
with self.raises(s_exc.CryptoErr) as cm:
|
|
588
|
+
cdir.genHostCsr('V' * 63 + 'ॐ')
|
|
589
|
+
|
|
584
590
|
def test_certdir_users_csr(self):
|
|
585
591
|
with self.getCertDir() as cdir:
|
|
586
592
|
caname = 'syntest'
|
|
@@ -612,6 +618,9 @@ class CertDirTest(s_t_utils.SynTest):
|
|
|
612
618
|
with self.raises(s_exc.CryptoErr) as cm:
|
|
613
619
|
cdir.genUserCsr('')
|
|
614
620
|
|
|
621
|
+
with self.raises(s_exc.CryptoErr) as cm:
|
|
622
|
+
cdir.genUserCsr('V' * 63 + 'ॐ')
|
|
623
|
+
|
|
615
624
|
def test_certdir_importfile(self):
|
|
616
625
|
with self.getCertDir() as cdir:
|
|
617
626
|
with self.getTestDir() as testpath:
|
synapse/tests/test_lib_layer.py
CHANGED
|
@@ -2216,3 +2216,25 @@ class LayerTest(s_t_utils.SynTest):
|
|
|
2216
2216
|
|
|
2217
2217
|
self.notin('pulls', dst_tree)
|
|
2218
2218
|
self.notin('pushs', dst_tree)
|
|
2219
|
+
|
|
2220
|
+
async def test_layer_readahead(self):
|
|
2221
|
+
|
|
2222
|
+
async with self.getTestCore() as core:
|
|
2223
|
+
|
|
2224
|
+
layr = core.getLayer()
|
|
2225
|
+
self.true(layr.layrslab.readahead)
|
|
2226
|
+
self.true(layr.layrslab.lenv.flags()['readahead'])
|
|
2227
|
+
self.false(layr.nodeeditslab.readahead)
|
|
2228
|
+
self.false(layr.nodeeditslab.lenv.flags()['readahead'])
|
|
2229
|
+
self.false(layr.dataslab.readahead)
|
|
2230
|
+
self.false(layr.dataslab.lenv.flags()['readahead'])
|
|
2231
|
+
|
|
2232
|
+
with self.setTstEnvars(SYNDEV_CORTEX_LAYER_READAHEAD='false'):
|
|
2233
|
+
iden = await core.callStorm('return($lib.layer.add().iden)')
|
|
2234
|
+
layr = core.getLayer(iden)
|
|
2235
|
+
self.false(layr.layrslab.readahead)
|
|
2236
|
+
self.false(layr.layrslab.lenv.flags()['readahead'])
|
|
2237
|
+
self.false(layr.nodeeditslab.readahead)
|
|
2238
|
+
self.false(layr.nodeeditslab.lenv.flags()['readahead'])
|
|
2239
|
+
self.false(layr.dataslab.readahead)
|
|
2240
|
+
self.false(layr.dataslab.lenv.flags()['readahead'])
|
|
@@ -559,3 +559,10 @@ class ModelRevTest(s_tests.SynTest):
|
|
|
559
559
|
self.len(2, rnodes)
|
|
560
560
|
|
|
561
561
|
self.eq([node.ndef[0] for node in nodes], [node.ndef[0] for node in reversed(rnodes)])
|
|
562
|
+
|
|
563
|
+
async def test_modelrev_0_2_27(self):
|
|
564
|
+
|
|
565
|
+
async with self.getRegrCore('model-0.2.27') as core:
|
|
566
|
+
nodes = await core.nodes('it:dev:repo:commit:id=" Foo "')
|
|
567
|
+
self.len(1, nodes)
|
|
568
|
+
self.eq('Foo', nodes[0].get('id'))
|
synapse/tests/test_lib_node.py
CHANGED
|
@@ -243,7 +243,8 @@ class NodeTest(s_t_utils.SynTest):
|
|
|
243
243
|
nodepaths = await alist(node.storm(runt, '-> test:int [:loc=$foo]', opts={'vars': {'foo': 'us'}}))
|
|
244
244
|
self.eq(nodepaths[0][0].props.get('loc'), 'us')
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
link = {'type': 'runtime'}
|
|
247
|
+
path = nodepaths[0][1].fork(node, link) # type: s_node.Path
|
|
247
248
|
path.vars['zed'] = 'ca'
|
|
248
249
|
|
|
249
250
|
# Path present, opts not present
|
|
@@ -251,12 +252,18 @@ class NodeTest(s_t_utils.SynTest):
|
|
|
251
252
|
self.eq(nodes[0][0].props.get('loc'), 'ca')
|
|
252
253
|
# path is not updated due to frame scope
|
|
253
254
|
self.none(path.vars.get('bar'), 'us')
|
|
255
|
+
self.len(2, path.links)
|
|
256
|
+
self.eq({'type': 'prop', 'prop': 'hehe'}, path.links[0][1])
|
|
257
|
+
self.eq(link, path.links[1][1])
|
|
254
258
|
|
|
255
259
|
# Path present, opts present but no opts['vars']
|
|
256
260
|
nodes = await alist(node.storm(runt, '-> test:int [:loc=$zed] $bar=$foo', opts={}, path=path))
|
|
257
261
|
self.eq(nodes[0][0].props.get('loc'), 'ca')
|
|
258
262
|
# path is not updated due to frame scope
|
|
259
263
|
self.none(path.vars.get('bar'))
|
|
264
|
+
self.len(2, path.links)
|
|
265
|
+
self.eq({'type': 'prop', 'prop': 'hehe'}, path.links[0][1])
|
|
266
|
+
self.eq(link, path.links[1][1])
|
|
260
267
|
|
|
261
268
|
# Path present, opts present with vars
|
|
262
269
|
nodes = await alist(node.storm(runt, '-> test:int [:loc=$zed] $bar=$baz',
|
|
@@ -294,6 +301,10 @@ class NodeTest(s_t_utils.SynTest):
|
|
|
294
301
|
self.eq(len(pcln.nodes), len(path.nodes))
|
|
295
302
|
pcln.nodes.pop(-1)
|
|
296
303
|
self.ne(len(pcln.nodes), len(path.nodes))
|
|
304
|
+
# Ensure the link elements are independent
|
|
305
|
+
pcln.links.append({'type': 'edge', 'verb': 'seen'})
|
|
306
|
+
self.len(3, pcln.links)
|
|
307
|
+
self.len(2, path.links)
|
|
297
308
|
|
|
298
309
|
# push a frame and clone it - ensure clone mods do not
|
|
299
310
|
# modify the original path
|
synapse/tests/test_lib_storm.py
CHANGED
|
@@ -3059,12 +3059,29 @@ class StormTest(s_t_utils.SynTest):
|
|
|
3059
3059
|
self.len(4, nodes)
|
|
3060
3060
|
|
|
3061
3061
|
q = 'inet:ipv4=1.2.3.4 | tee --join { -> * } { <- * }'
|
|
3062
|
-
|
|
3062
|
+
msgs = await core.stormlist(q, opts={'links': True})
|
|
3063
|
+
nodes = [m[1] for m in msgs if m[0] == 'node']
|
|
3063
3064
|
self.len(4, nodes)
|
|
3064
|
-
|
|
3065
|
-
self.eq(nodes[
|
|
3066
|
-
|
|
3067
|
-
self.
|
|
3065
|
+
|
|
3066
|
+
self.eq(nodes[0][0], ('inet:asn', 0))
|
|
3067
|
+
links = nodes[0][1]['links']
|
|
3068
|
+
self.len(1, links)
|
|
3069
|
+
self.eq({'type': 'prop', 'prop': 'asn'}, links[0][1])
|
|
3070
|
+
|
|
3071
|
+
self.eq(nodes[1][0][0], ('inet:dns:a'))
|
|
3072
|
+
links = nodes[1][1]['links']
|
|
3073
|
+
self.len(1, links)
|
|
3074
|
+
self.eq({'type': 'prop', 'prop': 'ipv4', 'reverse': True}, links[0][1])
|
|
3075
|
+
|
|
3076
|
+
self.eq(nodes[2][0][0], ('edge:refs'))
|
|
3077
|
+
links = nodes[2][1]['links']
|
|
3078
|
+
self.len(1, links)
|
|
3079
|
+
self.eq({'type': 'prop', 'prop': 'n2', 'reverse': True}, links[0][1])
|
|
3080
|
+
|
|
3081
|
+
self.eq(nodes[3][0], ('inet:ipv4', 0x01020304))
|
|
3082
|
+
links = nodes[2][1]['links']
|
|
3083
|
+
self.len(1, links)
|
|
3084
|
+
self.eq({'type': 'prop', 'prop': 'n2', 'reverse': True}, links[0][1])
|
|
3068
3085
|
|
|
3069
3086
|
q = 'inet:ipv4=1.2.3.4 | tee --join { -> * } { <- * } { -> edge:refs:n2 :n1 -> * }'
|
|
3070
3087
|
nodes = await core.nodes(q)
|
|
@@ -3834,10 +3851,18 @@ class StormTest(s_t_utils.SynTest):
|
|
|
3834
3851
|
self.eq(sorted([n.ndef[1] for n in nodes]), ['test1', 'test2'])
|
|
3835
3852
|
|
|
3836
3853
|
q = '[(test:str=refs) (test:str=foo)] $v=$node.value() | lift.byverb $v'
|
|
3837
|
-
|
|
3854
|
+
msgs = await core.stormlist(q, opts={'links': True})
|
|
3855
|
+
nodes = [n[1] for n in msgs if n[0] == 'node']
|
|
3838
3856
|
self.len(4, nodes)
|
|
3839
|
-
self.eq({n
|
|
3857
|
+
self.eq({n[0][1] for n in nodes},
|
|
3840
3858
|
{'test1', 'test2', 'refs', 'foo'})
|
|
3859
|
+
links = nodes[1][1]['links']
|
|
3860
|
+
self.len(1, links)
|
|
3861
|
+
self.eq({'type': 'runtime'}, links[0][1])
|
|
3862
|
+
|
|
3863
|
+
links = nodes[2][1]['links']
|
|
3864
|
+
self.len(1, links)
|
|
3865
|
+
self.eq({'type': 'runtime'}, links[0][1])
|
|
3841
3866
|
|
|
3842
3867
|
async def test_storm_nested_root(self):
|
|
3843
3868
|
async with self.getTestCore() as core:
|
|
@@ -423,7 +423,7 @@ class StormLibStixTest(s_test.SynTest):
|
|
|
423
423
|
self.stormIsInErr('storm query must be a string', msgs)
|
|
424
424
|
|
|
425
425
|
msgs = await core.stormlist('yield $lib.stix.import.ingest(({"objects": 3}), ({}))')
|
|
426
|
-
self.stormIsInErr('
|
|
426
|
+
self.stormIsInErr('data.objects must be array', msgs)
|
|
427
427
|
|
|
428
428
|
async def test_stix_export_custom(self):
|
|
429
429
|
|
|
@@ -108,6 +108,7 @@ class GeoPolModelTest(s_t_utils.SynTest):
|
|
|
108
108
|
|
|
109
109
|
nodes = await core.nodes('''
|
|
110
110
|
[ pol:candidate=*
|
|
111
|
+
:id=" P00009423"
|
|
111
112
|
:race={pol:race}
|
|
112
113
|
:contact={[ps:contact=* :name=whippit]}
|
|
113
114
|
:winner=$lib.true
|
|
@@ -116,6 +117,7 @@ class GeoPolModelTest(s_t_utils.SynTest):
|
|
|
116
117
|
]
|
|
117
118
|
''')
|
|
118
119
|
self.eq(1, nodes[0].get('winner'))
|
|
120
|
+
self.eq('P00009423', nodes[0].get('id'))
|
|
119
121
|
self.len(1, await core.nodes('pol:candidate -> pol:race'))
|
|
120
122
|
self.len(1, await core.nodes('pol:candidate -> ou:org +:name=vertex'))
|
|
121
123
|
self.len(1, await core.nodes('pol:candidate -> ps:contact +:name=whippit'))
|
synapse/tests/test_model_inet.py
CHANGED
|
@@ -2684,7 +2684,15 @@ class InetModelTest(s_t_utils.SynTest):
|
|
|
2684
2684
|
'acct': 'vertex.link/visi',
|
|
2685
2685
|
}
|
|
2686
2686
|
|
|
2687
|
-
q = '[
|
|
2687
|
+
q = '''[
|
|
2688
|
+
inet:search:query=$valu
|
|
2689
|
+
:time=$p.time
|
|
2690
|
+
:text=$p.text
|
|
2691
|
+
:engine=$p.engine
|
|
2692
|
+
:acct=$p.acct
|
|
2693
|
+
:host=$p.host
|
|
2694
|
+
:account=*
|
|
2695
|
+
]'''
|
|
2688
2696
|
nodes = await core.nodes(q, opts={'vars': {'valu': iden, 'p': props}})
|
|
2689
2697
|
self.len(1, nodes)
|
|
2690
2698
|
node = nodes[0]
|
|
@@ -2694,6 +2702,7 @@ class InetModelTest(s_t_utils.SynTest):
|
|
|
2694
2702
|
self.eq(node.get('engine'), 'roofroof')
|
|
2695
2703
|
self.eq(node.get('host'), host)
|
|
2696
2704
|
self.eq(node.get('acct'), ('vertex.link', 'visi'))
|
|
2705
|
+
self.len(1, await core.nodes('inet:search:query :account -> inet:service:account'))
|
|
2697
2706
|
|
|
2698
2707
|
residen = s_common.guid()
|
|
2699
2708
|
props = {
|
|
@@ -165,6 +165,7 @@ class PsModelTest(s_t_utils.SynTest):
|
|
|
165
165
|
:birth:place:name=$p."birth:place:name"
|
|
166
166
|
:death:place=$p."death:place" :death:place:loc=$p."death:place:loc"
|
|
167
167
|
:death:place:name=$p."death:place:name"
|
|
168
|
+
:service:accounts=(*, *)
|
|
168
169
|
)]'''
|
|
169
170
|
nodes = await core.nodes(q, opts=opts)
|
|
170
171
|
self.len(1, nodes)
|
|
@@ -208,6 +209,7 @@ class PsModelTest(s_t_utils.SynTest):
|
|
|
208
209
|
self.eq(node.get('death:place:name'), 'reston, va, usa, earth, sol, milkyway')
|
|
209
210
|
self.len(1, await core.nodes('ps:contact :birth:place -> geo:place'))
|
|
210
211
|
self.len(1, await core.nodes('ps:contact :death:place -> geo:place'))
|
|
212
|
+
self.len(2, await core.nodes('ps:contact :service:accounts -> inet:service:account'))
|
|
211
213
|
|
|
212
214
|
nodes = await core.nodes('''[
|
|
213
215
|
ps:achievement=*
|
|
@@ -112,7 +112,7 @@ class TelcoModelTest(s_t_utils.SynTest):
|
|
|
112
112
|
q = '''[(tel:mob:telem=$valu :time=$p.time :latlong=$p.latlong :place=$p.place :host=$p.host
|
|
113
113
|
:loc=$p.loc :accuracy=$p.accuracy :cell=$p.cell :imsi=$p.imsi :imei=$p.imei :phone=$p.phone
|
|
114
114
|
:mac=$p.mac :ipv4=$p.ipv4 :ipv6=$p.ipv6 :wifi=$p.wifi :adid=$p.adid :aaid=$p.aaid :idfa=$p.idfa
|
|
115
|
-
:name=$p.name :email=$p.email :acct=$p.acct :app=$p.app :data=$p.data)]'''
|
|
115
|
+
:name=$p.name :email=$p.email :acct=$p.acct :app=$p.app :data=$p.data :account=*)]'''
|
|
116
116
|
nodes = await core.nodes(q, opts={'vars': {'valu': guid, 'p': props}})
|
|
117
117
|
self.len(1, nodes)
|
|
118
118
|
node = nodes[0]
|
|
@@ -142,6 +142,7 @@ class TelcoModelTest(s_t_utils.SynTest):
|
|
|
142
142
|
self.eq(node.get('acct'), ('vertex.link', 'clown'))
|
|
143
143
|
self.eq(node.get('app'), softguid)
|
|
144
144
|
self.eq(node.get('data'), {'some key': 'some valu', 'BEEP': 1})
|
|
145
|
+
self.len(1, await core.nodes('tel:mob:telem :account -> inet:service:account'))
|
|
145
146
|
|
|
146
147
|
async def test_telco_imei(self):
|
|
147
148
|
async with self.getTestCore() as core:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: synapse
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.180.1
|
|
4
4
|
Summary: Synapse Intelligence Analysis Framework
|
|
5
5
|
Author-email: The Vertex Project LLC <root@vertex.link>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.11
|
|
|
20
20
|
Description-Content-Type: text/x-rst
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: pyOpenSSL<25.0.0,>=24.0.0
|
|
23
|
-
Requires-Dist: cryptography<
|
|
23
|
+
Requires-Dist: cryptography<44.0.0,>=43.0.1
|
|
24
24
|
Requires-Dist: msgpack<1.1.0,>=1.0.5
|
|
25
25
|
Requires-Dist: xxhash<3.5.0,>=1.4.4
|
|
26
26
|
Requires-Dist: lmdb<1.5.0,>=1.2.1
|