--- id: sanic-cors version: "2.2.0" license: MIT license_treatment: permissive maintenance: abandoned --- # Sanic-Cors — A Sanic extension adding a decorator for CORS support. Based on flask-cors by Cory Dolphin. License: permissive · Maintenance: abandoned · Downloads: 311.1K/mo ## What it is and what it does Sanic-CORS is a Sanic web framework extension that handles Cross-Origin Resource Sharing (CORS) headers and preflight requests, allowing your Sanic application to safely serve cross-origin AJAX requests. It is based on flask-cors and provides both a global initialization approach and per-route decorator patterns for fine-grained control over which origins, methods, and headers are allowed. The extension operates with a permissive default philosophy: when enabled globally, it allows CORS for all origins and methods on all routes unless you explicitly configure restrictions. It includes an automatic_options feature to handle OPTIONS preflight responses without manual route configuration. The package depends on sanic and packaging, and supports Python 3.7 through 3.10. However, the project has been abandoned since early 2023, with the last release in October 2022, and carries two known security vulnerabilities. Use it for: - Enable CORS globally on a Sanic API to allow browser-based clients from any origin to make cross-origin requests. - Configure CORS selectively for specific API routes using the @cross_origin decorator to restrict which origins can access sensitive endpoints. - Set up resource-level CORS policies by mapping URL patterns to specific allowed origins, methods, and headers in the resources parameter. - Automatically handle CORS preflight OPTIONS requests without manually implementing OPTIONS handlers on each route. - Integrate CORS support into a Sanic application managed by Sanic-Ext using the plugin system. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Sanic-CORS is a Sanic extension that adds Cross-Origin Resource Sharing (CORS) support to Sanic web applications, enabling cross-origin AJAX requests with configurable per-route or global policies. No. While Sanic-CORS provides straightforward CORS support with low install friction and permissive licensing, the project is abandoned (last commit January 2023) and carries two known security vulnerabilities. For new projects, consider alternatives or implement CORS handling directly. For existing projects already using it, evaluate whether upgrading to a maintained solution is feasible. ## Install pip install sanic-cors uv add sanic-cors poetry add sanic-cors ## Installing Sanic-Cors Before you install: Installation is straightforward with low friction. The package depends only on sanic and packaging. However, maintenance is a concern: the last release was October 2022 and the repository shows no commits since January 2023, indicating the project is abandoned despite the repository not being formally archived. License in practice: MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: pip install sanic-cors from sanic import Sanic from sanic.response import text from sanic_cors import CORS app = Sanic(__name__) CORS(app) @app.route("/", methods=['GET', 'OPTIONS']) def hello_world(request): return text("Hello, cross-origin-world!") Sanic-CORS requires routes to explicitly include 'OPTIONS' in the methods list to handle CORS preflight requests, unless automatic_options is enabled. Verify before relying: - Whether the two known vulnerabilities (GHSA-94jw-hqvj-vw74, PYSEC-2026-3539) have been patched or remain unresolved in version 2.2.0. - Compatibility status with current Sanic versions beyond the notices provided for v21.9, v21.12, and v22.9. - Whether the package will receive security updates or bug fixes despite abandonment status. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 311.1K/month (top 15,000 on PyPI) - Known vulnerabilities: 2 ## Tags sanic cors extension, cross-origin requests sanic, cors middleware sanic, enable cors sanic app, cross-origin ajax sanic, sanic cors decorator, cors, abandoned-project, sanic-framework [View on SkillFed](https://skillfed.io/packages/sanic-cors) · [View on PyPI](https://pypi.org/project/sanic-cors/)