Skip to content

Tightened validation for colors in email renderer#26956

Merged
EvanHahn merged 1 commit intomainfrom
tighten-valid-hex-regex
Mar 25, 2026
Merged

Tightened validation for colors in email renderer#26956
EvanHahn merged 1 commit intomainfrom
tighten-valid-hex-regex

Conversation

@EvanHahn
Copy link
Contributor

no ref

Before this change, foo #ff9900 was considered a valid hex color. After this change, it is not.

I believe it's difficult to have bad data in the database, but if that happens, we want to check it properly.

no ref

Before this change, `foo #ff9900` was considered a valid hex color.
After this change, it is not.

I believe it's difficult to have bad data in the database, but if that
happens, we want to check it properly.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50fc1c6d-bf8f-4345-bfc6-92dd5c0a4aa4

📥 Commits

Reviewing files that changed from the base of the PR and between 31e09b5 and de4f5b4.

📒 Files selected for processing (1)
  • ghost/core/core/server/services/email-service/email-renderer.js

Walkthrough

A regex pattern for validating hex-based color settings in the email renderer was modified to include string anchors. The pattern was updated to match the entire input string using ^...$ syntax, rather than allowing partial matches. This change tightens validation such that color values with leading or trailing characters will now be rejected, while the underlying hex length and format requirements remain unchanged. The modification affects accent color, background color, and other hex-based color validation in the email service.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: tightening validation for colors in the email renderer component.
Description check ✅ Passed The description is directly related to the changeset, providing concrete examples of the validation change (e.g., rejecting 'foo #ff9900') and explaining the motivation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tighten-valid-hex-regex

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EvanHahn EvanHahn requested a review from cmraible March 25, 2026 15:40
Copy link
Collaborator

@cmraible cmraible left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@EvanHahn EvanHahn merged commit 716a08f into main Mar 25, 2026
35 checks passed
@EvanHahn EvanHahn deleted the tighten-valid-hex-regex branch March 25, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants