Protect and discover secrets using Git-leaks - Blogs
X
02Aug

Protect and discover secrets using Git-leaks

  • Git-leaks is a SAST tool for detecting and preventing hardcoded secrets like Passwords, API keys and tokens in GitHub Repository.
  • Git-leaks is an easy-to-use, all-in-one solution for detecting secrets, past or present, in your code.
  • Git-leaks would be configured as part of GitHub actions workflow for all the repositories we want to monitor for any sensitive secret patterns.

Example of Git-Leaks basic workflow:

Workflow

The above GitHub Actions workflow does couple of things:

  • It only runs when the repository event is a push (direct commit) or a pull request against main branch. This is defined in the ‘on’ section of workflow file.
  • The job runs against the latest Ubuntu environment.
  • The steps defined in the job checks out the repository and install the Git-leaks.
  • Git-leaks will scan and if leaks are present, it will detect in the Action logs and same time it will generate the artifact also.
  • If required, we can download those reports to identify the leaks in our Repository.
  • By using some public actions, you can also generate the report on the Pull-request.
  • This is Pretty useful feature, for easily identifying the secrets or leaks while merging to the main/master branch.

Results:

Git-leaks Actions log Report:

  • From the GitHub Actions live logs, you can see something like this if no leaks are detected

log-report

 

Git-leaks report artifact:

Download reports when leaks are present from GitHub Actions.

artifact

 

Pull Request Comments:

  • Easy to understand report of a Git-leaks job. If no leaks are detected during pull-request, you'll see:

Pr-1

 

  • If leaks are encountered during a pull request, you’ll see something like this.

Pr-2

 

How to remove the valid detected secrets:

  • By using the generate artifact report or pull-request comments we can identify, where the secrets are leaking and simply, we can do modifications in that to remove the detected secrets.
  • By using BFG repo cleaner also you can remove the secrets.

 

Benefits of using Git-Leaks with GitHub Actions:

  • Pretty useful feature, to identify the leaks like Passwords, API keys, and tokens in GitHub repos.
  • With GitHub Actions you can also generate the report on the Pull-request and live logs.
  • By using Reusable workflows, easily you can trigger in all the workflows and get the results

Related

Namespaces in Kubernetes

A default namespace is created automatically when the cluster is being setup. To isolate or prevent ...

Read More >

Blog-subscribe

Subscribe using the form below to get updates on our futureblogs!!! We will ensure you to send updat...

Read More >

Overview of Microsoft Dynamics CRM 2013

What is CRM  Today’s world is fast changing and full of challenges, which fundamenta...

Read More >

Uses of MS Dynamics NAV Query Object

Query is a new object in Microsoft Dynamics NAV 2013 that a programmer can use to define a set of da...

Read More >

How to run NAV 2015 and NAV 2016 Administration tool side by side

Everyone would have installed NAV 2016 RTM and would have faced the same problem, i.e, you couldn...

Read More >

Brief Journey to Asp.Net MVC Framework

Introduction: ASP.NET MVC is a  framework for building web applications that uses the mode...

Read More >

Token Based Authentication for Web API's

Securing ASP.NET Web API using Custom Token Based AuthenticationProviding a security to the Web API&...

Read More >

Populate data as Facebook feeds in ASP.NET

Want to load the data dynamically as Facebook feeds?Need to populate the data when scrollbar comes d...

Read More >

Share

Try DevOpSmartBoard Ultimate complete Azure DevOps End-to end reporting tool

Sign Up

  • Recent
  • Popular
  • Tag
Monthly Archive
Subscribe
Name

Text/HTML
Contact Us
  • *
  • *