Repository navigation
Description
Description
The header and footer row Text Color settings (hfg_{header,footer}_layout_{row}_new_text_color) are cleaned with wp_filter_nohtml_kses. That only removes HTML tags, so the value is never checked as a color. Whatever text is left is printed on the front end as the row's --color value.
Because of this, a saved value can close the CSS rule and add any CSS to the page. HTML tags are removed, so this is CSS injection, not XSS. It still matters for users who can customize the theme but don't have unfiltered_html, such as site admins on multisite. An invalid value like notacolor is also printed as-is instead of falling back to the default text color.
The row Border Color setting in the same builder already uses neve_sanitize_colors() (header-footer-grid/Core/Builder/Abstract_Builder.php, around lines 450–468). Text Color, around line 530, doesn't.
Expected: Text Color goes through neve_sanitize_colors() like Border Color. Invalid values are rejected, and the CSS after the color is dropped.
Current: the value is saved and printed as typed, minus HTML tags.
Step-by-step reproduction instructions
- Activate Neve. Neve Pro isn't needed, because the footer uses the normal Customizer save.
- Go to Appearance → Customize → Footer → Footer Main.
- In the browser console, run:
wp.customize('hfg_footer_layout_main_new_text_color').set('#222;}body{background:lime}/*') - Click Publish.
- Open the front end and search the page source for
.footer-main{.- Bug:
.footer-main{ ... --color: #222;}body{background:lime}/*and the whole page turns lime. - Expected: the injected CSS is gone, and the page keeps its normal background.
- Bug:
- Repeat with
hfg_header_layout_main_new_text_color(Header Main). You get the same result. - Repeat with
notacolor. It's printed as--color: notacolorinstead of falling back to the default. - To compare, do step 3 with
hfg_footer_layout_main_border_color. The value is cut to#222, or falls back to the default.
Screenshots, screen recording, code snippet or Help Scout ticket
Front-end CSS after saving #222;}body{background:lime}/* on Footer Main Text Color:
.footer-main{ --rowbwidth:0px; --rowbcolor: #ff0000; --color: #222;}body{background:lime}/*; ... }Registration in header-footer-grid/Core/Builder/Abstract_Builder.php:
// Border Color
'sanitize_callback' => 'neve_sanitize_colors',
// Text Color
'sanitize_callback' => 'wp_filter_nohtml_kses',The same values can also be saved through the Header Configure / Footer Configure abilities (inc/abilities/builder_configure.php). There, text_color only goes through sanitize_text_field(). pirate-bot flagged this on Codeinwp/neve-pro-addon#3310.
Environment info
Neve 4.2.19 (current release, code checked). Reproduced on a live site with Neve Pro 3.2.16 active (build of Codeinwp/neve-pro-addon#3311).
Is the issue you are reporting a regression
No
Activity
girishpanchal30 commentedon Nov 20, 2026
@rodica-andronache I have fixed it with PR #4710
kushh23 commentedon Nov 20, 2026
🧪 QA steps and test links
The header and footer row Text Color settings are saved without checking that the value is a color. A saved value can end the row's CSS rule and add any CSS to the front end, for example to restyle the whole page. Invalid colors are printed as typed instead of falling back to the default.
Requires: the browser console in the Customizer, since the color picker only sends valid colors.
a86a3f4In the links:
debug.log.Reproduce on Neve 4.2.19:
hfg_footer_layout_main_new_text_colorwithwp.customize('<setting>').set('<value>')to a color followed by a closing brace and abodyrule with a lime background, ending with an open CSS comment..footer-main{ ... --color:.--colorholds only a valid color or the default.Edge cases
hfg_header_layout_main_new_text_color(Header Main): same result.notacolor: falls back to the default text color instead of printing--color: notacolor.Fix: #4710 (open)
pirate-bot commentedon Nov 20, 2026
QA agent — 🟢 Passing checks · Header and footer row Text Color no longer lets a saved value inject CSS; invalid colors fall back to the default.
We installed Neve with this fix and repeated the issue's steps in the Customizer: setting the Footer Main and Header Main Text Color to a value that closes the CSS rule, then publishing. The front end kept its normal white background and showed the default text color. On the current release, the same steps printed the injected CSS and 'notacolor' as typed. A script tried 9 values on all six header and footer rows: invalid ones were rejected and valid hex, rgba and CSS-variable colors still saved and showed. Colors picked with the color picker, values already saved before the update, the Header/Footer Configure abilities, row background and overlay colors, vertical alignment and the PR's unit tests all behaved correctly.
Worth a human look
Checks (8 passed)
Full report, evidence and session trail