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
LGTM deprecation: miscellaneous changes #11433
base: main
Are you sure you want to change the base?
Conversation
|
QHelp previews: go/ql/src/Security/CWE-601/BadRedirectCheck.qhelpBad redirect checkRedirect URLs should be checked to ensure that user input cannot cause a site to redirect to arbitrary domains. This is often done with a check that the redirect URL begins with a slash, which most of the time is an absolute redirect on the same host. However, browsers interpret URLs beginning with RecommendationAlso disallow redirect URLs starting with ExampleThe following function validates a (presumably untrusted) redirect URL 0 && redir[0] == '/' {
return redir
}
return "/"
}
">
package main func sanitizeUrl(redir string) string { if len(redir) > 0 && redir[0] == '/' { return redir } return "/" } While this check provides partial protection, it should be extended to cover package main
func sanitizeUrl1(redir string) string {
if len(redir) > 1 && redir[0] == '/' && redir[1] != '/' && redir[1] != '\\' {
return redir
}
return "/"
}References
python/ql/src/Imports/SyntaxError.qhelpSyntax errorSyntax errors prevent a module being evaluated and thus imported. An attempt to import a module with invalid syntax will fail; a A common cause of syntax errors is the difference in syntax between Python 2 and Python 3. In particular, a syntax error may be alerted if a Python 3 file is assumed to be compatible with Python 2 (or vice versa). Explicitly specifying the expected Python version can help prevent this. The existence of a syntax error in a module may suggest other problems as well. Either the module is never imported in practice and could be deleted or a RecommendationFixing the syntax error is the obvious fix. However, it is worth investigating why a module containing a syntax error was able to persist and address that problem as well. If you suspect that the syntax error is caused by the analysis using the wrong version of Python, consider specifying the version explicitly. When you run code scanning using the CodeQL action, you can configure the Python version to use. For more information, see Analyzing Python dependencies. References
|
|
It looks as if I need to run a formatter over the query files (and maybe the QLL files). Can someone help? |
Co-authored-by: Taus <tausbn@github.com>
In case you ever need to invoke the formatter in the future, the relevant command is ( If you don't have the CodeQL CLI installed locally, the easiest way to install it is probably to do so via the (and then using Alternatively, you can format the file using the VSCode CodeQL extension. |
| @@ -9,6 +9,5 @@ assignees: '' | |||
|
|
|||
| **Description of the issue** | |||
|
|
|||
| <!-- Please explain briefly what is the problem. | |||
| If it is about an LGTM project, please include its URL.--> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it useful to keep something like this in, but change LGTM -> GitHub?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't make the suggestion here, so have put the revised comment back in a different comment.
| @@ -9,6 +9,5 @@ assignees: '' | |||
|
|
|||
| **Description of the issue** | |||
|
|
|||
| <!-- Please explain briefly what is the problem. | |||
| If it is about an LGTM project, please include its URL.--> | |||
| <!-- Please explain briefly what is the problem.--> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <!-- Please explain briefly what is the problem.--> | |
| <!-- Please explain briefly what is the problem. | |
| If it is about a GitHub project, please include its URL. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion in response to @aeisenberg's comment on the line below.
The changes in this pull request replace references to LGTM in the following locations:
If your team has been pinged, please can you take a look and check that the substitutions that I've made are appropriate. Feedback very welcome.