Extracted from official patchs.
- Add files in '/config/initializers' directory.
To test the JSON parser (CVE-2013-0269), try to parse a malicious json:
- In console, before patch:
<#if entries?has_content> | |
<#list entries as curEntry> | |
<#assign renderer = curEntry.getAssetRenderer() /> | |
<#assign journalArticle = renderer.getArticle() /> | |
<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") /> | |
<#assign categories = AssetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle", journalArticle.getResourcePrimKey()) /> | |
<#if categories?has_content> | |
<#list categories as category> | |
${category.getName()} |
<!DOCTYPE html> | |
<html> | |
<head> | |
<%= inline_js 'application.js' %> | |
<%= inline_css 'application.css' %> | |
</head> | |
<body> | |
</body> | |
</html> |
;(function($, undefined) { | |
'use strict'; | |
if (typeof window.MY_MODULE_NAME !== 'undefined') { | |
return; | |
} | |
// | |
// Module general vars | |
// |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import csv | |
import codecs | |
import cStringIO | |
import os | |
from collections import namedtuple | |
def getParties(parties_file): |
config.assets.precompile += [ | |
# precompile any CSS or JS file that doesn't start with _ | |
/(^inline[^_\/]|\/[^_])[^\/]*.(js|css)$/, | |
... |
function countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); | |
} | |
function countSheet(sheet) { |
Extracted from official patchs.
To test the JSON parser (CVE-2013-0269), try to parse a malicious json:
class ApiLogger < Grape::Middleware::Base | |
def before | |
Rails.logger.info "[api] Requested: #{request_log_data.to_json}\n" + | |
"[api] #{response_log_data[:description]} #{response_log_data[:source_file]}:#{response_log_data[:source_line]}" | |
end | |
private | |
def request_log_data |
# Add these methods to your ApplicationController. Then, any controller | |
# that inherits from it will have these methods and can programmatically | |
# determine what filters it has set. | |
class ApplicationController < ActionController::Base | |
def self.filters(kind = nil) | |
all_filters = _process_action_callbacks | |
all_filters = all_filters.select{|f| f.kind == kind} if kind | |
all_filters.map(&:filter) | |
end |
#!/usr/bin/env ruby | |
# Put this file in the root of your Rails project, | |
# then run it to output the SQL needed to change all | |
# your tables and columns to the same character set | |
# and collation. | |
# | |
# > ruby character_set_and_collation.rb | |
DATABASE = '' |