crypto Cipher/Decipher validation issues
オープン
まだ誰も着手していません。
confirmed-bug
crypto
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
This also affects Decipher methods.
Here's an example:
const { createCipheriv, randomBytes } = require('crypto');
const cipher = createCipheriv('aes-256-cbc', randomBytes(32), randomBytes(16));
cipher.update('test', 'utf-8', 'bad');
Gives an internal assertion:
Error [ERR_INTERNAL_ASSERTION]: Cannot change encoding
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
final has the same issue:
const { createCipheriv, randomBytes } = require('crypto');
const cipher = createCipheriv('aes-256-cbc', randomBytes(32), randomBytes(16));
cipher.update('test', 'utf-8', 'utf-8');
cipher.final('bad');
Other issue:
const { createCipheriv, randomBytes } = require('crypto');
const cipher = createCipheriv('aes-256-cbc', randomBytes(32), randomBytes(16));
let result = cipher.update('test', 'bad', 'hex');
result += cipher.final('hex');
console.log(result);
Gives no error at all for the wrong input encoding.
@nodejs/crypto
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず issue 内の Cipher と Decipher の例を実行し、それらが通る crypto Cipher/Decipher メソッドパスを調べます。update と final における無効な入力エンコーディングと出力エンコーディングの扱いを比較します。無効なエンコーディングが、内部アサーションや暗黙の受け入れではなく、適切な検証エラーを受け取るようになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- api, security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100