Issues (38)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/FeedIo/Standard/Rss.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Standard;
12
13
use DOMDocument;
14
use FeedIo\Reader\Document;
15
use FeedIo\Rule\Author;
16
use FeedIo\Rule\Description;
17
use FeedIo\Rule\Language;
18
use FeedIo\Rule\Link;
19
use FeedIo\Rule\PublicId;
20
use FeedIo\Rule\Media;
21
use FeedIo\Rule\Category;
22
use FeedIo\Rule\Logo;
23
use FeedIo\RuleSet;
24
25
class Rss extends XmlAbstract
26
{
27
28
    /**
29
     * Format version
30
     */
31
    const VERSION = '2.0';
32
33
    /**
34
     * RSS document must have a <rss> root node
35
     */
36
    const ROOT_NODE_TAGNAME = 'rss';
37
38
    /**
39
     * <channel> node contains feed's metadata
40
     */
41
    const CHANNEL_NODE_TAGNAME = 'channel';
42
43
    /**
44
     * publication date
45
     */
46
    const DATE_NODE_TAGNAME = 'pubDate';
47
48
    protected $mandatoryFields = ['channel'];
49
50
    /**
51
     * Formats the document according to the standard's specification
52
     * @param  \DOMDocument $document
53
     * @return \DOMDocument
54
     */
55 3
    public function format(\DOMDocument $document) : \DOMDocument
56
    {
57 3
        $rss = $document->createElement(static::ROOT_NODE_TAGNAME);
58 3
        $rss->setAttribute('version', static::VERSION);
59
60 3
        $channel = $document->createElement(static::CHANNEL_NODE_TAGNAME);
61 3
        $rss->appendChild($channel);
62 3
        $document->appendChild($rss);
63
64 3
        return $document;
65
    }
66
67
    /**
68
     * Tells if the parser can handle the feed or not
69
     * @param  Document $document
70
     * @return boolean
71
     */
72 7 View Code Duplication
    public function canHandle(Document $document) : bool
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
73
    {
74 7
        if (!isset($document->getDOMDocument()->documentElement->tagName)) {
75
            return false;
76
        }
77 7
        return static::ROOT_NODE_TAGNAME === $document->getDOMDocument()->documentElement->tagName;
78
    }
79
80
    /**
81
     * @param  DOMDocument $document
82
     * @return \DomElement
83
     */
84 7
    public function getMainElement(\DOMDocument $document) : \DOMElement
85
    {
86 7
        return $document->documentElement->getElementsByTagName(static::CHANNEL_NODE_TAGNAME)->item(0);
87
    }
88
89
    /**
90
     * @return \FeedIo\RuleSet
91
     */
92 7
    public function buildFeedRuleSet() : RuleSet
93
    {
94 7
        $ruleSet = $this->buildBaseRuleSet();
95 7
        $ruleSet->add(new Language())
96 7
            ->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME));
97
98 7
        return $ruleSet;
99
    }
100
101
    /**
102
     * @return \FeedIo\RuleSet
103
     */
104 10
    public function buildItemRuleSet() : RuleSet
105
    {
106 10
        $ruleSet = $this->buildBaseRuleSet();
107
        $ruleSet
108 10
            ->add(new Author(), ['dc:creator'])
109 10
            ->add(new PublicId())
110 10
            ->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME), ['lastBuildDate', 'lastPubDate'])
111 10
            ->add(new Media(), ['media:thumbnail'])
112 10
            ->add(new Media(), ['media:group'])
113 10
            ->add(new Media(), ['media:content'])
114
            ;
115
116 10
        return $ruleSet;
117
    }
118
119
    /**
120
     * @return \FeedIo\RuleSet
121
     */
122 11
    protected function buildBaseRuleSet() : RuleSet
123
    {
124 11
        $ruleSet = parent::buildBaseRuleSet();
125
        $ruleSet
126 11
            ->add(new Link())
127 11
            ->add(new Description())
128 11
            ->add(new Category())
129 11
            ->add(new Logo());
130
131 11
        return $ruleSet;
132
    }
133
}
134