Skip to content

Commit 34cbaf1

Browse files
committed
Python: Use PostUpdateNode in py/azure-storage/unsafe-client-side-encryption-in-use
1 parent 86333e3 commit 34cbaf1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/ql/src/experimental/Security/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ module AzureBlobClientConfig implements DataFlow::StateConfigSig {
111111
attr.accesses(node, "encryption_version") and
112112
attr.getValue().asExpr().(StrConst).getText() in ["'2.0'", "2.0"]
113113
)
114+
or
115+
// small optimization to block flow with no encryption out of the post-update node
116+
// for the attribute assignment.
117+
isAdditionalFlowStep(_, MkUsesNoEncryption(), node, MkUsesV1Encryption()) and
118+
state = MkUsesNoEncryption()
114119
}
115120

116121
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
@@ -124,7 +129,7 @@ module AzureBlobClientConfig implements DataFlow::StateConfigSig {
124129
predicate isAdditionalFlowStep(
125130
DataFlow::Node node1, FlowState state1, DataFlow::Node node2, FlowState state2
126131
) {
127-
node1 = node2 and
132+
node1 = node2.(DataFlow::PostUpdateNode).getPreUpdateNode() and
128133
state1 = MkUsesNoEncryption() and
129134
state2 = MkUsesV1Encryption() and
130135
exists(DataFlow::AttrWrite attr |

0 commit comments

Comments
 (0)