oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package release
2
3import (
4 "crypto/sha256"
5 "encoding/hex"
6 "io"
7 "os"
8 "path/filepath"
9)
10
11const GitleaksVersion = "v8.30.1"
12
13// Linked from the matching platform artifact built before the runner.
14var gitleaksSHA256 string
15
16func GitleaksSHA256() string { return gitleaksSHA256 }
17
18func VerifyGitleaks(binary, want string) bool {
19 if !filepath.IsAbs(binary) || !sha256Hex(want) {
20 return false
21 }
22 info, err := os.Lstat(binary)
23 if err != nil || !info.Mode().IsRegular() || info.Mode().Perm()&0111 == 0 {
24 return false
25 }
26 f, err := os.Open(binary)
27 if err != nil {
28 return false
29 }
30 defer f.Close()
31 h := sha256.New()
32 _, err = io.Copy(h, f)
33 return err == nil && hex.EncodeToString(h.Sum(nil)) == want
34}
35