{ "info": { "author": "IncludeSecurity", "author_email": "safeurl@includesecurity.com", "bugtrack_url": null, "classifiers": [], "description": "# SafeURL for Python\r\n### Ported by [@nicolasrod](https://github.com/nicolasrod) and docs by [@momopranto](https://github.com/momopranto)\r\n\r\n## Overview\r\nSafeURL is a library that aids developers in protecting against a class of vulnerabilities known as [Server Side Request Forgery](http://www.acunetix.com/blog/articles/server-side-request-forgery-vulnerability/). It does this by validating each part of the URL against a configurable white or black list before making an HTTP request. SafeURL is open-source and licensed under MIT.\r\n\r\n## Installation\r\nClone this repository and import it into your project.\r\n\r\n## Implementation\r\nSafeURL serves as a replacement wrapper for [PyCurl](http://pycurl.io/) in Python.\r\n\r\n```python\r\ntry:\r\n #User controlled input\r\n url = request.args['url']\r\n su = safeurl.SafeURL()\r\n #Execute using SafeURL\r\n res = su.execute(url)\r\nexcept:\r\n print \"Unexpected error:\", sys.exc_info()\r\n #URL wasn't safe\r\n```\r\n\r\n## Configuration\r\nOptions such as white and black lists can be modified. For example:\r\n\r\n```python\r\ntry:\r\n su = safeurl.SafeURL()\r\n #Create an options object\r\n opt = safeurl.Options()\r\n opt.clearList(\"whitelist\")\r\n opt.clearList(\"blacklist\")\r\n #Allow requests to specific domains\r\n opt.setList(\"whitelist\", [\"google.com\", \"youtube.com\"], \"domain\")\r\n #Restrict urls with the ftp scheme\r\n opt.setList(\"blacklist\",[\"ftp\"],\"scheme\")\r\n\r\n su.setOptions(opt)\r\n res = su.execute(\"http://www.youtube.com\")\r\nexcept:\r\n print \"Unexpected error:\", sys.exc_info()\r\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/IncludeSecurity/safeurl-python", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "safeurl-python", "package_url": "https://pypi.org/project/safeurl-python/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/safeurl-python/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/IncludeSecurity/safeurl-python" }, "release_url": "https://pypi.org/project/safeurl-python/1.0/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "1.0" }, "last_serial": 2296339, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "4df2b86e4a624af32ce42aa01d4f4a1e", "sha256": "2e3e3eba66a447f6fe8457024b4bab2c0907b86aefccf482db033cc14c75d7e1" }, "downloads": -1, "filename": "safeurl-python-1.0.cygwin-1.7.35-i686.exe", "has_sig": false, "md5_digest": "4df2b86e4a624af32ce42aa01d4f4a1e", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 57428, "upload_time": "2016-08-22T19:57:52", "url": "https://files.pythonhosted.org/packages/15/ed/55ac6a341f6a3615c100b24baa8f735ed90026da3e031fec0facd7ae1769/safeurl-python-1.0.cygwin-1.7.35-i686.exe" }, { "comment_text": "", "digests": { "md5": "931f8da19aa1dfb065d3b59f2db8fed2", "sha256": "c04e8e0c1a21d07ff2279f164004a136c92b9506def0e6c174c222a12e7337d7" }, "downloads": -1, "filename": "safeurl-python-1.0.tar.gz", "has_sig": false, "md5_digest": "931f8da19aa1dfb065d3b59f2db8fed2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1378, "upload_time": "2016-08-22T19:57:50", "url": "https://files.pythonhosted.org/packages/ea/32/3239627e7abeb05c5377bbc7a9d5e06a40530b081f460d8c48595c63be10/safeurl-python-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4df2b86e4a624af32ce42aa01d4f4a1e", "sha256": "2e3e3eba66a447f6fe8457024b4bab2c0907b86aefccf482db033cc14c75d7e1" }, "downloads": -1, "filename": "safeurl-python-1.0.cygwin-1.7.35-i686.exe", "has_sig": false, "md5_digest": "4df2b86e4a624af32ce42aa01d4f4a1e", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 57428, "upload_time": "2016-08-22T19:57:52", "url": "https://files.pythonhosted.org/packages/15/ed/55ac6a341f6a3615c100b24baa8f735ed90026da3e031fec0facd7ae1769/safeurl-python-1.0.cygwin-1.7.35-i686.exe" }, { "comment_text": "", "digests": { "md5": "931f8da19aa1dfb065d3b59f2db8fed2", "sha256": "c04e8e0c1a21d07ff2279f164004a136c92b9506def0e6c174c222a12e7337d7" }, "downloads": -1, "filename": "safeurl-python-1.0.tar.gz", "has_sig": false, "md5_digest": "931f8da19aa1dfb065d3b59f2db8fed2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1378, "upload_time": "2016-08-22T19:57:50", "url": "https://files.pythonhosted.org/packages/ea/32/3239627e7abeb05c5377bbc7a9d5e06a40530b081f460d8c48595c63be10/safeurl-python-1.0.tar.gz" } ] }