解析并验证css的安全子集

reddit-cssfilter的Python项目详细描述


Build Status

从reddit的源代码中提取的cssfilter.py。

此库允许您从用户中筛选“不安全”的css。

此库需要属性!:

使用此库时,reddit要求您将以下信息放入应用程序的splash或“about”部分。

EXHIBIT B. Attribution Information

Attribution Copyright Notice: Copyright (c) 2006-2015 reddit Inc. All Rights Reserved.

Attribution Phrase (not exceeding 10 words): Powered by reddit

Attribution URL: http://code.reddit.com

Graphic Image as provided in the Covered Code: http://code.reddit.com/reddit_logo.png

信息

解析并验证css的安全子集。

此验证的目标不是确保功能正确的样式表 但是样式表可以安全地显示给下游用户。这个 包括:

  • 不生成对第三方主机的请求(信息泄漏)
  • 在错误浏览器中通过奇怪语法的xss

除此之外,所有的努力都是为了让现代css的全部范围。

如何使用

importreddit_cssfilter.cssfiltercssfilter.validate_css(stylesheet,images)

Validate and re-serialize the user submitted stylesheet.

images is a mapping of subreddit image names to their URLs. The re-serialized stylesheet will have %%name%% tokens replaced with their appropriate URLs.

The return value is a two-tuple of the re-serialized (and minified) stylesheet and a list of errors. If the list is empty, the stylesheet is valid.

许可证

版权所有(c)2006-2015 Reddit Inc.保留所有权利。

公共归属许可证1.0版(CPAL)

完整的许可证在这里可用:reddit Inc. Common Public Attribution License Version 1.0 (CPAL)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java正则表达式匹配子字符串/字符在字符串中出现的次数   java使用来自其他模块的Springbean?   java如何创建简单报警应用程序中的列表项,该应用程序可以在安卓中“创建/编辑报警”设置屏幕   java如何让我的应用程序运行一段时间?   java“列表接口提供了两种有效插入和删除多个元素的方法”有人知道第二种方法是什么吗?   java代码层中的异常处理   java在比较字符串和null时显示异常   spring在Java(基本XSS)中对脚本相关HTML标记的错误中和   java每30秒在后台刷新一次Android应用程序以获取推送通知\   从JSON文件Java获取字符串   java Hibernate SessionFactory:如何在Tomcat中配置JNDI?   java无法访问应用程序中的h2数据库文件   java领域响应状态=400   java使用ajax在JSP中获取“request.setAttribute”属性