问题标签 [codeql]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
recursion - How is this recursive CodeQL predicate is evaluated?
I'm in the process of trying to learn CodeQL and I'm a little confused about how certain CodeQL code is evaluated. I'm hoping someone can help me with a more simplistic explanation.
Take the following CodeQL code:
The result I get back is:
I understand why Belgium and Austria are returned. However I'm confused as to how CodeQL determines that France is to be returned as a result. My imperative programming intuition tells me that for France to be returned, I would need an additional line that looks something like country = "Germany" and result = "France", but I'm really confused here how France is being returned without that line of code.
Also, how does this line work exactly?:
With some of the simple examples that are given in the CodeQL handbook, they make it seem like that the 'result' keyword almost acts like 'return' in other languages. I feel that I have a fundamental misunderstanding of what 'result' does and how it works. I can't seem to find a good explanation after googling.
Thanks in advance!
semmle-ql - 如何在部分 c 源代码上使用 CodeQL?
我有一个项目的部分 c 源代码,因此我无法构建。有谁知道是否可以在该项目上运行 codeql?
通常,要创建数据库,codeql cli 需要指定构建项目的命令,我无法绕过它,即使我会说能够构建项目看起来并不重要。
不过我可能是错的,欢迎任何见解。
javascript - codeql CLI lgtm.yml:如何自定义 javascript 提取?
在使用 LGTM.com 构建数据库时,我可以使用 lgtm.yml 文件自定义 javascript 提取器,但是如何将这些自定义提供给 codeql CLI?
具体来说,我想包含一个提取器默认排除的目录(node_modules)。
这是我的 lgtm.yml 文件:
python - 实现 CI 测试以检查函数参数是否有效的方法?
假设我有一个 python 函数和字典,如下所示:
当我将代码推送到 GitHub 时(可能是某种持续集成),有没有办法检查所有调用是否foo
仅使用 的一个键d
作为input
参数,如果有调用带有无效参数,则标记它还是发出警报?
例如:
我知道如何ValueError
在运行时引发异常,但我正在寻找一个 CI 解决方案以包含在我们的 GitHub 工作流程中。现在我们正在使用 Travis-CI 进行自定义测试和 LGTM 提供的标准 CodeQL 测试。我研究过通过 LGTM 使用自定义 CodeQL,但我不太明白。我会很好地在这些持续集成中实现它或实现第三个。
c - 什么是通过套接字发送请求的良好指标?
我正在为 apache 和 nginx 等 Web 服务器编写一些 codeql。我做了一些研究,发现请求的一个很好的指标是 ntohs 或 ntohl,因为通过套接字发送的数据需要从网络字节顺序转换为主机字节顺序。我应该为 Web 服务器使用其他指标吗?
github - 有没有办法在codeql中处理Lombok-ed源文件
我正在尝试使用 codeql ( https://securitylab.github.com/tools/codeql ) 编写代码分析器,但我考虑了一个错误,该错误显示为以下内容
所以我的 lombok-ed 源文件不包含在 codeql 数据库中
eg.my lombok-ed 源文件显示为以下内容
并且该文件不包含在 src.zip 中 在此处输入图像描述
static-analysis - 如何将库/依赖项的额外源代码添加到 CodeQL 数据库?
我试图在我从 LGTM (GNU coreutils) 下载的代码存储库中全局跟踪污点,但 CodeQL 似乎也认为对 libc 的调用是“污点”,而它们实际上并没有引入任何污点。考虑以下示例:
如果some_array
或被some_fptr
污染,现在 CodeQL 也会认为字节被污染。我怀疑这是为了安全起见(而不是高估污染而不是低估)。
编辑:显然,默认情况下,外部调用被认为不会引入污点,但对于 libc 等常见 API,模型是根据文档制作关于污点跟踪的。然而,在这种情况下,它似乎有点错误,但它们正在不断发展。
我将如何在 CodeQL 保留的源数据库中包含 glibc 源,以便查询可以更准确地确定这些“闭源”函数调用中的污点?
如果代码依赖于其他一些预编译库怎么办,我如何使 CodeQL 可以使用它的源代码?