Malformed URI when encrypting string using md5

オープン
#1,053 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, typescript
領域
cryptography

調査の方向性

Read src/routes/offerwall/index.ts at the reported call site and node_modules/node-forge/lib/util.js around util.decodeUtf8. Reproduce the error with the shown query values, then inspect which value reaches ByteStringBuffer.toString(). Done would require identifying whether the malformed input is in the application usage or in forge's decoding behavior; the issue does not specify a repository change.

索引モデルが issue の本文から書いたものです。

説明

Kindly, help me solve this error of Malformed URI when encrypting string using md5.

The error is:

URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at Object.util.decodeUtf8 (/home/pi/Projects/scratcher/node_modules/node-forge/lib/util.js:1671:10)
    at ByteStringBuffer.util.ByteStringBuffer.toString (/home/pi/Projects/scratcher/node_modules/node-forge/lib/util.js:716:15)
    at /home/pi/Projects/scratcher/src/routes/offerwall/index.ts:32:99
    at Generator.next (<anonymous>)
    at /home/pi/Projects/scratcher/src/routes/offerwall/index.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/pi/Projects/scratcher/src/routes/offerwall/index.ts:4:12)
    at /home/pi/Projects/scratcher/src/routes/offerwall/index.ts:12:36
    at Layer.handle [as handle_request] (/home/pi/Projects/scratcher/node_modules/express/lib/router/layer.js:95:5)

The code is:


import { md5 } from "node-forge";

const sub_id = encodeURIComponent(req.query.sub_id!.toString());
const amount = encodeURIComponent(req.query.amount!.toString());
const signature = req.query.signature!.toString();

const secret_key = encodeURIComponent(process.env.SECRET_KEY!);

if (!amount || !sub_id || !signature) {
        res.send("0");
        return;
}
    
let conn;
const md = md5.create()
const validation_signature = md.update(sub_id + ":" + amount + ":" + secret_key).digest().toString();

Your help would be greatly appreciated.

主要言語
JavaScript
スター
5.4k
フォーク
875
平均マージ
3分
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

digitalbazaar/forge のほかの issue

digitalbazaar/forge の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。