Issues (64)

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.

helpers.php (2 issues)

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
2
/**
3
 * Theme helper functions.
4
 *
5
 * @package WordPress_GitHub_SYnc
6
 */
7
8
/**
9
 * Returns the HTML markup to view the current post on GitHub.
10
 *
11
 * @return string
12
 */
13
function get_the_github_view_link() {
14 1
	return '<a href="' . get_the_github_view_url() . '">' . apply_filters( 'wpghs_view_link_text', __( 'View this post on GitHub.', 'wp-github-sync' ) ) . '</a>';
15
}
16
17
/**
18
 * Returns the URL to view the current post on GitHub.
19
 *
20
 * @return string
21
 */
22
function get_the_github_view_url() {
23 2
	$wpghs_post = new WordPress_GitHub_Sync_Post( get_the_ID(), WordPress_GitHub_Sync::$instance->api() );
24
25 2
	return $wpghs_post->github_view_url();
26
}
27
28
/**
29
 * Returns the HTML markup to edit the current post on GitHub.
30
 *
31
 * @return string
32
 */
33
function get_the_github_edit_link() {
34 1
	return '<a href="' . get_the_github_edit_url() . '">' . apply_filters( 'wpghs_edit_link_text', __( 'Edit this post on GitHub.', 'wp-github-sync' ) ) . '</a>';
35
}
36
37
/**
38
 * Returns the URL to edit the current post on GitHub.
39
 *
40
 * @return string
41
 */
42
function get_the_github_edit_url() {
43 2
	$wpghs_post = new WordPress_GitHub_Sync_Post( get_the_ID(), WordPress_GitHub_Sync::$instance->api() );
44
45 2
	return $wpghs_post->github_edit_url();
46
}
47
48
49
/**
50
 * Common WPGHS function with attributes and shortcode
51
 *   - type: 'link' (default) to return a HTML anchor tag with text, or 'url' for bare URL.
52
 *   - target: 'view' (default) or 'edit' to return the respective link/url.
53
 *   - text: text to be included in the link. Ignored if type='url'.
54
 *
55
 * Returns either a HTML formatted anchor tag or the bare URL of the current post on GitHub.
56
 *
57
 * @return string
58
 */
59
function write_wpghs_link( $atts ) {
60
61
	$args = shortcode_atts(
62
		array(
63
			'type'   => 'link',
64
			'target' => 'view',
65
			'text'   => '',
66
		),
67
		$atts
68
	);
69
	$type   = esc_attr( $args['type'] );
70
	$target = esc_attr( $args['target'] );
71
	$text   = esc_attr( $args['text'] );
72
73
	$output = '';
74
75
	switch ( $target ) {
76 View Code Duplication
		case 'view': {
0 ignored issues
show
This code seems to be duplicated across 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...
77
			$getter = get_the_github_view_url();
78
			if ( ! empty( $text ) ) {
79
				$linktext = $text;
80
			} else {
81
				$linktext = __( 'View this post on GitHub', 'wp-github-sync' );
82
			}
83
			break;
84
		}
85 View Code Duplication
		case 'edit': {
0 ignored issues
show
This code seems to be duplicated across 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...
86
			$getter = get_the_github_edit_url();
87
			if ( ! empty( $text ) ) {
88
				$linktext = $text;
89
			} else {
90
				$linktext = __( 'Edit this post on GitHub', 'wp-github-sync' );
91
			}
92
			break;
93
		}
94
		default: {
95
			$getter = get_the_github_view_url();
96
			$linktext = __( 'View this post on GitHub', 'wp-github-sync' );
97
			break;
98
		}
99
	}
100
101
	switch ( $type ) {
102
		case 'link': {
103
			$output .= '<a href="' . $getter . '">' . $linktext . '</a>';
104
			break;
105
		}
106
		case 'url': {
107
			$output .= $getter;
108
			break;
109
		}
110
		default: {
111
			$output .= '<a href="' . $getter . '">' . $linktext . '</a>';
112
			break;
113
		}
114
	}
115
116
	return $output;
117
118
}
119