cisagov / ansible-role-megazord-composition

Creative Commons Zero v1.0 Universal
1 stars 1 forks source link

SourcePoint sometimes has an internal error #10

Closed D3cl4n closed 2 years ago

D3cl4n commented 2 years ago

🐛 Summary

What's wrong? Please be specific.

Sometimes SourcePoint throws an internal error, when running a command that should not cause issues. Often running the same command again will successfully generate the profile.

To reproduce

Steps to reproduce the behavior:

  1. Run your SourcePoint command multiple times. (The number of times varies but is usually ~13 or so

Expected behavior

Expected behavior is simply generating the c2 profile.

What did you expect to happen that didn't?

The profile was not generated because of the above bug

Any helpful log output or screenshots

Paste the results here:

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/Tylous/SourcePoint/Loader.GenerateOptions(0x7ffc03bed433, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /mnt/c/Users/D3cl4n/SourcePoint/Loader/Loader.go:94 +0xd2e
main.main()
        /mnt/c/Users/D3cl4n/SourcePoint/SourcePoint.go:252 +0xaf8

Add any screenshots of the problem here.

hsfetty commented 2 years ago

This is fixed by adding the task:

- name: Edit Loader.go to remove line
  ansible.builtin.replace:
    path: /tools/SourcePoint/Loader/Loader.go
    regexp: 'PE\[5]'
    replace: 'PE[len(PE)-3]'

to the SourcePoint Ansible role. This edits the Loader.go file to use correct indexing for the variable array and no longer throws an error.