-
I'm working on a project where I need to override the isSource, isSink, isBarrier predicates for several JavaScript security queries. For the PrototypePollutingAssignment.ql:
I understand that the dataflow configuration information comes from here in PrototypePollutingAssignmentQuery.qll:
I know that previously for Configurations classes we could simply extend and overide them like so:
However these Configuration classes are now deprecated in favor of modules. I can declare a new module that implements the same predicates as PrototypePollutingAssignmentConfig and that seems to allow me to keep the same funcitonality while changing certain predicates:
My question is does CodeQL support a method to inherit the predicates from other modules so users override certain predicates? I want to try certain changes to sources, sinks and barriers at scale and it would be much simpler if I could just inherit the Config from the security query and override the 1 or 2 predicates I want, rather than redeclaring the config only to change what I want each time. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
👋 @jghebre From what I tried, it does appear that is not possible. I got a somewhat terser way of doing that using module and predicate aliases: module Cfg = PrototypePollutingAssignmentConfig;
module GeneralConfig implements DataFlow::StateConfigSig {
class FlowState = Cfg::FlowState;
predicate isSource = Cfg::isSource/2;
predicate isSink = Cfg::isSink/2;
predicate isBarrier = Cfg::isBarrier/2;
} This still requires you to list all the "default" predicates you want to leave unchanged, but at least is less verbose than redefining the predicates. Let me ask around whether there's another way to achieve what you want. By the way, as far as I could see the latest version of the prototype pollution assignment query uses state data flow (which is why I'm implementing |
Beta Was this translation helpful? Give feedback.
@jghebre I can confirm that at the current time there is no better solution than using aliases as I suggested. You're not the first asking for such a feature though, so I would not exclude this will be possible at some point in the future. We can't make any promises at this time though.