Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation on data flow in Go (and some small fixes for java) #18511

Merged
merged 14 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
(Multiple languages) Be clearer about which query is being discussed
owen-mc committed Jan 20, 2025
commit d46899d37b5bf1589cdbec498866ccbc3d06a4b9
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ Then we can make the source more specific, for example an access to a public par
and call.getEnclosingCallable().(Member).isPublic()
select p, "Opening a file from a public method."

This query finds calls to ``String.Format`` where the format string isn't hard-coded:
The following query finds calls to ``String.Format`` where the format string isn't hard-coded:

.. code-block:: ql

Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ For example, you can find taint propagation from a parameter ``source`` to an ex
Examples
~~~~~~~~

This query finds the filename passed to ``os.Open(..)``.
This query finds the filename passed to ``os.Open(..)``:

.. code-block:: ql

@@ -131,7 +131,7 @@ Then we can make the source more specific, for example an access to a parameter.
DataFlow::localFlow(DataFlow::parameterNode(p), DataFlow::exprNode(call.getArgument(0)))
select p

This query finds calls to formatting functions where the format string is not hard-coded.
The following query finds calls to formatting functions where the format string is not hard-coded.
Note that `StringOps::Formatting::Range <https://codeql.github.com/codeql-standard-libraries/go/semmle/go/StringOps.qll/type.StringOps$StringOps$Formatting$Range.html>`_ is a class that represents all functions which have a format string, and its member predicate `getFormatStringIndex` gives the index of the argument which is the format string.

.. code-block:: ql
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ For example, you can find taint propagation from a parameter ``source`` to an ex
Examples
~~~~~~~~

This query finds the filename passed to ``new FileReader(..)``.
This query finds the filename passed to ``new FileReader(..)``:

.. code-block:: ql

@@ -137,7 +137,7 @@ Then we can make the source more specific, for example an access to a public par
DataFlow::localFlow(DataFlow::parameterNode(p), DataFlow::exprNode(call.getArgument(0)))
select p

This query finds calls to formatting functions where the format string is not hard-coded.
The following query finds calls to formatting functions where the format string is not hard-coded.

.. code-block:: ql