	{"id":64948,"date":"2021-10-29T08:24:28","date_gmt":"2021-10-29T07:24:28","guid":{"rendered":"https:\/\/www.artefact.com\/?post_type=news&#038;p=64948"},"modified":"2024-09-20T17:45:46","modified_gmt":"2024-09-20T16:45:46","slug":"how-to-secure-your-python-software-supply-chain","status":"publish","type":"blog","link":"https:\/\/www.artefact.com\/nl\/blog\/how-to-secure-your-python-software-supply-chain\/","title":{"rendered":"Hoe u uw toeleveringsketen van Python-software kunt beveiligen"},"content":{"rendered":"<p><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling article-author\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-background-color:#ffffff;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_2 1_2 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:50%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:50%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-title title fusion-title-1 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Auteur<\/h2><\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27150%27%20height%3D%270%27%20viewBox%3D%270%200%20150%200%27%3E%3Crect%20width%3D%27150%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/benoit-goujon.jpeg\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left article-author-image\" style=\"width: 150px; border-radius: 54% 46% 77% 23% \/ 74% 40% 60% 26%; overflow: hidden;\" width=\"150\" height=\"auto\" \/><div class=\"fusion-title title fusion-title-2 fusion-sep-none fusion-title-text fusion-title-size-three article-author-name-title\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Beno\u00eet Goujon<\/h3><\/div><div class=\"fusion-text fusion-text-1 article-author-description\"><p>Data ingenieur bij Artefact<\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-2 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-margin-top:40px;--awb-margin-bottom:40px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-center fusion-flex-justify-content-center fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-1 fusion_builder_column_1_1 1_1 fusion-flex-column fusion-flex-align-self-center fusion-column-inner-bg-wrapper\" style=\"--awb-padding-top:20px;--awb-padding-right:20px;--awb-padding-bottom:20px;--awb-padding-left:20px;--awb-overflow:hidden;--awb-inner-bg-size:cover;--awb-border-color:rgba(10,17,40,0.1);--awb-border-top:1px;--awb-border-right:1px;--awb-border-bottom:1px;--awb-border-left:1px;--awb-border-style:solid;--awb-border-radius:4px 4px 4px 4px;--awb-inner-bg-border-radius:4px 4px 4px 4px;--awb-inner-bg-overflow:hidden;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><span class=\"fusion-column-inner-bg hover-type-none\"><a class=\"fusion-column-anchor\" href=\"https:\/\/medium.com\/artefact-engineering-and-data-science\/how-to-secure-your-python-software-supply-chain-81490f6e4ff9\" rel=\"noopener noreferrer\" target=\"_blank\"><span class=\"fusion-column-inner-bg-image\"><\/span><\/a><\/span><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-center fusion-content-layout-row fusion-flex-align-items-center\"><div class=\"fusion-text fusion-text-2\"><p><u>Lees ons artikel over<\/u><\/p>\n<\/div><div class=\"fusion-image-element\" style=\"--awb-margin-right:20px;--awb-margin-left:20px;--awb-max-width:150px;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><span class=\"fusion-imageframe imageframe-none imageframe-1 hover-type-none\"><img decoding=\"async\" width=\"4000\" height=\"992\" title=\"Medium Blog\" src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog.png\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog.png\" alt class=\"lazyload img-responsive wp-image-60582\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%274000%27%20height%3D%27992%27%20viewBox%3D%270%200%204000%20992%27%3E%3Crect%20width%3D%274000%27%20height%3D%27992%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-srcset=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-200x50.png 200w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-400x99.png 400w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-600x149.png 600w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-800x198.png 800w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog-1200x298.png 1200w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/04\/Medium-Blog.png 4000w\" data-sizes=\"auto\" data-orig-sizes=\"(max-width: 640px) 100vw, 4000px\" \/><\/span><\/div><div class=\"fusion-text fusion-text-3\"><p>.<\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-3 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-2 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-text fusion-text-4 description\"><p>Een gids om u bewust te worden van de risico's waaraan u wordt blootgesteld en een paar tips om u ertegen te beschermen.<br \/>\n Onlangs is er een nieuw soort cyberdreiging aan het licht gekomen: aanvallen op de toeleveringsketen van software. Hoewel ze zeldzaam zijn, hebben ze enorme gevolgen, en bescherming ertegen wordt steeds belangrijker. Vanwege de verscheidenheid aan gebruikssituaties is er niet \u00e9\u00e9n regel die u op uw python-projecten kunt toepassen om veilig te zijn en zoals altijd hangt het af van uw context.<\/p>\n<\/div><\/div><\/div><\/div><\/div><article class=\"fusion-fullwidth fullwidth-box fusion-builder-row-4 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-justify-content-center fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-3 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-title title fusion-title-3 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Inleiding<\/h2><\/div><div class=\"fusion-text fusion-text-5\"><p>In traditionele industrie\u00ebn is een toeleveringsketen alles wat een bedrijf in staat stelt om een product aan de klant te leveren. Als u bijvoorbeeld een croissant bij de bakker koopt, maken alle ingredi\u00ebnten, de verpakking en het transport deel uit van de toeleveringsketen.<\/p>\n<\/div><div class=\"fusion-text fusion-text-6\"><p>In het softwaredomein is een toeleveringsketen alles wat invloed heeft op uw software voordat deze in productie wordt genomen. Het omvat alles van de ontwikkelingsfase tot het releaseproces, inclusief de code die u hebt geschreven, uw afhankelijkheden, uw buildomgeving, uw IDE, uw image register - elk onderdeel waarmee uw software op enig moment interageert!<\/p>\n<\/div><div class=\"fusion-image-element\" style=\"--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><span class=\"fusion-imageframe imageframe-none imageframe-2 hover-type-none\"><img decoding=\"async\" width=\"700\" height=\"272\" title=\"artikel-benoit1\" src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit1.png\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit1.png\" alt class=\"lazyload img-responsive wp-image-64951\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27700%27%20height%3D%27272%27%20viewBox%3D%270%200%20700%20272%27%3E%3Crect%20width%3D%27700%27%20height%3D%27272%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-srcset=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit1-200x78.png 200w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit1-400x155.png 400w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit1-600x233.png 600w, https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit1.png 700w\" data-sizes=\"auto\" data-orig-sizes=\"(max-width: 640px) 100vw, 700px\" \/><\/span><\/div><div class=\"fusion-text fusion-text-7\"><p>De term \u201ctoeleveringsketen\u201d is onlangs in het nieuws gekomen vanwege cyberaanvallen die een grote impact hadden. Van alle aanvallen is Solarwinds misschien wel de bekendste. De Amerikaanse overheid, grote techbedrijven zoals Microsoft en Intel, maar ook ziekenhuizen, energiebedrijven en financi\u00eble instellingen zijn getroffen.<\/p>\n<p>Ironisch genoeg is de hoofdoorzaak de infectie van Solarwinds Orion, een netwerkbeveiligingsmonitor. Het buildsysteem was gecompromitteerd en alle nieuwe releases tussen maart en juni 2020 waren ge\u00efnfecteerd met malware. Het resultaat is dat alle klanten die hun software in die periode hebben bijgewerkt, besmet zijn geraakt.<\/p>\n<\/div><div class=\"fusion-text fusion-text-8\"><p>Hoewel de Solarwinds-aanval grotendeels door de media is behandeld, zijn er tientallen soortgelijke aanvallen waar we nog nooit van hebben gehoord. Gelukkig houdt de Cloud Native Computing Foundation ze allemaal bij in een\u00a0<a class=\"bv ig\" href=\"https:\/\/github.com\/cncf\/tag-security\/tree\/main\/supply-chain-security\/compromises\" target=\"_blank\" rel=\"noopener ugc nofollow\">openbare opslagplaats<\/a>. U zult misschien verrast zijn door de versnelling van deze aanvallen in de afgelopen paar jaar.<\/p>\n<p>Het is niet haalbaar om alles wat te maken heeft met de beveiliging van de toeleveringsketen in \u00e9\u00e9n blogpost te behandelen, dus we zullen ons in dit artikel vooral richten op projecten die Python als primaire taal gebruiken.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-4 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Hoe uw afhankelijkheden beheren in Python<\/h3><\/div><div class=\"fusion-text fusion-text-9\"><p>Hoewel Python een \u201cbatterijen inbegrepen\u201d filosofie heeft, hebt u vaak externe bibliotheken nodig die u kunt downloaden van PyPI, de offici\u00eble Package Index en op dit punt moet u heel voorzichtig zijn.<\/p>\n<p>Het Python-ecosysteem is al doelwit geweest, met name door het gebruik van twee technieken:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-1 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Typo-squatting<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">Afhankelijkheidsverwarring<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-10\"><p>De eerste techniek heeft betrekking op een commando dat elke Python-ontwikkelaar minstens \u00e9\u00e9n keer in zijn\/haar carri\u00e8re heeft uitgevoerd:<\/p>\n<pre class=\"hp hq hr hs ht ku gv be\"><span id=\"3357\" class=\"ej je jf dm kv b kw kx ky s kz\" data-selectable-paragraph=\"\">pip installeren <\/span><\/pre>\n<p>Hackers publiceren pakketten met bijna dezelfde naam als bestaande pakketten in de hoop dat u een typefout maakt en hun pakket installeert in plaats van het offici\u00eble pakket. Een pakket met de naam\u00a0<code class=\"kg la lb lc kv b\">python3-dateutil<\/code>\u00a0in plaats van de offici\u00eble\u00a0<code class=\"kg la lb lc kv b\">datumutil<\/code>\u00a0is\u00a0<a class=\"bv ig\" href=\"https:\/\/snyk.io\/blog\/malicious-packages-found-to-be-typo-squatting-in-pypi\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">onlangs gedetecteerd<\/a>.<\/p>\n<p>De python-gemeenschap is\u00a0<a class=\"bv ig\" href=\"https:\/\/lwn.net\/Articles\/834078\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">hard werken<\/a>\u00a0om het risico te beperken, maar het risico is nog steeds hoog.<\/p>\n<p>De tweede techniek, afhankelijkheidsverwarring, is geavanceerder dan de eerste en heeft te maken met hoe\u00a0<code class=\"kg la lb lc kv b\">pip<\/code>\u00a0werkt onder de motorkap.<\/p>\n<p>Deze keer stelt deze opdracht u bloot aan het risico:<\/p>\n<pre class=\"hp hq hr hs ht ku gv be\"><span id=\"a769\" class=\"ej je jf dm kv b kw kx ky s kz\" data-selectable-paragraph=\"\">pip installeren --extra-index-url <\/span><\/pre>\n<p>Wanneer u dit commando typt, gebeurt er het volgende:<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%270%27%20viewBox%3D%270%200%20400%200%27%3E%3Crect%20width%3D%27400%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit2.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 400px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"400\" height=\"auto\" \/><div class=\"fusion-text fusion-text-11\"><p>Laten we een voorbeeld nemen:<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%270%27%20viewBox%3D%270%200%20400%200%27%3E%3Crect%20width%3D%27400%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/Article-benoit3.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 400px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"400\" height=\"auto\" \/><div class=\"fusion-text fusion-text-12\"><p>In dit voorbeeld wordt het pakket van de kwaadwillende hacker op de machine ge\u00efnstalleerd. Het hogere versienummer staat namelijk op de openbare pakketindex.<\/p>\n<p>U hebt misschien al begrepen wat er mis kan gaan met dit proces. Iemand met slechte bedoelingen kan pakketten publiceren op een openbare repository die dezelfde namen hebben als de pakketten die gehost worden op interne pakketindexen en ze labelen met een belachelijk hoog versienummer. Bovendien is het vinden van relevante pakketnamen niet zo moeilijk als\u00a0<a class=\"bv ig\" href=\"https:\/\/me&#100;&#105;&#117;&#109;&#46;&#x63;&#x6f;&#x6d;&#x2f;&#x40;&#x61;&#x6c;ex&#46;b&#105;&#114;&#115;&#97;&#110;\/dependency-confusion-4a5d60fec610\" rel=\"noopener\" target=\"_blank\">aangetoond door deze beveiligingsonderzoeker<\/a>.<\/p>\n<p>Dit commando kan worden gekwalificeerd als \u201conveilig door ontwerp\u201d. Deze aanval maakt gebruik van een functie van de Python pakketbeheerder en slechts enkele ontwikkelaars zijn zich bewust van dit gedrag.<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%270%27%20viewBox%3D%270%200%20400%200%27%3E%3Crect%20width%3D%27400%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit4.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 400px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"400\" height=\"auto\" \/><div class=\"fusion-title title fusion-title-5 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Hoe u zich tegen deze aanvallen op de toeleveringsketen kunt verdedigen<\/h3><\/div><div class=\"fusion-text fusion-text-13\"><p>Om u te verdedigen tegen typo-squatting aanvallen, kunt u een\u00a0<strong class=\"ij lj\">vergrendelingsbestand<\/strong>. A\u00a0<a class=\"bv ig\" href=\"https:\/\/www.youtube.com\/watch?v=VWWgkF-0cDQ\" target=\"_blank\" rel=\"noopener ugc nofollow\">goed slotbestand<\/a>\u00a0heeft de volgende kenmerken:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-2 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><strong>Versie spelden:<\/strong>ze maken uw builds voorspelbaar en deterministisch.<\/p>\n<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><strong>Hashes:<\/strong>\u00a0Ze zijn een manier om de integriteit van het pakket te controleren.<\/p>\n<\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><strong>Volledige afhankelijkheidsgrafiek:<\/strong> kunt u ook de afhankelijkheden van uw afhankelijkheden regelen.<\/p>\n<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-14\"><p>Het goede nieuws is dat er een pakket bestaat dat als doel heeft om een vergrendelingsbestand voor u te maken:\u00a0<code class=\"kg la lb lc kv b\">pip-tools<\/code>. Met slechts een paar commando's kunt u een slotbestand genereren met alle attributen die we eerder beschreven hebben.<\/p>\n<\/div><div class=\"fusion-text fusion-text-15\"><pre class=\"hp hq hr hs ht ku gv be\"><span id=\"0af8\" class=\"ej je jf dm kv b kw kx ky s kz\" data-selectable-paragraph=\"\">$ python3 -m venv my-env # maak een nieuwe virtuele omgeving aan\n<\/span><span id=\"6e92\" class=\"ej je jf dm kv b kw lk ll lm ln lo ky s kz\" data-selectable-paragraph=\"\">$ bron my-env\/bin\/activate # activeren\n<\/span><span id=\"eaf3\" class=\"ej je jf dm kv b kw lk ll lm ln lo ky s kz\" data-selectable-paragraph=\"\">$ pip install pip-tools==6.3.0 # installeer het pakket waarmee u\nu uw afhankelijkheden goed kunt beheren\n<\/span><span id=\"497e\" class=\"ej je jf dm kv b kw lk ll lm ln lo ky s kz\" data-selectable-paragraph=\"\">$ echo \u201csacremoses==0.0.46\u201d &gt;&gt; requirements.in # voeg het pakket van\nuw keuze in requirements.in\n<\/span><span id=\"fb7a\" class=\"ej je jf dm kv b kw lk ll lm ln lo ky s kz\" data-selectable-paragraph=\"\">$ pip-compile --generate-hashes # compileert requirements.txt met\nhashes gebaseerd op wat u in requirements.in hebt gezet<\/span><\/pre>\n<\/div><div class=\"fusion-text fusion-text-16\"><p>Uw requirements.txt bestand zou er als volgt uit moeten zien:<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%270%27%20viewBox%3D%270%200%20400%200%27%3E%3Crect%20width%3D%27400%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit5.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 400px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"400\" height=\"auto\" \/><div class=\"fusion-text fusion-text-17\"><p>Nu u dit bestand hebt, dat al uw afhankelijkheden met hun bijbehorende versies en hashes bevat, kunt u de volgende keer dat u gaat implementeren de volgende opdracht uitvoeren:<\/p>\n<pre class=\"hp hq hr hs ht ku gv be\"><span id=\"7aa9\" class=\"ej je jf dm kv b kw kx ky s kz\" data-selectable-paragraph=\"\">pip install --require-hashes -r requirements.txt<\/span><\/pre>\n<p>Zo weet u zeker dat de pakketten die u in productie gebruikt, niet gewijzigd zijn. Ervan uitgaande dat u voorzichtig bent geweest toen u uw\u00a0<code class=\"kg la lb lc kv b\">vereisten.in<\/code>\u00a0bestand \ud83d\udc40, kunt u er ook op vertrouwen dat u het pakket downloadt dat u echt wilt, omdat alles geautomatiseerd is. Geen risico op een typefout!<\/p>\n<p>Deze best practice is goed ter verdediging tegen typo-squatting aanvallen, maar hoe zit het met afhankelijkheidsverwarring?<\/p>\n<p>Als u kijkt naar de\u00a0<code class=\"kg la lb lc kv b\">pip<\/code>\u00a0documentatie, zult u zien dat er twee opties zijn die u kunt gebruiken om pakketten van een interne repository te downloaden:<\/p>\n<\/div><ul style=\"--awb-line-height:27.2px;--awb-icon-width:27.2px;--awb-icon-height:27.2px;--awb-icon-margin:11.2px;--awb-content-margin:38.4px;\" class=\"fusion-checklist fusion-checklist-3 fusion-checklist-default type-icons\"><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\"><code class=\"kg la lb lc kv b\">--extra-index-url<\/code><\/div><\/li><li class=\"fusion-li-item\" style=\"\"><span class=\"icon-wrapper circle-no\"><i class=\"fusion-li-icon awb-icon-check\" aria-hidden=\"true\"><\/i><\/span><div class=\"fusion-li-item-content\">\n<p><code class=\"kg la lb lc kv b\">--index-url<\/code><\/p>\n<\/div><\/li><\/ul><div class=\"fusion-text fusion-text-18\"><p>In de documentatie staat:<\/p>\n<\/div><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27400%27%20height%3D%270%27%20viewBox%3D%270%200%20400%200%27%3E%3Crect%20width%3D%27400%27%20height%3D%270%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/10\/article-benoit6.png\" alt=\"Image\" class=\"lazyload artefact-elegant-image align-left hover-enable\" style=\"width: 400px; border-radius: 59% 41% 41% 59% \/ 29% 48% 52% 71%; overflow: hidden;\" width=\"400\" height=\"auto\" \/><div class=\"fusion-text fusion-text-19\"><p>Zoals u kunt zien, is er een klein verschil tussen de twee en het is op het eerste gezicht niet duidelijk. Het verschil is dat als u de\u00a0<code class=\"kg la lb lc kv b\">--index-url<\/code>\u00a0optie,\u00a0<code class=\"kg la lb lc kv b\">pip<\/code>\u00a0zou alleen pakketten ophalen uit de repo met de URL die u hebt opgegeven, en niet uit openbare repositories. Dus, als u het gedrag dat we eerder beschreven wilt vermijden, gebruik dan\u00a0<code class=\"kg la lb lc kv b\">--index-url<\/code>\u00a0liever dan\u00a0<code class=\"kg la lb lc kv b\">--extra-index-url<\/code>\u00a0en u zult veilig zijn!<\/p>\n<p>Ten slotte kunt u, om de nieuwste kwetsbaarheden te volgen die in uw afhankelijkheden zijn ontdekt, ervoor kiezen om periodiek de\u00a0<a class=\"bv ig\" href=\"https:\/\/github.com\/advisories?query=ecosystem%3Apip\" target=\"_blank\" rel=\"noopener ugc nofollow\">GitHub advies database<\/a>\u00a0of beter nog, gebruik hulpmiddelen zoals\u00a0<a class=\"bv ig\" href=\"https:\/\/dependabot.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">dependabot<\/a>\u00a0die automatisch een pull-verzoek zal indienen op uw repo om een afhankelijkheid bij te werken waarin onlangs een kritieke kwetsbaarheid is ge\u00efdentificeerd.<\/p>\n<\/div><div class=\"fusion-title title fusion-title-6 fusion-sep-none fusion-title-text fusion-title-size-two\" style=\"--awb-margin-bottom-small:8px;\"><h2 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:50;line-height:1.2;\">Samenvatting<\/h2><\/div><div class=\"fusion-text fusion-text-20\"><p>In dit artikel hebben we het concept van de toeleveringsketen voor de softwarewereld ge\u00efntroduceerd. We hebben specifiek onderzocht hoe dit concept van toepassing is op het Python-ecosysteem. Typo-squatting en afhankelijkheidsverwarring zijn uitgelegd en er zijn oplossingen voorgesteld om het risico op compromittering te beperken.<\/p>\n<p>Deze korte inleiding tot de beveiliging van de toeleveringsketen besloeg slechts het topje van de ijsberg, we hebben niet de kans gehad om te bespreken hoe\u00a0<a class=\"bv ig\" href=\"https:\/\/about.codecov.io\/security-update\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">systemen bouwen<\/a>\u00a0of zelfs uw\u00a0<a class=\"bv ig\" href=\"https:\/\/snyk.io\/blog\/vulnerable-visual-studio-code-extensions-marketplace\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">IDE's<\/a> kan worden gecompromitteerd, maar dat laat ik voor een ander artikel!<\/p>\n<p>Bedankt voor het lezen! Ik hoor graag uw feedback. Als u het leuk vond om te lezen, kijk dan gerust naar onze\u00a0<a class=\"bv ig\" href=\"https:\/\/www.artefact.com\/nl\/careers\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">openstaande posities<\/a>\u00a0bij Artefact \ud83d\ude42<\/p>\n<\/div><\/div><\/div><\/div><\/article><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-5 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-margin-top:40px;--awb-margin-bottom:40px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-center fusion-flex-justify-content-center fusion-flex-content-wrap\" style=\"max-width:calc( 1440px + 20px );margin-left: calc(-20px \/ 2 );margin-right: calc(-20px \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-4 fusion_builder_column_1_1 1_1 fusion-flex-column fusion-flex-align-self-center\" style=\"--awb-padding-top:40px;--awb-padding-right:40px;--awb-padding-bottom:40px;--awb-padding-left:40px;--awb-overflow:hidden;--awb-bg-position:left center;--awb-bg-size:cover;--awb-border-color:rgba(10,17,40,0.1);--awb-border-style:solid;--awb-border-radius:4px 4px 4px 4px;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:10px;--awb-margin-bottom-large:0px;--awb-spacing-left-large:10px;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:10px;--awb-spacing-left-medium:10px;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:10px;--awb-spacing-left-small:10px;\"><div class=\"fusion-column-wrapper lazyload fusion-column-has-shadow fusion-flex-justify-content-center fusion-content-layout-column fusion-column-has-bg-image\" data-bg-url=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/03\/background.jpg\" data-bg=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/03\/background.jpg\"><div class=\"fusion-image-element\" style=\"text-align:center;--awb-margin-right:20px;--awb-margin-left:20px;--awb-max-width:150px;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><span class=\"fusion-imageframe imageframe-none imageframe-3 hover-type-none\"><img decoding=\"async\" width=\"72\" height=\"41\" title=\"middelgrote\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2772%27%20height%3D%2741%27%20viewBox%3D%270%200%2072%2041%27%3E%3Crect%20width%3D%2772%27%20height%3D%2741%27%20fill-opacity%3D%220%22%2F%3E%3C%2Fsvg%3E\" data-orig-src=\"https:\/\/www.artefact.com\/\/wp-content\/uploads\/2021\/03\/medium.png\" alt class=\"lazyload img-responsive wp-image-60927\"\/><\/span><\/div><div class=\"fusion-title title fusion-title-7 fusion-sep-none fusion-title-center fusion-title-text fusion-title-size-three\" style=\"--awb-margin-top:20px;--awb-margin-bottom:0px;--awb-margin-bottom-small:8px;\"><h3 class=\"fusion-title-heading title-heading-center fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:20;line-height:1.2;\">Medium Blog bij Artefact.<\/h3><\/div><div class=\"fusion-text fusion-text-21\" style=\"--awb-content-alignment:center;\"><p>Dit artikel werd oorspronkelijk gepubliceerd op <strong>Medium.com<\/strong>.<br \/>\nVolg ons op ons medium Blog !<\/p>\n<\/div><div style=\"text-align:center;\"><a class=\"fusion-button button-flat button-medium button-default fusion-button-default button-1 fusion-button-default-span fusion-button-default-type\" target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/medium.com\/artefact-engineering-and-data-science\/how-to-secure-your-python-software-supply-chain-81490f6e4ff9\"><span class=\"fusion-button-text awb-button__text awb-button__text--default\">Lees ons artikel<\/span><\/a><\/div><\/div><\/div><\/div><\/div><\/p>","protected":false},"excerpt":{"rendered":"<p>Een gids om u bewust te worden van de risico's waaraan u wordt blootgesteld en een paar tips om u ertegen te beschermen.<\/p>","protected":false},"featured_media":68687,"parent":0,"template":"","meta":{"_acf_changed":false,"ep_exclude_from_search":false},"blog-category":[21939],"blog-language":[2991],"class_list":["post-64948","blog","type-blog","status-publish","has-post-thumbnail","hentry","blog-category-medium","blog-language-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/blog\/64948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/types\/blog"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/media\/68687"}],"wp:attachment":[{"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/media?parent=64948"}],"wp:term":[{"taxonomy":"blog-category","embeddable":true,"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/blog-category?post=64948"},{"taxonomy":"blog-language","embeddable":true,"href":"https:\/\/www.artefact.com\/nl\/wp-json\/wp\/v2\/blog-language?post=64948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}