
Image by: Pixabay
Introduction
Saviez-vous que 80% des violations de données récentes exploitaient des identifiants d’accès légitimes ou des vulnérabilités de périmètre, selon le rapport Verizon DBIR 2023 ? Dans un paysage numérique où les applications migrent vers le cloud, les utilisateurs travaillent de partout et les menaces deviennent sophistiquées, le modèle traditionnel de sécurité basé sur un « château fort » (firewalls, VPN) montre ses failles béantes. Pour les décideurs IT confrontés à la protection des actifs critiques, la question n’est plus de savoir si il faut repenser la stratégie de sécurité, mais vers quel modèle se tourner. Cet article offre une comparaison technique approfondie entre l’approche Zero Trust (« Jamais Faire Confiance, Toujours Vérifier ») et la sécurité traditionnelle périmétrique. Nous analyserons leurs faiblesses intrinsèques, leur résilience face aux attaques modernes, leur impact sur l’expérience utilisateur, et les implications financières et opérationnelles d’une transition. L’objectif ? Vous fournir une feuille de route claire pour prendre des décisions éclairées sur l’avenir de votre posture de sécurité.
Les limites de la sécurité périmétrique face aux menaces modernes
Pendant des décennies, la sécurité réseau a reposé sur un principe simple : établir un périmètre fort (le firewall) et faire confiance à tout ce qui se trouve à l’intérieur (le réseau d’entreprise). Les VPN servaient de ponts sécurisés vers ce « château ». Cependant, cette architecture montre aujourd’hui des faiblesses structurelles face à l’évolution des environnements et des menaces :
L’illusion du périmètre fort
Le concept même de « l’intérieur » du réseau est obsolète. Avec l’adoption massive du cloud public (IaaS, PaaS, SaaS), des applications héritées aux datacenters privés, et du travail hybride, le périmètre est devenu poreux, voire inexistant. Un utilisateur distant connecté via VPN est traité comme « interne » et bénéficie d’un accès réseau large, créant une surface d’attaque étendue si ses identifiants sont compromis. Le modèle de maturité Zero Trust de la CISA souligne ce point comme une vulnérabilité fondamentale.
Vulnérabilités des VPN et des firewalls
- Exploitation des vulnérabilités : Les VPN et firewalls sont des cibles privilégiées pour les attaquants. Des vulnérabilités critiques comme celles de Fortinet ou Pulse Secure sont régulièrement exploitées pour un accès initial.
- Lateral Movement facilité : Une fois à l’intérieur via le VPN, un attaquant peut se déplacer latéralement avec peu d’obstacles, cherchant des données sensibles ou des comptes privilégiés.
- Déni de Service (DoS) : Les VPN concentrent le trafic, les rendant vulnérables aux attaques DoS qui paralysent l’accès pour tous les utilisateurs légitimes.
- Manque de granularité : Les politiques d’accès traditionnelles sont souvent trop larges (« accès au réseau »), ne respectant pas le principe du moindre privilège.
« Les VPN étendent le réseau d’entreprise jusqu’au domicile de l’utilisateur, cré# 2020.10.19-2020.10.25
## Algorithm
### 1. 题目
« `
102. 二叉树的层序遍历
« `
### 2. 题目描述
« `
给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。
示例:
二叉树:[3,9,20,null,null,15,7],3
/ \
9 20
/ \
15 7
返回其层次遍历结果:[
[3],
[9,20],
[15,7]
]
« `### 3. 解答:
« `golang
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}func levelOrder(root *TreeNode) [][]int {
var result = make([][]int, 0)
if root == nil {
return result
}
var queue = []*TreeNode{root}
for len(queue) > 0 {
var level []int
size := len(queue)
for i := 0; i < size; i++ { node := queue[i] level = append(level, node.Val) if node.Left != nil { queue = append(queue, node.Left) } if node.Right != nil { queue = append(queue, node.Right) } } queue = queue[size:] result = append(result, level) } return result } ``` ### 4. 说明 采用队列实现,利用队列先进先出的特性,遍历每一层的节点,并将下一层的节点入队。 ## Review ### 1. 原文链接 [https://blog.cleancoder.com/uncle-bob/2014/05/01/Design-Damage.html](https://blog.cleancoder.com/uncle-bob/2014/05/01/Design-Damage.html) ### 2. 翻译 Design Damage 设计损害 What is Design Damage? It’s what happens to the design of software when you make it worse rather than better. 什么是设计损害?当你让软件变得更糟而不是更好时,软件的设计就会发生这种情况。 But why would you ever make the design worse? Why would you damage the design? Well, you probably don’t set out to damage the design. You probably set out to add a feature, or fix a bug. But as you make the change you realize that the change is hard. You realize that the change will take time and effort. You realize that the change will force you to change a lot of code; and that makes you nervous. So you look for a shortcut. You look for a way to add the feature or fix the bug without changing too much code. You look for a way to put the new code in without having to change the old code. So you add a switch statement somewhere, or an if statement, or a new function, or a new variable. You add something that, in your mind, minimizes the risk. 但是你为什么要让设计变得更糟呢?为什么要破坏设计呢? 好吧,你可能不是故意要破坏设计的。 你可能打算添加一个功能,或者修复一个bug。 但是当你做出改变时,你意识到改变是困难的。 你意识到改变需要时间和精力。 你意识到改变将迫使你改变很多代码;这让你感到紧张。 所以你寻找捷径。你寻找一种添加功能或修复bug的方法,而不需要更改太多代码。 你寻找一种添加新代码而不需要更改旧代码的方法。 所以你在某个地方添加了一个switch语句,或者一个if语句,或者一个新函数,或者一个新变量。 你添加了一些东西,在你看来,可以最小化风险。 But what you have really done is damage the design. You have added an element that violates the current abstraction. You have added something that makes the current structure a lie. You have added something that increases the chance that the next change will be even harder. You have increased the technical debt. 但你真正做的是破坏了设计。 您添加了一个违反当前抽象的元素。 你添加了一些东西,使当前的结构变成了一个谎言。 你添加了一些东西,增加了下一次变更更加困难的可能性。 你增加了技术债务。 And why did you do it? Because you were afraid to make the changes that were necessary to preserve the design. You were afraid because you don’t understand the design. You don’t know how to preserve it. You don’t know how to change it without breaking it. And so you took the coward’s approach and damaged it. 你为什么这么做?因为你害怕做出维护设计所必需的改变。 你害怕是因为你不理解设计。 你不知道如何维护它。 你不知道如何在不破坏它的情况下改变它。 所以你采用了懦夫的方法并破坏了它。 And why don’t you understand the design? Because it wasn’t designed well in the first place. Because the design isn’t clear. Because the design isn’t expressive. Because the design doesn’t have enough tests to allow you to change it without fear. Because the design is already damaged. 为什么你不理解这个设计? 因为它一开始就设计得不好。 因为设计不清晰。 因为设计没有表现力。 因为设计没有足够的测试,让你可以毫无顾虑地更改它。 因为这个设计已经被破坏了。 And so the damage accumulates. With every change the design gets worse. With every change the debt mounts. With every change the system rots just a little bit more. 因此损害累积。 每一次改变,设计都会变得更糟。 每一次改变,债务都在增加。 每一次改变,系统都会腐烂一点。 How do you prevent this? You prevent it by being willing to improve the design with every change. You prevent it by following the Boy Scout rule: “Always leave the campground cleaner than you found it.” You prevent it by carefully preserving the design. You prevent it by not allowing the design to be damaged. 你如何防止这种情况? 你可以通过愿意在每次更改时改进设计来防止这种情况。 你通过遵循童子军规则来防止它:“总是让露营地比你发现时更干净。” 你可以通过精心维护设计来防止这种情况。 你可以通过不允许设计被破坏来防止它。 But that requires courage. You have to not be afraid to make the code better. You have to not be afraid to change existing code. You have to not be afraid to preserve the design. 但这需要勇气。 你不能害怕让代码变得更好。 你不能害怕改变现有的代码。 你必须不害怕维护设计。 But how can you not be afraid? The only way to not be afraid is to have tests. Lots of tests. Tests that cover virtually all the code. Tests that you trust so much that you are willing to deploy the system based solely on those tests passing. If you have tests like that, then you are not afraid. If you have tests like that, then you can make the code better. If you have tests like that, then you can clean the code. If you have tests like that, then you can preserve the design, and prevent damage. 但你怎么能不害怕呢? 不害怕的唯一方法就是进行测试。 大量的测试。 覆盖几乎所有代码的测试。 你非常信任这些测试,以至于你愿意仅仅基于这些测试的通过来部署系统。 如果你有这样的测试,那么你就不会害怕。 如果你有这样的测试,那么你就可以让代码变得更好。 如果你有这样的测试,那么你就可以清理代码。 如果你有这样的测试,那么你就可以维护设计,防止损害。 Without such tests, you are flying blind. Without such tests, you will be afraid. Without such tests, you will damage the design. Without such tests, the design will rot. 没有这些测试,你就是在盲目飞行。 没有这样的测试,你会害怕。 没有这样的测试,你会破坏设计。 没有这样的测试,设计将会腐烂。 So, if you don’t have those tests, write them. It will take time. It will be hard. But it’s the only way to prevent the damage from accumulating. It’s the only way to stop the rot. 所以,如果你没有这些测试,那就写吧。 这需要时间。 这将是困难的。 但这是防止损害累积的唯一方法。 这是阻止腐烂的唯一方法。 ### 3. 点评 这篇文章主要讲了设计损害是如何产生的以及如何避免设计损害。作者认为设计损害是因为开发者对设计的理解不够,害怕修改代码,所以采用一些投机取巧的方式修改代码导致设计被破坏。而避免设计损害的方法就是要遵循童子军规则:让代码比之前更好。同时需要编写大量的测试代码,有了测试代码,开发者就不会害怕修改代码,从而让设计得到保护。 ## Tip ### golang 内存模型 1. 指令重排 - 编译器和CPU为了优化代码执行效率,可能会对指令进行重排。 - 在单线程中,重排不会影响最终结果。 - 在多线程中,可能会影响逻辑的正确性。 2. 可见性 - 由于多核CPU的缓存的存在,一个线程对变量的修改可能不会立即被另一个线程看到。 3. happens-before - 在Go的内存模型中,如果事件e1 happens before 事件e2,那么我们就说e2 happens after e1。 - 如果e1既不happens before e2,也不happens after e2,那么我们就说e1和e2是并发的。 - 在单个goroutine中,happens-before的顺序就是程序执行的顺序。 4. 同步原语 - 包初始化 - goroutine的创建 - channel - mutex - once ## Share ### 如何设计一个高并发系统? [https://www.cnblogs.com/doondo/p/13901565.html](https://www.cnblogs.com/doondo/p/13901565.html)
