Skip to content

Commit

Permalink
Suppress ForbiddenCode errors from psalm
Browse files Browse the repository at this point in the history
We know that we are calling unsafe stuff that is the point of this app

Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Apr 1, 2022
1 parent 8526f76 commit 7563727
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@
<referencedClass name="OC\Security\CSP\ContentSecurityPolicyNonceManager" />
</errorLevel>
</UndefinedDocblockClass>
<ForbiddenCode errorLevel="suppress"/>
</issueHandlers>
</psalm>
15 changes: 0 additions & 15 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,13 @@
</UndefinedInterfaceMethod>
</file>
<file src="lib/OperatingSystems/DefaultOs.php">
<ForbiddenCode occurrences="10">
<code>shell_exec('cat /etc/resolv.conf |grep -i \'^nameserver\'|head -n1|cut -d \' \' -f2')</code>
<code>shell_exec('cat /sys/class/net/' . $iface['interface'] . '/duplex')</code>
<code>shell_exec('cat /sys/class/net/' . $iface['interface'] . '/operstate')</code>
<code>shell_exec('cat /sys/class/net/' . $iface['interface'] . '/speed')</code>
<code>shell_exec('date')</code>
<code>shell_exec('ip -o -6 addr show ' . $iface['interface'] . ' | sed -e \'s/^.*inet6 \([^ ]\+\).*/\1/\'')</code>
<code>shell_exec('ip addr show dev ' . $iface['interface'] . ' | grep "inet " | cut -d \' \' -f 6 | cut -f 1 -d \'/\'')</code>
<code>shell_exec('ip addr show dev ' . $iface['interface'] . ' | grep "link/ether " | cut -d \' \' -f 6 | cut -f 1 -d \'/\'')</code>
<code>shell_exec('ip route | awk \'/default/ { print $3 }\'')</code>
<code>shell_exec(escapeshellcmd($command))</code>
</ForbiddenCode>
<InvalidOperand occurrences="3">
<code>$matches['Available'][$i]</code>
<code>$matches['Used'][$i]</code>
<code>$matches['Value'][$i]</code>
</InvalidOperand>
</file>
<file src="lib/OperatingSystems/FreeBSD.php">
<ForbiddenCode occurrences="1">
<code>shell_exec(escapeshellcmd($command))</code>
</ForbiddenCode>
<InvalidOperand occurrences="8">
<code>$lines[0]</code>
<code>$lines[1]</code>
Expand Down

0 comments on commit 7563727

Please sign in to comment.