{"id":329637,"date":"2023-10-17T18:00:00","date_gmt":"2023-10-17T18:00:00","guid":{"rendered":"http:\/\/itteacheritfreelance.hk\/wordpress\/?guid=01686cab9197e93dfb739e818e5aac36"},"modified":"2023-10-17T18:00:00","modified_gmt":"2023-10-17T18:00:00","slug":"security-developer-in-residence-2023-q3-report","status":"publish","type":"post","link":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/2023\/10\/17\/security-developer-in-residence-2023-q3-report\/","title":{"rendered":"Security Developer-in-Residence 2023 Q3 Report"},"content":{"rendered":"<p class=\"syndicated-attribution\"><meta name= \\\"keywords \\\" content= \\\"\u96fb\u5b50\u8a08\u7b97\u6a5f, \u6559\u80b2, IT \u96fb\u8166\u73ed,\u96fb\u8166\u88dc\u7fd2\uff0c \u96fb\u8166\u73ed\uff0c \u5bb6\u6559\uff0c \u79c1\u4eba\u8001\u5e2b\uff0c \u8cc7\u8a0a\u6280\u8853\uff0c \u7a0b\u5e8f\u8a2d\u8a08\uff0c \u96fb\u5b50\u8a08\u7b97\u6a5f\uff0c \u904a\u6232\uff0c \u860b\u679c\uff0c \u96fb\u5f71\uff0c \u8a08\u7b97\u6a5f\uff0c\u7de8\u78bc\uff0c Java\uff0c C\/C++\uff0c JavaScript\uff0c PHP\uff0c HTML\uff0c CSS\uff0c MySQL\uff0c mobile\uff0c Android\uff0c \u52d5\u6f2b\uff0c Python\uff0c teacher\uff0c \u88dc\u7fd2\uff0c \u96fb\u8166\u88dc\u7fd2 \u8cc7\u8a0a, \u7535\u5b50\u8ba1\u7b97\u673a, IT ,Game, apple, movie, Computer,student,Java,\u6559\u80b2, ,\u5b66\u751f, \u5b66\u4e60, learn, \u6559\u5b66,  Android, apple,anime, animation, \u4fe1\u606f\u6280\u672f, \u7a0b\u5e8f\u8bbe\u8ba1, \u79fb\u52a8\u7535\u8bdd, \u8cc7\u8a0a\u79d1\u6280,Game, Jeu, Juego,Call Of Duty ,\u4f7f\u547d\u53ec\u559a , \u6e38\u620f, \u7535\u5b50\u6e38\u620f,, \u591a\u4eba\u7535\u5b50\u6e38\u620f, \u7f51\u7edc\u6e38\u620f\uff0conline\uff0conline game, \u624b\u673a\u6e38\u620f, mobile \\\"><\/p>\n<p>It\u2019s been three months since I was first hired as the inaugural Security Developer-in-Residence. I\u2019m quite proud of what I\u2019ve accomplished so far and think it shows the value of investing into the security of Open Source through hiring folks to work full-time in roles like \u201cDeveloper-in-Residence\u201d programs. I\u2019m thankful to the <a href=\"https:\/\/alpha-omega.dev\/\">Alpha-Omega project at OpenSSF<\/a> for funding this work. Let\u2019s review all of the accomplishments in the first quarter of this role and what to look forward to in the next quarter.<\/p>\n<p>If you\u2019d like to follow along with my work more closely you can subscribe to my <a href=\"https:\/\/sethmlarson.dev\/blog#archive\">personal blog<\/a> where I publish <a href=\"https:\/\/sethmlarson.dev\/security-developer-in-residence-weekly-report-13\">weekly updates<\/a> about the work I\u2019m doing. If you have questions or thoughts about what I\u2019m working on you can contact me via email: <a href=\"mailto:seth@python.org\">seth@python.org<\/a>.<\/p>\n<h2 style=\"text-align: left;\">The Python Software Foundation authorized as a CVE Numbering Authority (CNA)<\/h2>\n<p>Back in late August the Python Software Foundation received notice that we\u2019d successfully completed onboarding and had been <a href=\"https:\/\/pyfound.blogspot.com\/2023\/08\/psf-authorized-as-cna.html\">authorized by CVE as a CVE Numbering Authority<\/a> or \u201cCNA\u201d. The <a href=\"https:\/\/www.cve.org\/PartnerInformation\/ListofPartners\/partner\/PSF\">Python Software Foundation CNA scope<\/a> covers Python and pip, two projects which are fundamental to the rest of the Python ecosystem.<\/p>\n<p>Being a CNA means that the PSF can offer staffing to improve the sustainability and responsiveness of coordination and vulnerability disclosure work for covered projects. The PSF CNA also provides <a href=\"https:\/\/osv.dev\/vulnerability\/PSF-2023-8\">rich metadata for CVE records and advisories<\/a>, including remediation information, so upgrading or patching for vulnerabilities is as straightforward as possible for downstream users of Python.<\/p>\n<h2 style=\"text-align: left;\">CPython vulnerability advisories available in Open Source Vulnerability database<\/h2>\n<p style=\"text-align: left;\">The Python Software Foundation now hosts a <a href=\"https:\/\/github.com\/psf\/advisory-database\">vulnerability database on GitHub<\/a> using the <a href=\"https:\/\/ossf.github.io\/osv-schema\/\">Open Source Vulnerability format<\/a> (OSV). This database contains vulnerability information for CPython in addition to vulnerabilities getting published to the security-announce@python.org mailing list. The historical vulnerability information was sourced from Victor Stinner\u2019s \u201c<a href=\"https:\/\/python-security.readthedocs.io\/\">python-security<\/a>\u201d project in order to provide a complete history of vulnerabilities in CPython.<\/p>\n<p>By using the OSV format the vulnerabilities can be ingested and processed by the Open Source Vulnerability database which can be searched or <a href=\"https:\/\/google.github.io\/osv.dev\/api\/\">queried using an API<\/a> for machine-consumable vulnerability information. <\/p>\n<p>Having vulnerability information in a machine-consumable format enables tools that scan software deployments for vulnerabilities to easily provide accurate and automatically updated reports for CPython. The Open Source Vulnerability database also is more discoverable compared to the CVE database, having a readily available public API to query for vulnerabilities, products, and versions.<\/p>\n<h2 style=\"text-align: left;\">Python Security Response Team<\/h2>\n<p style=\"text-align: left;\">I have been helping coordinate reports to the <a href=\"https:\/\/www.python.org\/dev\/security\/\">Python Security Response Team<\/a> (PSRT) since joining the role. This work includes reviewing all reports, gathering information from reporters, discussing timelines, and working with core developers to create and release fixes and advisories in a coordinated manner. I also worked with CVE to get CVE IDs assigned on behalf of reports before the PSF was designated as a CNA.<\/p>\n<p>I revitalized the <a href=\"https:\/\/mail.python.org\/mailman3\/lists\/security-announce.python.org\/\">security-announce@python.org mailing list<\/a> to use for future advisory announcements so interested parties can be notified as soon as new vulnerabilities are published (subscribe to the linked list if you\u2019d like to receive these). I coordinated the two recent vulnerabilities affecting CPython (<a href=\"https:\/\/osv.dev\/vulnerability\/PSF-2023-8\">CVE-2023-40217<\/a> and <a href=\"https:\/\/osv.dev\/vulnerability\/PSF-2023-9\">CVE-2023-41105<\/a>) end-to-end from report to published advisory.<\/p>\n<p>Doing this coordination work frees up volunteers on the PSRT to focus on determining whether a report is a vulnerability and working on fixes. I\u2019m also working to further reduce the manual coordination work required by PSRT by moving the reporting and triage process to GitHub using GitHub Security Advisories.<\/p>\n<h2 style=\"text-align: left;\">OpenSSF Day Europe 2023<\/h2>\n<p style=\"text-align: left;\">I co-presented a talk titled \u201c<a href=\"https:\/\/sched.co\/1P6TW\">We Make Python Safer than Ever<\/a>\u201d at OpenSSF Day Europe 2023 with PSF Board Member and OpenSSF Community Manager Cheuk Ting-Ho. The <a href=\"https:\/\/static.sched.com\/hosted_files\/openssfdayeu2023\/a3\/Final%20-%20OpenSSF%20Day%20Europe%202023.pdf\">slides are available for download<\/a> and the <a href=\"https:\/\/www.youtube.com\/watch?v=jhzv5RU56V4\">talk recording is available to watch on YouTube<\/a>.<\/p>\n<p>The talk introduced the Security Developer-in-Residence role, went over the challenges that are unique to securing Open Source and Python ecosystems, described completed and future projects to make the Python ecosystem more secure, and gave a list of items that viewers themselves could do right away to make their own usage of Python more secure.<\/p>\n<h2 style=\"text-align: left;\">Sigstore signatures for Python release artifacts<\/h2>\n<p style=\"text-align: left;\">Python releases include signatures from the Release Managers using the signing tool \u201c<a href=\"https:\/\/www.sigstore.dev\/\">Sigstore<\/a>\u201d. These signatures mean you can be sure that a given release artifact wasn\u2019t tampered with and was created and vetted by the Release Manager for a given Python release.<\/p>\n<p>I did an audit of existing signatures and <a href=\"https:\/\/github.com\/sigstore\/sigstore-python\/issues\/600#issuecomment-1634961707\">found some discrepancies<\/a> between the documented identities and providers and what was published for each release. I worked with Release Managers to fix the discrepancies and <a href=\"https:\/\/github.com\/python\/release-tools\/pull\/51\">added extra safeguards<\/a> to release tooling to ensure signatures are verifiable as documented. I also was able to back-fill the <a href=\"https:\/\/github.com\/python\/pythondotorg\/issues\/2300\">new Sigstore signature format<\/a> from existing verification materials to make verifying signatures even easier!<span style=\"font-family: courier;\"><\/span><\/p>\n<blockquote><p><span style=\"font-family: courier;\">$ python -m sigstore verify identity \\<br \/>&nbsp;&nbsp;&nbsp; &#8211;bundle Python-3.12.0.tgz.sigstore \\<br \/>&nbsp;&nbsp;&nbsp; &#8211;cert-identity thomas@python.org \\<br \/>&nbsp;&nbsp;&nbsp; &#8211;cert-oidc-issuer https:\/\/accounts.google.com \\<br \/>&nbsp;&nbsp;&nbsp; Python-3.12.0.tgz<\/span><\/p><\/blockquote>\n<p>Having consistent artifact signatures is important because any discrepancies while consuming these signatures should raise red flags for downstream users and redistributors. This also helps build confidence in the new signing method over existing methods like GPG.<\/p>\n<h2 style=\"text-align: left;\">Adoption of system trust stores via Truststore<\/h2>\n<p style=\"text-align: left;\">There are three packaging tools (pip, PDM, and Conda) that are important to the Python ecosystem that are at various stages of adopting \u201cTruststore\u201d, a library that I authored prior to joining the PSF to enable Python projects to use system trust stores for verifying HTTPS certificates instead of relying on certifi for certificates.<\/p>\n<p>PDM has started using Truststore by default starting in <a href=\"https:\/\/github.com\/pdm-project\/pdm\/releases\/tag\/2.9.0\">v2.9.0<\/a>, Conda plans to release <a href=\"https:\/\/github.com\/conda\/conda\/milestone\/63\">optional support for Truststore in v23.9.0<\/a>, and pip already has <a href=\"https:\/\/pip.pypa.io\/en\/stable\/topics\/https-certificates\/#using-system-certificate-stores\">optional support for Truststore<\/a> since v22.2 but has recently bundled Truststore into pip to remove the need to \u201cbootstrap\u201d into Truststore by pre-installing the library.<\/p>\n<p>Using the system trust store is important because any removals to a trust store (<a href=\"https:\/\/osv.dev\/vulnerability\/PYSEC-2023-135\">like for e-Tugra root certificates<\/a>) must be propagated to all end systems in order to avoid \u201cmonster-in-the-middle\u201d attacks. Further challenging this propagation is that some tools like pip bundle certifi as a means of bootstrapping, which means that you need to upgrade both certifi and pip in order to completely propagate updates to certifi\u2019s certificate bundle.<\/p>\n<p>This propagation is better suited to a centralized system like an OS package manager or an automatic centralized authority or IT department keeping the trust bundles up-to-date, which can only happen through using system trust stores.<\/p>\n<p>Recently the Python implementation PyPy added support for Python 3.10, thus enabling PyPy to also use Truststore. I <a href=\"https:\/\/github.com\/sethmlarson\/truststore\/pull\/113\">subsequently added support and backwards compatibility tests for PyPy to Truststore<\/a> to ensure all compliant implementations of Python can take advantage of the benefits.<\/p>\n<h2 style=\"text-align: left;\">Future Projects and Challenges<\/p>\n<\/h2>\n<h3 style=\"text-align: left;\">Software Bills-of-Materials for CPython<\/h3>\n<p style=\"text-align: left;\">Software Bill-of-Materials (SBOMs) are a hot topic in the world of software security due to new government requirements and improved software and vulnerability management tooling. Many tools generate or consume SBOMs as a universal format for describing software and its components and then matching those components to known vulnerabilities.<\/p>\n<p>I&#8217;ve started working on an authoritative SBOM for the CPython project, you can follow along in <a href=\"https:\/\/github.com\/sethmlarson\/cpython-sbom\">this GitHub repository<\/a> if you are interested. This project is early and this will not be the final product or place where this information is published, this is only a place to experiment and get feedback on the approach and outputs before putting the final infrastructure in place.<\/p>\n<p>I started with the most straightforward release artifact, the source tarball, and I am planning to tackle the binary installers later since they&#8217;ll require more research into the release processes. There is a work-in-progress SBOM file for Python-3.12.0.tgz available in the <a href=\"https:\/\/github.com\/sethmlarson\/cpython-sbom\/blob\/main\/sboms\">sboms\/ directory on the repository<\/a>.<\/p>\n<p>Using vulnerability scanning tools I was able to see not only vulnerabilities in CPython, but <b>crucially in the bundled subcomponents like expat and pip<\/b>. Without an SBOM the subcomponents to a project like CPython likely wouldn\u2019t get detected properly and thus would be not covered by vulnerability management tooling.<\/p>\n<p>The challenges here will be integrating the creation and maintenance of the SBOMs into the CPython development and release processes while minimally disrupting other core developers workflows and avoiding the need to develop and maintain custom tooling for CPython\u2019s specific use-case.<\/p>\n<h3 style=\"text-align: left;\">Tracking bundled dependencies in Python packages<\/h3>\n<p style=\"text-align: left;\">Python is the premier \u201cglue\u201d language, meaning that Python is often used alongside many other programming languages like C, C++, Rust, Go, and more thanks to Python C API. This benefit also means that Python packages can include projects and source code from sources both within and external to the Python ecosystem.<\/p>\n<p>Those projects and source code from outside the Python ecosystem present a problem for vulnerability scanners <b>which typically rely on explicit metadata about projects and dependencies in order to find vulnerabilities in software manifests<\/b>. Without a clear way to encode this information into packaging metadata it\u2019s impossible to signal these dependencies even if a maintainer of a project wants to do so.<\/p>\n<p>C and C++ projects in particular pose additional issues due to their existence outside of a programming language packaging ecosystem like Python with PyPI or JavaScript and NPM. This makes tracking usage and vulnerabilities in these projects difficult and relies on other identification schemes like CPEs or redistributions in other packaging ecosystems like RPM\/DEB. Without this information scanners today miss vulnerable components bundled in Python packages, meaning developers won\u2019t know how or when their Python deployments are vulnerable.<\/p>\n<p>Solving this issue completely will be a multi-step process, starting with being able to encode information about bundled projects into Python distributions which will require a new packaging PEP. After the standard has been decided, next is getting bundled project metadata automatically captured to avoid needing an entire ecosystem to manually annotate every project. Concurrently to this I\u2019ll collaborate with SBOM generation tooling to add support for consuming the new standard and adding that information to SBOMs generated from Python environments.<\/p>\n<h3 style=\"text-align: left;\">CPython and pip release process improvements<\/h3>\n<p style=\"text-align: left;\">CPython and pip are two of the most important projects in the Python ecosystem and each have non-trivial release processes. In an effort to increase the integrity of these projects\u2019 releases I\u2019ve <a href=\"https:\/\/sethmlarson.dev\/security-developer-in-residence-weekly-report-9\">researched and documented their release process<\/a> and with <a href=\"https:\/\/slsa.dev\/spec\/v1.0\/threats-overview\">SLSA\u2019s list of historical supply chain attacks against software projects<\/a> have been making suggestions and implementing improvements.<\/p>\n<p>These improvements include reproducibility of built artifacts, extra guarantees on the integrity of inputs, automating the build processes to reduce attack surface area to only services like GitHub Actions and Azure Pipelines instead of individuals\u2019 computers, and making it so that in the event of an attack that it would need to be publicly detectable and traceable.<\/p>\n<p>By improving the integrity of these processes I am hoping to prevent disaster scenarios such as malware being injected into Python or pip at the \u201clast mile\u201d before being published to python.org. <b>Injection of malware during build time has happened to multiple other Open Source projects with disastrous results for users<\/b>. This work means users can be even more confident in their usage of Python and upgrade early and often to take advantage of Python\u2019s latest features.<\/p>\n\n<p class=\"syndicated-attribution\"><figure class= \\\"wp-block-image alignnone \\\"><img src= \\\"http:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-content\/uploads\/2016\/05\/logo2-2.png\\\" alt=\\\"IT\u96fb\u8166\u88dc\u7fd2 java\u88dc\u7fd2 \u70ba\u5927\u5bb6\u914d\u5c0d\u96fb\u8166\u88dc\u7fd2,IT freelance, \u79c1\u4eba\u8001\u5e2b, PHP\u88dc\u7fd2,CSS\u88dc\u7fd2,XML,Java\u88dc\u7fd2,MySQL\u88dc\u7fd2,graphic design\u88dc\u7fd2,\u4e2d\u5c0f\u5b78ICT\u88dc\u7fd2,\u4e00\u5c0d\u4e00\u79c1\u4eba\u88dc\u7fd2\u548cFreelance\u81ea\u7531\u5de5\u4f5c\u914d\u5c0d\u3002\\\"\/><figcaption>\u7acb\u523b\u8a3b\u518a\u53ca\u5831\u540d\u96fb\u8166\u88dc\u7fd2\u8ab2\u7a0b\u5427!<\/figcaption><\/figure>\r\n<\/br>Find A Teacher Form:\r\n<\/br>https:\/\/docs.google.com\/forms\/d\/1vREBnX5n262umf4wU5U2pyTwvk9O-JrAgblA-wH9GFQ\/viewform?edit_requested=true#responses\r\n<\/br><\/br>Email:\r\n<\/br>public1989two@gmail.com<br><br><br><br><br><br><br>\r\n<a href=www.itsec.hk style=color:#FFFFFF;>www.itsec.hk<\/a><br>\r\n<a href=\\\"www.itsec.vip\\\" style=color:#FFFFFF;>www.itsec.vip<\/a><br>\r\n<a href=\\\"www.itseceu.uk\\\" style=color:#FFFFFF;>www.itseceu.uk<\/a><br><\/p>","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>It\u2019s been three months since I was first hired as the inaugural Security Developer-in-Residence. I\u2019m quite proud of what I\u2019ve accomplished so far and think it shows the value of investing into the security of Open Source through hiring folks to work fu&#8230;<\/p>\n<\/div>","protected":false},"author":2051,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Security Developer-in-Residence 2023 Q3 Report - ITTeacherITFreelance.hk","description":"It\u2019s been three months since I was first hired as the inaugural Security Developer-in-Residence. I\u2019m quite proud of what I\u2019ve accomplished so far and think it s"},"footnotes":""},"categories":[10700],"tags":[],"_links":{"self":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329637"}],"collection":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/2051"}],"replies":[{"embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=329637"}],"version-history":[{"count":1,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329637\/revisions"}],"predecessor-version":[{"id":329638,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329637\/revisions\/329638"}],"wp:attachment":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=329637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=329637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=329637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}