
Research
/Security News
11 Malicious Go Packages Distribute Obfuscated Remote Payloads
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
hierarchy-closure
Advanced tools
Maintain simple hierarchy by adding members in any order.
npm install --save hierarchy-closure
This constructs a hierarchy.
// create hierarchy
myHierarchy = Hierarchy.create()
Adding parent/child pairs builds a structure called myHierarchy.roots
with the trees of added parent/child pairs.
It also creates two closures:
You can fill in your tree in any order and get the same closures:
// populating myHierarchy created above...
// add single entry B->C
myHierarchy.add('B', 'C')
// add single entry B->C
myHierarchy.add('B', 'C')
// add child C->D
myHierarchy.add('C', 'D')
// add disconnected entry F->G
myHierarchy.add('F', 'G')
// add parent E->F
myHierarchy.add('E', 'F')
// add middle D->E
myHierarchy.add('D', 'E')
// add top A->B
myHierarchy.add('A', 'B')
// add bottom G->H
myHierarchy.add('G', 'H')
// add redundant entry (no effect)
myHierarchy.add('A', 'B')
{ add: myHierarchy.add,
roots: {A: {B: {C: {D: {E: {F: {G: {H: {}}}}}}}}},
parents: {
A: [],
B: ['A'],
C: ['B', 'A'],
D: ['C', 'B', 'A'],
E: ['D', 'C', 'B', 'A'],
F: ['E', 'D', 'C', 'B', 'A'],
G: ['F', 'E', 'D', 'C', 'B', 'A'],
H: ['G', 'F', 'E', 'D', 'C', 'B', 'A']
},
children: {
A: ['B', 'C', 'D', 'E', 'F', 'G', 'H'],
B: ['C', 'D', 'E', 'F', 'G', 'H'],
C: ['D', 'E', 'F', 'G', 'H'],
D: ['E', 'F', 'G', 'H'],
E: ['F', 'G', 'H'],
F: ['G', 'H'],
G: ['H'],
H: []
}
}
This calls you callback function with parent/child pairs starting with any children:
// create hierarchy
h2 = Hierarchy.create()
h2.add('A', 'AB1')
h2.add('AB1', 'AB1C1')
h2.add('AB1C1', 'AB1C1D1')
h2.add('AB1C1', 'AB1C1D2')
h2.add('AB1', 'AB1C2')
h2.add('AB1C2', 'AB1C2D1')
h2.add('A', 'AB2')
h2.add('AB2', 'AB2C1')
h2.add('AB2C1', 'AB2C1D1')
const seen = []
Hierarchy.depthFirst(t.roots, (l, r) => seen.push([l, r]))
[
[ "AB1C1D1", "AB1C1" ],
[ "AB1C1D2", "AB1C1" ],
[ "AB1C1", "AB1" ],
[ "AB1C2D1", "AB1C2" ],
[ "AB1C2", "AB1" ],
[ "AB1", "A" ],
[ "AB2C1D1", "AB2C1" ],
[ "AB2C1", "AB2" ],
[ "AB2", "A" ]
]
FAQs
keep closure of parents and children in hierarchy
The npm package hierarchy-closure receives a total of 671 weekly downloads. As such, hierarchy-closure popularity was classified as not popular.
We found that hierarchy-closure demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).