Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,22 @@
domains as before but look at most 63 characters between their parts; a
copy of the old file in the uploads directory is still used if present.

- **A weblog's banned words are plain words, not regular expressions.** With
`weblogAdminsUntrusted=true` (the default), each line of a weblog's banned
words on Weblog Settings matches as literal text, in any case, as a whole
word, including lines that begin with `(`. A word in Chinese, Japanese,
Thai or another script written without spaces matches anywhere in the
text. A line that is only letters, digits and spaces in parentheses, such
as `(casino)`, matches that text anywhere, in any case, so such rules from
earlier versions keep working. Other rules written as regular expressions,
such as `(casino|poker)` or `viagra|cialis`, no longer match what they used
to; Weblog Settings lists them so the weblog admin can rewrite them as
words. The built-in list, the site-wide list in Server Admin, and weblog
rules on sites with `weblogAdminsUntrusted=false` are still regular
expressions. A regular expression rule that takes over a second on one
value, or runs out of stack, is logged; a comment is then treated as spam,
and a referrer is let through.

### Build and packaging

- The Docker image starts Tomcat with `-XX:-UseBASE64Intrinsics`, which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public String execute() {

// load bean with data from weblog
getBean().copyFrom(getActionWeblog());
listRulesMatchedAsText();

return INPUT;
}
Expand Down Expand Up @@ -207,14 +208,38 @@ private void myValidate() {
List<String> stringRules = new ArrayList<>();
try {
// just for testing/counting, this does not persist rules in any way
Bannedwordslist.populateSpamRules(getBean().getBannedwordslist(), stringRules, regexRules, null);
addMessage("websiteSettings.acceptedBannedwordslist", List.of(""+stringRules.size(), ""+regexRules.size()));
if (!weblogAdminsUntrusted) {
Bannedwordslist.validateRules(getBean().getBannedwordslist());
}
Bannedwordslist.populateSpamRules(getBean().getBannedwordslist(), stringRules, regexRules, null,
weblogAdminsUntrusted);
if (weblogAdminsUntrusted) {
addMessage("websiteSettings.acceptedBannedwordsAsWords", List.of(""+regexRules.size()));
listRulesMatchedAsText();
} else {
addMessage("websiteSettings.acceptedBannedwordslist", List.of(""+stringRules.size(), ""+regexRules.size()));
}
} catch (Exception e) {
addError("websiteSettings.error.processingBannedwordslist", e.getMessage());
}
}


/**
* Tells the weblog admin which banned words look like regular
* expressions, since with untrusted weblog admins they are matched as
* plain text; a list from an earlier version may have such lines.
*/
private void listRulesMatchedAsText() {
if (weblogAdminsUntrusted) {
List<String> rules = Bannedwordslist.regexStyleRules(getBean().getBannedwordslist());
if (!rules.isEmpty()) {
addMessage("websiteSettings.bannedwordsMatchedAsText", String.join(", ", rules));
}
}
}


@StrutsParameter(depth = 1)
public WeblogConfigBean getBean() {
return bean;
Expand Down
Loading
Loading