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\Image;
18
use FeedIo\Rule\Language;
19
use FeedIo\Rule\Link;
20
use FeedIo\Rule\PublicId;
21
use FeedIo\Rule\Media;
22
use FeedIo\Rule\Category;
23
use FeedIo\Rule\Logo;
24
use FeedIo\RuleSet;
25
26
class Rss extends XmlAbstract
27
{
28
29
    /**
30
     * Format version
31
     */
32
    const VERSION = '2.0';
33
34
    /**
35
     * RSS document must have a <rss> root node
36
     */
37
    const ROOT_NODE_TAGNAME = 'rss';
38
39
    /**
40
     * <channel> node contains feed's metadata
41
     */
42
    const CHANNEL_NODE_TAGNAME = 'channel';
43
44
    /**
45
     * publication date
46
     */
47
    const DATE_NODE_TAGNAME = 'pubDate';
48
49
    protected $mandatoryFields = ['channel'];
50
51
    /**
52
     * Formats the document according to the standard's specification
53
     * @param  \DOMDocument $document
54
     * @return \DOMDocument
55 3
     */
56
    public function format(\DOMDocument $document) : \DOMDocument
57 3
    {
58 3
        $rss = $document->createElement(static::ROOT_NODE_TAGNAME);
59
        $rss->setAttribute('version', static::VERSION);
60 3
61 3
        $channel = $document->createElement(static::CHANNEL_NODE_TAGNAME);
62 3
        $rss->appendChild($channel);
63
        $document->appendChild($rss);
64 3
65
        return $document;
66
    }
67
68
    /**
69
     * Tells if the parser can handle the feed or not
70
     * @param  Document $document
71
     * @return boolean
72 7
     */
73 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...
74 7
    {
75
        if (!isset($document->getDOMDocument()->documentElement->tagName)) {
76
            return false;
77 7
        }
78
        return static::ROOT_NODE_TAGNAME === $document->getDOMDocument()->documentElement->tagName;
79
    }
80
81
    /**
82
     * @param  DOMDocument $document
83
     * @return \DomElement
84 7
     */
85
    public function getMainElement(\DOMDocument $document) : \DOMElement
86 7
    {
87
        return $document->documentElement->getElementsByTagName(static::CHANNEL_NODE_TAGNAME)->item(0);
88
    }
89
90
    /**
91
     * @return \FeedIo\RuleSet
92 7
     */
93
    public function buildFeedRuleSet() : RuleSet
94 7
    {
95 7
        $ruleSet = $this->buildBaseRuleSet();
96 7
        $ruleSet->add(new Language())
97
            ->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME), ['lastBuildDate', 'lastPubDate']);
98 7
99
        return $ruleSet;
100
    }
101
102
    /**
103
     * @return \FeedIo\RuleSet
104 10
     */
105
    public function buildItemRuleSet() : RuleSet
106 10
    {
107
        $ruleSet = $this->buildBaseRuleSet();
108 10
        $ruleSet
109 10
            ->add(new Author(), ['dc:creator'])
110 10
            ->add(new PublicId())
111 10
            ->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME), ['lastBuildDate', 'lastPubDate'])
112 10
            ->add(new Image())
113 10
            ->add(new Media(), ['media:thumbnail'])
114
            ->add(new Media(), ['media:group'])
115
            ->add(new Media(), ['media:content'])
116 10
            ;
117
118
        return $ruleSet;
119
    }
120
121
    /**
122 11
     * @return \FeedIo\RuleSet
123
     */
124 11
    protected function buildBaseRuleSet() : RuleSet
125
    {
126 11
        $ruleSet = parent::buildBaseRuleSet();
127 11
        $ruleSet
128 11
            ->add(new Link())
129 11
            ->add(new Description())
130
            ->add(new Category())
131 11
            ->add(new Logo());
132
133
        return $ruleSet;
134
    }
135
}
136