Arrays in Snippets Cannot be Looped Over

Hello! I have a strange issue. We’re creating a bunch of snippets. One strange behaviour we noticed is: If you are using a custom plugin, an array output won’t work on a loop.

Here’s an example. I created a plugin that merely outputs an array of strings such as []string.

Using that action on a workflow works fine. The action outputs the array and I can use that array in a Loop Action.

However, if I add that same action on a snippet, the variable is NOT available to loop over. At first I thought I had a complex array of objects and R7 was complaining about something but even an action that simply returns a list of strings won’t work. Again, in a workflow this works fine.

Two interesting behaviours:

  • R7 plugins seem to work fine. I was using the string to list plugin to test and it works fine, the variable appears to be looped over just fine. I even inspected its plugin.spec.yaml to see if it was doing anything different, but it isn’t. It simply defines an output that is an array.

  • If I am on the snippet and I edit the output (via the UI) of the action to have any change, the variable suddenly appears to be looped over.

For example, let’s say I have this output:

texts: string
some_var: string

If I change some_var to be an integer, the variable “texts” magically appears on the loop step. If I change some_var to be a string again, the variable disappears on the loop step.

Anyone has any light to shed? It seems to be a bug.

This appears to be a bug. Can you submit a support case with the information above so that we can take a look at it?

Thank you,

Eric - Rapid7