Malformed URI when encrypting string using md5

Aperta
#1,053 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript, typescript
Ambito
cryptography

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
5.4k
Fork
874
Merge medio
3m
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di digitalbazaar/forge

Tutte le issue di digitalbazaar/forge

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.