기여 목록 / 8513339
[WebCrypto] Make the deriveBits() length argument [EnforceRange]
BlinkfixIn Review
WebCrypto SubtleCrypto.deriveBits()의 length 인자가 범위를 벗어난 값을 받으면 TypeError를 던지지 않고 2^32로 나눈 나머지로 처리하던 문제를 고쳤습니다. 2파일 +2/−2.
문제 설명
- issue url: https://crbug.com/549523419
- 스펙은
deriveBits()의length를[EnforceRange] unsigned long?으로 정의하므로, 범위를 벗어난 값은 TypeError로 거부해야 합니다. - Blink IDL에는
[EnforceRange]가 빠져 있어서 값이 modulo 2^32로 변환되었습니다.-8은 4294967288 bits 요청이 되었습니다.2^32 + 8은 아무 오류 없이 8 bits를 derive했습니다.
해결 내용
subtle_crypto.idl의deriveBits()length인자에[EnforceRange]를 추가했습니다.- PBKDF2
deriveBits-failuresweb test는 length-10을 넘기는데, 지금까지는 wrap된 값이 8의 배수가 아니라는 이유로만 OperationError로 거부되고 있었습니다. 이제는 바인딩 단계에서 TypeError가 나므로 expected 파일을 rebaseline했습니다.
Promise<ArrayBuffer> deriveBits(
AlgorithmIdentifier algorithm,
CryptoKey baseKey,
- optional unsigned long? length = null);
+ optional [EnforceRange] unsigned long? length = null); Deriving using length -10...
-SUCCESS (rejected): OperationError: Length for PBKDF2 key derivation must be a multiple of 8 bits.
+SUCCESS (rejected): TypeError: Failed to execute 'deriveBits' on 'SubtleCrypto': Value is outside the 'unsigned long' value range.테스트 방법
- 기존 web test
crypto/subtle/pbkdf2/deriveBits-failures의 기대 결과를 갱신했습니다.
배운 점
- (작성 예정)