{"id":3981,"date":"2023-03-16T16:02:52","date_gmt":"2023-03-16T16:02:52","guid":{"rendered":"https:\/\/gitprotect.io\/blog\/?p=3981"},"modified":"2024-03-04T14:26:21","modified_gmt":"2024-03-04T14:26:21","slug":"detect-secrets-in-code-with-gitguardian","status":"publish","type":"post","link":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/","title":{"rendered":"<strong>Detect Secrets in Code with GitGuardian<\/strong>"},"content":{"rendered":"\n<p>Let&#8217;s begin with an undeniable truth: every programmer has, at some point in their coding career, hard-coded secrets into their code. Whether it&#8217;s to perform a quick API test or to store credentials temporarily, there&#8217;s no denying that it&#8217;s a convenient shortcut. However, it&#8217;s also becoming an increasingly dangerous threat to the security of codebases.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Problem of Secrets Sprawl<\/strong><\/h2>\n\n\n\n<p>The issue at hand is one of magnitude: while most developers recognize that hard-coding secrets is an ill-advised practice, errors still occur often enough to make the situation dangerous for everyone. To put it simply, secrets-in-code, and even more in Version Control Systems such as git, are a reality that must be addressed.<\/p>\n\n\n\n<p>If you are not yet convinced, please allow me to present the data: according to the largest study on the matter, the&nbsp; <a href=\"https:\/\/www.gitguardian.com\/files\/the-state-of-secrets-sprawl-report-2023\" target=\"_blank\" rel=\"noreferrer noopener\">State of Secrets Sprawl 2023 report<\/a>, in 2022, 10 million new secrets were discovered in public GitHub commits. This number, derived from analyzing more than 1 billion new commits, is 67% higher than the preceding year.<\/p>\n\n\n\n<p>The report also uncovered that 1 out of 10 GitHub code authors exposed a secret in 2022, which indicates that such incidents are not uncommon and are not necessarily related to experience or seniority. Furthermore, what is visible on GitHub is only the tip of the iceberg, as secrets are more frequently exposed in private source code repositories.<\/p>\n\n\n\n<p>With software development teams managing an ever-increasing number of credentials, there is a heightened risk of secrets being exposed in source code, CI\/CD workflows, container image layers, runner logs, and other areas. This is not only a security issue, but it also affects productivity, as teams must rotate credentials quickly to address the vulnerability, which can disrupt CI\/CD pipelines and bring teams to a standstill. To reduce these risks, organizations should consider shifting secrets scanning left and detecting hard-coded secrets earlier.<\/p>\n\n\n\n<p>First, let&#8217;s review why secrets detection is harder than one might think. We will then look at how to use secret detection to develop an effective policy for protecting an organization&#8217;s secrets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Are Hard-coded Secrets Different from other Types of Vulnerabilities?<\/strong><\/h2>\n\n\n\n<p>It is important to note that hard-coded secrets differ from other types of vulnerabilities in that they are not execution vulnerabilities.<\/p>\n\n\n\n<p>This means that they do not require the software to be running to be a vulnerability; rather, from the moment a secret is copied in cleartext in a digital asset, it becomes a security flaw. That&#8217;s a fundamental difference with all the security flaws listed in well-known security resources, such as the <a href=\"https:\/\/cwe.mitre.org\/top25\/archive\/2022\/2022_cwe_top25.html?ref=gitguardian-blog-automated-secrets-detection\" target=\"_blank\" rel=\"noreferrer noopener\">Common Weaknesses Enumeration Top 25<\/a>, or the <a href=\"https:\/\/owasp.org\/www-project-top-ten\/\" target=\"_blank\" rel=\"noreferrer noopener\">OWASP Top 10<\/a>.<\/p>\n\n\n\n<p>In the event that a developer mistakenly commits a secret, it may either be acknowledged or not.<\/p>\n\n\n\n<p>In the latter case, it is likely the secret will reach the remote version control system (VCS). At that point, the secret would already be considered leaked (best case scenario, it would be detected at the code review stage, but the secret may already need to be rotated at that point).<\/p>\n\n\n\n<p>In the former case, one very common mistake would be to delete it and simply commit the change. The secret disappears from the current state of the source code, but it is still in the commit history!<\/p>\n\n\n\n<p>It is not uncommon to find valid secrets<strong> hidden deep inside the codebase history<\/strong>. The bottom line is that, unlike other vulnerability scanning processes, secrets detection needs to take into account this attack surface <em>and<\/em> scan for incremental changes to the repository to prevent these kinds of leaks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Detect Secret Credentials in Your Repositories?<\/strong><\/h2>\n\n\n\n<p>From a developer perspective, you want a tool that supports:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CLI support<\/li>\n\n\n\n<li>Historical scans<\/li>\n\n\n\n<li>Pre-commit hooks<\/li>\n\n\n\n<li>Continuous Integration (we will use GitHub Action as an example)<\/li>\n<\/ul>\n\n\n\n<p>From a security analyst perspective, you would want:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A single pane of glass to monitor in one place dozens, hundreds or even thousands of repos spread over multiple SCM systems (GitHub, but also GitLab, Bitbucket or Azure Repos)<\/li>\n\n\n\n<li>Generic detection to catch less obvious secrets, like for instance a JSON Web Token<\/li>\n\n\n\n<li>Developer-driven remediation<\/li>\n\n\n\n<li>Possibility to run the app on-premise<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s have a quick look at the GitGuardian solution.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>GitGuardian Dashboard<\/strong><\/h3>\n\n\n\n<p>GitGuardian monitors a set of shared repositories called the Perimeter, which is VCS-agnostic: no matter whether the repositories are hosted on GitHub, GitLab, Bitbucket or Azure Repos, they are all visible from a single place:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/qe_CIyFlswDYtw272vGJPqTaaEwtanAHtMQZUX_POyHoXWDDBKOxqRSc2otwHByNBH0PC3IfHWVCTLWPvCegQXmCKkhvlfTkc5TLv0sdjqYLbpT108SwmvQQU-paz4vDKTSPLeTA8VYwsromXi-K\" alt=\"Perimeter page\" style=\"width:499px;height:310px\"\/><\/figure><\/div>\n\n\n<p>This single pane of glass allows you to check all your projects&#8217; status rapidly. You can also re-initiate a full scan on selected repositories.<\/p>\n\n\n\n<p class=\"has-text-align-left\">Then you have the incident view. This view allows you to filter by status, source, severity, and more tags.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/7UZY-AXx-4jR-nBj0gOAhUMx-5gOiHeEMzcKuEvsxkHtsWjQJhHs9BMQcqX4lmz1AjYxNz7hlWhPAHqnUR0Vldw2TrVg1SROTDqYZ835Z7X2Pia3plT_29aVL_LZT6jyNQjXgI7-ulED5f-vUC__\" style=\"width: 499px;\"><\/p>\n\n\n\n<p>Detected <strong>secrets are always grouped by incidents<\/strong>: the same API key hard-coded in multiple files would appear as a single incident. GitGuardian has some powerful features to accelerate the triage of incidents.&nbsp;<\/p>\n\n\n\n<p>First, to ensure high-precision alerts, GitGuardian checks<strong> the validity of secrets with <\/strong>non-intrusive API calls. Though not always possible (the interface clearly indicates when it is not), this check ensures perfect confidence in the importance of the alert.&nbsp;<\/p>\n\n\n\n<p>Second, GitGuardian uses <strong>rule sets to automatically assign severity<\/strong> to each incident. These severity rules are invaluable to prioritizing the remediation work. By following <a href=\"https:\/\/docs.gitguardian.com\/internal-repositories-monitoring\/remediate\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">GitGuardian&#8217;s best practices<\/a> on prioritization, investigation and remediation, you should be able to decide what needs to be acted on immediately and what is less urgent.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Real-time detection with GitHub integration<\/strong><\/h3>\n\n\n\n<p>Another important step in setting things up is integrating GitGuardian with your VCS for continuous monitoring.<\/p>\n\n\n\n<p>We will focus on GitHub here, but feel free to check our <a href=\"https:\/\/docs.gitguardian.com\/internal-repositories-monitoring\/monitor-perimeter\/vcs-integrations\/github\" target=\"_blank\" rel=\"noreferrer noopener\">documentation<\/a> to integrate with GitLab, Bitbucket, or Azure Devops.<\/p>\n\n\n\n<p>GitGuardian integrates natively with GitHub via a <strong>GitHub app<\/strong> that you can install on your personal <a href=\"https:\/\/gitprotect.io\/blog\/github-repository-vs-project\/\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub repositories<\/a> and on the repositories of your GitHub organizations. Once set-up, secrets scanning will be fully integrated with each GitHub Pull Request through Check Runs:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/dh3TREecTG0lJ2ZL9xRs5qsAr7g-6tthwfYMYRzCadHGUQEdN2-YX6Qq5bbWDQ6-pBw_sZeXKuVFHxIlCV-ArpvfVs_M8OtpNDBbj32pz_aSmp92h0bP5KuOi9agT7UY1979CZJ_G81r8kDdHJOs\" alt=\"Checkruns details in GitHub UI\" style=\"width:449px;height:309px\"\/><\/figure><\/div>\n\n\n<p>This allows the individual developer to get notified when an incident is detected by GitGuardian, <strong>directly in the GitHub interface<\/strong>.<\/p>\n\n\n\n<p>One important thing here is that the <strong>check will alert the developer before the commits are merged<\/strong>. This limits the incident to their branch and gives them a chance to fix it easily. As a result, secrets-free collaborative branches can be used for QA, staging, and production environments.<\/p>\n\n\n\n<p>It is also essential to understand that <strong>scans are conducted on each commit within a pull request<\/strong>, not just on the final state reviewed in the pull request.<\/p>\n\n\n\n<p>This deep scanning helps uncover cases where one commit adds a secret, and one commit removes the same secret within the same pull request (a very common case, which couldn&#8217;t have been identified through a code review):<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/2LGIRm66WwlIU81o-OBRQRudm9n3zRyUleeQNdXs5-tTTM0XXyggNvqBE3SqvcJ4vESMxWEgW7RIhiT_8uwPjpWBt_23fHSN60EjZzmKjLPXDpQgvsX16_Mb3-ZhvVdjN1iOuo8jphfweDRJm2Yi\" alt=\"Looking for secrets in git history\" style=\"width:498px;height:250px\"\/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>Pre-commit Hook<\/strong><\/h3>\n\n\n\n<p>The best way to protect a team, or an organization&#8217;s sensitive credentials is <strong>pre-commit hooks<\/strong>. They are like a security seatbelt for developers.<\/p>\n\n\n\n<p>A pre-commit hook is a short (or long!) snippet of code that is run, as you guessed before anything is committed in git.<\/p>\n\n\n\n<p>For our use case, this is actually the best moment to scan for credentials and secrets, since once one has created a git commit, it can be annoying to have to rewrite the history.<\/p>\n\n\n\n<p>Conversely, pre-commit hooks are <a href=\"https:\/\/blog.gitguardian.com\/setting-up-a-pre-commit-git-hook-with-gitguardian-shield-to-scan-for-secrets\/\" target=\"_blank\" rel=\"noreferrer noopener\">easy to set up<\/a> globally on a developer&#8217;s machine and are a &#8220;set &amp; forget&#8221; security mechanism.<\/p>\n\n\n\n<p>How? You simply need to have the following in .git\/hooks\/pre-commit file:<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#fafafa\">bash<br><strong>#!\/bin\/bash<\/strong><br>ggshield secret scan pre-commit<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">GitHub Action<\/h3>\n\n\n\n<p>Scanning for secrets in the CI is really your last line of defense. Imagine someone decided to bypass security checks and a credential is about to be merged with the main branch.<\/p>\n\n\n\n<p>To counter this, we have to set up a GitGuardian action on our repository, so that we can at least catch these during pull request checks. This is what a simple GitGuardian action check looks like. You can put this in <em>.github\/workflows\/gitguardian.yml<\/em><\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#fafafa\"><em>yaml<\/em><br>name: GitGuardian scan<br>on: [push, pull_request]<br>jobs:<br>    scanning:<br>        name: GitGuardian scan<br>        runs-on: ubuntu-latest<br>        steps:<br>            &#8211; name: Checkout<br>             &nbsp;uses: actions\/checkout@v2<br>    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  with:<br>      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fetch-depth: 0<br>     &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8211; name: GitGuardian scan<br>            &nbsp;&nbsp;uses: GitGuardian\/gg-shield-action@master<br>              env:<br>        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}<br>        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}<br>        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha<br>}}<br>        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GITHUB_DEFAULT_BRANCH: ${{ <br>github.event.repository.default_branch }}<br>        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}<\/p>\n\n\n\n<p>Make sure to create a GitGuardian personal access token in your account first:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/DKwjFjn_6Vs854IcTVwYKM3BoGncxRHqolg71-a9COiUXokvvBUEIvDoTUvfd97WLLPT2GVvHDv7iO6qmS9XVxuqWi7Oh8W5ea3Q0D9GKTqSwS-xa0uTJHuBdG6Hi_Xg5CsuVdr2EmYvqJ22wmwq\" alt=\"\" style=\"width:499px;height:94px\"\/><\/figure><\/div>\n\n\n<p>Then, set the GITGUARDIAN_API_KEY as an encrypted secret for your GitHub repository.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Going Further: Developer-Driven Remediation<\/strong><\/h2>\n\n\n\n<p>If you made it this far, congratulations! You can be sure that any secret committed to this repository would break the pipeline and be reported in the dashboard, along with all the other past incidents.&nbsp;<\/p>\n\n\n\n<p>You can also configure <strong>real-time alerting and notifications <\/strong>to push incident alerts on your perimeter to the channel of your choice ( Slack, Discord, JIRA, etc.). Even if you are rolling your own tools, it\u2019s fairly easy to integrate GitGuardian alerts thanks to <strong>event-based custom webhooks <\/strong>that any custom web service can consume.<\/p>\n\n\n\n<p>Along with other features, these integrations are here to help pull all parties closer to the remediation process. Developers need to acknowledge the threats and consequences of secrets sprawl, and picture how collaborating with security teams can strengthen the overall security posture \u2013 without compromising speed and productivity.<\/p>\n\n\n\n<p>The <strong>auto-healing playbook<\/strong> allows automatic incident-sharing with the involved developer to collect feedback more quickly or to allow them to resolve or ignore the incident.&nbsp;<\/p>\n\n\n\n<p>You can <a href=\"https:\/\/docs.gitguardian.com\/internal-repositories-monitoring\/incidents\/lifecycle\" target=\"_blank\" rel=\"noreferrer noopener\">read more<\/a> about how to assign incidents, collaborate, and organize the cleaning of your repositories\u2019 leaked secrets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Try it Yourself!<\/strong><\/h2>\n\n\n\n<p>You are now aware of how easily secrets can be leaked. <strong>Unlike runtime vulnerabilities, leaked secrets can persist in old commits and represent a real threat.<\/strong> That\u2019s why using a secrets detector in your DevSecOps workflows is a must-have for code security.<\/p>\n\n\n\n<p>This awareness is an essential first step toward building a culture of shared responsibility between security, operations, and developers for preventing production issues, keeping pipelines running, and remediating issues as soon as possible.<\/p>\n\n\n\n<p>GitGuardian is free for individual developers, open-source projects &amp; teams of less than 25 members.<\/p>\n\n\n\n<p><a href=\"https:\/\/dashboard.gitguardian.com\/\"><em>Install GitGuardian and start monitoring your repositories today<\/em><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s begin with an undeniable truth: every programmer has, at some point in their coding career, hard-coded secrets into their code. Whether it&#8217;s to perform a quick API test or to store credentials temporarily, there&#8217;s no denying that it&#8217;s a convenient shortcut. However, it&#8217;s also becoming an increasingly dangerous threat to the security of codebases.<\/p>\n","protected":false},"author":9,"featured_media":3983,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-github","post--single"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Detect Secrets in Code with GitGuardian - Blog | GitProtect.io<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Detect Secrets in Code with GitGuardian - Blog | GitProtect.io\" \/>\n<meta property=\"og:description\" content=\"Let&#8217;s begin with an undeniable truth: every programmer has, at some point in their coding career, hard-coded secrets into their code. Whether it&#8217;s to perform a quick API test or to store credentials temporarily, there&#8217;s no denying that it&#8217;s a convenient shortcut. However, it&#8217;s also becoming an increasingly dangerous threat to the security of codebases.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | GitProtect.io\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/XoperoSoftware\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-16T16:02:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-04T14:26:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Thomas Segura, Technical Content Writer at GitGuardian\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GitProtectio\" \/>\n<meta name=\"twitter:site\" content=\"@GitProtectio\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thomas Segura, Technical Content Writer at GitGuardian\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\"},\"author\":{\"name\":\"Thomas Segura, Technical Content Writer at GitGuardian\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/de0315973b221681eded9f0e00b39074\"},\"headline\":\"Detect Secrets in Code with GitGuardian\",\"datePublished\":\"2023-03-16T16:02:52+00:00\",\"dateModified\":\"2024-03-04T14:26:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\"},\"wordCount\":1774,\"publisher\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg\",\"articleSection\":[\"GitHub\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\",\"url\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\",\"name\":\"Detect Secrets in Code with GitGuardian - Blog | GitProtect.io\",\"isPartOf\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg\",\"datePublished\":\"2023-03-16T16:02:52+00:00\",\"dateModified\":\"2024-03-04T14:26:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage\",\"url\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg\",\"contentUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg\",\"width\":1200,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Strona g\u0142\u00f3wna\",\"item\":\"https:\/\/gitprotect.io\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Detect Secrets in Code with GitGuardian\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#website\",\"url\":\"https:\/\/gitprotect.io\/blog\/\",\"name\":\"GitProtect.io Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/gitprotect.io\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#organization\",\"name\":\"GitProtect.io\",\"url\":\"https:\/\/gitprotect.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png\",\"contentUrl\":\"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png\",\"width\":528,\"height\":528,\"caption\":\"GitProtect.io\"},\"image\":{\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/XoperoSoftware\/\",\"https:\/\/x.com\/GitProtectio\",\"https:\/\/www.linkedin.com\/company\/xopero-software\/\",\"https:\/\/www.youtube.com\/channel\/UCiEnl6n0mIO6w7twccz-l2w\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/de0315973b221681eded9f0e00b39074\",\"name\":\"Thomas Segura, Technical Content Writer at GitGuardian\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a5bd5c5d7c515e495b96f1b069f2f5e7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a5bd5c5d7c515e495b96f1b069f2f5e7?s=96&d=mm&r=g\",\"caption\":\"Thomas Segura, Technical Content Writer at GitGuardian\"},\"description\":\"Thomas has worked both as an analyst and as a software engineer consultant for various big French companies. His passion for tech and open source led him to join GitGuardian as technical content writer. He focuses now on clarifying the transformative changes that cybersecurity and software are going through.\",\"sameAs\":[\"http:\/\/gitguardian.com\"],\"url\":\"https:\/\/gitprotect.io\/blog\/author\/thomas-segura\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Detect Secrets in Code with GitGuardian - Blog | GitProtect.io","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/","og_locale":"en_US","og_type":"article","og_title":"Detect Secrets in Code with GitGuardian - Blog | GitProtect.io","og_description":"Let&#8217;s begin with an undeniable truth: every programmer has, at some point in their coding career, hard-coded secrets into their code. Whether it&#8217;s to perform a quick API test or to store credentials temporarily, there&#8217;s no denying that it&#8217;s a convenient shortcut. However, it&#8217;s also becoming an increasingly dangerous threat to the security of codebases.","og_url":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/","og_site_name":"Blog | GitProtect.io","article_publisher":"https:\/\/www.facebook.com\/XoperoSoftware\/","article_published_time":"2023-03-16T16:02:52+00:00","article_modified_time":"2024-03-04T14:26:21+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg","type":"image\/jpeg"}],"author":"Thomas Segura, Technical Content Writer at GitGuardian","twitter_card":"summary_large_image","twitter_creator":"@GitProtectio","twitter_site":"@GitProtectio","twitter_misc":{"Written by":"Thomas Segura, Technical Content Writer at GitGuardian","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#article","isPartOf":{"@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/"},"author":{"name":"Thomas Segura, Technical Content Writer at GitGuardian","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/de0315973b221681eded9f0e00b39074"},"headline":"Detect Secrets in Code with GitGuardian","datePublished":"2023-03-16T16:02:52+00:00","dateModified":"2024-03-04T14:26:21+00:00","mainEntityOfPage":{"@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/"},"wordCount":1774,"publisher":{"@id":"https:\/\/gitprotect.io\/blog\/#organization"},"image":{"@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage"},"thumbnailUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg","articleSection":["GitHub"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/","url":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/","name":"Detect Secrets in Code with GitGuardian - Blog | GitProtect.io","isPartOf":{"@id":"https:\/\/gitprotect.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage"},"image":{"@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage"},"thumbnailUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg","datePublished":"2023-03-16T16:02:52+00:00","dateModified":"2024-03-04T14:26:21+00:00","breadcrumb":{"@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#primaryimage","url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg","contentUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/03\/GitGuardian_blogpost.jpg","width":1200,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/gitprotect.io\/blog\/detect-secrets-in-code-with-gitguardian\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Strona g\u0142\u00f3wna","item":"https:\/\/gitprotect.io\/blog\/"},{"@type":"ListItem","position":2,"name":"Detect Secrets in Code with GitGuardian"}]},{"@type":"WebSite","@id":"https:\/\/gitprotect.io\/blog\/#website","url":"https:\/\/gitprotect.io\/blog\/","name":"GitProtect.io Blog","description":"","publisher":{"@id":"https:\/\/gitprotect.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gitprotect.io\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/gitprotect.io\/blog\/#organization","name":"GitProtect.io","url":"https:\/\/gitprotect.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png","contentUrl":"https:\/\/gitprotect.io\/blog\/wp-content\/uploads\/2023\/05\/favicon-528x528-1.png","width":528,"height":528,"caption":"GitProtect.io"},"image":{"@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/XoperoSoftware\/","https:\/\/x.com\/GitProtectio","https:\/\/www.linkedin.com\/company\/xopero-software\/","https:\/\/www.youtube.com\/channel\/UCiEnl6n0mIO6w7twccz-l2w"]},{"@type":"Person","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/de0315973b221681eded9f0e00b39074","name":"Thomas Segura, Technical Content Writer at GitGuardian","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gitprotect.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a5bd5c5d7c515e495b96f1b069f2f5e7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a5bd5c5d7c515e495b96f1b069f2f5e7?s=96&d=mm&r=g","caption":"Thomas Segura, Technical Content Writer at GitGuardian"},"description":"Thomas has worked both as an analyst and as a software engineer consultant for various big French companies. His passion for tech and open source led him to join GitGuardian as technical content writer. He focuses now on clarifying the transformative changes that cybersecurity and software are going through.","sameAs":["http:\/\/gitguardian.com"],"url":"https:\/\/gitprotect.io\/blog\/author\/thomas-segura\/"}]}},"_links":{"self":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts\/3981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/comments?post=3981"}],"version-history":[{"count":5,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts\/3981\/revisions"}],"predecessor-version":[{"id":4904,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/posts\/3981\/revisions\/4904"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/media\/3983"}],"wp:attachment":[{"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/media?parent=3981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/categories?post=3981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gitprotect.io\/blog\/wp-json\/wp\/v2\/tags?post=3981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}