The Pragmatic Engineer - 软件工程师的代码安全 封面

软件工程师的代码安全

Code security for software engineers

本集简介

由以下赞助商为您呈现: • Statsig —— 集功能开关、数据分析、实验等功能于一体的统一平台。Statsig助力首届Pragmatic峰会成为现实。2月11日,旧金山特别一日活动,与我及400位顶尖工程师和领导者共襄盛举。立即预订席位。 • Linear —— 现代产品开发系统。如今工程团队借助AI大幅提速,协作问题随之凸显。Linear正是为高效团队保持专注而生。了解Linear。 — 作为软件工程师,编写安全代码需要了解什么? Johannes Dahse是Sonar代码安全副总裁,拥有20年行业经验的安全专家。在本期《务实工程师》节目中,他将与我探讨安全团队的实际职责、开发者应承担的责任,以及现实风险如何潜入现代代码库。 我们将讨论依赖风险、软件成分分析、CVE漏洞、动态测试,以及日常开发实践如何影响安全结果。Johannes还将解析AI在哪些领域真正有效、会引入哪些新故障模式,以及为何理解自己编写和发布的代码仍是最可靠的防御手段。 如果您从事软件开发和发布,本期节目将为您提供真实工程约束下思考代码安全的实用指南。 — 时间轴 (00:00) 开场 (02:31) 什么是渗透测试? (06:23) 代码安全责任归属:开发者还是安全团队? (14:42) 什么是代码安全? (17:10) 开发者必备的代码安全基础 (21:35) 高级安全挑战 (24:36) SCA成分分析测试 (25:26) CVE漏洞计划 (29:39) 《代码安全现状报告》解读 (32:02) 代码质量与安全性的关系 (35:20) 开发机作为安全漏洞源 (37:29) 常见安全工具 (42:50) 动态安全测试工具 (45:01) AI安全审查的局限性 (47:51) AI生成代码的风险 (49:21) 代码越多漏洞越多 (51:44) AI对代码安全的影响 (58:32) 安全行业常见误解 (1:03:05) 何时算"足够安全"? (1:05:40) Johannes最爱的编程语言 — 本期相关《务实工程师》深度内容: • 什么是安全工程? • Next.js安全漏洞处理不当事件 • Okta安全实践教训 — 节目制作与营销由https://penname.co/负责。赞助咨询请邮件podcast@pragmaticengineer.com。 订阅The Pragmatic Engineer完整内容请访问newsletter.pragmaticengineer.com/subscribe

双语字幕

仅展示文本字幕,不包含中文音频;想边听边看,请使用 Bayt 播客 App。

Speaker 0

每位软件开发者都应了解的代码安全基础知识有哪些?

What are code security basics that every software developer should know?

Speaker 0

真正了解并理解你的代码在做什么。

Really know and understand what your code is doing.

Speaker 0

也许听起来有点

Maybe that sounds a

Speaker 1

愚蠢且显而易见,但安全专家正是这样发现代码中的基本安全问题的。

bit silly and obvious, but that's how security experts find basically security issues in your code.

Speaker 1

我会搭建一个

I'll set up

Speaker 0

声称执行某项功能但实际上暗中执行其他操作的MCP服务器。

an MCP server that says it does something, but secretly does something else.

Speaker 1

它在本地运行。

It runs locally.

Speaker 1

砰。

Boom.

Speaker 1

随着智能代理的出现和更多控制权的让渡,这里出现了一个新的威胁——不仅要关注你使用的依赖项和整体机器安全,还要确保你使用的代理在做正确的事情。

With agents and giving away more control, there is a new threat here because it's not just about the dependencies you're using or your machine security in general, but also making sure that the agent you're using is doing the right thing.

Speaker 0

你认为AI是如何改变代码安全乃至整体安全领域的?

How do you think AI is changing code security and also security in general?

Speaker 0

今天我们看到的是,作为软件工程师,我们应该了解哪些关于编写安全代码的知识?

Today, we're seeing is As software engineers, what should we know about writing secure code?

Speaker 0

为了回答这个问题,我请教了Johannes Das,他拥有二十年安全专家经验,现任Sonar公司代码安全副总裁。

To answer this question, I turn to Johannes Das, who has been a security expert for twenty years and is currently the VP of code security at Sonar.

Speaker 0

在本期节目中,我们将探讨:所有软件工程师都应了解的代码安全基础知识、值得了解和使用的常见代码安全工具(如静态应用安全测试)以及更先进的工具(如软件成分分析)、AI编程助手如何引入新风险及应对措施等内容。

In today's episode, we cover: Code security basics all software engineers should know of Common code security tools worth knowing of and using, like static application security testing and more advanced tools like software composition analysis how AI coding assistants introduce new risks and what we can do about these, and more.

Speaker 0

如果你是一名寻求如何让代码更安全的软件工程师,本期节目正适合你。

If you're a software engineer looking for pointers on how to make your code more secure, this episode is for you.

Speaker 0

本期播客节目由Statsig赞助播出,Statsig是功能开关、数据分析、实验等功能的统一平台。

This podcast episode is presented by Statsig, the unified platform for flags, analytics, experiments, and more.

Speaker 0

查看节目说明以了解更多关于他们和我们本季其他赞助商的信息。

Check out the show notes to learn more about them and our other season sponsor.

Speaker 0

那么,约翰内斯,欢迎来到播客节目。

So, Johannes, welcome to the podcast.

Speaker 1

谢谢。

Thank you.

Speaker 1

非常高兴能来到这里。

Big pleasure to be here.

Speaker 0

我们今天要讨论网络安全的话题。

So we're gonna talk about cybersecurity today.

Speaker 0

我想了解一下,你是如何进入网络安全领域的,那是什么时候的事?

I wanted to get to know how did you get into cybersecurity, and when was this?

Speaker 1

大概是在二十年前吧。

Must have been, like, twenty years ago.

Speaker 1

我记得我当时被黑客攻击了。

I I remember I got hacked.

Speaker 1

基本上,我的电脑被感染了。

Basically, my computer got infected.

Speaker 1

我记得那是很久以前的SASSA病毒,当时我特别沮丧。

I think it was the SASSA one back in the days, and I was super frustrated.

Speaker 1

对吧?

Right?

Speaker 1

但同时也特别好奇,比如:别人是怎么入侵我电脑的?

And then also super intrigued, like, how could someone get access to my computer?

Speaker 1

这促使我开始在学校里捣鼓安全相关的东西,比如特洛伊木马之类的。

And so that led me into, you know, playing with security things like Trojan horses and that stuff at school time.

Speaker 1

后来我搬到了德国波鸿市,那里可以学习IT安全专业,这让我很兴奋。

And then I moved to Bochum, a city in Germany, where you could study IT security, and that was exciting.

Speaker 1

我们还参加了夺旗赛,对吧?

And so they played capture the flag competitions, right?

Speaker 1

那是大学团队在隔离网络环境中进行的黑客竞赛,通过互相攻击得分。我对这类比赛简直着了迷,这成了我最好的学习经历。这让我后来进入了专业渗透测试领域,开发漏洞挖掘工具,最终还促使我创办了后来被Sona收购的初创公司。

Those are hacking competitions where university teams connect online in an isolated environment, and they try to hack each other to get points, and I got really obsessed playing those competitions, and that was the best learning experience for me, you know, and this led them into, you know, me getting into professional penetration testing, writing tools to assist the the vulnerability hunting, and and this led then into a startup which got acquired by Sona, where

Speaker 0

我现在就在这里工作。

I am today.

Speaker 0

我们该如何理解渗透测试?

How can we imagine penetration testing?

Speaker 1

渗透测试本质上就是模拟一次攻击。

So penetration testing is, simulating an attack, basically.

Speaker 1

对吧?

Right?

Speaker 1

简单来说就是公司雇佣你当黑客,你需要在规定时间内找出指定应用程序的漏洞。

So you are kind of like a company hires you as a as a hacker, basically, and you you have to find out vulnerabilities in a given, you know, time scope and and and scope of the application that you should test.

Speaker 1

这就像是从业余爱好自然过渡到职业——你从为了比赛积分而黑,到作为学生靠找漏洞赚钱,再到成为专业的安全分析师。

It And was just like a natural move if you do that as a hobby with the hacking competitions, right, where you just do that for winning points in games to do then, you know, kind of, like, earn money with that as a student to to also look for security issues as a professional.

Speaker 0

我明白了,现在确实可以雇佣渗透测试人员。

And I I understand that, you know, like, yes, you can now hire penetration testers.

Speaker 0

对吧?

Right?

Speaker 0

作为公司,我可以雇佣专业团队来做这件事。

As as the company, I can hire teams that do this.

Speaker 0

但你做过这类工作吗?

But did you do some of this?

Speaker 0

你做过专业的渗透测试吗?

Did you do professional penetration testing?

Speaker 1

是的。

Yes.

Speaker 1

当然。

Absolutely.

Speaker 1

有几年时间我以自由职业者身份为大型公司做这个,主要就是寻找他们存在的安全问题,通常通过利用他们运行的软件应用中的漏洞尝试进入他们的网络,然后将这些记录下来。

For a couple of years, doing this as a freelancer and for big companies, basically, right, looking for security issues they they have and always trying to to get into their network, typically, by by exploiting vulnerabilities in software applications they are running and then documenting this.

Speaker 1

对吧?

Right?

Speaker 1

不会进一步行动,不会破坏或进行恶意操作,主要是报告攻击者可能利用这种方式入侵,好让他们能修复漏洞。

Not going further, not destroying something, doing something malicious, but basically reporting then this is how an attacker could get in so they can fix it.

Speaker 0

当公司说'好的,来给我们做渗透测试'时,整个测试过程是怎样的?

How does the penetration test look like from when the company says, like, alright, come and penetration test us.

Speaker 0

你具体是怎么操作的?

How do you actually go around?

Speaker 0

他们会给你某些系统的访问权限吗?还是你需要从零开始假设没有任何信息?

Do they actually give you access to some of their systems, or or you need to just assume no knowledge?

Speaker 0

这个过程是怎么运作的?

How does that work?

Speaker 1

是的。

Yeah.

Speaker 1

不同类型的测试。

The the different types.

Speaker 1

对吧?

Right?

Speaker 1

有黑盒渗透测试和白盒测试,黑盒意味着你没有任何访问权限。

So there's black box penetration testing and white box, meaning black box, you don't have access to anything.

Speaker 1

你就像真正的攻击者那样操作,完全不了解内部情况。

You you treat it as a real attacker, like, with no knowledge.

Speaker 1

通常你会遇到一个正在运行的Web应用,你会从攻击者的角度去观察它,从外部与这个应用进行交互,试图推测出这个应用背后的代码逻辑,通过使用这个应用来推测可能存在的代码实现,然后尝试找出其中可能存在的漏洞。

Now you you, know, you typically you have maybe like a web application running, and and you go and look at it from the attacker perspective, and and play around with the application from the outside, trying to imagine basically what could be the code behind that application, what could be the code doing that I'm seeing from from using that application, and then trying to figure out what could be vulnerabilities here.

Speaker 1

对吧?

Right?

Speaker 1

开发者可能遗漏了哪些操作?

What could be something a developer forgot to do?

Speaker 1

通过经验积累,你会逐渐掌握一些技巧,比如

And by experience, you you learn a bit, like,

Speaker 0

了解常见的错误类型,然后从这些点出发,不断尝试寻找可被利用的漏洞,比如窃取文件、获取数据库访问权限,或是获取对业务敏感的关键数据——这些都可能成为安全威胁。

what are typical mistakes, and and then you you go from there, trying to always, you know, exploit something where you can steal files or or get access to the database or something where there is some data, something, you know, that could be sensitive to the business that that then security critical.

Speaker 0

你们会自带工具吗?

Do you bring your own tools there?

Speaker 0

有没有系统性的方法论?

Do you have, like, methodologies?

Speaker 0

虽然很基础,但我知道有个概念叫端口扫描——就是编写软件尝试连接各种端口发送信息,希望当服务器配置错误(甚至正确配置时)能找到突破口。

Like, I guess, you know, like, it's very basic, but I I do know of the concept called port scanning where you write a software where it tries all the different ports, it sends messages, and you hope that if they configure it up a server incorrectly or or or maybe correctly, you can get through.

Speaker 0

但你具体会用到哪些工具呢?

But what what kind of tools that do do you come with?

Speaker 1

作为渗透测试人员,你确实会使用工具。

You do use tools in in in as a penetration tester.

Speaker 1

我认为主要是用来探测可用的资源。

I think mostly for kind of, like, mapping out what's available.

Speaker 1

对吧?

Right?

Speaker 1

我觉得最大的部分就是自动化这些测试,这样你就不需要手动检测端口或终端了。

That's, I think, the biggest part you automate so you don't, you know, test for the endpoints or ports, as you said.

Speaker 1

但一旦你摸清了整体情况,就会开始手动操作。

But I think then once you found a good landscape of what's out there, you you go in manually.

Speaker 1

至少我以前都是手动操作,尝试各种触碰和试探,看看哪些地方会出问题,这其实也是最刺激的部分。

At least I used to do that manually to to, you know, try to to poke and and see what what breaks when you touch it and when when when you play around with it, and that's also the most exciting part, I think.

Speaker 0

要知道,在现实工作中,我们作为软件工程师坐在公司里开发软件时

You know, in in the real world, we're gonna be sitting, you know, as as software engineers inside a company, and we're gonna be building our software.

Speaker 0

这些可能是服务。

This might be services.

Speaker 0

这些可能是应用、网站等等。

This might be apps, websites, and so on.

Speaker 0

外部会有攻击者,比如脚本小子或者随便玩玩的人四处试探,也会有专业人士试图获取经济利益等等。

And there's gonna be attackers outside, it's gonna be like script kids or like, you know, like people just like, playing around, poking around, and there's gonna be professionals as well who will be trying to get financial gain, whatnot.

Speaker 0

现在在公司内部,谁应该负责代码安全?

Now inside the company, who should own code security?

Speaker 0

要知道,在当今行业中,我们看到的情况是

You know, the in the industry today, what we're seeing is that this is

Speaker 1

这基本上是一项共同责任。

a shared responsibility, basically.

Speaker 1

对吧?

Right?

Speaker 1

所以我们谈到了渗透测试,通常安全团队会参与其中。

So we talked about the penetration tests, and typically, security teams are involved in that.

Speaker 1

然后还有开发人员,你知道的,他们在不断添加和编写代码。

And then there is still developers, you know, adding and writing code.

Speaker 1

对吧?

Right?

Speaker 1

我认为在行业内,主流观点是安全团队应该负责所有安全事务。

And I think predominantly in the industry, the view is that the security team should own all that security.

Speaker 1

对吧?

Right?

Speaker 1

毕竟团队名称里就有'安全'二字。

It's in the name of the team.

Speaker 1

但我持完全相反的看法。

But I see it quite the other way around.

Speaker 1

我认为,基本上每个软件漏洞都体现在代码中,而开发人员是组织中唯一编写和修改代码的人。

I I think, you know, every software vulnerability basically manifests in code, and and developers are the only ones writing the code in in organizations and changing the code.

Speaker 1

对吧?

Right?

Speaker 1

而且他们是唯一能修复安全问题的人。

And they are the only ones who can fix security issues.

Speaker 1

所以我认为他们应该对所有代码安全问题负责。

And so I think they they should own all those code security issues.

Speaker 1

对吧?

Right?

Speaker 1

他们基本上应该对自己的代码份额以及与其代码相关的问题负责。

They should own basically their share of the code and also the problems related to their code.

Speaker 1

我认为这在当今也更现实,因为开发者现在有很好的教育资源和完善的工具可用。

And I think that's also more realistic today because you have great education available and great tools available for developers.

Speaker 1

所以我认为代码安全问题的责任应该由开发者承担。

So I think that ownership should be with developers on on the code security problems.

Speaker 0

我听到你说开发者应该负责代码安全,但那样为什么还需要安全团队,或者说在什么情况下才需要安全团队?

I hear what you're saying on devs should own code security, but then why have a security team, or at what point should you have a security team?

Speaker 0

再说你现在与许多不同规模和类型的公司合作,之前也担任过安全工程师。

Again, you now work with a lot of different companies and sizes and previously also worked as security engineer.

Speaker 0

公司在什么情况下会引入安全团队?

At what point do companies bring in a security team?

Speaker 0

当他们引入时,安全团队的职责是什么?

And when they do, what is their role?

Speaker 0

我有点觉得,既然有安全团队,那就该发挥作用。

I'm kind of like, look, if there's a security team, I'm like, come on.

Speaker 0

他们...那就是他们的职责所在。

They they that's their name.

Speaker 0

对吧?

Right?

Speaker 0

作为开发者,要确保整个服务100%安全,这确实令人望而生畏。

Like, as a developer, like, security as a whole, like, to make your your service a 100% secure, that's pretty daunting.

Speaker 1

迪亚托,我并不认为安全团队毫无用处。

Diato, I I don't think that security teams are useless.

Speaker 1

对吧?

Right?

Speaker 1

完全不是这样。

Not at all.

Speaker 1

我们之前讨论过渗透测试。

I we we talked about the the penetration test.

Speaker 1

这通常是安全团队负责的工作。

That's that's typically something run by security teams.

Speaker 1

所以我认为应用安全领域远比代码安全要广泛得多。

And so I think the the field of, you know, application security is just much more broader than than code security.

Speaker 1

对吧?

Right?

Speaker 1

你可能需要关注合规要求、组织范围内的安全计划、渗透测试的可用性报告或新出现的威胁。

So you have maybe compliance requirements that that you need to look after and and some, you know, organization wide initiatives, security initiatives, or the availability reports coming in from a penetration test or new threats available.

Speaker 1

因此我认为安全团队应该着眼于更广泛的应用安全领域,在这方面拥有安全团队是很有必要的。

And so security teams, I think, should look at this broader application security field, and and it's it's good to have a security team for that.

Speaker 1

而且组织规模越大,我认为就越需要安全团队。

And the larger the organization gets, right, you I think you need a security team.

Speaker 1

我只是认为,当开发软件和组织部署软件时,安全团队不应该把时间浪费在排查开发过程中出现的每一个安全问题上。

I just think that when you write software and when organizations, you know, deploy software, the security team shouldn't waste their time in in looking into every single security issue that happens during development.

Speaker 1

对吧?

Right?

Speaker 1

我认为这部分工作应该完全由开发人员负责。

And I think that part should be fully owned by by developers.

Speaker 1

对吧?

Right?

Speaker 1

我觉得反复检查每一个新的跨站脚本问题,试图构建复杂攻击和风险评估是浪费时间,而开发人员本可以在编码时直接修复问题并继续推进。这样安全团队也能有更多时间专注于更重要的问题,那些真正需要他们专业知识的领域,比如密码学、认证逻辑等,在这些方面他们可以为开发人员提供宝贵帮助。

I think it's a waste of time to look at every single new crosshatch scripting issue again and again and try to exploit and build some some fancy exploit and risk assessment where SE developers could just, you know, fix issues as they as they code and move on, and that also allows then security teams to to have more time to actually focus on bigger problems, on on problems where they can really bring in their expertise, like cryptography or or authentication logic or things like this where they can then also be very helpful with the expertise for developers.

Speaker 0

所以我听到了一些与功能团队/项目团队和平台团队类似的模式,平台团队通常构建供工程师使用的专业平台。

So I'm kind of hearing some similarities between the kind of feature teams or program teams and platform teams where, you know, platform teams typically build platforms where engineers can build on and they have a specialized expertise.

Speaker 0

可能是像大型数据存储公司那样庞大的数据库平台,工程师们通过API使用它,但无需了解所有细节。

It might be a massive database platform, like, for for a large data storage company, and then engineers, they kind of use the APIs, but they don't need to know all the details.

Speaker 0

但当他们需要时,可以直接咨询平台团队:'嘿,我该如何存储2PB的数据?'

But when they do, they can just go to the platform team saying, hey, How do I store, you know, like like, two petabytes of data?

Speaker 0

然后他们会说,好的。

And they'll be like, okay.

Speaker 0

这里有几种不同的方法可以实现。

Here's different ways you can do it.

Speaker 0

那么我的理解是否正确,你是在说安全团队也应该成为这种专业支持力量,既能提供各种帮助,又能为开发人员打造工具,让他们能自助解决问题,或是共享需要警惕的常见事项?

So do I understand correctly that you're kind of saying security teams will also be this, like, specialized expertise where they can help you with a bunch of stuff, and they will try to do tools as well for for devs to, like, self-service or or, you know, share common things to watch out for.

Speaker 1

是的。

Yeah.

Speaker 1

没错。

Exactly.

Speaker 1

我觉得这个类比很恰当。

I think it's a good comparison.

Speaker 1

对吧?

Right?

Speaker 1

当然要提供帮助,但也要把主要责任留给开发人员,这样安全才能真正融入开发流程,而不是事后附加或临时补救的措施。

Definitely helping, but also leaving, you know, the majority of ownership there with developers so they can basically have security as part of the process of development and not just something that is, you know, attached to or ad hoc run.

Speaker 1

每当安全团队决定时,我认为这确实应该成为开发流程的一部分,并且必须由开发人员来负责,真正参与解决安全问题,因为这才是最终保障安全的关键。

And whenever the security teams decides, right, I think it should be really part of the process of development, and and that must be then owned by developers to really, you know, engage in security issues and and fix them because that's what makes you secure in the end.

Speaker 1

我要向你提出挑战

I will challenge you

Speaker 0

从历史上看,我不认为软件工程师曾经负责或被认为应该负责安全。

all that historically, I don't think software engineers owned security or were expected to own.

Speaker 0

我们能聊聊这二十年来这种变化是如何发生的吗?你目睹了哪些转变?

Can we talk about how this changed over time, over your twenty years, how how you've seen changes happen?

Speaker 0

因为我确实感觉到责任在向开发者左移,但历史背景是怎样的?现在又发生了什么变化?

Because I do feel it's shifting left on onto developers, but what was the historic context here, and and what what is changing now?

Speaker 1

从历史上看,我认为这显然是由安全团队负责的。

Historically, I think it was clearly owned by security teams.

Speaker 1

对吧?

Right?

Speaker 1

如果你回想二十年前,那时一切都以合规为导向,而且软件开发周期比现在慢得多。

So if you imagine twenty years back, it was all about compliance, driven by compliance, and then also the software development life cycle was a lot slower than today.

Speaker 1

对吧?

Right?

Speaker 1

以前是季度发布一次,在发布前会有安全团队来做最终审计。

You would have your quarterly release, and then there would be before that, there would a security team come in and and do a final audit.

Speaker 1

对吧?

Right?

Speaker 1

然后你们才会发布。

And then you would release.

Speaker 1

而如今我们的节奏快得多,每天甚至每小时都要发布好几次。

And and today, we are just moving at a much more faster pace, releasing a couple of times a day or per hour.

Speaker 1

对吧?

Right?

Speaker 1

现在有了AI编程助手,我们的开发速度大大提升了。

And you have AI coding assistance, and so we are moving a lot faster now.

Speaker 0

Johannes刚才谈到现在的工程团队开发节奏比过去快得多,尤其是使用AI编程助手的团队——说实话现在大部分工程团队都在用。

Johannes just talks about how engineering teams today are moving at a much faster pace than before, especially teams using AI coding assistance, which are most engineering teams, honestly.

Speaker 0

不过这里有件令人意外的事。

Here's something surprising though.

Speaker 0

随着开发团队以前所未有的速度构建更多产品和功能,协调问题却日益凸显。

As dev teams build more products and features faster than before, coordination is increasing the problem.

Speaker 0

现在你们会冒出更多Slack频道,需要处理更多客户反馈,经常不得不在不同工具间切换来决定要构建什么以及如何构建。

You now have more Slack channels pop up, more customer feedback to deal with and you often end up switching between different tools to decide what to build and how to build it.

Speaker 0

这正是经验丰富的赞助商Linear能帮助开发团队保持专注的地方。

This is where a seasoned sponsor, Linear, can help dev teams stay focused.

Speaker 0

Sierra是一家AI驱动的客户体验初创公司。

Sierra is an AI powered customer experience startup.

Speaker 0

他们正在为公司下一阶段的增长做准备,希望找到一个能帮助更大团队快速行动而不减速的工具。

They were preparing for the next phase of company growth and wanted to find a tool that can help a larger team move quickly without slowing down.

Speaker 0

他们选择Linear作为公司的操作系统,将所有工作都接入这个平台。

They chose Linear as their operating system of the company and wired all of their work into the platform.

Speaker 0

如今,Linear中的项目更新会同步到Slack,客户请求被记录在Linear,平台数据会被提取到公司仪表盘和Sierra在全员会议上展示胜利成果的幻灯片中。

Today, project updates in Linear ripple through Slack, customer requests are logged in Linear, and stats from Linear are pulled out into company dashboards and into the slides that Sierra shows off as they celebrate wins at all hands meetings.

Speaker 0

尽管Sierra处于高速增长阶段,但每个人都清楚他们在构建什么、为何构建以及工作进展如何。

Despite Sierra being in hypergrowth, everyone understands what they're building, why they're building it, and how the work is progressing.

Speaker 0

我欣赏Sierra的做法在于,他们使用Linear不是为了了解个人每周做了什么,而是关注项目推进中完成了哪些成果。

What I love about Sierra's approach is how they didn't set up Linear wanting to know what individuals did on a given week, they wanted to know what was accomplished in service of which projects.

Speaker 0

这就是使用Linear的精妙之处。

This is the beauty of using Linear.

Speaker 0

它帮助高速增长的公司保持专注,花更多时间构建产品,减少协调消耗。

It helps hypergo companies stay focused, spend more time building, and less time coordinating.

Speaker 0

如果你的团队关注的是能减少额外工作而非增加负担的工具,请访问linear.app/pragmatic了解Linear。

If your team cares about tools that remove additional work for the team instead of adding extra to it, check out Linear at linear.app/pragmatic.

Speaker 0

现在让我们回到快速推进的工程团队和安全审查的话题。

And now let's get back to fast moving engineering teams and security reviews.

Speaker 1

你不能在事后进行这种脱节的安全审查。

You cannot have this disconnected security review that you do afterwards.

Speaker 1

因此在这个行业中,我认为正在改变的还有所需的工具——要知道,历史上这些工具是专为安全团队设计的。

And so in the industry, what's also changing here is I think the tools that you need for this, you know, historically, the tools are built only for security teams.

Speaker 1

对吧?

Right?

Speaker 1

随之而来的是一种不同的安全产品设计理念。

And and and then with that, there is a different product philosophy that that comes with security products.

Speaker 1

因为作为安全审计员,你基本上想知道每一个潜在问题。

Because as a security auditor, basically, you want to know about every single potential issue.

Speaker 1

对吧?

Right?

Speaker 1

你想翻遍每块石头,宁可多检查两次也不愿漏掉任何可能出错的地方。

You wanna turn every stone and and and better look twice than never to find out what's you know, what could go wrong.

Speaker 1

但如果把这种方式应用到如今快速开发的新节奏中,就完全行不通了。

And then now if if you apply this to this new pace of of past development, that doesn't work anymore.

Speaker 1

对吧?

Right?

Speaker 1

因为你不可能总是被各种发现的问题打断工作。

Because you cannot get interrupted all the time with findings.

Speaker 1

这太吵了。

It's it's it's too noisy.

Speaker 1

对吧?

Right?

Speaker 1

我喜欢这样比喻:想象你开车时,副驾驶坐着个安全员,他会对每个潜在危险都大喊大叫。前50米可能还有点意思,但之后就会变得极其痛苦和烦人。

I I like to compare this with, you know, if you drive a car and you have a security guy in your passenger seat, and he would scream and yell at you at every single thing that could go wrong all the time, that's maybe interesting the first 50 meters, but then gets super painful and annoying.

Speaker 1

我认为这反映了行业的转变——开发者应该负责代码安全问题,但相关工具也必须是为开发者设计并由他们掌控的。

I think with that, we see a change in the industry that, you know, I think developers should own code security issues, but also the toolings around code security issues must be owned and and for developers.

Speaker 0

而其他应用安全工具以及更广泛的应用安全领域,仍应由安全团队负责。

And then there are other application security tools and and application security as a broader thing that should be still owned by security teams.

Speaker 0

到目前为止你提到了两个不同方面,如果我没理解错的话。

So so far, you've mentioned two different things, or if I caught this correctly.

Speaker 0

一个是代码安全,另一个是应用安全。

One was code security and then application security.

Speaker 0

你还说应用安全远不止代码安全。

And you said that application security is a lot more than code security.

Speaker 0

所以它是一个,你知道的,就像是它的超集。

So it's a, you know, like, it's a super set of of it.

Speaker 0

什么是代码安全?

What is code security?

Speaker 0

我的意思是,据我所知,这是你的专业领域之一。

I mean, this this is one of your your expertise as as I understand.

Speaker 0

但你是如何定义它的?

But how do you define that?

Speaker 0

你知道,它从哪里开始?

You know, where does it start?

Speaker 0

又在哪里结束?

Where does it end?

Speaker 0

因为这听起来确实像是我们软件工程师应该意识到的事情。

Because it it does sound like something that as a software engineer, we we should be aware of it.

Speaker 0

对吧?

Right?

Speaker 1

是的。

Yeah.

Speaker 1

如果非要下个定义的话,我会说基本上就是指没有安全问题的代码,没有任何可能被攻击者利用来入侵你的应用程序、获取数据或危及业务安全的漏洞。

For a lack of a better definition, I would say it it it's basically code that is, you know, free of security issues, free of anything that, you know, can be leveraged by an attacker to exploit the your application and then, you know, get access to some of your data and and put your business at risk.

Speaker 1

但这个简单定义背后,我认为复杂性在于——当我们说代码没有安全问题时,究竟什么才算是安全问题?

But with that simple definition, I think the the the complexity is a bit, you know, what are security issues when we say code is free of security issues?

Speaker 1

我想这里我们通常考虑的是漏洞。

And I think here the we think typically as vulnerabilities.

Speaker 1

对吧?

Right?

Speaker 1

SQL注入是一种漏洞,但我认为安全问题的范畴远不止于此。

SQL injection is a vulnerability, and and I think it's much more than this.

Speaker 1

对吧?

Right?

Speaker 1

比如像空指针异常这类导致程序崩溃的bug,会使应用程序处于非预期状态,在某些场景下也可能被攻击者利用。

If you think about bugs like a, I don't know, null pointer exception where your application crashes, then your application is in in an unintended state, and this can be abused by attackers in some scenarios.

Speaker 1

或者更明显的例子可能是C/C++中的内存损坏问题,攻击者可以通过缓冲区溢出来在你的服务器上执行代码。

Or maybe a more obvious example would be, you know, memory corruption problems in c c plus plus where as an attacker, you can, you know, do a buffer overflow and then execute code on your server.

Speaker 1

所以我认为这里的界限变得更加模糊,还有一些更逻辑性的问题,比如如果你开发一个可以上传头像的应用,你不能忘记攻击者不应该能上传一个shell到你的服务器这类事情。

And so I think here the the lines get more blurry, and and then there are also more logical things, like if you write an application where you can upload a profile picture, you you shouldn't forget that, you know, an an attacker couldn't be you shouldn't be able to upload a shell to your server and those kind of things.

Speaker 1

因此我们真正意识到代码安全远不止是漏洞问题,归根结底这些都只是缺陷。

So I think we are really realizing that code security is much more than just vulnerabilities, and and in the end, those are just bugs.

Speaker 1

对吧?

Right?

Speaker 1

这些要么是你代码中遗漏的事项,要么是规范错误的内容,所以本质上这是技术债务。

Those are either things you forgot about in your code or those are misspecified things, and so it's it's basically technical depth.

Speaker 1

对吗?

Right?

Speaker 1

这和你待办列表中的其他代码缺陷没有太大区别,开发者只需要修复它们。从这个角度看,也更能理解为什么这是开发者应该负责的问题。

It's it's not so much different than other bugs in your code that you have in your backlog and you just need to fix as a developer, and I think from that perspective, it's also more clear why that's a developer problem and and should be owned by developers.

Speaker 0

我明白了。

I understand.

Speaker 0

要知道,我们应该对代码安全负责,但正如你所说,这是个相当模糊的领域。

You know, we should be owning, you know, code security, but it is it's a pretty it's a pretty mushy subject, as you say.

Speaker 0

它涵盖了很多内容,从显而易见的空指针异常,到可能不那么明显的缓冲区溢出问题——如果你没意识到后者,处理起来会困难得多。

It it it's a lot of things from from the the obvious null pointer exceptions to may the maybe not as so obvious buffer overflows, which are a little bit harder to work with if if you're not aware of it.

Speaker 0

当然,有时候选用特定编程语言就能解决这类问题。

Of course, sometimes use languages and and that solves for it.

Speaker 0

作为一名软件工程师,你认为所有开发者都应该掌握哪些代码安全基础知识?

As a software engineer, what are code security basics that every software developer should know in in your mind?

Speaker 1

你刚才提到了缓冲区溢出。

You just mentioned buffer overflows.

Speaker 1

我认为关键在于,开发者只需要掌握如何预防和修补这些基础问题。

I think that the the key is, you know, for developers in those basics, they need to only understand how to prevent those issues and how to patch them.

Speaker 1

他们不需要完全理解实施缓冲区溢出攻击的所有利用技巧。

They don't need to understand the full exploitation techniques to run a buffer overflow attack.

Speaker 1

对吧?

Right?

Speaker 1

比如,你可以在不需要执行完整攻击链的情况下修复问题。我认为开发者应该掌握的基础知识中,首先想到的是要真正了解和理解你的代码在做什么。这听起来可能有点傻气且显而易见,但安全专家正是通过这种方式发现代码中的安全漏洞。

Like, you can patch things without necessarily needing to run the full chain, and I think some of the basics you should be aware of I think the first thing that comes to my mind is to to really know and understand what your code is doing, and maybe that sounds a bit silly and obvious, but that that's how security experts find basically security issues in your code.

Speaker 1

他们会寻找你可能忘记或忽略的边界情况和极端案例。在AI加速开发、使用库和开源代码的时代,要时刻清楚我们的代码在做什么以及它如何与代码库交互,已经不那么显而易见了。

They try to look for corner cases and edge cases that you may have forgotten about or overlooked, and maybe in the time of, you know, AI accelerated development and using libraries and open source code, that's not so obvious anymore to say that we all the time know what our code is doing and how it interacts with our code base.

Speaker 1

对吧?

Right?

Speaker 1

所以我认为我们可以做的一件事是真正从攻击者的角度来审视问题,至少在处理安全敏感功能时要这样做。

So I think one thing we we can do here is to really look through the to the eyes of an attacker, at least when working on security sensitive features.

Speaker 1

攻击者在这里能做什么?攻击者能如何修改这里的某些内容?

What could an attacker do here, and and how could an attacker modify something here?

Speaker 1

对吧?

Right?

Speaker 1

业界长期以来一直在讨论输入验证和输入净化的问题。

The industry has been talking for a long time about this input validation, input sanitization.

Speaker 1

对吧?

Right?

Speaker 1

也许这里有个很好的例子

Maybe that's a good example here where

Speaker 0

永远不要相信输入数据

Never never trust the input.

Speaker 0

对吧?

Right?

Speaker 0

任何输入数据

Any input.

Speaker 1

是的。

Yes.

Speaker 1

没错。

Exactly.

Speaker 1

而且这可能还更微妙一些。

And and this can be also a bit more subtle.

Speaker 1

对吧?

Right?

Speaker 1

比如,如果你向YouTube上传视频,有人用应用程序暂停操作,修改YouTube视频标题,那本质上就是输入。

Like, if if you upload a video to to YouTube and someone pauses with the application, the YouTube video titles, then that's that's that's input, basically.

Speaker 1

对吧?

Right?

Speaker 1

因为你修改了YouTube的标题名称。

Because you you modify the the the YouTube title name.

Speaker 1

但真正重要的是我们要思考清楚,所有这些get参数、post参数、cookies、外部输入在哪里被使用,以及我在文件操作中如何使用这些输入——这些操作可能被攻击者修改用来打开任意文件,或者传统SQL查询中,你的HTML响应页面可能存在SQL注入漏洞。

But then really making sure we think about this, where is all that, you know, get parameters, post parameters, cookies, external input used, and where am I using this in my file operation, which which, you know, could be modified to open arbitrary files from attacker or, you know, traditionally in a SQL query, you have a SQL injection in your HTML response page.

Speaker 1

还存在跨站脚本攻击等典型问题。

You have cross site scripting and and on those typical things.

Speaker 1

而且我认为我们仍然能看到这些问题。

And and I think we are still seeing those issues.

Speaker 1

对吧?

Right?

Speaker 1

这些都是最关键的漏洞,它们已经存在很长时间了,但我们仍然能看到这些问题。

They are the most critical ones, and they have been around for for for a long time, but we still see those issues.

Speaker 1

然后是密钥泄露,我认为这是另一个常见的基础问题,涉及许多流行的数据泄露事件,你知道,就是开发人员硬编码了某些内容,可能只是为了临时测试目的,比如在代码中硬编码了一个小小的API令牌。

And then secret leaks, I think, is a is another, you know, basic thing that is involved in in many popular data breaches, you know, where the developer hardcoded basically, maybe just for testing purposes temporarily, added, like, hardcoded into the code, like, a little API token.

Speaker 0

所以,这些密钥,比如API令牌,还有各种令牌,对吧,这些通常应该存放在你的本地环境变量中。

So so, like, the secrets, like, API token well, like, all sorts of tokens, right, that that should typically live in your, like, local environment for variables.

Speaker 1

没错。

Exactly.

Speaker 1

完全正确。

Exactly.

Speaker 1

可能是API访问令牌、加密令牌,或者是数据库密码之类的。

And it can be API access tokens or cryptography tokens or or passwords for the database or whatever.

Speaker 1

现在的攻击者会爬取公开的GitHub仓库,对吧,然后窃取这些密钥,并尝试验证它们是否仍然有效。

Attackers nowadays, they crawl into public GitHub repositories, right, and and and steal those secrets and try if this to see if they're still valid.

Speaker 1

即使你删除了代码,它仍然存在于Git历史记录中,而且会被传播出去。

Even if you delete your code, right, it's in the Git history, and it gets passed.

Speaker 1

所以我认为这是我们应该意识到并避免的基本问题,但由于我们是人类,这种情况仍然会发生。

So I think that's not a basic thing we should be aware of and and not do, and it still happens because we are humans.

Speaker 1

对吧?

Right?

Speaker 0

所以这些大概就是需要涵盖的基础内容。

So these were the kind of, I guess, the basics to cover.

Speaker 0

作为开发者,有没有一个可以遵循的检查清单?

Like, as a developer, is there, like, a checklist I I could go through?

Speaker 0

因为你刚才列举了很多项,根据你的经验水平,你可能会觉得这些非常基础,或者完全不知道这些是什么。

Because, again, you listed a bunch of them, and depending on your level, you'll either say these are super basic or, like, what are these things?

Speaker 0

但你知道的,参数处理、SQL注入、密钥泄露,还有其他一些内容。

But, you know, the the parameters, SQL injections, secret leaks, and some some other things.

Speaker 0

你有没有一个固定的清单,可以逐一检查确保理解每项内容,并能审查代码或判断是否适用?

Like, do do you have a go to list of, like, you know, go through all these things and make sure you understand each of these things and you can check your code or know if they would be applicable.

Speaker 1

这个清单会随时间有所变化。

It changes a bit over time.

Speaker 1

而且你知道,我们也在不断进步,对某些安全问题和特定类型的问题了解得越来越多。

Also, you know, we are evolving, and and we are learning more about certain security issues and and certain types of issues.

Speaker 1

我们做得少了,然后可能新型问题变得更普遍,也许是因为环境变化或开发方式改变。

We we do less, and then maybe new types are becoming more prevalent, maybe also because how the landscape changes or how development changes.

Speaker 1

但话说回来,我认为我们讨论的那些基本问题已经存在很长时间了,而且我们仍然能看到它们。

But, again, I think those those basic ones we talked about have been around for for a long time, and and and they they we don't we still see them.

Speaker 1

它们显然没有消失。

They don't go they apparently, they don't go away.

Speaker 1

那么那些更高级的潜在问题呢?

And what about the more advanced things that could go wrong?

Speaker 1

因为这些是

Because these were

Speaker 0

最基础的。

the basic ones.

Speaker 0

对吧?

Right?

Speaker 0

比如,我觉得我们刚讨论的都是基础问题,但你肯定见过一些更奇特的安全漏洞,可能没那么容易预防,或者更具创意的案例。

Like, I I I think we just covered the basic ones, but you must have seen some more exotic security issues that maybe would have not been as easily preventable or a lot more creative ones.

Speaker 1

所以在专业知识要求方面,确实存在更高级的问题。

So there are more advanced things in in the terms of maybe expertise, what is needed.

Speaker 1

如果我们讨论加密相关的问题,比如当你加密某些内容时攻击者仍能解密,无论是认证逻辑、访问权限还是密码重置功能,这些地方通常也容易出问题。

If we talk about cryptography things, right, if if, you know, you're encrypting something and an attacker is still able to decrypt it, whether it's some, you know, authentication logic or access privileges or password reset functionality is is also something where typically, you know, often things can go wrong.

Speaker 1

我认为作为开发者,对于这些更复杂的安全功能,关键是要避免重复造轮子,直接使用经过开源社区验证且可信的成熟框架或库。

I think the the key as a developer is to for those more complex features, security features, is to not try to reinvent the wheel and just use, you know, solid frameworks or libraries as something that is vetted by the open source community and and trusted.

Speaker 1

这方面安全团队确实能提供帮助。

And I think here, again, a security team can can help you with that.

Speaker 1

对吧?

Right?

Speaker 0

最近Node生态系统中出现的安全问题是软件包投毒,攻击者接管某些软件包后注入恶意代码,任何使用该软件包或其下游依赖的用户都可能受到影响。

One of the recent security issues that that is coming up in the node ecosystem is packages being poisoned, where an attacker takes over some packages, they inject malicious code, and whoever is using a package or downstream dependency of that package, they can be impacted.

Speaker 0

我记得我们见过类似的加密货币相关事件。

I think we we we've seen a crypto related issue like this.

Speaker 0

在你看来,谁最能防范这类问题?

In in your view, who who could best protect against these issues?

Speaker 0

是否需要由安全团队来决定固定特定版本的软件包或扫描更新这类事项?

Would it would it need to be a security team who decides on things like pinning certain versions of packages or scanning updates for it?

Speaker 0

或者,作为开发者,如果我依赖第三方软件包,有哪些最佳实践可以帮助避免这些日益普遍的依赖安全问题?

Or basically, as as a developer, if I'm if I'm depending on third party packages, what are good practices I could I can do to try to avoid some of these, you know, dependency security issues, which are now becoming more widespread?

Speaker 1

这确实是个难题。

That's a tough one.

Speaker 1

对吧?

Right?

Speaker 1

因为每个人都在使用依赖项,而你的依赖项又有自己的依赖项。

Because everyone uses dependencies, and your dependencies are using dependencies.

Speaker 1

所以当整个依赖链中某个依赖项的维护者被攻破时,你几乎无法避免安全问题——毕竟我们不可能完全不使用依赖项。

And and so it's quite hard to to do something, right, if you have this whole dependency chain and it's you know, some developer of that dependency, a maintainer gets compromised, and then, you know, a dependency get back towards, you have almost no chance in having a security problem when you pull in that dependency, you cannot not use dependencies.

Speaker 1

我认为唯一能做的就是配备相关工具,比如软件成分分析工具。这类工具会持续监控和检查你的依赖项是否存在已知威胁,并及时更新漏洞数据库,在发现特定版本存在风险时发出警告,告诉你应该升级到哪个版本或直接移除该依赖。

I think the only thing what you can do here is to have tools in place, and this is like software composition analysis is a thing here, that basically observe and check your dependencies, you know, for known threats, right, at some point, luckily, like the NPM package you mentioned, became known to be vulnerable or malicious or backdoored, and then those tools basically get updated on a very frequent basis to look what are the threats and what are dependencies you shouldn't be using in a specific version and then warn you about this and what what is the the the next version you should use or that you should get rid of that dependency, basically.

Speaker 0

什么是软件成分分析?

And what is software composition analysis?

Speaker 1

软件成分分析简称SCA。

So software composition analysis is called SCA.

Speaker 1

本质上这是一种技术手段,我们会检查清单文件——也就是你的依赖项列表(具体取决于你使用的包管理器),然后将这些依赖项与已知安全问题的数据库进行比对。

It's it's basically a a technique where, you know, we look at manifest files, your list of dependencies, right, depending on the package manager you use, And then this list of dependencies is checked to a database of known security problems.

Speaker 1

对吧?

Right?

Speaker 1

这些被称为CBE。

Those are called the CBEs.

Speaker 1

这些并非我们之前讨论的零日漏洞——那些你直接编码引入的问题,而是指某个维护者的代码存在安全隐患,被发现后上报并记录在漏洞数据库中。通过软件成分分析,系统能识别出你使用的特定Log4j版本存在已知的Log4Shell漏洞,从而向你发出警告。

Those are not the the zero day vulnerabilities we talked about earlier that you typed into your code, right, that someone else some maintainer had a security problem, someone found that problem, reported it, it's documented in a database, and then, you know, you can basically, with software composition analysis map that this specific Log4j version of your library is is vulnerable to the Log4Shell vulnerability that is known, and then it can warn you.

Speaker 0

能为我们介绍一下CVE项目吗?

And can you tell us about the CVE program?

Speaker 0

我明白在安全圈内这是常识且极具价值,但作为开发者应该了解哪些内容?需要花多少精力去查阅、核对和关注它?

I understand inside Security Circle, this is very well known and very useful, but what should I know as a developer about this, and how much should I kind of look it up, check it, worry about it?

Speaker 1

该项目由Mitre机构运营。

It's run by Mitra.

Speaker 1

对吗?

Right?

Speaker 1

比如美国政府。

Like, the US government.

Speaker 1

这里正在发生一些变化,所以CVE列表就是通用漏洞枚举,它曾是一个记录已知漏洞的核心数据库。

There is some change happening here, so that's the the the common vulnerability enumeration is the CVE list, and it's a database where it used to be kind of like the central database for documenting known vulnerabilities.

Speaker 1

我认为每天报告的漏洞实在太多,所以这里确实存在一些瓶颈。

I think it's just too many vulnerabilities reported every day, so I think there's a bit of a bottleneck there.

Speaker 1

因此也出现了其他收集安全问题的数据库和平台,SCA工具通常会使用CVE数据库,同时也会参考其他资源来收集各类已知漏洞,以确保掌握所有潜在威胁。

And so there are also other databases evolving or places revolving where security issues are collected and and and gathered, and SCA tools typically use that CVE database, but also other resources to collect all kinds of known vulnerabilities to make sure they they know about all potential threats.

Speaker 0

作为一名专注于代码安全的软件工程师,你认为关注CVE和新漏洞有价值吗?还是说这更需要专职的安全工程师来负责?

And as a software engineer, strictly focusing on, you know, I'm trying to make my code secure, do you see value in kind of trying to keep up with with CVEs, with with new vulnerabilities, or or do you see this being more of something that you really need someone who is is dedicated, focused on this, may this be a security engineer?

Speaker 0

从实际角度出发,如果我在一个中等规模的初创团队工作,可能只有一名安全工程师,而我非常想尽力保障我们领域的重要安全——这部分责任我该承担多少?

I'm just talking from a practical you know, if I'm if I'm working at a scale up where we have a mid sized team, maybe have one security engineer, and I really, really wanna, you know, do my best work to try to secure what is important in in our domain, do I take some of this on on me, or do I say, like, hey.

Speaker 0

如果这确实很重要,我们是否应该争取更多资源,配备专职人员来应对行业深层次的安全问题?

Let's let's if if we really need about this, let's get more resources, dedicated folks who can help with, you know, the the kind of depths of the industry?

Speaker 1

是的

Yeah.

Speaker 1

我会使用工具来处理这个问题

I I would use a tool for this.

Speaker 1

对吧?

Right?

Speaker 1

这是个可以自动化解决的问题,我不会为此扩招安全团队成员

It it's a it's a problem that you can automate, and I I wouldn't hire more security team members for this.

Speaker 1

所以你可以使用软件成分分析工具。

So you can use software composition analysis.

Speaker 1

它会自动检查所有依赖项。

You know, it will automatically check all the dependencies.

Speaker 1

据我所知,数据库里有超过20万个CVE漏洞,每天大概新增50个,不一定都出现在开源库中,也包括已知产品等。但我觉得无论是开发者还是安全人员,都不应该把时间花在追踪每一个新出现的CVE上。

There are, I think, in the database, like, over 200,000 CVEs, and and every day, I think there's, like, 50 new CVEs coming out, not necessarily, I think, in in open source libraries, right, also in known products, etcetera, but I think it's not a good use of your time as a developer, but also not as a security member to to look at, you know, every single CDE that comes out.

Speaker 1

我认为应该配备一个好工具,比如软件成分分析工具,既能帮你检测这些漏洞,更重要的是能协助修复它们,这比堆积大量安全待办事项要有意义得多。

I think you should then have a good tool in place, a software composition analysis tool in place that helps you to detect those, but also helps you in fixing those, right, which is much more important than building a huge backlog of security issues.

Speaker 1

关键在于你不仅能修复这些问题,还能获得关于如何修复的具体建议。

The important thing is that you can also fix this and get some advice on on on how to fix this.

Speaker 0

Johannes刚刚谈到,自动化大部分安全分析(比如跟进最新的安全漏洞)是理所当然的选择。

Johannes just talked about how it's a no brainer to automate much of your security analysis, like keeping up with the latest security vulnerabilities.

Speaker 0

在软件工程中,使用正确的自动化和工具意味着你能专注于重要事项,比如产品开发,而不必在基础设施上花费过多时间。

In software engineering, using the right automation and the right tooling means that you get focus on what matters, like building your product and not spend as much time on infrastructure.

Speaker 0

这就是我们的赞助商Static发挥作用的地方。

This is where our presenting sponsor Static comes in.

Speaker 0

Static为工程团队提供了一套更安全部署的工具包。

Static gives engineering teams a toolkit for safer deployment.

Speaker 0

功能开关、渐进式发布和实验机制,这些都内置在您的发布流程中。

Feature gates, gradual rollouts, and experimentation, these are built into your release process.

Speaker 0

因此您可以将变更先推送给10%的用户,再扩展到剩余的90%。

So you ship changes to 10% of users, then expand to the remaining 90%.

Speaker 0

您可以验证行为、测量实际影响,只有在一切正常的情况下才全面推广。

You validate behavior, measure real impact and scale only when things look good.

Speaker 0

如果出现问题,你可以立即关闭它,避免影响所有用户。

If something goes wrong, you can instantly turn it off before it affects everyone.

Speaker 0

为支持这一功能,Statsig内置了产品与信息分析工具、日志记录和追踪功能,让你能在一个平台上实时查看代码在生产环境中的运行情况、性能表现、错误信息及用户行为。

To support this, Statsig includes product and info analytics, built in tools for logging and tracing, so you can actually see what your code is doing in production, performance, errors, user behavior all in one place.

Speaker 0

因为你无法保护你看不见的东西。

Because you cannot secure what you cannot observe.

Speaker 0

对于有严格数据治理或安全要求的团队,Static还提供数据仓库原生方案。

For teams with strict data governance or security requirements, Static also offers warehouse native.

Speaker 0

你的用户层级数据会保留在自有的数据仓库中——无论是Snowflake、BigQuery、Databricks还是其他系统。

Your user level data stays in your data warehouse, Snowflake, BigQuery, Databricks, whatever you use.

Speaker 0

在安全边界内保持完全控制,既能获得部署安全性和可观测性,又无需将敏感数据传输到外部系统。

Full control inside your security boundary, You get the deployment safety and observability without shipping sensitive data to external systems.

Speaker 0

微软、Atlassian和Brex等企业都在使用Static进行更安全的部署,满足企业级安全需求。

Companies like Microsoft, Atlassian and Brex use Static for safer deployments with enterprise grade security.

Speaker 0

Static提供丰厚的免费使用额度供起步使用,专业版团队定价每月仅需150美元起。

Static has a generous free tier to get started and pro pricing for teams starts at $150 per month.

Speaker 0

了解更多信息并获取30天企业试用,请访问statsiq.com/pragmatic。

To learn more and get a thirty day enterprise trial, go to statsiq.com/pragmatic.

Speaker 0

说到这里,让我们回到代码安全的话题,有请Johannes。

With this, let's get back to code security with Johannes.

Speaker 0

最近,你发布了代码安全现状报告,据我所知这是一份相当全面的报告。

And recently, you've produced the state of code security report, which is a pretty comprehensive one as I understand.

Speaker 0

你在报告中发现了哪些重要内容?

What are things that you found there?

Speaker 1

是的。

Yeah.

Speaker 1

在Sonar,我们每天扫描7500亿行代码。

So at Sonar, we we scan 750,000,000,000 lines of code daily.

Speaker 1

对吧?

Right?

Speaker 1

所以我们的分析器能看到大量代码,而我们研究了其中的一个子集。

So there's our analyzers see quite a lot of code, and we we we studied, like, a subset of this.

展开剩余字幕(还有 420 条)
Speaker 1

我们选取了全球4万家组织的100万名开发者编写的80亿行代码。

And we we took 8,000,000,000 lines of code that was written by 1,000,000 developers of 40,000 organizations globally.

Speaker 1

这是一个相当大的数据集,然后我们分析了发现的问题。

So quite a dataset, and then we looked at what are the issues we we see.

Speaker 1

我认为一个发现是大约每1000行代码中就存在一个安全问题,这也反映了我手动审计代码时的感受。

And I think one finding was that every about 1,000 line of code, we we see a security issue, and that reflects kind of, well, my my my feeling of when I manually audited code.

Speaker 1

所以每1000行代码就出现问题的频率,我认为是相当高的。

So every 1,000 line of code and issues is quite a lot, I think.

Speaker 1

我们发现和看到的问题类型正是我们之前讨论过的基本类型。

And then the issue types we found and saw were the basic ones we talked about.

Speaker 1

对吧?

Right?

Speaker 1

至少在前五名中最常见的。

The most in the top five, at least.

Speaker 1

对吧?

Right?

Speaker 1

存在日志注入、跨站脚本攻击、SQL注入、硬编码密码等典型问题。

There was log injection, crosshat scripting, SQL injection, hard coded passwords, the typical things that that that go wrong.

Speaker 1

我认为其中关于正则表达式的发现有些出人意料,比如我们经常或更常见地会遇到执行缓慢或不安全的正则表达式,这可能导致拒绝服务攻击,这类问题相对更偏离常规。

I think some surprises were in there about regular expressions, for example, was was something that we are typically or more often, apparently, you know, we have a slow regular expression or insecure regular expression, which can lead to denial of service attacks, And so that would be something more out of the lines.

Speaker 1

不过,是的,这些基础问题至今在代码中仍然非常突出。

But, yeah, the the basic ones are still very prominent today in code.

Speaker 0

这非常有趣,因为你提到大约每1000行代码就会出现一个安全问题。

It's very interesting because you like, you're saying every 1,000 lines of code, roughly one security issue.

Speaker 0

这很有趣,因为我们总是争论代码行数的问题。

That's funny because lines of code, we always argue about.

Speaker 0

它是否真的能衡量复杂度、工作量等等?还是说不能?

Is it a good measurement of things, you know, complexity, work, whatnot, or or is it not?

Speaker 0

但我想,你仍然在使用这种启发式方法。

But I guess, you know, you're you're still using this heuristic.

Speaker 0

对吧?

Right?

Speaker 1

我是说,这是我们为报告构建的一个统计数据。

I mean, it's it's it's a statistic we built for the report.

Speaker 1

对吧?

Right?

Speaker 1

但我认为,是的,归根结底,这里的质量确实与安全性息息相关。

But I think, yes, I think what comes down to that is is that quality here is really connected to to security.

Speaker 1

对吧?

Right?

Speaker 1

我的意思是,你可以用更多或更少的代码行数来解决某些问题,而我认为代码质量在这里非常关键——当代码量越大时,审查的工作量就越大,最终维护安全性也越困难。当然,如果能以良好维护和结构化的方式编写就另当别论。

I mean, you could solve certain problems with, you know, more lines of code or with less lines of code, and I think equality is something here that, you know, is very related in terms of when you have more lines of code, right, there's more, you know, code to review, basically, and it's it's harder to support security issues in the end while if if you do it in a well maintained and and and structured way.

Speaker 0

确实如此。

Exactly.

Speaker 0

但这正是我对这件事的直观感受。

But this was exactly my feeling on on this.

Speaker 0

那么,你会怎么说呢?

So, like, what would you say?

Speaker 0

代码质量与安全性之间有何关联?

How was the quality of code related to security?

Speaker 0

你们在这方面有什么发现吗?

Did you see any findings on this?

Speaker 1

是的。

Yeah.

Speaker 1

我认为它们高度相关。

I I think it's super related.

Speaker 1

对吧?

Right?

Speaker 1

而且我觉得这在当今行业中被严重低估了。

And I think it's it's totally underrated in in the industry today.

Speaker 1

我们讨论过空指针异常或这些低效的正则表达式,它们可能导致安全问题,这些算是比较明显的缺陷案例。

We I mean, we talked about the the null pointer exceptions or these slow regular expressions, right, that can lead to security issues, and and that's more maybe the obvious examples of bugs.

Speaker 1

但如果你想想那些难以阅读、维护不善的代码,比如所谓的'意大利面条式代码',一开始可能不太明显它们与安全性的关联。

But, also, if you think about unreadable codes, not well maintained code, right, as kind of like spaghetti code, then it's not so obvious at first maybe how this is connected to security.

Speaker 1

但如果你考虑到代码不易理解、不易审查,而你的开发团队又进行结对编程或代码审查时,在这种意大利面条式的代码中,你更有可能忽视同事代码中的安全问题。

But then if you think about that code is not easy to comprehend, not easy to review, and you do pair programming or code reviews in your development team, then in that spaghetti code, you will more likely oversee security problems of your peer.

Speaker 1

再想想修复安全问题的情况,比如现在可能有人发现了问题或后来发现问题并反馈给你,而你作为开发者必须修复它。

And then also if you think about fixing security issues, right, like now maybe someone found an issue or found later an issue and reports that back to you, and you as a developer have to fix it.

Speaker 1

想象一下如果那是难以维护的代码,你就无法修复那个安全问题。

Think about if that's, you know, not well maintainable code, you you you cannot fix the problem, the security problem.

Speaker 1

因此代码质量突然就变成了安全问题,因为攻击者的机会窗口会开放得更久。

So quality suddenly becomes a security issue in the sense that the, you know, attacker window stays open longer.

Speaker 1

到某个时候,你不得不修复这些问题。

At some point, you have to to fix the issues.

Speaker 1

所以我认为你的代码质量与代码安全高度相关,特别是在AI生成代码普遍质量较差的当下。

And so I think your code quality is super related to code security, especially now with AI generated code where we see typically poor quality of code.

Speaker 1

对吧?

Right?

Speaker 1

这就成了安全问题。

And that becomes a problem for security.

Speaker 0

当我们讨论代码安全时,它与整体网络安全有何关联?

When we look at code security, how does that relate to cybersecurity as as a whole?

Speaker 0

所以

So there

Speaker 1

安全领域包含许多方面。

are many fields of security.

Speaker 1

对吧?

Right?

Speaker 1

有数据安全、云安全、网络安全、取证安全等。

There's data security, cloud security, network security, forensics.

Speaker 1

作为一个大型组织,你基本上需要所有这些方面,它们相互关联,共同构建多道防线。

As a larger organization, you kind of need all of them, and they are all interconnected, and they build multiple lines of defenses.

Speaker 1

从我的角度来看,从进攻性安全的角度来说,我发现应用安全始终是最有趣的领域,因为想想看,如今每个组织基本上都在部署软件。

From my perspective, from an, you know, offensive security perspective, I found application security always the most interesting field because if you think about, you know, every organization today basically deploys software.

Speaker 1

他们要么将软件作为产品交付,要么在线部署某些服务让客户与其业务互动。

They they they ship software as a product, or they deploy some services online to have customers interact with their business.

Speaker 1

因此这些应用程序是7×24小时在线的。

And so those applications are online twenty four seven.

Speaker 1

对吧?

Right?

Speaker 1

而且它们对我这样的攻击者来说是可利用的。

And they're available to to me as an attacker.

Speaker 1

这就是安全的最前线,通常也是进入网络的第一道入口。

And that's the, you know, at the forefront of security and and typically the first entry point into the network.

Speaker 1

这使得应用安全领域对攻击者来说既至关重要又充满吸引力。

And so that makes it so so critical, also interesting for attackers, the the application security field.

Speaker 1

而其他安全领域更多是试图阻止横向移动。

Whereas the other areas, you know, more try to prevent the lateral movement.

Speaker 1

一旦攻击者入侵,能否让他无法解密窃取的数据?或者无法从一台服务器转移到另一台?

Once an attacker is in, can the attacker maybe not decrypt the data he stole, or can the attacker not, you know, move from one server to the other?

Speaker 1

什么是横向移动?

What is lateral movement?

Speaker 1

是的。

Yeah.

Speaker 1

通常来说,作为攻击者,你会先获得进入网络的第一个切入点,然后可能想从那里进一步扩展。

So, typically, as an attacker, you would, you know, gain your first entry point into a network, and then maybe you wanna expand from there.

Speaker 1

比如你在某台服务器上获得了一个shell。

So you have a shell on one server.

Speaker 1

你可以控制一台服务器或机器。

You can control a server or a machine.

Speaker 1

你可以运行系统命令,然后从内部网络尝试探查:还能访问哪些其他服务?哪些内部资源?

You can run system commands, and then you would from there, you know, you are in the internal network and try to see what other services can I reach, what other internal things can I access?

Speaker 1

因此需要制定安全策略——更广泛地说,是网络安全策略——来防止这种内部服务间的横向移动。

And then you need a security strategy, basically, in the broader cybersecurity strategy to prevent that lateral movement between internal services.

Speaker 0

关于横向移动,我想到一个观点。

One idea that comes to me about lateral movement.

Speaker 0

随着AI助手和MCP服务器的出现,这很可能会成为极具诱惑力的攻击途径——攻击者会想:让我试试获取那个开发人员的机器权限。

With the advent of AI assistants, MCP servers, it's probably gonna be a pretty tempting attack vector for just thinking as an attacker, hey, let me try to get access to that developer's machine.

Speaker 0

我会搭建一个声称具有某种功能的MCP服务器,但实际上它暗中执行其他操作,在本地运行,砰的一声。

You know, I'll set up an MCP server that says it does something, but secretly it does something else, it runs locally, Boom.

Speaker 0

我就获得了这位开发者的机器访问权限。

I get access to this developer's machine.

Speaker 0

作为开发者和安全专业人员,我们该对此有多担忧?

As developers and as as security professionals, how much should we worry about this?

Speaker 0

你们是否观察到针对这一特定攻击因素的担忧?

And are are you seeing any worries about this specific attack factor?

Speaker 0

因为我感觉迄今为止,开发者的机器某种程度上算是禁区,或者说它们真的是禁区吗?

Because I feel until now, developer's machines were kind of a little bit off limit, or were they off limits?

Speaker 1

是的。

Yeah.

Speaker 1

我认为开发者的机器并非禁区。

I mean, developers' machines, I think, are not off limits.

Speaker 1

对吧?

Right?

Speaker 1

我认为供应链攻击是一个重大议题,开发者构建的软件会被部署到全球各个组织中,这使其变得尤为关键。

I think supply chain attacks is a a big a big topic where, I mean, developers are building software, and then software is deployed on all the organizations worldwide, right, and that makes it so interesting.

Speaker 1

我们讨论过通过入侵开发者机器来破坏NPM包的案例,进而可以入侵极其流行的依赖项。如果你是软件供应商,必须确保交付给数千家组织的软件不会因某个开发者被入侵而被植入后门。随着智能代理的普及,新威胁也随之而来——不仅要关注依赖项安全或机器安全,还要确保使用的代理行为正当,不会因权限过高而有意或无意造成危害。比如代理处理Jira工单时,恶意工单可能诱导其植入后门而非解决开发问题,这就衍生出全新的安全隐患。

So we talked about an NPM package that gets compromised by compromising a developer's machine basically, right, and then from there, you can compromise a super popular dependency, right, or if you're a software vendor, you better make sure the software that is shipped to thousands of organizations maybe is not backtowered because some developer got backtowered, and yes, I think also with agents and and giving way more control, there is a a new threat here because it's not just about the dependencies you're using or your machine security in general, but also making sure that the the agent you're using is doing the right thing and doesn't have the privileges to do something accidentally or on purpose, as you said, to do something harmful, like if the if the agent passes a Jira ticket and something is you know, someone can create a malicious Jira ticket that instructs, basically, the agent to add a backdoor and just in instead of just solving a development problem, then you suddenly have a new, you know, type of security problem to think about.

Speaker 0

你之前提到过,在代码安全或应用安全方面,能自动化的工作都应尽量自动化。

You previously mentioned that if you can automate things as for for code security or application security, you should try to do that.

Speaker 0

你常见到工程团队使用哪些代码安全工具来维持安全卫生?

What are the common code security tools that you've used you keep seeing engineering teams use for security hygiene?

Speaker 0

比如,我能想到哪些类别?

Like, what are the categories that that I can think of?

Speaker 1

我认为每个开发者都会使用IDE。

I think every developer uses an IDE.

Speaker 1

对吧?

Right?

Speaker 1

所以IDE中提供了一些基本的代码检查功能,这很棒。

So there is some basic linting available in IDEs, and that's great.

Speaker 1

对吧?

Right?

Speaker 1

就像你在输入时发现问题,然后可以解决它们。

Like, because as you type, you find issues, and you can resolve them.

Speaker 1

只是在集成开发环境中,通常没有这么广泛或深入的安全检查功能内置。

Just that in an IDE, typically, you don't have such a broad or in-depth security coverage built in.

Speaker 1

对吧?

Right?

Speaker 1

你可以使用一些IDE扩展插件,但通常仍停留在代码检查层面。

There are some IDE extensions you can use, but then, typically, you stay at the linting side.

Speaker 1

这意味着进行一些语法和语义检查,而且通常只针对当前工作文件,纯粹出于性能考虑。

That means some syntactical and semantical checks, and typically in the current file you're working in, simply out of performance reasons.

Speaker 1

对吧?

Right?

Speaker 1

因为这些检查必须在编码时毫秒级完成,不能拖慢你的工作速度。

Because it has to be done in milliseconds as you code and shouldn't slow you down.

Speaker 1

然后你还有静态应用程序安全测试工具,SaaS工具,可以进行更深入的代码分析。

And then you have static application security testing tools, SaaS tools, that can go more into a deeper level of of code analysis.

Speaker 1

对吧?

Right?

Speaker 1

所以根据你使用的SaaS工具不同,可能会采用符号执行或污点分析等技术,将整个代码库转换为抽象模型,然后通过静态分析模拟运行时可能发生的情况——它并不实际执行代码,而是通过分析我们之前讨论过的用户输入等问题,追踪数据流在所有代码路径中的走向,模拟可能出错的地方来发现各种问题。

So and depending on the SaaS tool you use, there is, for example, symbolic execution or taint analysis techniques used where your whole code base is transformed into an abstract model, basically, and then it's simulating static analysis is simulating what could happen here at runtime, what it's not executing the code, right, but but analyzing this and connecting what we talked earlier about user inputs, for example, how are they flowing in terms of data flows through through all your code paths and simulating what what could go wrong here to find different issues.

Speaker 0

能不能简单给我们概括一下整个过程?

And and can you just give us a high level of of of what is happening?

Speaker 0

因为这听起来非常有趣。

Because this sounds super interesting.

Speaker 0

我的理解是——如果我理解有误请指正——你把代码转换成某种图形结构,然后可以尝试分析输入如何流动、如何到达各个组件。

What I understood and, you know, tell me if I if I got it right is you you take your code and you kinda turn it into, like, maybe a graph or or of some sort, and then you can try to figure out kind of inputs, how they can flow, how they can get to components.

Speaker 1

是的。

Yeah.

Speaker 1

完全正确。

Exactly.

Speaker 1

所以你的代码会被转换成一个大型的图模型。

So your your code is is transformed into a big graph model.

Speaker 0

这个图可以是任意维度的。

This can be any dimensions.

Speaker 1

是的。

Yes.

Speaker 1

没错。

Right.

Speaker 1

基本上,代码库中的每个文件、每个函数、每个if-else语句都会被纳入其中。

So so every basically, every file of your code base, every function, function, every if else, basically.

Speaker 1

每当应用程序的控制流发生变化时,每个函数调用、每个if-else分支都会成为这个大图模型的一部分。

So whenever the control flow of your application changes, every function call, every if else is a part of that big graph model.

Speaker 1

对吧?

Right?

Speaker 1

然后你要找出所有可能的组合——那些创建数据流的变量赋值,用户输入在应用程序中的接收点,以及它们如何通过不同的if-else分支和函数调用进行传递,最终到达哪些安全敏感的位置。

And then you try to figure out what are all the combinations where, you know, your variable assignments, which which create data flow, basically, where is user input received in that application and then passed on with, you know, data assignments through different if else and function calls, and where does it end up in something security sensitive.

Speaker 1

对吧?

Right?

Speaker 1

而且这些数据流路径可能非常非常长,要正确处理并高效执行也非常复杂。

And this can be very, very long data flow paths and very complicated to do right and also to do that efficiently.

Speaker 1

对吧?

Right?

Speaker 1

过去这需要花费数天时间,而现在我们能在几分钟内完成,这是个非常难解决的问题。

It it used to be taking days, and and now we can do that in minutes, and that's a very hard problem to solve.

Speaker 1

但它能帮助你自动化那个流程,对吧?就是我们之前讨论的要留意用户输入的部分。

But it helps you to automate that that that process, right, what we talked about earlier where you should be be mindful of what is user input.

Speaker 1

它能帮你自动化这个过程,并找出用户输入与敏感安全点之间那些非常棘手且冗长的关联。

It it helps you to automate that and find even very tricky and long connections between user input and something security sensitive.

Speaker 0

好的。

Okay.

Speaker 0

所以我们讨论了集成在IDE中的那些linter工具,就是你提到的SAST扫描器。

So we talked about the kind of linters inside IDs, the SAST, s s a s t scanners that you said.

Speaker 0

还有哪些值得了解的工具吗?

Are there other tools worth knowing about?

Speaker 1

比如密钥检测,我们讨论过硬编码密码之类的,所以有专门的密钥检测工具。

I mean, secret detection, we talked about hard coded passwords or so there are secret detection tools.

Speaker 1

还有基础设施即代码扫描。

There is infrastructure as code scanning.

Speaker 1

对吧?

Right?

Speaker 1

如果你从更广义的角度看代码,基础设施即代码也算,或者你的GitHub Actions文件也可以视为代码。

If you think about code more broadly, it's also infrastructure as code, or your GitHub actions file can be code.

Speaker 1

对吧?

Right?

Speaker 1

而且有专门的工具可以扫描这些内容。

And there are there are tools to scan this.

Speaker 1

通常来说,如果你有一个好的SaaS工具,这些基本上都被静态分析覆盖了,对吧?因为在这里所有东西都可以被视为代码。

Typically, if you have a good SaaS tool, that's all covered by by static analysis, basically, right, because everything can be considered code here.

Speaker 1

我们之前已经讨论过软件成分分析,这是开发者的另一个工具,用于发现依赖项中已知的漏洞,即那些CVE。

And then we talked already about software composition analysis as another tool for developers where you find those known vulnerabilities, those CVEs in your dependencies.

Speaker 0

我想这是一种分层方法。

I guess this is a layered approach.

Speaker 0

对吧?

Right?

Speaker 0

所以你想要的安全级别越高,就需要设置更多这样的防护层。

So the the more security you'd like, the more of these layers you would set up.

Speaker 0

但我是不是感觉到这些方法之间存在权衡?

But do I do I sense that there's a trade off between them?

Speaker 0

可能会增加复杂性、运行时间这类问题。

It's going to be maybe complexity, time to run, those kind of things.

Speaker 0

比如说,如果我把所有这些工具都堆到每个代码库上,即使我只是个单人创业公司,会有什么弊端?

Like, what what is the downside of just, like, throwing all of these tools onto every single code base I have even if I'm a if if I'm a one person start up.

Speaker 0

对吧?

Right?

Speaker 0

比如,如果你不建议这么做,那为什么不推荐呢?

Like, why would you not recommend that if if you would not recommend it?

Speaker 1

是的。

Yeah.

Speaker 1

我认为,对于基本的静态分析工具,我绝对推荐使用。

I think I mean, for the the basic static analysis tools, I would definitely recommend to do that.

Speaker 1

我觉得这里需要注意选择那些专为开发者而非安全团队设计的工具。

I think here, what you should be careful of is choosing something that is, you know, intended to be used by developers and not by security teams.

Speaker 1

对吧?

Right?

Speaker 1

我们讨论过噪音水平的问题——从安全团队的老视角看可能很有趣,但对产品开发或生产力来说可能是致命的,你不应该被这些干扰,这是需要警惕的。

We talked about the noise level that is, you know, interesting for security teams from an old perspective, but deadly for your product development or, you know, productivity where you shouldn't be annoyed, and and and I think that's something to watch out for.

Speaker 1

不过SaaS工具和SCA工具之间也有区别,取决于它们更多面向安全团队还是开发者。但我绝对建议各个层面都运行静态分析和软件成分分析,这是基础的安全卫生措施。

But and and then there are differences, you know, for SaaS tools and SCA tools if they are more for the security teams or for developers, but I would definitely recommend, I think, all levels to to run static analysis and software composition analysis to have your your basic security hygiene in place.

Speaker 1

这些都是静态工具。

So these are static tools.

Speaker 1

它们可以在你运行代码后对这些代码进行分析。

They after you run the code, they can run on them.

Speaker 1

它们可以在持续集成(CI)环境中运行。

They can run on CI.

Speaker 0

它们可以与持续部署一起运行。

They can run with continuous deployment.

Speaker 0

有没有更偏向动态分析的工具?

Are there kinda more dynamic tools?

Speaker 0

我在想的是那种随着代码运行、服务器运作时,能动态进行测试或尝试各种非常规操作的工具。

And I'm just kind of thinking of of of the idea that, you know, as your code runs, as your servers operate, that dynamically try to test or or or just do funky stuff.

Speaker 1

当然有。

Absolutely.

Speaker 1

这就是动态应用安全测试(DAST)。

So there's dynamic application security testing.

Speaker 1

我们之前讨论过渗透测试。

We we talked about penetration tests.

Speaker 1

对吧?

Right?

Speaker 1

而Dust工具正是试图将这个过程自动化。

And and and the Dust tool tries exactly to automate this.

Speaker 1

对吧?

Right?

Speaker 1

Dust是什么?

What is Dust?

Speaker 1

动态应用程序安全测试是从外部以黑盒方式进行的测试,当你的应用程序已在测试服务器或生产环境中运行时,它会从外部向你的应用程序发射各种恶意负载,观察其反应——是否会崩溃、出现延迟等问题。

Dynamic application security testing is testing from the outside as a black box when your application is already running on a test server or in production, and it's basically shooting all kinds of malicious payloads from the outside against your application to see how it reacts, and is it breaking or, you know, is there a delay?

Speaker 1

它的行为是否异常或抛出错误信息?

Is it behaving weird or throwing an error message?

Speaker 1

通过这种方式,试图将这种人工渗透测试自动化,以发现是否存在可检测到的问题。

And in this way, trying to automate such a human penetration test to find out if there are issues it can detect.

Speaker 1

动态测试方面还有模糊测试,这与Dust类似,主要针对嵌入式软件,如二进制文件、C/C++库或应用程序,通常处理复杂格式或协议(如文件格式),然后你基本上会翻转处理过程中的每一个比特位,看看是否会导致程序崩溃。

And then there's also on the dynamic side fuzzing, which is similar to Dust, basically, where it's more for embedded software, you know, binaries, c c plus plus libraries or applications where typically you pass complex formats or protocols like file formats, and then you wanna flip every single bit basically in what you're processing to see if something breaks.

Speaker 1

对吧?

Right?

Speaker 1

你可以通过模糊测试自动化这个过程,然后发现那些崩溃。

And you can automate that with fuzzing and then find those crashes.

Speaker 1

所以这种方法效果很好。

So that that works very well.

Speaker 1

我只是认为,那些更动态的工具对现在的开发者来说不太适用,因为你与编码过程有点脱节,需要切换上下文,无法在编写代码时即时发现问题。

I just think that, you know, those more dynamic tools are not so much for developers today because you are a bit disconnected from your coding and, you know, you you have to context switch basically because you cannot find things as you type.

Speaker 1

你需要先完成手头的工作,部署到测试服务器上运行,然后反馈周期就会变得稍长一些。

You need to kind of, like, finish what you're doing, deploy it on the test server, get it run, and then the feedback loop is just a bit longer.

Speaker 1

因此我认为对开发者来说效率较低,但对安全团队来说,拥有一个能额外运行Dust或模糊测试的工具是非常棒的。

And so I think for for developers, it's it's more inefficient, but for security teams, it's it's a it's a great tool to have to to additionally maybe run a Dust or a fuzzing.

Speaker 1

对吧?

Right?

Speaker 1

是的。

Yeah.

Speaker 1

而且

And as

Speaker 0

就像你说的,听起来要做一堆准备工作就为了多做一件事。

you say, like, it's it sounds like a bunch of setup to do just one more thing.

Speaker 0

我能理解为什么你说这更适合安全团队?

Like, I can I can see why you're saying that it's it's more for a security team?

Speaker 0

有件事你没提到,但我一直在等你提,就是AI安全审查。

One thing you haven't mentioned, but I I was waiting if you would mention, AI security reviews.

Speaker 0

你知道的,这些现在遍地开花。

These are, you know, popping up everywhere.

Speaker 0

有很多不同的工具,不同的供应商,有些是现有的,他们都在说同样的话。

There's there's a lot of different tools, a lot of different vendors, some some existing ones, and they're all saying the same thing.

Speaker 0

用这个工具。

Use this thing.

Speaker 0

它会让你的代码更安全。

It will make your code more secure.

Speaker 0

作为一名软件专业人士,你的看法是什么?

What is your take as a software professional?

Speaker 1

我觉得这非常有趣且令人兴奋。

I think it's super fascinating and fun to to see.

Speaker 1

对吧?

Right?

Speaker 1

而且AI如今能发现的问题也令人印象深刻。

And and also impressive what AI can find today.

Speaker 1

就像静态分析或其他技术一样,对我来说,它不仅仅在于发现问题,至少当你想要系统性地作为开发者使用时是这样。

You know, as with static analysis or every other technology, to me, it's not necessarily all about just finding issues, at least when you wanna, you know, use that in a systematic way as a developer.

Speaker 1

这里需要找到一个良好的平衡点:不仅要发现问题,还要考虑我报告的这些问题中有多少实际上并非真实或有意义的,以及我能否将其扩展到五十万行代码等等?

Here you have to get into a good balance of am I not only finding things, but how often do am I reporting things that are actually not a true or a meaningful issue, and and can I scale this to half a million lines of code, etcetera?

Speaker 1

对吧?

Right?

Speaker 1

所以我认为我们现在看到更多的是安全研究代理,它们会随机发现各种问题。

So I think what we are seeing more today is, you know, security research agents that go in and and randomly find issues.

Speaker 1

要知道,这对安全团队来说是个非常棒的工具。

You know, it's it's a great tool for security teams here.

Speaker 1

但作为开发者,我认为你需要的是更系统化的方案,能发现所有代码安全问题。

But as a developer, you wanna have, I think, something a bit more systematic that that finds all code security problems.

Speaker 1

你刚才提到,在我看来还存在确定性与非确定性的区别。

And you mentioned maybe the the you know, to me, there's another aspect of being deterministic versus nondeterministic.

Speaker 1

对吧?

Right?

Speaker 1

这里的AI本质上是非确定性的,我认为这对安全领域不太重要,但作为开发组织,你需要建立质量关卡,确保团队间的一致性,保持稳定输出,不能因为随机出现或消失的问题导致关卡失效。

Here, the the AI basically is nondeterministic, and I think, you know, again, for security, that's not so important, but as a development organization, you you need to have basically, like, a a quality gate, and that's consistent across your team and all the other teams that always has the same output, and you cannot fail your gates, you know, because randomly a new issue is popping up or disappearing, etcetera.

Speaker 1

所以我认为这对当今的开发者并不太适用。

So I think that that doesn't really work well for developers today.

Speaker 1

最后从开发者角度看,这里还存在矛盾——根据调查对象不同,很多代码本就是AI生成的。

And lastly, to me, from a developer perspective, right, there's also a a bit of a contradiction if you think about most or or a lot of code is written by AI itself, right, depending on who you ask.

Speaker 1

若再用AI来审查AI生成的代码,就像让学生自己批改作业——如果AI本就能避免生成安全问题,为何事后又能检测出这些问题呢?

And if you then use AI to review AI generated code, that's a bit, you know, having students grade their own homework where you you you would think that, you know, if AI didn't you know, could prevent actually generating a security issue, why would it later on detect that security issue?

Speaker 1

所以我认为我们需要建立良好的防护措施和验证机制,而不是用AI来验证这些由AI生成的代码。

So I think we need to have good guardrails and verification in place that is not AI to verify then basically basically, this AI generated code.

Speaker 0

我...我能理解你的出发点。

I I I can see where you're coming from.

Speaker 0

不过我也能想到有些人可能会说,如果是不同的AI呢?

Although, I can also see some some people might say, like, well, what if it's a different AI?

Speaker 0

如果是不同的大语言模型呢?

What is a different LLM?

Speaker 0

你知道,就是有差异的那种。

You know, like, difference.

Speaker 0

懂吗?

Know?

Speaker 0

但我们...我们还是在互相追逐。

But I I we're we're still not, you know, we're just chasing one another.

Speaker 0

我们还是没有解决核心问题。

Like, we're still not chasing the core problem here.

Speaker 0

你之前提到AI可能生成低质量代码,当我们讨论每行代码对应的安全问题时,这可能会成为一个隐患。

And earlier you said that AI can generate low quality code, and this could be an issue when we're talking about the the lines of code per per security issue.

Speaker 1

你能稍微

Can you go a little

Speaker 0

详细说明一下你观察到的现象吗?

bit into more detail on in what you're seeing, observing?

Speaker 0

在这个语境下,低质量具体指什么?是指我们有时看到的冗长特性吗?

What what what does low quality mean in in this sense, or is it the verbose nature of that we're sometimes seeing?

Speaker 1

比如在Sonar,我们对主流大语言模型进行了深入研究,包括Claude Sonar、GPT-4、5、Lama、OpenCoder等。

So, for example, at Sonar, we did great studies of the most popular LLMs, like Claude Sonar, GPT four, five, Lama, OpenCoder, etcetera.

Speaker 1

我们分析了它们所谓的'个性特征'。

And we looked at the what we call personalities of them.

Speaker 1

对吧?

Right?

Speaker 1

我们研究了它们会产生哪些类型的问题、产出代码的质量如何,并对输出结果进行了量化分析和研究。

How do they what kind of issues do they produce, and what kind of quality are they producing, and then measured what comes out of of of that and studied this.

Speaker 1

其中一个有趣的发现是,比如当你使用GPT-5的推理模式时,实际上会减少——虽然不是完全消除——但会减少发现的安全问题数量,但它会通过更冗长的输出来解决开发问题。

And one interesting finding to me was, for example, that, you know, if you if you use the reasoning mode of g p d five, it it actually decreases, not eliminates, but decreases the number of security issues you find, but it it's it's using more verbose, you know, output to solve the the development problem.

Speaker 1

它实际上会生成更多的代码。

It produces more code, actually.

Speaker 1

对吧?

Right?

Speaker 1

而这又会导致安全问题的出现,因为你会有更多低质量的代码,这些代码本身可能安全风险较少,但当与其他代码片段结合时就会产生问题,或者同行评审和后期维护会更困难,最终导致安全问题。

And this is then, again, something that leads into security problems because you have more low quality code that maybe have less security issues itself, but then poses a problem maybe combined with other snippets of your code, or it's it's harder to review by your peers or later on, and it's less maintainable and and, you you know, leads to a security problem.

Speaker 0

这让我想起在AI时代之前有句老话:代码就是负债。

This reminds me of there's this, like, old saying before AI, that code is a liability.

Speaker 0

你拥有的代码越多,你的负债就越多。

The more code you have, the more liability you have.

Speaker 0

这就是为什么在过去,有经验的工程师有时会花一两天时间减少代码行数,重构、压缩代码,实现单一职责,消除重复。

And this was a reason that, you know, back in the day, as an experienced engineer would sometimes spend a day or two reducing the lines of code, refactoring, compressing it, bringing single responsibility, moving duplication.

Speaker 0

我在想我们是否有点忘记了这个道理:代码行数越多——就拿你说的每千行代码一个安全问题的统计数据来说(暂且接受这个数据)——问题就越多。

And I wonder if we're kind of forgotten this a little bit, that the more lines of code you have, I mean, just taking your statistic of one security issue per thousand lines of code, let's just take it for now.

Speaker 0

嗯,是的。

Like, yeah.

Speaker 0

就像,你知道的,你会希望代码行数尽可能高效。

Like, you know, like, you you would want to have kind of an efficient lines of code.

Speaker 0

对吧?

Right?

Speaker 0

就像,你确实应该花时间和精力去构建一个简单、职责明确且简洁的系统。

Like, you do wanna spend that time and effort of of getting to a system that is simple, clear responsibilities, and concise.

Speaker 1

我认为这是开发者和工程师现在就需要关注的问题,不仅仅是盲目接受所有生成的代码,而是要确保代码逻辑合理、结构良好,以保持代码库的良好架构,并拥有可维护性强的代码等等——这甚至在安全领域之外就已经是个重大代码质量问题,我想开发者们都意识到了这点。

I think this is something for the developers or, you know, and and engineers look at today already, not just to to wipe code and accept all the code, but to actually make sure that the code makes sense and is is well structured for all kinds of purposes, right, to maintain a good architecture in your in your code base, right, and and to have a good maintainable code, etcetera, outside of the security world, that that's already a a big code quality problem, and and and I think developers are aware of this.

Speaker 1

但确实,这也会进一步加剧安全问题。

But then, yes, it it it adds for that to, you know, security problem.

Speaker 1

除此之外,我记得Stack Overflow做过一个不错的调查,结果显示只有3%的受访开发者表示信任AI生成的代码,我觉得这个比例非常合理。

On top of that, there was a nice survey by, I think it was Stack Overflow, where I think only 3% of the developers asked, basically, said they they they trust their AI generated code, and I I think that's that's very reasonable.

Speaker 1

没错。

Yep.

Speaker 1

是啊。

Yeah.

Speaker 0

我是说,当我用AI来构建自己的API和测试这些东西时,也经常发现这种情况——我给它指令,时不时还会要求重构某些部分,在查看输出时调整代码结构。

I mean, when when I'm using AI to, like, build myself my APIs and test in all those things, I also find myself like, I I give it instructions, and every now and then, I also tell it to refactor some things, to move things around as I'm watching the output.

Speaker 0

我就是看到有些部分变得臃肿了。

I I just see something is getting bloated.

Speaker 0

比如有个index.ts文件变得这么大。

You know, I have an index dot t s that is getting this big.

Speaker 0

我就觉得,好吧,

I'm like, alright.

Speaker 0

先暂停一下,

Let's pause.

Speaker 0

我们来重构吧。

Let's refactor.

Speaker 0

我这么做是因为,毕竟多年开发经验告诉我,不整理的话代码很快就会变得一团糟。

But I do this because, again, you know, like years of building software, I know that it's just gonna get a mess.

Speaker 0

我会完全迷失方向。

I'm not gonna be able to navigate.

Speaker 0

对我来说,理解自己的代码并保持清晰的结构至关重要。

And for me, it's important that I need to understand my code and I need to have the structure for that.

Speaker 0

所以我认为这一点不会改变,或许那些随性编程的人最终也会学到我们曾艰难领悟的相同教训。

So, I guess this doesn't change or and and maybe the people who are vibe coding, they're gonna come around to learning the same lessons that, you know, we we all learned the hard way.

Speaker 1

是的。

Yes.

Speaker 1

我想是的。

I guess so.

Speaker 1

但如何

But how do

Speaker 0

你认为AI是如何改变代码安全以及整体安全性的?

you think AI is changing code security and also security in general?

Speaker 0

你看到它已经产生了什么影响?

What impact did you see it's already having?

Speaker 1

我是说,变化肯定是有的。

I mean, there's definitely a change.

Speaker 1

对吧?

Right?

Speaker 1

我认为,即使对我们的安全工具来说,变化也很大,因为它非常强大且有用。

I think I mean, even for our security tools, I think there's a big change in the sense that it's it's it's very powerful and helpful.

Speaker 1

所以即便你运行确定性算法(如静态分析)来检测问题,仍然可以用AI来增强这些确定性算法。

So even if if you run deterministic algorithms like static analysis to detect issues, you can still enhance that deterministic algorithms with AI.

Speaker 1

对吧?

Right?

Speaker 1

比如我们之前讨论过的污点分析。

So, for example, we talked about the taint analysis.

Speaker 1

你的确定性分析器需要掌握大量关于现有库和框架的知识,而这些库和框架有数百万之多。

Your deterministic analyzer needs to have a lot of knowledge about all the libraries and frameworks that are there, and there are millions.

Speaker 1

对吧?

Right?

Speaker 1

因此,人工智能可以帮助你收集知识和信息,然后将其输入到确定性算法中。

And so AI can help you with gathering knowledge and information and then feed that into a deterministic algorithm.

Speaker 1

对吧?

Right?

Speaker 1

所以你可以结合多种技术,我认为这无疑正在改变静态分析领域,同时也影响着动态分析和其他安全工具领域。

So you can combine technologies, and that's definitely changing, I think, the static analysis, but also dynamic analysis and other security tool areas.

Speaker 1

我们还观察到,修复方案的效果相当不错。

And then what we are also seeing is, you know, fixes work quite well.

Speaker 1

比如,如果你把50万行代码一股脑儿塞进上下文窗口,效果就不太理想。

Like if you throw half a million line of code, you know, into the the the context window, it's it's not working so well.

Speaker 1

但如果你只针对一个非常具体的任务。

But if you just throw in you have a very specific task.

Speaker 1

比如你说,这里有一个确定性发现的安全问题。

If you say, here's a deterministically found security issue.

Speaker 1

这里有20行代码,这就是问题所在,然后人工智能非常擅长修复这类问题。

Here are the 20 lines of code, and that's the problem, and then AI is very good in in fixing those issues.

Speaker 1

对吧?

Right?

Speaker 1

所以这非常有用,因为它关乎修复而不仅仅是检测,AI在这方面非常强大。

So so that's very helpful because it's about fixing and not just detecting, and AI is super powerful here.

Speaker 1

我们还看到代码和应用程序构建方式的变化。

We we also see, like, a change in how code and applications are built.

Speaker 1

对吧?

Right?

Speaker 1

传统应用架构中,有后端、前端,后端是数据库。

So if you think about applications traditionally, you have this back end, front end, and in the back end is a is a database.

Speaker 1

如果移除数据库,就不会再有SQL注入攻击了。

If you remove that database, then you don't have a SQL injection anymore.

Speaker 1

对吧?

Right?

Speaker 1

但如果在后端加入LLM,就可能出现提示注入漏洞——攻击者可能篡改系统提示词或你的提示工程,从而干扰LLM的逻辑或输出,这正在改变威胁格局,攻击者会随之调整,当然工具和行业也需要适应,这个过程可能需要些时间。

But if you add an LLM to the back end, then you have a prompt injection, maybe, you know, another vulnerability where the attacker, you know, can modify the system prompt or your prompt engineering and then mess with the LLM's logic or or the the output, and that's becoming then, you know, sort of threat landscape changes, and attackers adjust for it, and and certainly the tools and the the industry adjust to this, and that's that's maybe taking a bit of time.

Speaker 1

对吧?

Right?

Speaker 1

想想我们现在还能看到的所有COBOL代码。

If you think about all the COBOL code we are still seeing.

Speaker 0

是啊。

Yeah.

Speaker 0

但我觉得我们可以把提示注入和Ezequiel注入相提并论。

But I I guess we can add prompt injection right up we can pin it up there with Ezequiel injection.

Speaker 0

事实上,谁知道呢?

In fact, who knows?

Speaker 0

提示注入可能会演变成更严重的安全威胁。

Prompt injection might become even more of a threat security issue.

Speaker 1

没错。

Yeah.

Speaker 1

我认为随着文本逐渐代码化,提示注入就像是新型的代码注入。

I think as, you know, text becomes code, right, I think prompt injection is kind of like the new code injection.

Speaker 1

对吧?

Right?

Speaker 1

人类语言就是新代码,如果你注入人类语言,那突然之间这就成了新的代码注入方式。

The human language is the new code, and if you inject human language, then suddenly that's that's your new code injection.

Speaker 1

所以从安全角度来看这很有趣。

So that's interesting from a security perspective.

Speaker 0

那编程辅助工具呢?

And what about with coding assistance?

Speaker 0

你有没有发现我们对代码安全的思考方式正在发生变化?

Are are you seeing things change with in terms of how we think about code security?

Speaker 1

我认为安全方面的最大问题是,现在代码生成速度快得多,编写代码已不再是挑战。

I mean, I think the the the big problem in terms of security is that you, you know, produce just code much more faster, and and and writing code is not the challenge anymore.

Speaker 1

所以突然之间,新的瓶颈变成了如何验证所有这些代码。

And so suddenly, the new bottleneck is how are you verifying all that code.

Speaker 1

对吧?

Right?

Speaker 1

现在的新瓶颈不是完成代码,而是验证代码是否真正安全。

That's a new bottleneck, not to get your code done, but to verify it that's actually secure.

Speaker 1

如果不这样做,就会导致安全问题或质量问题,长期来看最终会引发安全隐患。

And if if you don't, then that leads to security issues or quality issues, which then, on the long run, lead to security problems.

Speaker 1

对吧?

Right?

Speaker 1

所以我认为这是安全和代码安全领域面临的新挑战。

So I think that's the big new challenge for for security or code security.

Speaker 1

如何大规模、快速地验证所有这些快速生成的代码?

How do you verify all of that faster produced code at scale and at speed?

Speaker 0

那么你对目前有效的方法有什么看法?

And what is your take on what is working so far?

Speaker 0

我听到很多工程师和工程领导者都在说,显然我们需要扩大代码审查规模。

I mean, the obvious thing that I'm hearing a lot of engineers and engineering leaders say is, like, well, we need to scale code reviews.

Speaker 0

我们需要找到方法让人类能审查更多代码,比如增加工具支持,提供更多上下文信息。

We need to figure out ways where humans can look at code reviews, you know, like, more of them, meaning let's add tools to them, let's add additional context.

Speaker 0

除此之外,你是否看到其他可能有前景的领域,可以从纯粹的安全角度来验证代码是否安全?

But outside of that, do do you see some other maybe promising areas where where we could actually verify from strictly from a security perspective, like, is this code secure?

Speaker 1

是的。

Yeah.

Speaker 1

我认为你已经提到了关键点,就是增加工具,在代码生成时自动验证。

I think you mentioned already the the key things, right, to to to add tooling, to to automatically verify a code as you produce it.

Speaker 1

我认为还有一些领域,比如SolarSource正在开创性地研究如何通过观察LLM的训练方式,确保其训练数据集没有常见的安全问题。

I think there are also areas where and and SolarSource is pioneering something here in the field where you basically look at how are LLMs trained, and you make sure the data set that an LLM is trained on is actually free of common security issues.

Speaker 1

对吧?

Right?

Speaker 1

如果你这样做,用高质量、无安全或质量问题的代码和数据训练LLM,从一开始就能生成更安全的代码,这可能是未来我们会看到更多发展的方向。

And if you do that and train your LLM on high quality code, on high quality data, free of security or quality problems, you you are producing from the beginning, right, a much more secure code, and that's maybe another thing where in the future we will see more of this.

Speaker 0

说到这个,因为你接触大量代码,做很多安全分析,你是否发现AI生成的代码会引入与人类不同的安全问题类型?毕竟我们知道LLM最终是用人类代码训练的。

And speaking of this, like, again, because you you you see a lot of code, you do a lot of security analysis, do you see AI generated code introduce different types of security issues than humans would do, especially because we know that LMs are trained on, you know, human code in the end.

Speaker 1

我认为它们会犯同样的错误,原因正如你所说。

I think they are doing the same mistakes for for the reason you mentioned.

Speaker 1

也许某些问题类型的普遍性会发生变化。

Maybe the the prevalence changes of certain issue types.

Speaker 1

对吧?

Right?

Speaker 1

问题类型本身变化不大,但我们看到例如域名抢注就是个很好的例子,AI会建议使用一个根本不存在的库。

The issue types don't don't change so much, but what we are seeing, for example, slop squatting is a good example where, you know, AI proposes to use a library that doesn't even exist.

Speaker 1

对吧?

Right?

Speaker 1

然后攻击者就可以在NPM或Maven Central上注册那个不存在的包,突然你就包含了恶意软件,后门就产生了。

And then so an attacker can register in in NPM or Maven Central that that that package, a non existing package, and then with that, you suddenly include a malicious package, and there's a backdoor.

Speaker 1

这种安全问题之前就为人所知,我们有过依赖混淆的情况,但开发者不太可能打错依赖项,而有了AI后,这种普遍性突然就改变了。

And so this security issue was known before, and we had dependency confusion, but it's just less likely that that a developer, you know, mistypes a dependency, while with AI, that's that prevalence changes suddenly.

Speaker 1

对吧?

Right?

Speaker 1

这种情况正在加速发生。

There is an acceleration of that.

Speaker 1

而其他类型的问题可能会减少。

While other issues maybe decrease.

Speaker 1

对吧?

Right?

Speaker 1

我可以想象——虽然目前还没观察到——比如硬编码密码这类单行代码问题可能会减少,因为AI能学会不该这么做,这样我们可能会看到这类问题的减少。

I could imagine, I'm not seeing this for now, but I could imagine hard coded passwords, like some some issues that are just one liner issues maybe decrease a little because AI is able to learn that, you know, I shouldn't do that, and then we could see a reduction of of of, you know, those issues.

Speaker 1

虽然人类开发者仍可能添加这些问题,但随着AI生成代码使用增多,这类问题可能会变少。

Still human developers can add them, but maybe the more AI generated code is used, we see less of them.

Speaker 1

然后我们可能会看到更多复杂问题。

And then maybe we will see more of the complicated issues.

Speaker 1

对吧?

Right?

Speaker 1

那些需要组合多个代码片段才能形成的安全问题,AI就不那么容易理解了。

Issues where you need to combine multiple code snippets with each other to form a security issue that is then not so easy for AI to to to to grasp.

Speaker 1

所以可以肯定的是,我们已经知道的问题类型分布会发生一些变化。

And so definitely, you know, some changes in the prevalences of of what we know of already today.

Speaker 0

关于安全行业,有哪些常见的误解?

What are some commonly misunderstood things about the security industry?

Speaker 0

那些我们可以称之为谬误的东西。

Things that, you know, we we we could call them fallacies.

Speaker 1

我来自安全行业。

I mean, I come from the security industry.

Speaker 1

对吧?

Right?

Speaker 1

应该说这些年来我逐渐转向了开发者的角色。

And I I moved more to the developer side of the over the years, I would say.

Speaker 1

现在稍微退一步观察安全行业,会发现很有趣的现象:我们有一个与开发者社区分离的独立行业和群体,虽然我们本质上都在讨论代码和漏洞,但一方更关注构建,另一方则更关注攻击和破坏,两者在某种程度上是割裂的。

And and now, you know, stepping a bit back for a moment and looking at the security industries, it's quite fascinating how we have this separated industry and community on the developer community, right, where we both talk about code and bugs, basically, but one side is maybe more about building things and the other about attacking and destroying, and and so they are a bit distinct somehow and separated.

Speaker 1

这让我觉得很有意思。

And that's that's interesting to me.

Speaker 1

我认为由此产生的一个谬误是:安全行业痴迷于安全问题,然后销售那些承诺'安全可以像产品一样购买'的产品。

And I think one fallacy that comes out of this is, you know, that the security industry is all fascinated about the the security problems and then is selling products basically that that that promise, you know, you can have security just as a product.

Speaker 1

对吧?

Right?

Speaker 1

而且,我是说,这个行业有很多钱可赚,它是由合规性和对数据泄露的恐惧驱动的。

And and, I mean, there's a lot of money in that industry, and it's it's driven by, you know, compliance and fear of data breaches.

Speaker 1

所以我认为作为CISO,你会很难决定该使用和购买什么产品。

And and so I think as a CISO, you have a hard time knowing, you know, what product should I should I use and and and buy.

Speaker 1

我认为这里常犯的错误是把安全视为产品,而不是将其构建到开发流程中。

And often, I think a mistake here is to to look at security as a product and not as something that you are building into the process of development.

Speaker 1

对吧?

Right?

Speaker 1

因为我认为现实中,这才是你必须做的——而不是拥有一个工具,在你点击扫描按钮后又找出1000个问题。

Because I think in reality, that's that's what you must do and not have a tool that finds you yet another 1,000 issues if you hit the scan button.

Speaker 1

对吧?

Right?

Speaker 1

而是应该将安全嵌入流程中发现问题,然后让开发人员参与并帮助修复问题,我认为这才是最大的误区。

But something that embeds into the process finding issues, but then engaging developers and and and helping you fix things, and I think that's the the biggest fallacy to me.

Speaker 1

我们之前可能讨论过随之而来的责任归属问题。

We talked about the the ownership that comes with that maybe.

Speaker 1

对吧?

Right?

Speaker 1

我认为安全领域存在某种神秘感,让人觉得只有顶尖黑客专家才能掌控,但实际上界限要模糊得多。

I think there is a bit of this mysterium about security, and it can only be owned by experts who are top notch hackers, etcetera, where I think the lines are a bit more blurry here.

Speaker 1

更重要的是修复问题,而非总是聚焦在安全行业热衷讨论的漏洞利用阶段。

And it's it's more about fixing things and not just so much about the exploitation stage all the time that the security industry talks about and and finds fascinating.

Speaker 1

我自己也对此深感着迷,不得不承认这点。

And I myself, you know, am guilty here and and find fascinating.

Speaker 1

最后一点或许是:不存在完美的安全性。

Lastly, maybe this, you know, that there is no perfect security.

Speaker 1

如果你了解安全行业就会明白,追求完美安全本身就是个谬误——很遗憾,完美安全并不存在。

If you get the understanding of the security industry, then maybe that's a fallacy here that, you know, there's no perfect security, unfortunately.

Speaker 0

是的。

Yeah.

Speaker 0

关于厂商销售产品时承诺能让你的组织安全无忧这件事。

This this thing about vendors selling products promising, you know, your your your organization will be secure.

Speaker 0

你的代码会变得安全。

Your code will be secure.

Speaker 0

没错。

It's right.

Speaker 0

而事实上,现实情况要复杂得多,事情并非如此简单。

And and the fact that the reality is a lot more, it it doesn't really work like that.

Speaker 0

你需要团队,需要真正关心安全的人。

Like, you need teams, you need people who care about it.

Speaker 0

有时候,我想,一个完全不使用安全工具的团队也能产出非常安全的代码,因为他们都是经验丰富的工程师,或者在他们熟悉的领域工作。反过来也同样成立。

Sometimes you can, I guess, you can have a team that uses zero security tools producing really secure code because they're just experienced engineers or working in the domain that they understand, and you can have the other way around as well?

Speaker 0

你可能有一个配备了各种扫描工具的团队,但他们的代码质量依然不高,甚至存在安全隐患。

Like, you can have a team that has all these scanners and whatever, and their code is is still, like, not great not good and unsecure.

Speaker 0

这让我想起开发者生产力这个术语,比如我的工程师们效率如何?

It reminds me of the developer productivity term, like, how productive are my engineers?

Speaker 0

而且,又有供应商在推销各种工具,声称只要衡量这个指标就能得到那个结果。

And, again, there's vendors selling all these tools saying, hey, measure this and you will get this.

Speaker 0

我们看到的还是同样的套路。

And we just see the same thing.

Speaker 0

所以我在想,是不是有些事情本身就很难,因为涉及太多变数。

So, I I wonder if it's just a thing of there are just some things that are just hard because there's a lot of moving parts.

Speaker 0

你无法只衡量单一指标,因为我们可以针对它优化,但最终结果还是

You cannot just measure just one thing because we can optimize for that and still the outcome will

Speaker 1

不尽如人意。

not be great.

Speaker 1

我在想是否某些领域就是如此。

I wonder if there's just some areas.

Speaker 1

比如开发者生产力是一个,安全性也是。

You know, developer productivity is one, security.

Speaker 1

也许软件开发本身就是件难事。

Maybe software is just hard.

Speaker 1

确实如此。

It is.

Speaker 1

对吧?

Right?

Speaker 1

我认为你写的软件越复杂,每个开发者都明白这一点。

I I think the more complex software you write, it's and every developer knows this.

Speaker 1

对吧?

Right?

Speaker 1

问题越多,难题越多,bug也越多,遇到的安全问题自然也就越多,这是不可避免的。

The the more problems you have, hard problems you have, you know, bugs you have, and also the the more security problems you will run into, and that's just natural.

Speaker 1

我们在Sona有一支优秀的漏洞研究团队,他们专门挑选全球最流行的开源项目——那些部署广泛、拥有优秀社区和维护者、设有漏洞赏金计划的项目。

We, you know, we have a great vulnerability research team at Sona, and and so those guys are they are picking the the most popular open source projects in the world that are, you know, deployed everywhere with great communities, great maintainers, bug bounty programs where people get paid if they find something, etcetera.

Speaker 1

这让我觉得非常有意思。

And it's fascinating to me.

Speaker 1

每次他们选择这类高关注度的目标,总能有所发现。

Every time they choose such a, you know, high profile target, they go in and they still find something.

Speaker 1

对吧?

Right?

Speaker 1

如果你有足够的动力,并且足够仔细地寻找,我认为总能发现些什么。

If you, you know, if you're motivated enough and, you know, look hard enough, I I I think you you can find something.

Speaker 1

不幸的是,这就是现实。

And and, unfortunately, that's that's that's the that's the reality.

Speaker 1

对吧?

Right?

Speaker 0

作为一名从业二十年的软件安全专业人士,您能给我这个工程师什么建议?

As a software professional, as a security professional in the field for twenty years, what can you advise to me as an engineer?

Speaker 0

我如何知道我的软件足够安全?或者说应该在什么时候停止追求完美?

How can I know that my software is secure enough or at what point should I stop?

Speaker 0

您会如何看待这个问题?

And how would you think about this?

Speaker 0

显然,个人开发者、小型企业、中型公司和大型企业的情况会有所不同。您会建议工程师如何考量'足够好'的安全标准?

Obviously, there will be differences between if I'm a one person, you know, tiny business, a mid sized company at a very large company, how would you advise engineers to think about, you know, good enough security?

Speaker 0

好的。

Okay.

Speaker 0

我可以继续了。

I can move on.

Speaker 0

这很好。

This is good.

Speaker 0

我们来做其他事情吧。

Let's let's do the other stuff.

Speaker 1

是的。

Yeah.

Speaker 1

这很棘手,因为我们说过完美的安全性很难实现,但问题是:什么是足够好?你该如何解决这个问题?

It's tough because we said it's it's you know, perfect security is is is hard, but then to the question, what is good enough and and how can you solve this?

Speaker 1

我认为使用工具是你应该做的第一件事。

I think using tools is a is the first thing you you you should use.

Speaker 1

对吧?

Right?

Speaker 1

我认为,这有点像保护你的房子。

I I think, you know, it's like a bit like securing your house.

Speaker 1

对吧?

Right?

Speaker 1

就像,你应该确保关好门窗并保持基本的安全习惯。

Like, you should make sure you shut your windows and doors and have some basic hygiene.

Speaker 1

这并不意味着一个技术高超或资金充足的攻击者无法闯入,但你可以确保自己关好了那些门窗。

It doesn't mean that a, you know, highly skilled or funded attacker can break in, but you can make sure you you shut those windows and doors.

Speaker 1

我认为在软件领域,挑战在于你每天都在新增门窗,基本上就是随着新功能的添加,所以我认为你需要一些自动化工具来确保基础安全,然后我建议可以先做一个初步评估。

I think with software, the the challenge is a bit you're adding new windows and doors every day, basically, like with the new features you're adding, and so I think you need some automation for that to have your basics right, and then I would recommend, basically, you can start with a initial assessment.

Speaker 1

我目前处于什么水平?

Where where am I standing today?

Speaker 1

对吧?

Right?

Speaker 1

比如,你可以聘请专业人士,或者使用工具来评估当前的状况,找出最需要解决的关键问题并修复它们。

Like, you can hire professionals or, you know, use a tool for this and kind of, like, assess where do I stand today, what are my most critical issues I should fix, and and get them fixed.

Speaker 1

更重要的是,在你添加功能和编写代码时,要确保不会在此基础上引入更多问题。

And then more importantly, as you're adding features and as you're coding, making sure you're not adding more on top of that.

Speaker 1

对吧?

Right?

Speaker 1

确保你不会增加更多的安全漏洞,同时也不会引入更多技术债务和质量问题,这些问题长期来看会导致安全隐患。

Making sure you're not adding more security vulnerabilities, and, also, you're not adding more technical depth that and and quality problems that in the long run lead to security issues.

Speaker 1

我认为在这里自动化是关键。

And I think here automation is key, basically.

Speaker 1

然后,大概一个季度后,你可以再次运行评估,看看自己处于什么位置。

And then, you know, after a quarter or something, you can run that assessment again and and look at where am I standing.

Speaker 1

希望作为开发者的你一直高效工作,添加新功能没有拖慢进度,同时也在那个时间点提升了安全防护水平。

And, hopefully, you have been, you know, very productive as a developer and adding new features didn't slow you down, but, also, you you increased your security posture at that point.

Speaker 0

这是个永无止境的故事,而且是个不断发展的领域。

That's a never ending story, and and it's a growing field.

Speaker 0

对吧?

Right?

Speaker 0

比如,我们始终需要关注最新的变化。

Like, we always need to be aware of the latest changes.

Speaker 0

现在,关于语言模型和提示注入攻击,你可能需要自问——作为Mike,如果我基于语言模型开发或调用API,它们能防范这些风险吗?

Right now, LMs and prompt injections, you'll probably need to ask yourself as as Mike if I'm building on top of LMs or I'm invoking APIs, can they go in there?

Speaker 0

然后,你知道的,新问题会不断涌现,一个接一个。

And then, you know, the next thing will come out come again, and the next and the next and the next.

Speaker 0

我觉得关注OWASP十大安全风险总没错,至少能覆盖最基础的防护。

I I guess keeping an eye on the OWASP top 10 is never a bad thing, just to cover the very basics.

Speaker 0

没错。

Yep.

Speaker 0

我同意。

I agree.

Speaker 0

现在作为结束问题,我要让你当场作答了。

Now, as a closing question, I'm gonna put you on the spot here.

Speaker 0

你认为哪种编程语言最安全?

Which programming language do you think is the most secure?

Speaker 0

那种让你无论是使用还是观察时都感到非常满意的语言,它本身似乎从一开始就能帮助预防许多安全问题。

The the the one that you you are very happy either is using it or observing as, like, okay, this is the language itself seems to help prevent a bunch of security issues to start with.

Speaker 1

我认为新语言更安全。

I think the newer languages are more secure.

Speaker 1

我我喜欢,Go语言就是个很好的例子。

I I like, Gov is a is a is a good example.

Speaker 1

我认为,默认情况下,新语言从旧语言中吸取了教训,表现得更为强大,但其他语言也在不断进化。

I think, you know, by default, things are just, you know, new languages learned from the past, from from older languages, would go strong, but I think also other languages are evolving.

Speaker 1

我觉得Java在企业中很常见,我认为它相当安全。

I think Java is you know, we see that a lot in enterprises, and I think it's it's quite secure to use.

Speaker 1

所以这就是我的答案。

So so that would be my answer here.

Speaker 0

不。

No.

Speaker 0

我我我很高兴你提到了Go语言。

I I I like that you dropped Go.

Speaker 0

它在初创企业中获得了相当不错的反响,包括目前甚至用于构建网页应用。

It's it's it's getting pretty good traction with startups as well, including, for now, even building web stuff.

Speaker 0

它的势头正在上升。

It's it's picking up.

Speaker 0

所以我想这归根结底取决于人们的喜好,但听到这些很好。

So it's I I guess it's all all all down to people's tastes, but it's good to hear.

Speaker 0

那么,约翰尼斯,这次谈话真的很有趣。

So, Johannes, this was really interesting.

Speaker 0

感谢你参加播客。

Thanks for coming on the podcast.

Speaker 1

是的。

Yeah.

Speaker 1

谢谢。

Thank you.

Speaker 1

很荣幸能来到这里,感谢邀请。

My pleasure to be here, and thanks for the invite.

Speaker 0

非常感谢这次交流。

Well, thanks very much for this.

Speaker 0

特别感谢约翰内斯带我们深入探讨代码安全这个话题。

Thanks a lot to Johannes for taking us deeper into the topic of code security.

Speaker 0

我觉得最有趣的是,要准确定义什么使代码安全是如此困难,因为存在太多潜在的攻击途径。

The thing that I found the most interesting is just how hard it is to define exactly what makes code secure because there are simply so many impossible attack vectors.

Speaker 0

从使用被入侵的依赖包,到AI生成的代码存在明显安全漏洞(如未验证输入),再到意外泄露凭证,问题层出不穷。

From using a dependency that gets compromised, to AI generating code with clearing security vulnerability, like not validating inputs, to accidentally leaking credentials, the list just goes on.

Speaker 0

安全就像是贯穿软件的无形之物。

Security feels like this invisible thing across software.

Speaker 0

只要没有发现安全问题,它就不会引起太多关注。

As long as there's no security issues discovered, it doesn't get much attention.

Speaker 0

但一旦出现问题,就会陷入手忙脚乱的应对状态。

But once there is, then there's a scramble on what to do.

Speaker 0

作为专业软件工程师,我们需要持续关注常见安全漏洞及防御措施,包括AI工具带来的新型威胁。

As a professional software engineer, we need to keep up to date with common security vulnerabilities and how we can defend against them, including the new ones that AI tools introduce.

Speaker 0

更多关于安全工程的细节,请查看节目说明中链接的《务实工程师》深度解析。

For more details on security engineering, see the Pragmatic Engineer deep dives linked in the show notes below.

Speaker 0

如果你喜欢这期播客,请在您喜爱的播客平台和YouTube上订阅。

If you've enjoyed this podcast, please do subscribe on your favorite podcast platform and on YouTube.

Speaker 0

如果你能给节目评分,我们将特别感谢。

A special thank you if you also leave a rating on the show.

Speaker 0

感谢收听,我们下期节目再见。

Thanks and see you on the next one.

关于 Bayt 播客

Bayt 提供中文+原文双语音频和字幕,帮助你打破语言障碍,轻松听懂全球优质播客。

继续浏览更多播客