Skip to content

Commit

Permalink
XSS vulnerability reported by Eugene Lim and Sng Jay Kai.
Browse files Browse the repository at this point in the history
  • Loading branch information
brushed committed Nov 24, 2022
1 parent 484c6a1 commit 9d6dbf9
Showing 1 changed file with 6 additions and 4 deletions.
@@ -1,4 +1,4 @@
/*
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
Expand All @@ -14,7 +14,7 @@ Licensed to the Apache Software Foundation (ASF) under one
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
under the License.
*/
package org.apache.wiki.plugin;

Expand All @@ -23,6 +23,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import org.apache.wiki.api.plugin.Plugin;
import org.apache.wiki.preferences.Preferences;
import org.apache.wiki.preferences.Preferences.TimeFormat;
import org.apache.wiki.util.TextUtil;

import java.text.SimpleDateFormat;
import java.util.Date;
Expand All @@ -32,7 +33,7 @@ Licensed to the Apache Software Foundation (ASF) under one
/**
* Just displays the current date and time.
* The time format is exactly like in the java.text.SimpleDateFormat class.
*
*
* <p>Parameters : </p>
* NONE
* @since 1.7.8
Expand All @@ -59,7 +60,8 @@ public String execute( final Context context, final Map< String, String > params

final Date d = new Date(); // Now.

return fmt.format( d );
return TextUtil.replaceEntities( fmt.format( d ) );

} catch( final IllegalArgumentException e ) {
final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE );
throw new PluginException( rb.getString( "currenttimeplugin.badformat" ) + e.getMessage() );
Expand Down

0 comments on commit 9d6dbf9

Please sign in to comment.