我正在测试 SonarQube Community Edition,版本 7.9.4(内部版本 35981)(因为 LTS),其中包含一些故意危险的 js 代码,例如:
eval(evt.body);
const net = require('net');
var socket = new net.Socket(); // Questionable
socket.connect(80, 'google.com');
// net.createConnection creates a new net.Socket, initiates connection with socket.connect(), then returns the net.Socket that starts the connection
net.createConnection({ port: port }, () => {}); // Questionable
// net.connect is an alias to net.createConnection
net.connect({ port: port }, () => {}); // Questionable
let password = 'my totally secret password';
console.log(password);
(一切都取自质量概况中给出的安全问题示例:推荐的 Sonar 方式)
但我在仪表板上看不到任何错误。错误和代码味道正在显现。
从我读到的文档中: 为什么我看不到任何漏洞或安全热点?
You might not see any Vulnerabilities or Security Hotspots for the following reasons:
- You don't have any because the code has been written without using any security-sensitive API.
- Vulnerability or Security Hotspot rules are available but not activated in your Quality Profile so no Security Hotspots or
- Vulnerabilities are raised. The analyzer for your language might only currently offer a few rules and won't raise any or only a small number of Vulnerabilities
or Security Hotspots.
#1 是不可能的,因为我故意放了错误的代码。
#2 我的“Sonar way Recommended”说它有 13 个活跃的安全热点
#3 我不知道如何设置特定的分析器
我还尝试禁用质量门(放置一个假的门)以防万一没有任何覆盖阻止显示其他错误,但无济于事。
我可以做些什么来显示这些错误吗?
编辑:如果解决方案是更改版本,我也可以这样做
最佳答案
对于其他读者:问题是我试图一次测试太多东西,所以不仅是安全热点,还有一般的 linting 错误,const 重新定义两次,let 不重新定义,以及使用 let 关键字重新定义变量:
let x=1
// some other lines...
let x='two'
首先“解决”这些错误之后(它们不是为了解决而是故意显示...)现在我可以看到安全热点问题
https://stackoverflow.com/questions/63833488/
相关文章:
go - 我可以将 volume 挂载到 Katib Experiment 吗?
.net - Visual Studio 调试时未找到 : ScriptLoggingBuilder
asp.net-core - 客户端中的 IdentityServer 4 身份验证事件
firebase - 使用 firebase 时 Google 应用程序脚本中的服务器错误
typescript - Deno 记录器 FileHandler 不写入文件
c# - 连接池中处于 TIME_WAIT 状态的许多连接,在 WebApi 中使用静态或单个 Ht