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

during dump_redacted_config(): config keys may not be dictionaries #231

Closed
cedricbu opened this issue Oct 29, 2024 · 0 comments
Closed

during dump_redacted_config(): config keys may not be dictionaries #231

cedricbu opened this issue Oct 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@cedricbu
Copy link
Collaborator

INFO:Redacting sensitive information from configuration ./config/config-template-nessus.yaml
Traceback (most recent call last):
  File "/home/cedric/prodsec/rapidast/rapidast/./rapidast.py", line 292, in <module>
    run()
  File "/home/cedric/prodsec/rapidast/rapidast/./rapidast.py", line 232, in run
    dump_rapidast_redacted_configs(config_file, full_result_dir_path)
  File "/home/cedric/prodsec/rapidast/rapidast/./rapidast.py", line 183, in dump_rapidast_redacted_configs
    if not dump_redacted_config(main_config_file_location, destination_dir):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cedric/prodsec/rapidast/rapidast/./rapidast.py", line 158, in dump_redacted_config
    if config[key].get("authentication") and config[key]["authentication"].get("parameters"):
       ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

This happens when loading the currently proposed config nessus template (https://github.com/RedHatProductSecurity/rapidast/blob/nessus/config/config-template-nessus.yaml).

The issue is that some root config (e.g.: general in particular) may be empty, which is translated into None by the YAML translator.

The following modification would resolve it, I think:

156         logging.info(f"Redacting sensitive information from configuration {config_file_location}")                                                                                         
157         for key in config.keys():                                                                                                                                                          
158             if isinstance(config[key], dict) and config[key].get("authentication") and config[key]["authentication"].get("parameters"):                                                                                      
159                 for param in config[key]["authentication"]["parameters"]:                                                                                                                  
160                     config[key]["authentication"]["parameters"][param] = "*****"  
@sfowl sfowl self-assigned this Oct 29, 2024
@sfowl sfowl added the bug Something isn't working label Oct 29, 2024
@sfowl sfowl closed this as completed Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants