Skip to content

Commit 6f5bf82

Browse files
coder-karenmatticbot
authored andcommitted
Social Menu: Replacing SVG file inclusion method (#39136)
Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10617469718 Upstream-Ref: Automattic/jetpack@1779fe4
1 parent 2608ae0 commit 6f5bf82

File tree

5 files changed

+110
-86
lines changed

5 files changed

+110
-86
lines changed

composer.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/automattic/jetpack-classic-theme-helper/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
This is an alpha version! The changes listed here are not final.
1111

12+
### Security
13+
- Social Menu: Switch to more appropriate method of calling the SVG icon file.
14+
1215
### Added
1316
- Classic Theme Helper: Adding Portfolio custom post type content
1417
- Content Options: Moving content to Classic Theme Helper package.

vendor/automattic/jetpack-classic-theme-helper/src/social-menu/icon-functions.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,28 @@ function jetpack_social_menu_include_svg_icons() {
1818
$svg_icons = __DIR__ . '/social-menu.svg';
1919
// If it exists and we use the SVG menu type, include it.
2020
if ( file_exists( $svg_icons ) && 'svg' === jetpack_social_menu_get_type() ) {
21-
require_once $svg_icons;
21+
$svg_contents = file_get_contents( $svg_icons ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Only reading a local file.
22+
}
23+
24+
if ( ! empty( $svg_contents ) ) {
25+
$allowed_tags = array(
26+
'svg' => array(
27+
'style' => true,
28+
'version' => true,
29+
'xmlns' => true,
30+
'xmlns:xlink' => true,
31+
),
32+
'defs' => array(),
33+
'symbol' => array(
34+
'id' => true,
35+
'viewbox' => true,
36+
),
37+
'path' => array(
38+
'd' => true,
39+
'style' => true,
40+
),
41+
);
42+
echo wp_kses( $svg_contents, $allowed_tags );
2243
}
2344
}
2445
add_action( 'wp_footer', 'jetpack_social_menu_include_svg_icons', 9999 );

0 commit comments

Comments
 (0)