Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYN-7653: Migration for invalid it:sec:cpe nodes #3815

Merged
merged 73 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
fe14e9a
wip
MichaelSquires Jul 16, 2024
794fc52
wip
MichaelSquires Jul 16, 2024
68681c4
wip
MichaelSquires Jul 17, 2024
adb26c6
wip
MichaelSquires Jul 17, 2024
f026ab6
SpooledDict
MichaelSquires Jul 17, 2024
a44d665
wip
MichaelSquires Jul 17, 2024
590cafc
wip
MichaelSquires Jul 17, 2024
a5ea422
wip
MichaelSquires Jul 19, 2024
a33e875
wip
MichaelSquires Jul 19, 2024
f15ad17
wip
MichaelSquires Jul 19, 2024
6072a74
Merge remote-tracking branch 'origin/master' into blackout/SYN-7653/i…
MichaelSquires Jul 19, 2024
559c2e1
wip
MichaelSquires Jul 19, 2024
631e4a8
wip
MichaelSquires Jul 20, 2024
3c493cf
wip
MichaelSquires Jul 20, 2024
00950cc
wip
MichaelSquires Jul 20, 2024
b3a98e6
wip
MichaelSquires Jul 20, 2024
c7f625b
wip
MichaelSquires Jul 20, 2024
7a0d132
wip
MichaelSquires Jul 20, 2024
0625952
wip
MichaelSquires Jul 20, 2024
9bd68f5
wip
MichaelSquires Jul 22, 2024
3e7f42e
wip
MichaelSquires Jul 22, 2024
c0ebba5
wip
MichaelSquires Jul 22, 2024
e10e52d
wip
MichaelSquires Jul 22, 2024
2c4e393
wip
MichaelSquires Jul 22, 2024
1845160
ndef wip
MichaelSquires Jul 23, 2024
f313c46
wip
MichaelSquires Jul 23, 2024
ba60b4d
wip
MichaelSquires Jul 23, 2024
7c8e576
stormcov
MichaelSquires Jul 23, 2024
aa81856
wip
MichaelSquires Jul 23, 2024
731becb
wip
MichaelSquires Jul 24, 2024
f852a30
wip
MichaelSquires Jul 24, 2024
c7f0d6d
wip
MichaelSquires Jul 24, 2024
bcdf7f3
wip
MichaelSquires Jul 24, 2024
13dd7a0
wip
MichaelSquires Jul 25, 2024
76a423a
wip
MichaelSquires Jul 25, 2024
2e10ca5
wip
MichaelSquires Jul 25, 2024
83d88c3
wip
MichaelSquires Jul 25, 2024
00d53aa
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Jul 25, 2024
a10efcc
update test
MichaelSquires Jul 25, 2024
eebfe87
wip
MichaelSquires Jul 26, 2024
c5e8185
wip
MichaelSquires Jul 26, 2024
6ecc735
feedback; cov
MichaelSquires Jul 26, 2024
655dd38
wip
MichaelSquires Jul 26, 2024
0e44550
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Jul 26, 2024
eb0a0fb
Update .coveragerc
MichaelSquires Jul 29, 2024
ad43859
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Jul 29, 2024
cf0bc08
feedback
MichaelSquires Jul 29, 2024
4ad4bf6
Merge branch 'blackout/SYN-7653/it-sec-cpe-migration' of github.com:v…
MichaelSquires Jul 29, 2024
ceb5df3
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Jul 31, 2024
130ae58
feedback
MichaelSquires Aug 2, 2024
19befc0
wip
MichaelSquires Aug 2, 2024
266d98b
docker branch build
MichaelSquires Aug 2, 2024
8daefb7
Merge remote-tracking branch 'origin/master' into blackout/SYN-7653/i…
MichaelSquires Aug 2, 2024
3e8b31e
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Aug 5, 2024
1e2ff88
feedback
MichaelSquires Aug 8, 2024
806cad9
Merge remote-tracking branch 'origin/master' into blackout/SYN-7653/i…
MichaelSquires Aug 8, 2024
eb2288c
Merge branch 'blackout/SYN-7653/it-sec-cpe-migration' of github.com:v…
MichaelSquires Aug 8, 2024
76d4ea4
bool to boolean
MichaelSquires Aug 8, 2024
e13dc25
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
vEpiphyte Aug 17, 2024
4fb670d
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Aug 28, 2024
a83f3b8
feedback
MichaelSquires Aug 29, 2024
cf07874
remove temp configs
MichaelSquires Aug 29, 2024
7424b2e
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Aug 29, 2024
341510c
Update changes/88b706497043eda897376f772af55b88.yaml
MichaelSquires Sep 4, 2024
a98b925
Merge remote-tracking branch 'origin/master' into blackout/SYN-7653/i…
MichaelSquires Sep 4, 2024
ffafdec
wip
MichaelSquires Sep 4, 2024
7166329
Migrate extended properties
MichaelSquires Sep 4, 2024
6747287
0.2.27 -> 0.2.28
MichaelSquires Sep 4, 2024
0f3eebe
wip
MichaelSquires Sep 4, 2024
e478a64
wip
MichaelSquires Sep 4, 2024
51bb546
Merge branch 'master' into blackout/SYN-7653/it-sec-cpe-migration
MichaelSquires Sep 4, 2024
e68372b
wip
MichaelSquires Sep 4, 2024
c58a16d
Merge branch 'blackout/SYN-7653/it-sec-cpe-migration' of github.com:v…
MichaelSquires Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[report]
omit =
*/synapse/tests/test_*

; Uncomment this section to enable code coverage of storm files in the
; storm_dirs directory listed below. This is disabled by default right now
; because it's pretty intensive and imposes a large perf hit on the already slow
; tests.
;[run]
;plugins = synapse.utils.stormcov

[synapse.utils.stormcov]
storm_dirs = synapse/assets/storm
25 changes: 25 additions & 0 deletions changes/0d926b9f9e5e7d7c790015c2495dd8d8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
desc: Migrate invalid ``it:sec:cpe`` nodes if possible. Expanding on the
migration helpers added in v2.170.0, this migration will attempt to fix and
migrate invalid ``it:sec:cpe`` nodes.

Migration of these nodes will only be successful if one of the CPE2.3 (primary
property) or the CPE2.2 (``:v2_2``) strings are valid CPEs. If both CPE
strings are invalid, the node will be removed from the cortex and stored in a
queue (``model_0_2_28:nodes``). All references to these invalid nodes will
also be removed and stored in a separate queue (``model_0_2_28:nodes:refs``).
Finally, all edges to these invalid nodes will be removed and stored in a
queue (``model_0_2_28:nodes:edges``).

The structure of items in these queues are opaque. The intent is for Power-Ups
to be able to process these queues in an attempt to fix the invalid nodes on a
per Power-Up basis (the idea being that Power-Up data vendors probably make
the same mistake consistently).

During migration or removal of invalid ``it:sec:cpe`` nodes, referencing nodes
with readonly properties will be removed and stored in the
``model_0_2_28:nodes:refs`` queue. We are unable to automatically migrate
these nodes due to the dynamic nature of their construction.
prs: []
type: migration
...
6 changes: 6 additions & 0 deletions changes/78a597dcd9eb9803a3cc240410eab395.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
desc: Added ``opts`` field to ``model:type`` Storm type. This field contains the property
type options as defined in the data model.
prs: []
type: feat
...
7 changes: 7 additions & 0 deletions changes/88b706497043eda897376f772af55b88.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
desc: 'Updated Storm coverage tracker to support ``pragma: no cover`` for ignoring
single lines of code and ``pragma: no cover start``/``pragma: no cover stop`` for
ignoring multi-line blocks of Storm code.'
prs: []
type: feat
...
6 changes: 6 additions & 0 deletions changes/cb62250eded6427c7bcfce4602b867d7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
desc: Storm lists now have a ``remove`` method that can be used to remove a single
item from the list without having to iterate through the list.
prs: []
type: feat
...
22 changes: 22 additions & 0 deletions synapse/assets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os

import synapse.common as s_common

dirname = os.path.dirname(__file__)

def getStorm(*names):
'''
Return a storm file from the synapse storm folder.

Example:

text = storm.get('migrate.storm')
await core.callStorm(text)

Example #2:
text = storm.get('migrations', 'model-0.2.28.storm')
await core.callStorm(text)
'''
with s_common.genfile(dirname, 'storm', *names) as fp:
text = fp.read()
return text.decode('utf8')
Loading
Loading