From e79ec4b6b6c876921c6690fc9895f9e1c59d40c4 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 9 Nov 2026 09:25:13 +0100 Subject: [PATCH 1/2] Dataflow: Use the config rather than the language default ap limit. --- .../codeql/dataflow/internal/DataFlowImpl.qll | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll index e467e6caa708..9c399ea26a17 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll @@ -566,7 +566,7 @@ module MakeImpl Lang> { pragma[nomagic] private int getAnApLengthLowerBound(Ap ap) { - accessPathLimit() != 0 and // `accessPathLimit() = 0` is already checked in `useFieldFlow` + Config::accessPathLimit() != 0 and // `accessPathLimit() = 0` is already checked in `useFieldFlow` result = ap.length() or not exists(ap.length()) and @@ -574,7 +574,7 @@ module MakeImpl Lang> { fwdFlowConsCand(_, ap, _, _, tail) and ap != tail and // no need to report a longer length result = 1 + getAnApLengthLowerBound(tail) and - result <= accessPathLimit() + result <= Config::accessPathLimit() ) } @@ -612,7 +612,7 @@ module MakeImpl Lang> { fwdFlowStore(_, _, ap0, _, c, t, stored, node, cc, summaryCtx) and ap = apCons(c, ap0) and apa = getApprox(ap) and - getAnApLengthLowerBound(ap0) < accessPathLimit() + getAnApLengthLowerBound(ap0) < Config::accessPathLimit() ) or // read @@ -1340,7 +1340,7 @@ module MakeImpl Lang> { pragma[nomagic] private int getAnApLengthLowerBoundRev(Ap ap) { - accessPathLimit() != 0 and // `accessPathLimit() = 0` is already checked in `useFieldFlow` + Config::accessPathLimit() != 0 and // `accessPathLimit() = 0` is already checked in `useFieldFlow` result = ap.length() or not exists(ap.length()) and @@ -1348,7 +1348,7 @@ module MakeImpl Lang> { revFlowConsCand(ap, _, tail) and ap != tail and // no need to report a longer length result = 1 + getAnApLengthLowerBoundRev(tail) and - result <= accessPathLimit() + result <= Config::accessPathLimit() ) } @@ -1389,7 +1389,7 @@ module MakeImpl Lang> { exists(Nd mid, Ap ap0 | revFlow(mid, returnCtx, returnAp, ap0) and readStepFwd(node, ap, _, mid, ap0) and - getAnApLengthLowerBoundRev(ap0) < accessPathLimit() + getAnApLengthLowerBoundRev(ap0) < Config::accessPathLimit() ) or // flow into a callable From d4875b89133d7c36d9d5155e4ed5d7b3fbbd6761 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 9 Nov 2026 09:27:45 +0100 Subject: [PATCH 2/2] Dataflow: Allow a config ap limit above the language default. --- .../codeql/dataflow/internal/DataFlowImplCommon.qll | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll index 8d77198e5721..e163b8eee6b6 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll @@ -1794,15 +1794,22 @@ module MakeImplCommon Lang> { TReturnCtxNoFlowThrough() or TReturnCtxMaybeFlowThrough(ReturnPosition pos) + /** + * Gets the upper bound for the access path length limit that is supported + * in data flow Configurations. This is set to be at least twice the + * language default access path limit. + */ + private int accessPathLimitConfigCap() { result = 10.maximum(2 * accessPathLimit()) } + cached newtype TAccessPathFront = TFrontNil() or - TFrontHead(Content c, int length) { length in [1 .. accessPathLimit()] } + TFrontHead(Content c, int length) { length in [1 .. accessPathLimitConfigCap()] } cached newtype TApproxAccessPathFront = TApproxFrontNil() or - TApproxFrontHead(ContentApprox c, int length) { length in [1 .. accessPathLimit()] } + TApproxFrontHead(ContentApprox c, int length) { length in [1 .. accessPathLimitConfigCap()] } cached newtype TAccessPathFrontOption =