Skip to content
\n

The minimal codeql query:

\n
/**\n * @kind path-problem\n */\nimport go\nimport DataFlow\nimport PathGraph\nimport semmle.go.security.CommandInjection\n\nimport kubernetes_controller_client\n\nclass MySource extends Parameter {\n    MySource() {\n        this.getFunction().getName() = \"Reconcile\" and\n        this.getType().hasQualifiedName(\"sigs.k8s.io/controller-runtime/pkg/reconcile\", \"Request\")\n    }\n}\n\nclass MyConf extends TaintTracking::Configuration {\n    MyConf() { this = \"MyConf\" }\n\n    override predicate isSource(DataFlow::Node node) {\n        node.asParameter() instanceof MySource\n    }\n\n    override predicate isSink(DataFlow::Node node) {\n        node instanceof CommandInjection::Sink\n    }\n}\n\nfrom DataFlow::PathNode source, DataFlow::PathNode sink, MyConf cfg\nwhere cfg.hasFlowPath(source, sink)\nselect sink.getNode(), source, sink, \"Found path\"
\n

Any ideas ?

\n

P.S.: I would also like to taint only some of the Sample's type fields (i.e. Spec and some of the metadata), is that even possible? or should I flip the issue and create Sanitizers/Barriers to exclude the rest instead?

\n

Thanks in advance!

","upvoteCount":2,"answerCount":5,"acceptedAnswer":{"@type":"Answer","text":"

I discussed your first point with some colleagues. It would be nice, but it would be a lot of work. We have added it to our list of issues we may work on in the future.

\n

For your second point, I have made a draft PR which should fix/improve the situation (when combined with #13461). So far I have only tested it on your example, where it does indeed add a path step where you expected it. (There is the same backwards flow immediately afterwards, but it isn't shown in the path summary because it is skipped over). There is more work to be done to make sure this doesn't cause any regressions and works in all situations, but I am hopeful we will be able to get this in and improve path summaries for CodeQL for Go.

","upvoteCount":0,"url":"https://github.com/github/codeql/discussions/13415#discussioncomment-6188194"}}}
Discussion options

You must be logged in to vote

I discussed your first point with some colleagues. It would be nice, but it would be a lot of work. We have added it to our list of issues we may work on in the future.

For your second point, I have made a draft PR which should fix/improve the situation (when combined with #13461). So far I have only tested it on your example, where it does indeed add a path step where you expected it. (There is the same backwards flow immediately afterwards, but it isn't shown in the path summary because it is skipped over). There is more work to be done to make sure this doesn't cause any regressions and works in all situations, but I am hopeful we will be able to get this in and improve path summaries …

Replies: 5 comments 10 replies

Comment options

You must be logged in to vote
1 reply
@rh-tguittet
Comment options

Comment options

You must be logged in to vote
3 replies
@rh-tguittet
Comment options

@owen-mc
Comment options

@owen-mc
Comment options

Comment options

You must be logged in to vote
3 replies
@rh-tguittet
Comment options

@owen-mc
Comment options

@rh-tguittet
Comment options

Comment options

You must be logged in to vote
3 replies
@rh-tguittet
Comment options

@owen-mc
Comment options

Answer selected by rh-tguittet
@rh-tguittet
Comment options

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants