diff --git a/cmd/protect.go b/cmd/protect.go index 36007fa0..da267096 100644 --- a/cmd/protect.go +++ b/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 { diff --git a/detect/detect_test.go b/detect/detect_test.go index 8c76f2ce..f6f95458 100644 --- a/detect/detect_test.go +++ b/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) { diff --git a/testdata/repos/staged/.gitleaksignore b/testdata/repos/staged/.gitleaksignore new file mode 100644 index 00000000..770453ca --- /dev/null +++ b/testdata/repos/staged/.gitleaksignore @@ -0,0 +1 @@ +api/api.go:aws-access-key:6 \ No newline at end of file diff --git a/testdata/repos/staged/README.md b/testdata/repos/staged/README.md new file mode 100644 index 00000000..5cc9baf4 --- /dev/null +++ b/testdata/repos/staged/README.md @@ -0,0 +1,2 @@ +# test +This is a repo used for testing gitleaks diff --git a/testdata/repos/staged/api/api.go b/testdata/repos/staged/api/api.go new file mode 100644 index 00000000..b16d768d --- /dev/null +++ b/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) +} diff --git a/testdata/repos/staged/dotGit/COMMIT_EDITMSG b/testdata/repos/staged/dotGit/COMMIT_EDITMSG new file mode 100644 index 00000000..b83ad539 --- /dev/null +++ b/testdata/repos/staged/dotGit/COMMIT_EDITMSG @@ -0,0 +1 @@ +add .gitleaksignore file diff --git a/testdata/repos/staged/dotGit/FETCH_HEAD b/testdata/repos/staged/dotGit/FETCH_HEAD new file mode 100644 index 00000000..66c1c77c --- /dev/null +++ b/testdata/repos/staged/dotGit/FETCH_HEAD @@ -0,0 +1 @@ +2e1db472eeba53f06c4026ae4566ea022e36598e branch 'main' of github.com:gitleaks/test diff --git a/testdata/repos/staged/dotGit/HEAD b/testdata/repos/staged/dotGit/HEAD new file mode 100644 index 00000000..b870d826 --- /dev/null +++ b/testdata/repos/staged/dotGit/HEAD @@ -0,0 +1 @@ +ref: refs/heads/main diff --git a/testdata/repos/staged/dotGit/ORIG_HEAD b/testdata/repos/staged/dotGit/ORIG_HEAD new file mode 100644 index 00000000..96321ccd --- /dev/null +++ b/testdata/repos/staged/dotGit/ORIG_HEAD @@ -0,0 +1 @@ +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 diff --git a/testdata/repos/staged/dotGit/config b/testdata/repos/staged/dotGit/config new file mode 100644 index 00000000..374df60b --- /dev/null +++ b/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 diff --git a/testdata/repos/staged/dotGit/description b/testdata/repos/staged/dotGit/description new file mode 100644 index 00000000..498b267a --- /dev/null +++ b/testdata/repos/staged/dotGit/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/testdata/repos/staged/dotGit/index b/testdata/repos/staged/dotGit/index new file mode 100644 index 00000000..42a3c443 Binary files /dev/null and b/testdata/repos/staged/dotGit/index differ diff --git a/testdata/repos/staged/dotGit/info/exclude b/testdata/repos/staged/dotGit/info/exclude new file mode 100644 index 00000000..a5196d1b --- /dev/null +++ b/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] +# *~ diff --git a/testdata/repos/staged/dotGit/logs/HEAD b/testdata/repos/staged/dotGit/logs/HEAD new file mode 100644 index 00000000..928095a1 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/HEAD @@ -0,0 +1,14 @@ +0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice 1635896329 -0500 clone: from github.com:gitleaks/test.git +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice 1635896362 -0500 checkout: moving from main to remove-secrets +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 906335481df9a4b48906c90318b4fac76b67fe73 Zach Rice 1635896426 -0500 commit: load token via env var +906335481df9a4b48906c90318b4fac76b67fe73 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice 1635896518 -0500 commit: add api package +a122b33c6bad3ee54724f52f2caad385ab1982ab a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice 1635896543 -0500 checkout: moving from remove-secrets to api-pkg +a122b33c6bad3ee54724f52f2caad385ab1982ab 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice 1635896644 -0500 checkout: moving from api-pkg to main +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635896648 -0500 pull origin main: Fast-forward +2e1db472eeba53f06c4026ae4566ea022e36598e 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635896716 -0500 checkout: moving from main to foo +2e1db472eeba53f06c4026ae4566ea022e36598e 491504d5a31946ce75e22554cc34203d8e5ff3ca Zach Rice 1635896886 -0500 commit: adding foo package with secret +491504d5a31946ce75e22554cc34203d8e5ff3ca f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice 1635896931 -0500 commit: removing secret from foo package +f1b58b97808f8e744f6a23c693859df5b5968901 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635897009 -0500 checkout: moving from foo to main +2e1db472eeba53f06c4026ae4566ea022e36598e f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice 1635897062 -0500 checkout: moving from main to foo +f1b58b97808f8e744f6a23c693859df5b5968901 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635897508 -0500 checkout: moving from foo to main +2e1db472eeba53f06c4026ae4566ea022e36598e bf3f24164d7256b4021575cbdb2f97b98e6f057e Rafael Figueiredo 1679239434 -0300 commit: add .gitleaksignore file diff --git a/testdata/repos/staged/dotGit/logs/refs/heads/api-pkg b/testdata/repos/staged/dotGit/logs/refs/heads/api-pkg new file mode 100644 index 00000000..18e1cff1 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/heads/api-pkg @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice 1635896543 -0500 branch: Created from HEAD diff --git a/testdata/repos/staged/dotGit/logs/refs/heads/foo b/testdata/repos/staged/dotGit/logs/refs/heads/foo new file mode 100644 index 00000000..0588ad53 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/heads/foo @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635896716 -0500 branch: Created from HEAD +2e1db472eeba53f06c4026ae4566ea022e36598e 491504d5a31946ce75e22554cc34203d8e5ff3ca Zach Rice 1635896886 -0500 commit: adding foo package with secret +491504d5a31946ce75e22554cc34203d8e5ff3ca f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice 1635896931 -0500 commit: removing secret from foo package diff --git a/testdata/repos/staged/dotGit/logs/refs/heads/main b/testdata/repos/staged/dotGit/logs/refs/heads/main new file mode 100644 index 00000000..c4bd6cb6 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/heads/main @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice 1635896329 -0500 clone: from github.com:gitleaks/test.git +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635896648 -0500 pull origin main: Fast-forward +2e1db472eeba53f06c4026ae4566ea022e36598e bf3f24164d7256b4021575cbdb2f97b98e6f057e Rafael Figueiredo 1679239434 -0300 commit: add .gitleaksignore file diff --git a/testdata/repos/staged/dotGit/logs/refs/heads/remove-secrets b/testdata/repos/staged/dotGit/logs/refs/heads/remove-secrets new file mode 100644 index 00000000..58344a34 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/heads/remove-secrets @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice 1635896362 -0500 branch: Created from HEAD +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 906335481df9a4b48906c90318b4fac76b67fe73 Zach Rice 1635896426 -0500 commit: load token via env var +906335481df9a4b48906c90318b4fac76b67fe73 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice 1635896518 -0500 commit: add api package diff --git a/testdata/repos/staged/dotGit/logs/refs/remotes/origin/HEAD b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/HEAD new file mode 100644 index 00000000..a2076e59 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 Zach Rice 1635896329 -0500 clone: from github.com:gitleaks/test.git diff --git a/testdata/repos/staged/dotGit/logs/refs/remotes/origin/api-pkg b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/api-pkg new file mode 100644 index 00000000..9c8e059c --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/api-pkg @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 a122b33c6bad3ee54724f52f2caad385ab1982ab Zach Rice 1635896552 -0500 update by push diff --git a/testdata/repos/staged/dotGit/logs/refs/remotes/origin/foo b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/foo new file mode 100644 index 00000000..f6aed264 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/foo @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 f1b58b97808f8e744f6a23c693859df5b5968901 Zach Rice 1635896935 -0500 update by push diff --git a/testdata/repos/staged/dotGit/logs/refs/remotes/origin/main b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/main new file mode 100644 index 00000000..530a7894 --- /dev/null +++ b/testdata/repos/staged/dotGit/logs/refs/remotes/origin/main @@ -0,0 +1 @@ +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 2e1db472eeba53f06c4026ae4566ea022e36598e Zach Rice 1635896648 -0500 pull origin main: fast-forward diff --git a/testdata/repos/staged/dotGit/objects/02/d85657604c34e7b7fbb324a0c6c8b13c2c3760 b/testdata/repos/staged/dotGit/objects/02/d85657604c34e7b7fbb324a0c6c8b13c2c3760 new file mode 100644 index 00000000..dab89999 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/testdata/repos/staged/dotGit/objects/15/2888a42422b2ff5868b8d003d626120a9cb738 b/testdata/repos/staged/dotGit/objects/15/2888a42422b2ff5868b8d003d626120a9cb738 new file mode 100644 index 00000000..f9ada072 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/15/2888a42422b2ff5868b8d003d626120a9cb738 differ diff --git a/testdata/repos/staged/dotGit/objects/2e/1db472eeba53f06c4026ae4566ea022e36598e b/testdata/repos/staged/dotGit/objects/2e/1db472eeba53f06c4026ae4566ea022e36598e new file mode 100644 index 00000000..5dd33dfc Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/2e/1db472eeba53f06c4026ae4566ea022e36598e differ diff --git a/testdata/repos/staged/dotGit/objects/46/18d7e4512b6b0b1dab85cf846d9f43474ec8be b/testdata/repos/staged/dotGit/objects/46/18d7e4512b6b0b1dab85cf846d9f43474ec8be new file mode 100644 index 00000000..92ce09d2 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/46/18d7e4512b6b0b1dab85cf846d9f43474ec8be differ diff --git a/testdata/repos/staged/dotGit/objects/49/1504d5a31946ce75e22554cc34203d8e5ff3ca b/testdata/repos/staged/dotGit/objects/49/1504d5a31946ce75e22554cc34203d8e5ff3ca new file mode 100644 index 00000000..754d7397 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/49/1504d5a31946ce75e22554cc34203d8e5ff3ca differ diff --git a/testdata/repos/staged/dotGit/objects/5c/547e4215d9594c3935bdfefdf4f500016a4112 b/testdata/repos/staged/dotGit/objects/5c/547e4215d9594c3935bdfefdf4f500016a4112 new file mode 100644 index 00000000..5bddb82e Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/5c/547e4215d9594c3935bdfefdf4f500016a4112 differ diff --git a/testdata/repos/staged/dotGit/objects/65/83d6db4a57bbeda62d50fc91649036d499418d b/testdata/repos/staged/dotGit/objects/65/83d6db4a57bbeda62d50fc91649036d499418d new file mode 100644 index 00000000..b6fec1e0 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/65/83d6db4a57bbeda62d50fc91649036d499418d differ diff --git a/testdata/repos/staged/dotGit/objects/66/bc70d0c0bfbb6468b3f90c3f1e9f2ddba02b43 b/testdata/repos/staged/dotGit/objects/66/bc70d0c0bfbb6468b3f90c3f1e9f2ddba02b43 new file mode 100644 index 00000000..f6622df7 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/66/bc70d0c0bfbb6468b3f90c3f1e9f2ddba02b43 differ diff --git a/testdata/repos/staged/dotGit/objects/78/9ba677976d5db481de55c799d67acbf8e3f16a b/testdata/repos/staged/dotGit/objects/78/9ba677976d5db481de55c799d67acbf8e3f16a new file mode 100644 index 00000000..93acde0f Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/78/9ba677976d5db481de55c799d67acbf8e3f16a differ diff --git a/testdata/repos/staged/dotGit/objects/90/6335481df9a4b48906c90318b4fac76b67fe73 b/testdata/repos/staged/dotGit/objects/90/6335481df9a4b48906c90318b4fac76b67fe73 new file mode 100644 index 00000000..ce4a269d --- /dev/null +++ b/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œ \ No newline at end of file diff --git a/testdata/repos/staged/dotGit/objects/9a/932e37eaa9fb64b09e47e5e859c9b2c8cb47ad b/testdata/repos/staged/dotGit/objects/9a/932e37eaa9fb64b09e47e5e859c9b2c8cb47ad new file mode 100644 index 00000000..5e51e39d Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/9a/932e37eaa9fb64b09e47e5e859c9b2c8cb47ad differ diff --git a/testdata/repos/staged/dotGit/objects/a1/22b33c6bad3ee54724f52f2caad385ab1982ab b/testdata/repos/staged/dotGit/objects/a1/22b33c6bad3ee54724f52f2caad385ab1982ab new file mode 100644 index 00000000..fbcf357c Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/a1/22b33c6bad3ee54724f52f2caad385ab1982ab differ diff --git a/testdata/repos/staged/dotGit/objects/a5/caae6d742e49a33982f1fdc608ce861ea59be5 b/testdata/repos/staged/dotGit/objects/a5/caae6d742e49a33982f1fdc608ce861ea59be5 new file mode 100644 index 00000000..8be258a3 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/a5/caae6d742e49a33982f1fdc608ce861ea59be5 differ diff --git a/testdata/repos/staged/dotGit/objects/a9/aa0c942dcef669a94f207a77426106b25efd1a b/testdata/repos/staged/dotGit/objects/a9/aa0c942dcef669a94f207a77426106b25efd1a new file mode 100644 index 00000000..9221b3c0 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/a9/aa0c942dcef669a94f207a77426106b25efd1a differ diff --git a/testdata/repos/staged/dotGit/objects/b1/6d768dd595a59f947abe087901183d219d7e54 b/testdata/repos/staged/dotGit/objects/b1/6d768dd595a59f947abe087901183d219d7e54 new file mode 100644 index 00000000..6ba6deaf Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/b1/6d768dd595a59f947abe087901183d219d7e54 differ diff --git a/testdata/repos/staged/dotGit/objects/bc/f47ef84f29bb7ed6e653d61fccd30d0ecce886 b/testdata/repos/staged/dotGit/objects/bc/f47ef84f29bb7ed6e653d61fccd30d0ecce886 new file mode 100644 index 00000000..ec618b7a Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/bc/f47ef84f29bb7ed6e653d61fccd30d0ecce886 differ diff --git a/testdata/repos/staged/dotGit/objects/bf/3f24164d7256b4021575cbdb2f97b98e6f057e b/testdata/repos/staged/dotGit/objects/bf/3f24164d7256b4021575cbdb2f97b98e6f057e new file mode 100644 index 00000000..897417b6 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/testdata/repos/staged/dotGit/objects/d8/32479114dc6be7207edc7c37ce91dd11b93161 b/testdata/repos/staged/dotGit/objects/d8/32479114dc6be7207edc7c37ce91dd11b93161 new file mode 100644 index 00000000..0bd9a371 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/d8/32479114dc6be7207edc7c37ce91dd11b93161 differ diff --git a/testdata/repos/staged/dotGit/objects/da/2622b4d97e32c5801511244b809144b6b3ea78 b/testdata/repos/staged/dotGit/objects/da/2622b4d97e32c5801511244b809144b6b3ea78 new file mode 100644 index 00000000..d4a8c3de Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/da/2622b4d97e32c5801511244b809144b6b3ea78 differ diff --git a/testdata/repos/staged/dotGit/objects/e5/c0849a65c586eab87dcfc31fec74f0fd7c62cb b/testdata/repos/staged/dotGit/objects/e5/c0849a65c586eab87dcfc31fec74f0fd7c62cb new file mode 100644 index 00000000..53b83ef0 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/e5/c0849a65c586eab87dcfc31fec74f0fd7c62cb differ diff --git a/testdata/repos/staged/dotGit/objects/f1/b58b97808f8e744f6a23c693859df5b5968901 b/testdata/repos/staged/dotGit/objects/f1/b58b97808f8e744f6a23c693859df5b5968901 new file mode 100644 index 00000000..a7bf9018 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/f1/b58b97808f8e744f6a23c693859df5b5968901 differ diff --git a/testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.idx b/testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.idx new file mode 100644 index 00000000..3cdb2bd0 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.idx differ diff --git a/testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.pack b/testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.pack new file mode 100644 index 00000000..975d3711 Binary files /dev/null and b/testdata/repos/staged/dotGit/objects/pack/pack-2cdc2976b84768d0829c75cc8d8fc4d849be62cd.pack differ diff --git a/testdata/repos/staged/dotGit/packed-refs b/testdata/repos/staged/dotGit/packed-refs new file mode 100644 index 00000000..859b8c5a --- /dev/null +++ b/testdata/repos/staged/dotGit/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +1b6da43b82b22e4eaa10bcf8ee591e91abbfc587 refs/remotes/origin/main diff --git a/testdata/repos/staged/dotGit/refs/heads/api-pkg b/testdata/repos/staged/dotGit/refs/heads/api-pkg new file mode 100644 index 00000000..31b6c789 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/heads/api-pkg @@ -0,0 +1 @@ +a122b33c6bad3ee54724f52f2caad385ab1982ab diff --git a/testdata/repos/staged/dotGit/refs/heads/foo b/testdata/repos/staged/dotGit/refs/heads/foo new file mode 100644 index 00000000..57d58484 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/heads/foo @@ -0,0 +1 @@ +f1b58b97808f8e744f6a23c693859df5b5968901 diff --git a/testdata/repos/staged/dotGit/refs/heads/main b/testdata/repos/staged/dotGit/refs/heads/main new file mode 100644 index 00000000..a06d4d30 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/heads/main @@ -0,0 +1 @@ +bf3f24164d7256b4021575cbdb2f97b98e6f057e diff --git a/testdata/repos/staged/dotGit/refs/heads/remove-secrets b/testdata/repos/staged/dotGit/refs/heads/remove-secrets new file mode 100644 index 00000000..31b6c789 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/heads/remove-secrets @@ -0,0 +1 @@ +a122b33c6bad3ee54724f52f2caad385ab1982ab diff --git a/testdata/repos/staged/dotGit/refs/remotes/origin/HEAD b/testdata/repos/staged/dotGit/refs/remotes/origin/HEAD new file mode 100644 index 00000000..4b0a8759 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/remotes/origin/HEAD @@ -0,0 +1 @@ +ref: refs/remotes/origin/main diff --git a/testdata/repos/staged/dotGit/refs/remotes/origin/api-pkg b/testdata/repos/staged/dotGit/refs/remotes/origin/api-pkg new file mode 100644 index 00000000..31b6c789 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/remotes/origin/api-pkg @@ -0,0 +1 @@ +a122b33c6bad3ee54724f52f2caad385ab1982ab diff --git a/testdata/repos/staged/dotGit/refs/remotes/origin/foo b/testdata/repos/staged/dotGit/refs/remotes/origin/foo new file mode 100644 index 00000000..57d58484 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/remotes/origin/foo @@ -0,0 +1 @@ +f1b58b97808f8e744f6a23c693859df5b5968901 diff --git a/testdata/repos/staged/dotGit/refs/remotes/origin/main b/testdata/repos/staged/dotGit/refs/remotes/origin/main new file mode 100644 index 00000000..98f12e92 --- /dev/null +++ b/testdata/repos/staged/dotGit/refs/remotes/origin/main @@ -0,0 +1 @@ +2e1db472eeba53f06c4026ae4566ea022e36598e diff --git a/testdata/repos/staged/main.go b/testdata/repos/staged/main.go new file mode 100644 index 00000000..9a932e37 --- /dev/null +++ b/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) +}