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

AttributeError: 'NoneType' object has no attribute 'get_secret_accessor' #12

Closed
granwizzard opened this issue Aug 18, 2020 · 1 comment

Comments

@granwizzard
Copy link

I'm receiving this error when I'm importing the module and execute the init.

import msticnb as nb
nb.init(query_provider="AzureSentinel")

This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.

AttributeError Traceback (most recent call last)
in
1 import msticnb as nb
----> 2 nb.init(query_provider="AzureSentinel")

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticnb\data_providers.py in init(query_provider, providers, **kwargs)
443
444 """
--> 445 d_provs = DataProviders(query_provider, providers, **kwargs)
446 print(f"Loaded providers: {', '.join(d_provs.providers.keys())}")
447 msticnb = sys.modules["msticnb"]

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticnb\data_providers.py in call(self, *args, **kwargs)
57 or self.instance.args != args
58 ):
---> 59 self.instance = self.wrapped_cls(*args, **kwargs)
60 self.instance.kwargs = kwargs
61 self.instance.args = args

c:\Users\dp\Jupyter\MyJupyter\venv\lib\site-packages\msticnb\data_providers.py in init(self, query_provider, providers, **kwargs)
153 for provider in sorted(self.provider_names):
154 try:
--> 155 self.add_provider(provider, **kwargs)
156 except MsticnbDataProviderError as err:
157 print(f"Data provider {provider} could not be added.")

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticnb\data_providers.py in add_provider(self, provider, **kwargs)
220 new_provider = self._query_prov(provider, prov_def, **kwargs)
221 else:
--> 222 new_provider = self._no_connect_prov(provider, prov_def, **kwargs)
223 else:
224 raise MsticnbDataProviderError(f"Provider {provider} not recognized.")

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticnb\data_providers.py in _no_connect_prov(self, provider, provider_defn, **kwargs)
343 prov_args = provider_defn.get_config()
344 # Instatiate the provider
--> 345 return provider_defn.prov_class(prov_args)
346
347 # Helper methods

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticpy\sectools\tilookup.py in init(self, primary_providers, secondary_providers, providers)
84 self.add_provider(prov, primary=False)
85 if not (primary_providers or secondary_providers):
---> 86 self._load_providers()
87
88 self._all_providers = ChainMap(self._secondary_providers, self._providers)

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticpy\sectools\tilookup.py in _load_providers(self)
243 def _load_providers(self):
244 """Load provider classes based on config."""
--> 245 prov_settings = get_provider_settings()
246
247 for provider_entry, settings in prov_settings.items():

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticpy\common\provider_settings.py in get_provider_settings(config_section)
87 name=provider,
88 description=item_settings.get("Description"),
---> 89 args=_get_setting_args(
90 config_section=config_section,
91 provider_name=provider,

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticpy\common\provider_settings.py in _get_setting_args(config_section, provider_name, prov_args)
124 "subscriptionid": "subscription_id",
125 }
--> 126 return _get_settings(
127 config_section=config_section,
128 provider_name=provider_name,

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticpy\common\provider_settings.py in _get_settings(config_section, provider_name, conf_group, name_map)
177 elif isinstance(arg_value, dict):
178 try:
--> 179 setting_dict[target_name] = _fetch_setting(
180 config_section, provider_name, arg_name, arg_value
181 ) # type: ignore

c:\Users\dp\MyJupyter\venv\lib\site-packages\msticpy\common\provider_settings.py in _fetch_setting(config_section, provider_name, arg_name, config_setting)
211 )
212 config_path = [config_section, provider_name, "Args", arg_name]
--> 213 sec_func = _SECRETS_CLIENT.get_secret_accessor( # type:ignore
214 ".".join(config_path)
215 )

AttributeError: 'NoneType' object has no attribute 'get_secret_accessor'

To Reproduce
Steps to reproduce the behavior:

  1. Open VScode
  2. Create venv
    3 Add Microsoft Python Extension
    4 Create file x.ipynb
    5 Execute on the jupyter cell:
    import msticnb as nb
    nb.init(query_provider="AzureSentinel")
    6 Authenticate against Azure
    7 Error.

Expected behavior
Read the key from msticpyconfig.yaml and continue with init.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • VSCode
    Version: 1.48.0 (user setup)
    Commit: db40434f562994116e5b21c24015a2e40b2504e6
    Date: 2020-08-13T07:50:42.600Z
    Electron: 7.3.2
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0

  • Python 3.8.3

  • OS: Windows_NT x64 10.0.19041

  • Chrome: 78.0.3904.130

Please let me know if any other info is needed.

@granwizzard
Copy link
Author

This was an issue defining the key vault parameters on mstcipyconfig.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant