Skip to content

[Bug] navlayers initialization errors out #60

@pljoel

Description

@pljoel

Expected Behavior

A navigation layer object should be created when passing a name and a domain to mitreattack.navlayers.layer

Actual Behavior

The program errors out since in the init method uses self.__data (double underscore), but the rest of the code uses self._data (single underscore)

Steps to Reproduce the Problem

Follow example 2 of https://github.com/mitre-attack/mitreattack-python/tree/master/mitreattack/navlayers/core#creating-layers-programmatically

  1. Init a navigation layer with a name and a domain
import mitreattack.navlayers as navlayers

layer_example = navlayers.Layer(name="example", domain="enterprise-attack")
Traceback (most recent call last):
  File "/Users/me/test/test.py", line 3, in test
    layer_example = navlayers.Layer(name="example", domain="enterprise-attack")
  File "/Users/me/.local/share/virtualenvs/test-XrAZKEUD/lib/python3.8/site-packages/mitreattack/navlayers/core/layer.py", line 19, in __init__
    self._build()
  File "/Users/me/.local/share/virtualenvs/test-XrAZKEUD/lib/python3.8/site-packages/mitreattack/navlayers/core/layer.py", line 82, in _build
    self.__layer = _LayerObj(self._data['name'],  self._data['domain'])
AttributeError: 'Layer' object has no attribute '_data'

Possible Solution

Change self.__data (double underscore) to self._data (single underscore).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions