Skip to content

Commit bf32b5a

Browse files
Reiview suggestions - add doc comment, reword description, simplify a part
1 parent a62bb8e commit bf32b5a

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

java/ql/lib/semmle/code/java/security/StaticInitializationVectorQuery.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** Definitions for the Static Initialization Vector query. */
2+
13
import java
24
import semmle.code.java.dataflow.TaintTracking
35
import semmle.code.java.dataflow.TaintTracking2
@@ -73,9 +75,7 @@ private class ArrayUpdateConfig extends TaintTracking2::Configuration {
7375
source.asExpr() instanceof StaticByteArrayCreation
7476
}
7577

76-
override predicate isSink(DataFlow::Node sink) {
77-
exists(ArrayUpdate update | update.getArray() = sink.asExpr())
78-
}
78+
override predicate isSink(DataFlow::Node sink) { sink.asExpr() = any(ArrayUpdate upd).getArray() }
7979
}
8080

8181
/**

java/ql/src/Security/CWE/CWE-1204/StaticInitializationVector.ql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
/**
22
* @name Using a static initialization vector for encryption
3-
* @description A cipher needs an initialization vector (IV) in some cases,
4-
* for example, when CBC or GCM modes are used. IVs are used to randomize the encryption,
5-
* therefore they should be unique and ideally unpredictable.
6-
* Otherwise, the same plaintexts result in same ciphertexts under a given secret key.
7-
* If a static IV is used for encryption, this lets an attacker learn
8-
* if the same data pieces are transferred or stored,
9-
* or this can help the attacker run a dictionary attack.
3+
* @description An initialization vector (IV) used for ciphers of certain modes (such as CBC or GCM) should be unique and unpredicateble.
4+
* Otherwise, if the same IV is used with a the same secret key then the same plaintext results in same ciphertext, which weakens the encryption.
105
* @kind path-problem
116
* @problem.severity warning
127
* @precision high

0 commit comments

Comments
 (0)