New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@onjmin/cors-killer

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onjmin/cors-killer

CORS制限を回避するモジュール

latest
Source
npmnpm
Version
1.0.16
Version published
Maintainers
1
Created
Source

cors-killer

CORS制限を回避するモジュール

特徴

  • CORS対応済みのURLは素通し
    既に CORS 対応済みの代表的なサービスの URL(例: Imgur、Wikipedia、Unsplash)や Base64 埋め込み形式の data URI は、そのまま返す設計。
    → 既に安全にアクセスできるものは手を加えず、可用性を落とさない。

  • その他の URL は自動でプロキシ経由
    上記以外の URL は、公開・無認証のプロキシをランダムで経由して安全に取得。
    使用するプロキシ例:

    • https://api.allorigins.win/raw?url=...
    • https://corsproxy.io/?...
    • https://api.codetabs.com/v1/proxy?quest=...
  • 余計な機能なし
    エクスポートされる関数は corsKiller ただ1つ。
    引数は文字列、返り値も文字列のシンプル設計。

  • Node.js / ブラウザ対応
    型安全な TypeScript で両環境で利用可能

  • おんJ民が作っている
    質問や相談はフォーラムで: 質問フォーラム

リンク集

インストール

npm i @onjmin/cors-killer

使用例

Node.js / ES Modules

import { corsKiller } from "@onjmin/cors-killer";

const url = "https://example.com/image.png"; // CORS非対応
const safeUrl = corsKiller(url);

console.log(safeUrl); // CORS対応済みURL
// https://api.allorigins.win/raw?url=https://example.com/image.png

ブラウザでの使用

const { corsKiller } = await import("https://cdn.jsdelivr.net/npm/@onjmin/cors-killer/dist/index.min.mjs");

const url = "https://example.com/image.png"; // CORS非対応
const safeUrl = corsKiller(url);

console.log(safeUrl); // CORS対応済みURL
// https://api.allorigins.win/raw?url=https://example.com/image.png

TODO

  • 現状は画像を前提に作っているが、動画、音楽、JS/CSS など、CORS が絡むその他のリソースにも対応可能。
  • その場合に備えて、テスト用関数やユーティリティも整備する必要がある。
  • コントリビュート大歓迎!興味のある方はぜひ pull request や issue を送ってほしい。

コントリビュート方法

  • 開発環境
    • 推奨エディタ: VSCode
    • 開発言語: TypeScript
    • 実行環境: Volta / pnpm / Biome
  • 開発コマンド

ライセンス

開発者 / Author

Keywords

CORS

FAQs

Package last updated on 10 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts