Skip to content

remove invalid chars from states dump#1771

Closed
fraenki wants to merge 1 commit intoopnsense:masterfrom
fraenki:kill_states
Closed

remove invalid chars from states dump#1771
fraenki wants to merge 1 commit intoopnsense:masterfrom
fraenki:kill_states

Conversation

@fraenki
Copy link
Member

@fraenki fraenki commented Aug 10, 2017

In this example I've got the following state in Firewall->Diagnostics->States Dump that I've wanted to remove:

Int 	Proto 	Source -> Router -> Destination 	State
all 	carp 	224.0.0.18 <- 10.0.0.1 	NO_TRAFFIC:SINGLE

Unfortunately, when clicking the "Remove" button nothing happened and I was seing the following error message in my browser's console:

POST: action=remove&srcip=224.0.0.18%3C&dstip=10.0.0.1
Response: invalid input

The HTML code looks like this:

<tr class="r224_0_0_18 &lt;10_0_0_1">
  <td>all</td>
  <td>carp</td>
  <td>224.0.0.18 &lt;- 10.0.0.1</td>
  <td>NO_TRAFFIC:SINGLE</td>
  <td>
    <a href="#" data-rowid="r224_0_0_18 &lt;10_0_0_1" data-srcip="224.0.0.18 &lt;" data-dstip="10.0.0.1" class="act_del btn btn-default" title="Remove all state entries from 224.0.0.18 &lt; to 10.0.0.1"><span class="glyphicon glyphicon-remove"></span></a>
  </td>
</tr>

Apparently the parameter srcip is wrong, because it includes an <.
This patch removes invalid characters. I'm not sure it is the best way to do it, but it fixes the issue for me. :)

@AdSchellevis
Copy link
Member

@fraenki I think we better switch to configd here, we already have a call for this, but may need to include a filter there and perhaps a rowlimit.

configctl filter list states json

As soon as I can find some time I will fix this page.

$iface = convert_real_interface_to_friendly_descr($iface);

/* break up info and extract $srcip and $dstip */
$charmask = array(' ','\t','\n','\r','\0','\x0B','<','>');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work? Usually single quotes support a limited set of escape sequences

AdSchellevis added a commit that referenced this pull request Aug 12, 2017
@AdSchellevis
Copy link
Member

@fraenki can you test 00fdadc + 39bb03f? that should do the trick.

@fraenki
Copy link
Member Author

fraenki commented Aug 12, 2017

@AdSchellevis Tested; looks good to me, the GUI is working as expected for me and I was able to kill states.

I'm closing this PR because it's obsolete now.

@fraenki fraenki closed this Aug 12, 2017
fichtner pushed a commit that referenced this pull request Aug 28, 2017
PR: #1771

(cherry picked from commit 00fdadc)
(cherry picked from commit 39bb03f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants