Issues (4)

Security Analysis    no request data  

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/helpers.php (2 issues)

Severity
1
<?php
2
3
if (!function_exists('d_make_btn')) {
4
5
    /**
6
     * 生成 button 辅助函数
7
     *
8
     * @param string $title     按钮文案
9
     * @param string $actionURL 按钮跳转地址
10
     *
11
     * @return array
12
     */
13
    function d_make_btn($title, $actionURL)
14
    {
15 3
        if (!is_string($title) || !is_string($actionURL)) {
16 1
            throw new \InvalidArgumentException('wrong btn params');
17
        }
18 3
        return compact('title', 'actionURL');
19
    }
20
}
21
22
if (!function_exists('d_make_link')) {
23
24
    /**
25
     * 生成 link 辅助函数
26
     *
27
     * @param string $title      链接标题
28
     * @param string $messageURL 跳转链接
29
     * @param string $picURL     图片地址
30
     *
31
     * @return array
32
     */
33
    function d_make_link($title, $messageURL, $picURL)
34
    {
35 2
        if (!is_string($title) || !is_string($messageURL) || !is_string($picURL)) {
36 1
            throw new \InvalidArgumentException('wrong link params');
37
        }
38 2
        return compact('title', 'messageURL', 'picURL');
39
    }
40
}
41
42
if (!function_exists('d_action_card')) {
43
44
    /**
45
     * 快速生成 action card 辅助函数
46
     *
47
     * @param string $title       标题
48
     * @param string $text        markdown 格式摘要
49
     * @param string $singleTitle 单个按钮文案
50
     * @param string $singleURL   按钮跳转地址
51
     *
52
     * @return \DingRobot\Message\ActionCard
53
     */
54
    function d_action_card($title, $text, $singleTitle, $singleURL)
55
    {
56 1
        return \DingRobot\Ding::actionCard($title)->text($text)->singleTitle($singleTitle)
57 1
            ->singleURL($singleURL);
58
    }
59
}
60
61
if (!function_exists('d_action_card_btn')) {
62
63
    /**
64
     * 快速生成 action_card_btn 辅助函数
65
     *
66
     * @param string $title 标题
67
     * @param string $text  markdown 格式摘要
68
     * @param array  $btns  按钮
69
     *
70
     * @return \DingRobot\Message\ActionCardBtn
71
     */
72
    function d_action_card_btn($title, $text, array $btns)
73
    {
74 1
        return \DingRobot\Ding::actionCardBtn($title)->text($text)->btns($btns);
0 ignored issues
show
Bug Best Practice introduced by
The expression return DingRobot\Ding::a...ext($text)->btns($btns) returns the type DingRobot\Message\ActionCard which is incompatible with the documented return type DingRobot\Message\ActionCardBtn.
Loading history...
The method btns() does not exist on DingRobot\Message\ActionCard. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

74
        return \DingRobot\Ding::actionCardBtn($title)->text($text)->/** @scrutinizer ignore-call */ btns($btns);
Loading history...
75
    }
76
}
77
78
if (!function_exists('d_feed_card')) {
79
80
    /**
81
     * 快速生成 action card 辅助函数
82
     *
83
     * @param array $links 链接
84
     *
85
     * @return \DingRobot\Message\FeedCard
86
     */
87
    function d_feed_card(array $links)
88
    {
89 1
        return \DingRobot\Ding::feedCard($links);
90
    }
91
}
92
93
if (!function_exists('d_link')) {
94
95
    /**
96
     * 快速生成 Link 辅助函数
97
     *
98
     * @param string      $title      标题
99
     * @param string      $text       markdown 格式摘要
100
     * @param string      $messageUrl 点击消息跳转的URL
101
     * @param string|null $picUrl     图片地址
102
     *
103
     * @return \DingRobot\Message\Link
104
     */
105
    function d_link($title, $text, $messageUrl, $picUrl = '')
106
    {
107 1
        return \DingRobot\Ding::link($title)->text($text)->messageUrl($messageUrl)->picUrl($picUrl);
108
    }
109
}
110
111
if (!function_exists('d_markdown')) {
112
113
    /**
114
     * 快速生成 Markdown 辅助函数
115
     *
116
     * @param string $title 标题
117
     * @param string $text  markdown 格式摘要
118
     *
119
     * @return \DingRobot\Message\Markdown
120
     */
121
    function d_markdown($title, $text)
122
    {
123 1
        return \DingRobot\Ding::markdown($title)->text($text);
124
    }
125
}
126
127
if (!function_exists('d_text')) {
128
129
    /**
130
     * 快速生成 Text 辅助函数
131
     *
132
     * @param string $content 内容
133
     *
134
     * @return \DingRobot\Message\Text
135
     */
136
    function d_text($content)
137
    {
138 2
        return \DingRobot\Ding::text($content);
139
    }
140
}
141
142
if (!function_exists('d_web_hook')) {
143
144
    /**
145
     * 设置 或者 获取 web hook 地址
146
     *
147
     * @param string|null $web_hook_val web hook 地址
148
     *
149
     * @return mixed
150
     */
151
    function d_web_hook($web_hook_val = null)
152
    {
153 1
        static $web_hook;
154
155 1
        if ($web_hook_val) {
156 1
            $web_hook = $web_hook_val;
157
        }
158
159 1
        return $web_hook;
160
    }
161
}