Forráskód Böngészése

Bufix/1100 protect stagged files (#1121)

* create repo with stagged secrets

* add .gitleaksignore to testdata repo

* fix typo

* add gitleaksignore to detector on protect command

---------

Co-authored-by: Rafael Figueiredo <rfigueiredo@garoa.cloud>
Rafael Figueiredo 2 éve
szülő
commit
9701bf1724
55 módosított fájl, 195 hozzáadás és 1 törlés
  1. 6 1
      cmd/protect.go
  2. 81 0
      detect/detect_test.go
  3. 1 0
      testdata/repos/staged/.gitleaksignore
  4. 2 0
      testdata/repos/staged/README.md
  5. 10 0
      testdata/repos/staged/api/api.go
  6. 1 0
      testdata/repos/staged/dotGit/COMMIT_EDITMSG
  7. 1 0
      testdata/repos/staged/dotGit/FETCH_HEAD
  8. 1 0
      testdata/repos/staged/dotGit/HEAD
  9. 1 0
      testdata/repos/staged/dotGit/ORIG_HEAD
  10. 13 0
      testdata/repos/staged/dotGit/config
  11. 1 0
      testdata/repos/staged/dotGit/description
  12. BIN
      testdata/repos/staged/dotGit/index
  13. 6 0
      testdata/repos/staged/dotGit/info/exclude
  14. 14 0
      testdata/repos/staged/dotGit/logs/HEAD
  15. 1 0
      testdata/repos/staged/dotGit/logs/refs/heads/api-pkg
  16. 3 0
      testdata/repos/staged/dotGit/logs/refs/heads/foo
  17. 3 0
      testdata/repos/staged/dotGit/logs/refs/heads/main
  18. 3 0
      testdata/repos/staged/dotGit/logs/refs/heads/remove-secrets
  19. 1 0
      testdata/repos/staged/dotGit/logs/refs/remotes/origin/HEAD
  20. 1 0
      testdata/repos/staged/dotGit/logs/refs/remotes/origin/api-pkg
  21. 1 0
      testdata/repos/staged/dotGit/logs/refs/remotes/origin/foo
  22. 1 0
      testdata/repos/staged/dotGit/logs/refs/remotes/origin/main
  23. 1 0
      testdata/repos/staged/dotGit/objects/02/d85657604c34e7b7fbb324a0c6c8b13c2c3760
  24. BIN
      testdata/repos/staged/dotGit/objects/15/2888a42422b2ff5868b8d003d626120a9cb738
  25. BIN
      testdata/repos/staged/dotGit/objects/2e/1db472eeba53f06c4026ae4566ea022e36598e
  26. BIN
      testdata/repos/staged/dotGit/objects/46/18d7e4512b6b0b1dab85cf846d9f43474ec8be
  27. BIN
      testdata/repos/staged/dotGit/objects/49/1504d5a31946ce75e22554cc34203d8e5ff3ca
  28. BIN
      testdata/repos/staged/dotGit/objects/5c/547e4215d9594c3935bdfefdf4f500016a4112
  29. BIN
      testdata/repos/staged/dotGit/objects/65/83d6db4a57bbeda62d50fc91649036d499418d
  30. BIN
      testdata/repos/staged/dotGit/objects/66/bc70d0c0bfbb6468b3f90c3f1e9f2ddba02b43
  31. BIN
      testdata/repos/staged/dotGit/objects/78/9ba677976d5db481de55c799d67acbf8e3f16a
  32. 3 0
      testdata/repos/staged/dotGit/objects/90/6335481df9a4b48906c90318b4fac76b67fe73
  33. BIN
      testdata/repos/staged/dotGit/objects/9a/932e37eaa9fb64b09e47e5e859c9b2c8cb47ad
  34. BIN
      testdata/repos/staged/dotGit/objects/a1/22b33c6bad3ee54724f52f2caad385ab1982ab
  35. BIN
      testdata/repos/staged/dotGit/objects/a5/caae6d742e49a33982f1fdc608ce861ea59be5
  36. BIN
      testdata/repos/staged/dotGit/objects/a9/aa0c942dcef669a94f207a77426106b25efd1a
  37. BIN
      testdata/repos/staged/dotGit/objects/b1/6d768dd595a59f947abe087901183d219d7e54
  38. BIN
      testdata/repos/staged/dotGit/objects/bc/f47ef84f29bb7ed6e653d61fccd30d0ecce886
  39. 2 0
      testdata/repos/staged/dotGit/objects/bf/3f24164d7256b4021575cbdb2f97b98e6f057e
  40. BIN
      testdata/repos/staged/dotGit/objects/d8/32479114dc6be7207edc7c37ce91dd11b93161
  41. BIN
      testdata/repos/staged/dotGit/objects/da/2622b4d97e32c5801511244b809144b6b3ea78
  42. BIN
      testdata/repos/staged/dotGit/objects/e5/c0849a65c586eab87dcfc31fec74f0fd7c62cb
  43. BIN
      testdata/repos/staged/dotGit/objects/f1/b58b97808f8e744f6a23c693859df5b5968901
  44. BIN
      testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.idx
  45. BIN
      testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.pack
  46. 2 0
      testdata/repos/staged/dotGit/packed-refs
  47. 1 0
      testdata/repos/staged/dotGit/refs/heads/api-pkg
  48. 1 0
      testdata/repos/staged/dotGit/refs/heads/foo
  49. 1 0
      testdata/repos/staged/dotGit/refs/heads/main
  50. 1 0
      testdata/repos/staged/dotGit/refs/heads/remove-secrets
  51. 1 0
      testdata/repos/staged/dotGit/refs/remotes/origin/HEAD
  52. 1 0
      testdata/repos/staged/dotGit/refs/remotes/origin/api-pkg
  53. 1 0
      testdata/repos/staged/dotGit/refs/remotes/origin/foo
  54. 1 0
      testdata/repos/staged/dotGit/refs/remotes/origin/main
  55. 27 0
      testdata/repos/staged/main.go

+ 6 - 1
cmd/protect.go

@@ -66,11 +66,16 @@ func runProtect(cmd *cobra.Command, args []string) {
 	if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
 		log.Fatal().Err(err).Msg("")
 	}
-
 	if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
 		log.Fatal().Err(err).Msg("")
 	}
 
+	if fileExists(filepath.Join(source, ".gitleaksignore")) {
+		if err = detector.AddGitleaksIgnore(filepath.Join(source, ".gitleaksignore")); err != nil {
+			log.Fatal().Err(err).Msg("could not call AddGitleaksIgnore")
+		}
+	}
+
 	// get log options for git scan
 	logOpts, err := cmd.Flags().GetString("log-opts")
 	if err != nil {

+ 81 - 0
detect/detect_test.go

@@ -485,6 +485,87 @@ func TestFromGit(t *testing.T) {
 		assert.ElementsMatch(t, tt.expectedFindings, findings)
 	}
 }
+func TestFromGitStaged(t *testing.T) {
+	tests := []struct {
+		cfgName          string
+		source           string
+		logOpts          string
+		expectedFindings []report.Finding
+	}{
+		{
+			source:  filepath.Join(repoBasePath, "staged"),
+			cfgName: "simple",
+			expectedFindings: []report.Finding{
+				{
+					Description: "AWS Access Key",
+					StartLine:   7,
+					EndLine:     7,
+					StartColumn: 18,
+					EndColumn:   37,
+					Line:        "\n\taws_token2 := \"AKIALALEMEL33243OLIA\" // this one is not",
+					Match:       "AKIALALEMEL33243OLIA",
+					Secret:      "AKIALALEMEL33243OLIA",
+					File:        "api/api.go",
+					SymlinkFile: "",
+					Commit:      "",
+					Entropy:     3.0841837,
+					Author:      "",
+					Email:       "",
+					Date:        "0001-01-01T00:00:00Z",
+					Message:     "",
+					Tags: []string{
+						"key",
+						"AWS",
+					},
+					RuleID:      "aws-access-key",
+					Fingerprint: "api/api.go:aws-access-key:7",
+				},
+			},
+		},
+	}
+
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer func() {
+		if err := moveDotGit(".git", "dotGit"); err != nil {
+			t.Error(err)
+		}
+	}()
+
+	for _, tt := range tests {
+
+		viper.AddConfigPath(configPath)
+		viper.SetConfigName("simple")
+		viper.SetConfigType("toml")
+		err = viper.ReadInConfig()
+		if err != nil {
+			t.Error(err)
+		}
+
+		var vc config.ViperConfig
+		err = viper.Unmarshal(&vc)
+		if err != nil {
+			t.Error(err)
+		}
+		cfg, err := vc.Translate()
+		if err != nil {
+			t.Error(err)
+		}
+		detector := NewDetector(cfg)
+		detector.AddGitleaksIgnore(filepath.Join(tt.source, ".gitleaksignore"))
+		findings, err := detector.DetectGit(tt.source, tt.logOpts, ProtectStagedType)
+		if err != nil {
+			t.Error(err)
+		}
+
+		for _, f := range findings {
+			f.Match = "" // remove lines cause copying and pasting them has some wack formatting
+		}
+		assert.ElementsMatch(t, tt.expectedFindings, findings)
+	}
+}
 
 // TestFromFiles tests the FromFiles function
 func TestFromFiles(t *testing.T) {

+ 1 - 0
testdata/repos/staged/.gitleaksignore

@@ -0,0 +1 @@
+api/api.go:aws-access-key:6

+ 2 - 0
testdata/repos/staged/README.md

@@ -0,0 +1,2 @@
+# test
+This is a repo used for testing gitleaks

+ 10 - 0
testdata/repos/staged/api/api.go

@@ -0,0 +1,10 @@
+package api
+
+import "fmt"
+
+func PrintHello() {
+	aws_token := "AKIALALEMEL33243OLIA"  // fingerprint of that secret is added to .gitleaksignore
+	aws_token2 := "AKIALALEMEL33243OLIA" // this one is not
+	fmt.Println(aws_token)
+	fmt.Println(aws_token2)
+}

+ 1 - 0
testdata/repos/staged/dotGit/COMMIT_EDITMSG

@@ -0,0 +1 @@
+add .gitleaksignore file

+ 1 - 0
testdata/repos/staged/dotGit/FETCH_HEAD

@@ -0,0 +1 @@
+2e1db472eeba53f06c4026ae4566ea022e36598e		branch 'main' of github.com:gitleaks/test

+ 1 - 0
testdata/repos/staged/dotGit/HEAD

@@ -0,0 +1 @@
+ref: refs/heads/main

+ 1 - 0
testdata/repos/staged/dotGit/ORIG_HEAD

@@ -0,0 +1 @@
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587

+ 13 - 0
testdata/repos/staged/dotGit/config

@@ -0,0 +1,13 @@
+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = false
+	logallrefupdates = true
+	ignorecase = true
+	precomposeunicode = true
+[remote "origin"]
+	url = git@github.com:gitleaks/test.git
+	fetch = +refs/heads/*:refs/remotes/origin/*
+[branch "main"]
+	remote = origin
+	merge = refs/heads/main

+ 1 - 0
testdata/repos/staged/dotGit/description

@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.

BIN
testdata/repos/staged/dotGit/index


+ 6 - 0
testdata/repos/staged/dotGit/info/exclude

@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~

+ 14 - 0
testdata/repos/staged/dotGit/logs/HEAD

@@ -0,0 +1,14 @@
+0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896329 -0500	clone: from github.com:gitleaks/test.git
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896362 -0500	checkout: moving from main to remove-secrets
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 906335481df9a4b48906c90318b4fac76b67fe73 Zach Rice <zricer@protonmail.com> 1635896426 -0500	commit: load token via env var
+906335481df9a4b48906c90318b4fac76b67fe73 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896518 -0500	commit: add api package
+a122b33c6bad3ee54724f52f2caad385ab1982ab a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896543 -0500	checkout: moving from remove-secrets to api-pkg
+a122b33c6bad3ee54724f52f2caad385ab1982ab 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896644 -0500	checkout: moving from api-pkg to main
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896648 -0500	pull origin main: Fast-forward
+2e1db472eeba53f06c4026ae4566ea022e36598e 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896716 -0500	checkout: moving from main to foo
+2e1db472eeba53f06c4026ae4566ea022e36598e 491504d5a31946ce75e22554cc34203d8e5ff3ca Zach Rice <zricer@protonmail.com> 1635896886 -0500	commit: adding foo package with secret
+491504d5a31946ce75e22554cc34203d8e5ff3ca f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635896931 -0500	commit: removing secret from foo package
+f1b58b97808f8e744f6a23c693859df5b5968901 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635897009 -0500	checkout: moving from foo to main
+2e1db472eeba53f06c4026ae4566ea022e36598e f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635897062 -0500	checkout: moving from main to foo
+f1b58b97808f8e744f6a23c693859df5b5968901 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635897508 -0500	checkout: moving from foo to main
+2e1db472eeba53f06c4026ae4566ea022e36598e bf3f24164d7256b4021575cbdb2f97b98e6f057e Rafael Figueiredo <rfigueiredo@garoa.cloud> 1679239434 -0300	commit: add .gitleaksignore file

+ 1 - 0
testdata/repos/staged/dotGit/logs/refs/heads/api-pkg

@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896543 -0500	branch: Created from HEAD

+ 3 - 0
testdata/repos/staged/dotGit/logs/refs/heads/foo

@@ -0,0 +1,3 @@
+0000000000000000000000000000000000000000 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896716 -0500	branch: Created from HEAD
+2e1db472eeba53f06c4026ae4566ea022e36598e 491504d5a31946ce75e22554cc34203d8e5ff3ca Zach Rice <zricer@protonmail.com> 1635896886 -0500	commit: adding foo package with secret
+491504d5a31946ce75e22554cc34203d8e5ff3ca f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635896931 -0500	commit: removing secret from foo package

+ 3 - 0
testdata/repos/staged/dotGit/logs/refs/heads/main

@@ -0,0 +1,3 @@
+0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896329 -0500	clone: from github.com:gitleaks/test.git
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896648 -0500	pull origin main: Fast-forward
+2e1db472eeba53f06c4026ae4566ea022e36598e bf3f24164d7256b4021575cbdb2f97b98e6f057e Rafael Figueiredo <rfigueiredo@garoa.cloud> 1679239434 -0300	commit: add .gitleaksignore file

+ 3 - 0
testdata/repos/staged/dotGit/logs/refs/heads/remove-secrets

@@ -0,0 +1,3 @@
+0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896362 -0500	branch: Created from HEAD
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 906335481df9a4b48906c90318b4fac76b67fe73 Zach Rice <zricer@protonmail.com> 1635896426 -0500	commit: load token via env var
+906335481df9a4b48906c90318b4fac76b67fe73 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896518 -0500	commit: add api package

+ 1 - 0
testdata/repos/staged/dotGit/logs/refs/remotes/origin/HEAD

@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice <zricer@protonmail.com> 1635896329 -0500	clone: from github.com:gitleaks/test.git

+ 1 - 0
testdata/repos/staged/dotGit/logs/refs/remotes/origin/api-pkg

@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice <zricer@protonmail.com> 1635896552 -0500	update by push

+ 1 - 0
testdata/repos/staged/dotGit/logs/refs/remotes/origin/foo

@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice <zricer@protonmail.com> 1635896935 -0500	update by push

+ 1 - 0
testdata/repos/staged/dotGit/logs/refs/remotes/origin/main

@@ -0,0 +1 @@
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice <zricer@protonmail.com> 1635896648 -0500	pull origin main: fast-forward

+ 1 - 0
testdata/repos/staged/dotGit/objects/02/d85657604c34e7b7fbb324a0c6c8b13c2c3760

@@ -0,0 +1 @@
+xUÌ1Â0`×ܯ8nJ––.‚ƒƒ:*(8–´\¤´É•$ê þw3	Noxï{Ý$6Ëf1Û~´wF'0øYbF
ŠœÏTB�p�ÐãND|ƒ*]uŽCÈSÐT •…ªkLÌ>a²Ž#(ûJm–‘®Ö(©ÚsæðÔ´¹]Úëé°=õ÷ô>ð°ú03

BIN
testdata/repos/staged/dotGit/objects/15/2888a42422b2ff5868b8d003d626120a9cb738


BIN
testdata/repos/staged/dotGit/objects/2e/1db472eeba53f06c4026ae4566ea022e36598e


BIN
testdata/repos/staged/dotGit/objects/46/18d7e4512b6b0b1dab85cf846d9f43474ec8be


BIN
testdata/repos/staged/dotGit/objects/49/1504d5a31946ce75e22554cc34203d8e5ff3ca


BIN
testdata/repos/staged/dotGit/objects/5c/547e4215d9594c3935bdfefdf4f500016a4112


BIN
testdata/repos/staged/dotGit/objects/65/83d6db4a57bbeda62d50fc91649036d499418d


BIN
testdata/repos/staged/dotGit/objects/66/bc70d0c0bfbb6468b3f90c3f1e9f2ddba02b43


BIN
testdata/repos/staged/dotGit/objects/78/9ba677976d5db481de55c799d67acbf8e3f16a


+ 3 - 0
testdata/repos/staged/dotGit/objects/90/6335481df9a4b48906c90318b4fac76b67fe73

@@ -0,0 +1,3 @@
+xťŽM
+Â0F]çs%™üt
+"žÁĄ»I2ˇEŰ”»đôö®>xĽ_ŞË2w@;śză‘�ءCŚXЧ@‘˛Ö65Ź)–ÔĆMÖ&†ĚÎF:l'ĚFÇTHÄŹFFĂ1–äiPüéSmđä4ÁcN×o;¦Ý·V{]žß—T—�`=ŤÁa€łöZ«�»ü«wĺ˝ľd…}f�u‡ť›úKKś

BIN
testdata/repos/staged/dotGit/objects/9a/932e37eaa9fb64b09e47e5e859c9b2c8cb47ad


BIN
testdata/repos/staged/dotGit/objects/a1/22b33c6bad3ee54724f52f2caad385ab1982ab


BIN
testdata/repos/staged/dotGit/objects/a5/caae6d742e49a33982f1fdc608ce861ea59be5


BIN
testdata/repos/staged/dotGit/objects/a9/aa0c942dcef669a94f207a77426106b25efd1a


BIN
testdata/repos/staged/dotGit/objects/b1/6d768dd595a59f947abe087901183d219d7e54


BIN
testdata/repos/staged/dotGit/objects/bc/f47ef84f29bb7ed6e653d61fccd30d0ecce886


+ 2 - 0
testdata/repos/staged/dotGit/objects/bf/3f24164d7256b4021575cbdb2f97b98e6f057e

@@ -0,0 +1,2 @@
+x¥ŽAn!sæó�X³ÀÎɲ|Êòƒš5ÊÚX˜ý¬ò[ª*uj·[dçð1:@"1-œ9q,1Š—ct%preB(6ç¨l£wæ¡÷—ˆ)G¿X êì
+KòlEág¼P's8Âè>®­Ó·ÅF_uÝQ;r£S/ÿã²jozH[Ûó™&Y‚uÁ;OŸì˜Mú;;ðfÆhÎtXëØ ?ϺÞ[•ºÁü_]U

BIN
testdata/repos/staged/dotGit/objects/d8/32479114dc6be7207edc7c37ce91dd11b93161


BIN
testdata/repos/staged/dotGit/objects/da/2622b4d97e32c5801511244b809144b6b3ea78


BIN
testdata/repos/staged/dotGit/objects/e5/c0849a65c586eab87dcfc31fec74f0fd7c62cb


BIN
testdata/repos/staged/dotGit/objects/f1/b58b97808f8e744f6a23c693859df5b5968901


BIN
testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.idx


BIN
testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.pack


+ 2 - 0
testdata/repos/staged/dotGit/packed-refs

@@ -0,0 +1,2 @@
+# pack-refs with: peeled fully-peeled sorted 
+1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 refs/remotes/origin/main

+ 1 - 0
testdata/repos/staged/dotGit/refs/heads/api-pkg

@@ -0,0 +1 @@
+a122b33c6bad3ee54724f52f2caad385ab1982ab

+ 1 - 0
testdata/repos/staged/dotGit/refs/heads/foo

@@ -0,0 +1 @@
+f1b58b97808f8e744f6a23c693859df5b5968901

+ 1 - 0
testdata/repos/staged/dotGit/refs/heads/main

@@ -0,0 +1 @@
+bf3f24164d7256b4021575cbdb2f97b98e6f057e

+ 1 - 0
testdata/repos/staged/dotGit/refs/heads/remove-secrets

@@ -0,0 +1 @@
+a122b33c6bad3ee54724f52f2caad385ab1982ab

+ 1 - 0
testdata/repos/staged/dotGit/refs/remotes/origin/HEAD

@@ -0,0 +1 @@
+ref: refs/remotes/origin/main

+ 1 - 0
testdata/repos/staged/dotGit/refs/remotes/origin/api-pkg

@@ -0,0 +1 @@
+a122b33c6bad3ee54724f52f2caad385ab1982ab

+ 1 - 0
testdata/repos/staged/dotGit/refs/remotes/origin/foo

@@ -0,0 +1 @@
+f1b58b97808f8e744f6a23c693859df5b5968901

+ 1 - 0
testdata/repos/staged/dotGit/refs/remotes/origin/main

@@ -0,0 +1 @@
+2e1db472eeba53f06c4026ae4566ea022e36598e

+ 27 - 0
testdata/repos/staged/main.go

@@ -0,0 +1,27 @@
+package main
+
+import (
+	"fmt"
+	"os"
+)
+
+func main() {
+
+	var a = "initial"
+	fmt.Println(a)
+
+	var b, c int = 1, 2
+	fmt.Println(b, c)
+
+	var d = true
+	fmt.Println(d)
+
+	var e int
+	fmt.Println(e)
+
+	// load secret via env
+	awsToken := os.Getenv("AWS_TOKEN")
+
+	f := "apple"
+	fmt.Println(f)
+}