This file is indexed.

/usr/share/icingaweb2/modules/monitoring/test/php/regression/Bug6088Test.php is in icingaweb2-module-monitoring 2.1.0-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

namespace Tests\Icinga\Regression;

use Icinga\Test\BaseTestCase;
use Icinga\Module\Monitoring\Command\IcingaCommand;
use Icinga\Module\Monitoring\Command\Renderer\IcingaCommandFileCommandRenderer;


/**
 * A command that has a hardcoded parameter with newlines
 */
class Bug6088Command extends IcingaCommand
{
    public function getParameterWithCarriageReturnAndLineFeed()
    {
        return "foo\r\nbar";
    }

    public function getBug()
    {
        return '6088';
    }
}


/**
 * A subclass of IcingaCommandFileCommandRenderer to utiliseIcingaCommandFileCommandRenderer
 * to render an instance of Bug6088Command
 */
class Bug6088CommandFileCommandRenderer extends IcingaCommandFileCommandRenderer
{
    public function renderBug6088(Bug6088Command $command)
    {
        return 'SOLVE_BUG;' . $command->getBug() . ';' . $command->getParameterWithCarriageReturnAndLineFeed();
    }
}


/**
 * Class Bug6088
 *
 * Multi-line comments don't work
 *
 * @see https://dev.icinga.org/issues/6088
 */
class Bug6088Test extends BaseTestCase
{
    public function testWhetherCommandParametersWithMultipleLinesAreProperlyEscaped()
    {
        $command = new Bug6088Command();
        $renderer = new Bug6088CommandFileCommandRenderer();
        $commandString = $renderer->render($command);

        $this->assertEquals(
            'SOLVE_BUG;6088;foo\r\nbar',
            substr($commandString, strpos($commandString, ' ') + 1),
            'Command parameters with multiple lines are not properly escaped'
        );
    }
}