Skip to content

Retire incoming Trackback support and normalize comment links - #176

Open
snoopdave wants to merge 1 commit into
entry-trackback-cleanupfrom
incoming-trackback-retirement
Open

Retire incoming Trackback support and normalize comment links#176
snoopdave wants to merge 1 commit into
entry-trackback-cleanupfrom
incoming-trackback-retirement

Conversation

@snoopdave

Copy link
Copy Markdown
Contributor

Summary:

  • remove incoming Trackback servlet, request routing, runtime controls, and autodiscovery output
  • remove the unused linkback validator and helper
  • render comment author links only for valid absolute HTTP(S) URLs
  • remove stale Trackback labels and configuration

Dependency:

Testing:

  • mvn -pl app -Dtest=IncomingTrackbackRemovalTest,WeblogEntryCommentWrapperTest,EntryTrackbackRemovalTest test
  • mvn -V -ntp install (Temurin JDK 11.0.31)

@mraible mraible left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Retiring incoming Trackback is overdue and the removal itself is thorough. What I'd like fixed before approving is the compatibility for existing sites (inline), and a few notes outside the diff:

  • TrackbackLinkbackCommentValidator is deleted, and it's a documented entry for comment.validator.classnames in the user guide. CommentValidationManager builds the list with Reflection.newInstances, which throws on the first missing class and leaves the list empty, so an install that lists it loses every comment validator (banned words, excess links, Akismet) silently. Either keep a no-op class for a release or make the manager skip unknown validators with a warning.
  • docs/roller-template-guide.adoc:846 still documents $url.trackback(anchor) and line 1861 still documents #showTrackbackAutodiscovery($entry); docs/roller-user-guide.adoc:1282 and docs/examples/configs/tomcat/mod_jk.conf:10 also still reference trackbacks.

#end
#end

#**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Every release through 6.1.5 shipped basic/_day.vm and basicmobile/_day.vm with #showTrackbackAutodiscovery($entry), and anyone who clicked "Customize theme" has that copied into their DB templates. runtime.strict_mode.enable is off, so Velocity renders the now-undefined macro call as literal text under every entry. Keep the macro as a documented no-op (#macro( showTrackbackAutodiscovery $entry )#end) for at least a release, and the same goes for $url.trackback(...) in URLModel, which custom templates reference outside an #if.

*/
public String getUrl() {
return StringEscapeUtils.escapeHtml4(this.pojo.getUrl());
return StringEscapeUtils.escapeHtml4(this.pojo.getSafeUrl());

@mraible mraible Aug 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CommentServlet stores "" for a blank URL, so this used to return "" and the javadoc promises a non-null escaped value; escapeHtml4(null) is null, and with strict mode off a custom template that writes $comment.url without an isEmpty guard now prints the literal $comment.url into href for every comment without a URL. Return "" when getSafeUrl() is null.

</div>

<s:if test="#comment.url != null && !#comment.url.equals('')">
<s:if test="#comment.safeUrl != null">

@mraible mraible Aug 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hiding the URL entirely when it fails validation takes away the thing the moderator needs to judge the comment (javascript:..., a homoglyph domain, an intranet host). Render the raw value as escaped text when safeUrl is null and only make it a link when it isn't.

return null;
}
String normalized = value.trim();
return VALIDATOR.isValid(normalized) ? normalized : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Default UrlValidator (no ALLOW_LOCAL_URLS, IANA TLD list, ASCII path regex) rejects http://localhost:8080/blog, http://intranet-wiki/page, http://my_host.example.com/ and IDN paths, so legacy comments and imported ones lose their author link on public pages and vanish from the admin page, with no log line. CommentServlet accepts on post with the same validator today, so at minimum reuse one shared instance/policy for both (this class is the natural home; have the servlet call normalize), and consider ALLOW_LOCAL_URLS for intranet installs.

configForm.commentSettings=Kommentar und Trackback Einstellungen
configForm.editorPages=Bearbeitungsseiten
configForm.emailComments=E-Mailbenachrichtung bei Kommentaren?
configForm.enableComments=Kommentare in Weblogs erlauben?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

configForm.commentSettings was removed from all seven translated bundles but is still the display-group key in runtimeConfigDefs.xml:155, so the Global Configuration heading falls back to English for every non-English admin. Re-add it (minus the Trackback wording) in each bundle.

/**
* URL of the comment writer when it can be safely rendered as a link.
*/
public String getSafeUrl() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: this runs the validator (regex + DomainValidator lookup) on every call, and Comments.jsp evaluates #comment.safeUrl three times per row while weblog.vm evaluates $comment.url twice per comment. Compute once per render (an s:set in the JSP, a local in the macro, or memoize in the wrapper).


@Test
void deploymentAndRuntimeConfigurationDoNotExposeTrackbacks() throws Exception {
assertFileDoesNotContain("src/main/webapp/WEB-INF/web.xml", "trackback");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cwd-relative paths again; surefire sets project.build.directory for this module, and no other test in app/src/test reads source files relative to the working directory.

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