Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
feat(git): scan commit metadata (#2754)
Richard Gomez11e5febeee7a
diff --git a/pkg/gitparse/gitparse.go b/pkg/gitparse/gitparse.goindex 94d3fb80f..e1db17f64 100644--- a/pkg/gitparse/gitparse.go+++ b/pkg/gitparse/gitparse.go@@ -22,7 +22,7 @@ import (const (// defaultDateFormat is the standard date format for git.- defaultDateFormat = "Mon Jan 02 15:04:05 2006 -0700"+ defaultDateFormat = "Mon Jan 2 15:04:05 2006 -0700"// defaultMaxDiffSize is the maximum size for a diff. Larger diffs will be cut off.defaultMaxDiffSize = 2 * 1024 * 1024 * 1024 // 2GB@@ -108,11 +108,12 @@ func (d *Diff) finalize() error { return d.contentWriter.CloseForWriting() }// Commit contains commit header info and diffs.type Commit struct {- Hash string- Author string- Date time.Time- Message strings.Builder- Size int // in bytes+ Hash string+ Author string+ Committer string+ Date time.Time+ Message strings.Builder+ Size int // in byteshasDiffs bool}@@ -133,10 +134,15 @@ const (CommitLineMergeLineAuthorLine- DateLine+ AuthorDateLine+ CommitterLine+ CommitterDateLineMessageStartLineMessageLineMessageEndLine+ NotesStartLine+ NotesLine+ NotesEndLineDiffLineModeLineIndexLine@@ -154,10 +160,15 @@ func (state ParseState) String() string {"CommitLine","MergeLine","AuthorLine",- "DateLine",+ "AuthorDateLine",+ "CommitterLine",+ "CommitterDateLine","MessageStartLine","MessageLine","MessageEndLine",+ "NotesStartLine",+ "NotesLine",+ "NotesEndLine","DiffLine","ModeLine","IndexLine",@@ -211,7 +222,15 @@ func NewParser(options ...Option) *Parser {// RepoPath parses the output of the `git log` command for the `source` path.// The Diff chan will return diffs in the order they are parsed from the log.func (c *Parser) RepoPath(ctx context.Context, source string, head string, abbreviatedLog bool, excludedGlobs []string, isBare bool) (chan *Diff, error) {- args := []string{"-C", source, "log", "-p", "--full-history", "--date=format:%a %b %d %H:%M:%S %Y %z"}+ args := []string{+ "-C", source,+ "log",+ "--patch", // https://git-scm.com/docs/git-log#Documentation/git-log.txt---patch+ "--full-history",+ "--date=format:%a %b %d %H:%M:%S %Y %z",+ "--pretty=fuller", // https://git-scm.com/docs/git-log#_pretty_formats+ "--notes", // https://git-scm.com/docs/git-log#Documentation/git-log.txt---notesltrefgt+ }if abbreviatedLog {args = append(args, "--diff-filter=AM")}@@ -375,16 +394,23 @@ func (c *Parser) FromReader(ctx context.Context, stdOut io.Reader, diffChan chanlatestState = MergeLinecase isAuthorLine(isStaged, latestState, line):latestState = AuthorLine- currentCommit.Author = strings.TrimRight(string(line[8:]), "\n")-- case isDateLine(isStaged, latestState, line):- latestState = DateLine+ currentCommit.Author = strings.TrimSpace(string(line[8:]))+ case isAuthorDateLine(isStaged, latestState, line):+ latestState = AuthorDateLine- date, err := time.Parse(c.dateFormat, strings.TrimSpace(string(line[6:])))+ date, err := time.Parse(c.dateFormat, strings.TrimSpace(string(line[12:])))if err != nil {- ctx.Logger().V(2).Info("Could not parse date from git stream.", "error", err)+ ctx.Logger().Error(err, "failed to parse commit date", "commit", currentCommit.Hash, "latestState", latestState.String())+ latestState = ParseFailure+ continue}currentCommit.Date = date+ case isCommitterLine(isStaged, latestState, line):+ latestState = CommitterLine+ currentCommit.Committer = strings.TrimSpace(string(line[8:]))+ case isCommitterDateLine(isStaged, latestState, line):+ latestState = CommitterDateLine+ // NoOpcase isMessageStartLine(isStaged, latestState, line):latestState = MessageStartLine// NoOp@@ -395,6 +421,17 @@ func (c *Parser) FromReader(ctx context.Context, stdOut io.Reader, diffChan chancase isMessageEndLine(isStaged, latestState, line):latestState = MessageEndLine// NoOp+ case isNotesStartLine(isStaged, latestState, line):+ latestState = NotesStartLine++ currentCommit.Message.WriteString("\n")+ currentCommit.Message.Write(line)+ case isNotesLine(isStaged, latestState, line):+ latestState = NotesLine+ currentCommit.Message.Write(line[4:]) // Notes are indented by 4 spaces.+ case isNotesEndLine(isStaged, latestState, line):+ latestState = NotesEndLine+ // NoOpcase isDiffLine(isStaged, latestState, line):latestState = DiffLine@@ -579,20 +616,42 @@ func isAuthorLine(isStaged bool, latestState ParseState, line []byte) bool {return false}-// Date: Tue Aug 10 15:20:40 2021 +0100-func isDateLine(isStaged bool, latestState ParseState, line []byte) bool {+// AuthorDate: Tue Aug 10 15:20:40 2021 +0100+func isAuthorDateLine(isStaged bool, latestState ParseState, line []byte) bool {if isStaged || latestState != AuthorLine {return false}- if len(line) > 7 && bytes.Equal(line[:5], []byte("Date:")) {+ if len(line) > 10 && bytes.Equal(line[:11], []byte("AuthorDate:")) {+ return true+ }+ return false+}++// Commit: Bill Rich <[email protected]>+func isCommitterLine(isStaged bool, latestState ParseState, line []byte) bool {+ if isStaged || latestState != AuthorDateLine {+ return false+ }+ if len(line) > 8 && bytes.Equal(line[:7], []byte("Commit:")) {return true}return false}-// Line directly after Date with only a newline.+// CommitDate: Wed Apr 17 19:59:28 2024 -0400+func isCommitterDateLine(isStaged bool, latestState ParseState, line []byte) bool {+ if isStaged || latestState != CommitterLine {+ return false+ }+ if len(line) > 10 && bytes.Equal(line[:11], []byte("CommitDate:")) {+ return true+ }+ return false+}++// Line directly after CommitterDate with only a newline.func isMessageStartLine(isStaged bool, latestState ParseState, line []byte) bool {- if isStaged || latestState != DateLine {+ if isStaged || latestState != CommitterDateLine {return false}// TODO: Improve the implementation of this and isMessageEndLine@@ -624,15 +683,51 @@ func isMessageEndLine(isStaged bool, latestState ParseState, line []byte) bool {return false}+// `Notes:` or `Notes (context):`+// See https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/+func isNotesStartLine(isStaged bool, latestState ParseState, line []byte) bool {+ if isStaged || latestState != MessageEndLine {+ return false+ }+ if len(line) > 5 && bytes.Equal(line[:5], []byte("Notes")) {+ return true+ }+ return false+}++// Line after NotesStartLine that starts with 4 spaces+func isNotesLine(isStaged bool, latestState ParseState, line []byte) bool {+ if isStaged || !(latestState == NotesStartLine || latestState == NotesLine) {+ return false+ }+ if len(line) > 4 && bytes.Equal(line[:4], []byte(" ")) {+ return true+ }+ return false+}++// Line directly after NotesLine with only a newline.+func isNotesEndLine(isStaged bool, latestState ParseState, line []byte) bool {+ if isStaged || latestState != NotesLine {+ return false+ }+ if len(strings.TrimRight(string(line[:]), "\r\n")) == 0 {+ return true+ }+ return false+}+// diff --git a/internal/addrs/move_endpoint_module.go b/internal/addrs/move_endpoint_module.gofunc isDiffLine(isStaged bool, latestState ParseState, line []byte) bool {if !(latestState == MessageStartLine || // Empty commit messages can go from MessageStart->DifflatestState == MessageEndLine ||+ latestState == NotesEndLine ||latestState == BinaryFileLine ||+ latestState == ModeLine ||latestState == IndexLine ||latestState == HunkContentLine ||latestState == ParseFailure) {- if latestState == Initial && !isStaged {+ if !(isStaged && latestState == Initial) {return false}}diff --git a/pkg/gitparse/gitparse_test.go b/pkg/gitparse/gitparse_test.goindex 3628f4741..f5ca0d579 100644--- a/pkg/gitparse/gitparse_test.go+++ b/pkg/gitparse/gitparse_test.go@@ -78,7 +78,7 @@ func TestLineChecksWithStaged(t *testing.T) {},fails: []testCaseLine{{- DateLine,+ CommitterDateLine,[]byte(" Merge pull request #34511 from cescoffier/duplicated-context-doc"),},{@@ -111,16 +111,16 @@ func TestLineChecksWithStaged(t *testing.T) {},function: isAuthorLine,},- "dateLine": {+ "authorDateLine": {passes: []testCaseLine{{AuthorLine,- []byte("Date: Tue Jan 18 16:59:18 2022 -0800"),+ []byte("AuthorDate: Tue Jan 18 16:59:18 2022 -0800"),},},fails: []testCaseLine{{- DateLine,+ AuthorDateLine,[]byte(""),},{@@ -128,12 +128,54 @@ func TestLineChecksWithStaged(t *testing.T) {[]byte("notcorrect"),},},- function: isDateLine,+ function: isAuthorDateLine,+ },+ "committerLine": {+ passes: []testCaseLine{+ {+ AuthorDateLine,+ []byte("Commit: Zachary Rice <[email protected]>"),+ },+ {+ AuthorDateLine,+ []byte("Commit: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>"),+ },+ },+ fails: []testCaseLine{+ {+ CommitLine,+ []byte("Date: Tue Jun 20 13:55:31 2023 -0500"),+ },+ {+ AuthorLine,+ []byte("Author: Bill Rich <[email protected]>"),+ },+ },+ function: isCommitterLine,+ },+ "committerDateLine": {+ passes: []testCaseLine{+ {+ CommitterLine,+ []byte("CommitDate: Tue Jan 18 16:59:18 2022 -0800"),+ },+ },+ fails: []testCaseLine{+ {+ CommitterDateLine,+ []byte(""),+ },+ {+ CommitterLine,+ []byte("notcorrect"),+ },+ },+ function: isCommitterDateLine,},"messageStartLine": {passes: []testCaseLine{{- DateLine,+ CommitterDateLine,[]byte(""),},},@@ -143,7 +185,7 @@ func TestLineChecksWithStaged(t *testing.T) {[]byte("Date: Tue Jun 20 13:21:19 2023 -0700"),},{- DateLine,+ CommitterDateLine,[]byte("notcorrect"),},},@@ -166,7 +208,7 @@ func TestLineChecksWithStaged(t *testing.T) {[]byte("Date: Tue Jun 20 13:21:19 2023 -0700"),},{- DateLine,+ CommitterDateLine,[]byte("notcorrect"),},},@@ -191,6 +233,67 @@ func TestLineChecksWithStaged(t *testing.T) {},function: isMessageEndLine,},+ "notesStartLine": {+ passes: []testCaseLine{+ {+ MessageEndLine,+ []byte("Notes:"),+ },+ {+ MessageEndLine,+ []byte("Notes (review):"),+ },+ },+ fails: []testCaseLine{+ {+ MessageStartLine,+ []byte(""),+ },+ {+ MessageEndLine,+ []byte("notcorrect"),+ },+ },+ function: isNotesStartLine,+ },+ "notesLine": {+ passes: []testCaseLine{+ {+ NotesStartLine,+ []byte(" Submitted-by: Random J Developer <[email protected]>"),+ },+ },+ fails: []testCaseLine{+ {+ MessageEndLine,+ []byte(""),+ },+ {+ MessageEndLine,+ []byte("notcorrect"),+ },+ },+ function: isNotesLine,+ },+ "notesEndLine": {+ passes: []testCaseLine{+ {+ NotesLine,+ []byte("\n"),+ },+ },+ fails: []testCaseLine{+ {+ MessageEndLine,+ []byte("\n"),+ },+ {+ NotesLine,+ []byte("notcorrect"),+ },+ },+ function: isNotesEndLine,+ },"diffLine": {passes: []testCaseLine{{@@ -201,6 +304,10 @@ func TestLineChecksWithStaged(t *testing.T) {MessageEndLine,[]byte("diff --git a/ Lunch and Learn - HCDiag.pdf b/ Lunch and Learn - HCDiag.pdf"),},+ {+ NotesEndLine,+ []byte("diff --git \"a/one.txt\" \"b/one.txt\""),+ },{BinaryFileLine,[]byte("diff --git a/pkg/decoders/utf16_test.go b/pkg/decoders/utf16_test.go"),@@ -209,16 +316,24 @@ func TestLineChecksWithStaged(t *testing.T) {HunkContentLine,[]byte("diff --git a/pkg/decoders/utf8.go b/pkg/decoders/utf8.go"),},+ {+ ModeLine,+ []byte("diff --git a/pkg/decoders/utf8.go b/pkg/decoders/utf8.go"),+ },},fails: []testCaseLine{{- DateLine,+ CommitterDateLine,[]byte(" Make trace error message so newlines aren't escaped (#1396)"),},{MessageLine,[]byte("notcorrect"),},+ {+ NotesLine,+ []byte("diff --git a/pkg/decoders/utf8.go b/pkg/decoders/utf8.go"),+ },},function: isDiffLine,},@@ -931,30 +1046,33 @@ func TestCommitParseFailureRecovery(t *testing.T) {PathB: ".travis.yml",LineStart: 1,Commit: &Commit{- Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",- Author: "Stephen <[email protected]>",- Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),- Message: newStringBuilderValue("Add travis testing\n"),+ Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",+ Author: "Stephen <[email protected]>",+ Committer: "Stephen <[email protected]>",+ Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),+ Message: newStringBuilderValue("Add travis testing\n"),},contentWriter: newBufferWithContent([]byte("language: python\npython:\n - \"2.6\"\n - \"2.7\"\n - \"3.2\"\n - \"3.3\"\n - \"3.4\"\n - \"3.5\"\n - \"3.5-dev\" # 3.5 development branch\n - \"3.6\"\n - \"3.6-dev\" # 3.6 development branch\n - \"3.7-dev\" # 3.7 development branch\n - \"nightly\"\n")),IsBinary: false,},{Commit: &Commit{- Hash: "3d76a97faad96e0f326afb61c232b9c2a18dca35",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:03:54 2023 -0400"),- Message: strings.Builder{},+ Hash: "3d76a97faad96e0f326afb61c232b9c2a18dca35",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:03:54 2023 -0400"),+ Message: strings.Builder{},},},{PathB: "tzu",LineStart: 11,Commit: &Commit{- Hash: "7bd16429f1f708746dabf970e54b05d2b4734997",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:10:49 2023 -0400"),- Message: newStringBuilderValue("Change file\n"),+ Hash: "7bd16429f1f708746dabf970e54b05d2b4734997",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:10:49 2023 -0400"),+ Message: newStringBuilderValue("Change file\n"),},contentWriter: newBufferWithContent([]byte("\n\n\n\nSource: https://www.gnu.org/software/diffutils/manual/diffutils.html#An-Example-of-Unified-Format\n")),IsBinary: false,@@ -982,30 +1100,33 @@ func TestCommitParseFailureRecoveryBufferedFileWriter(t *testing.T) {PathB: ".travis.yml",LineStart: 1,Commit: &Commit{- Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",- Author: "Stephen <[email protected]>",- Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),- Message: newStringBuilderValue("Add travis testing\n"),+ Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",+ Author: "Stephen <[email protected]>",+ Committer: "Stephen <[email protected]>",+ Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),+ Message: newStringBuilderValue("Add travis testing\n"),},contentWriter: newBufferedFileWriterWithContent([]byte("language: python\npython:\n - \"2.6\"\n - \"2.7\"\n - \"3.2\"\n - \"3.3\"\n - \"3.4\"\n - \"3.5\"\n - \"3.5-dev\" # 3.5 development branch\n - \"3.6\"\n - \"3.6-dev\" # 3.6 development branch\n - \"3.7-dev\" # 3.7 development branch\n - \"nightly\"\n")),IsBinary: false,},{Commit: &Commit{- Hash: "3d76a97faad96e0f326afb61c232b9c2a18dca35",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:03:54 2023 -0400"),- Message: strings.Builder{},+ Hash: "3d76a97faad96e0f326afb61c232b9c2a18dca35",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:03:54 2023 -0400"),+ Message: strings.Builder{},},},{PathB: "tzu",LineStart: 11,Commit: &Commit{- Hash: "7bd16429f1f708746dabf970e54b05d2b4734997",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:10:49 2023 -0400"),- Message: newStringBuilderValue("Change file\n"),+ Hash: "7bd16429f1f708746dabf970e54b05d2b4734997",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:10:49 2023 -0400"),+ Message: newStringBuilderValue("Change file\n"),},contentWriter: newBufferedFileWriterWithContent([]byte("\n\n\n\nSource: https://www.gnu.org/software/diffutils/manual/diffutils.html#An-Example-of-Unified-Format\n")),IsBinary: false,@@ -1034,7 +1155,9 @@ func TestCommitParseFailureRecoveryBufferedFileWriter(t *testing.T) {const recoverableCommits = `commit df393b4125c2aa217211b2429b8963d0cefcee27Author: Stephen <[email protected]>-Date: Wed Dec 06 14:44:41 2017 -0800+AuthorDate: Wed Dec 06 14:44:41 2017 -0800+Commit: Stephen <[email protected]>+CommitDate: Wed Dec 06 14:44:41 2017 -0800Add travis testing@@ -1074,7 +1197,9 @@ index 00000000..e69de29bcommit 3d76a97faad96e0f326afb61c232b9c2a18dca35 (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:03:54 2023 -0400+AuthorDate: Tue Jul 11 18:03:54 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:03:54 2023 -0400diff --git a/sample.txt b/sample.txtnew file mode 100644@@ -1086,7 +1211,9 @@ index 0000000..af5626bcommit 7bd16429f1f708746dabf970e54b05d2b4734997 (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:10:49 2023 -0400+AuthorDate: Tue Jul 11 18:10:49 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:10:49 2023 -0400Change file@@ -1360,7 +1487,9 @@ func TestMaxCommitSize(t *testing.T) {const commitLog = `commit e50b135fd29e91b2fbb25923797f5ecffe59f359Author: lionzxy <[email protected]>-Date: Wed Mar 1 18:20:04 2017 +0300+AuthorDate: Wed Mar 1 18:20:04 2017 +0300+Commit: lionzxy <[email protected]>+CommitDate: Wed Mar 1 18:20:04 2017 +0300Все работает, но он не принимает :(@@ -1382,10 +1511,15 @@ index 85bfb17..89b08b5 100644commit fd6e99e7a80199b76a694603be57c5ade1de18e7Author: Jaliborc <[email protected]>-Date: Mon Apr 25 16:28:06 2011 +0100+AuthorDate: Mon Apr 25 16:28:06 2011 +0100+Commit: Jaliborc <[email protected]>+CommitDate: Mon Apr 25 16:28:06 2011 +0100Added Unusable coloring+Notes:+ Message-Id: <[email protected]>+diff --git a/components/item.lua b/components/item.luaindex fc74534..f8d7d50 100755--- a/components/item.lua@@ -1420,17 +1554,23 @@ new file mode 160000commit 4727ffb7ad6dc5130bf4b4dd166e00705abdd018 (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 22:26:11 2023 -0400+AuthorDate: Tue Jul 11 22:26:11 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 22:26:11 2023 -0400commit c904e0f5cd9f30ae520c66bd5f70806219fe7ca2 (HEAD -> master)Author: John Smith <[email protected]>-Date: Mon Jul 10 10:17:11 2023 -0400+AuthorDate: Mon Jul 10 10:17:11 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Mon Jul 10 10:17:11 2023 -0400Empty Commitcommit 3d76a97faad96e0f326afb61c232b9c2a18dca35 (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:03:54 2023 -0400+AuthorDate: Tue Jul 11 18:03:54 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:03:54 2023 -0400diff --git a/sample.txt b/sample.txtnew file mode 100644@@ -1442,7 +1582,9 @@ index 0000000..af5626bcommit df393b4125c2aa217211b2429b8963d0cefcee27Author: Stephen <[email protected]>-Date: Wed Dec 06 14:44:41 2017 -0800+AuthorDate: Wed Dec 06 14:44:41 2017 -0800+Commit: Stephen <[email protected]>+CommitDate: Wed Dec 06 14:44:41 2017 -0800Add travis testing@@ -1482,7 +1624,9 @@ index 00000000..e69de29bcommit 4218c39d99b5f30153f62471c1be1c1596f0a4d4Author: Dustin Decker <[email protected]>-Date: Thu Jan 13 12:02:24 2022 -0800+AuthorDate: Thu Jan 13 12:02:24 2022 -0800+Commit: Dustin Decker <[email protected]>+CommitDate: Thu Jan 13 12:02:24 2022 -0800Initial CLI w/ partially implemented Git source and demo detector (#1)@@ -1538,7 +1682,9 @@ index 00000000..7fb2f73ccommit 934cf5d255fd8e28b33f5a6ba64276caf0b284bf (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:43:22 2023 -0400+AuthorDate: Tue Jul 11 18:43:22 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:43:22 2023 -0400Test toFile/plusLine parsing@@ -1554,7 +1700,9 @@ index 0000000..451be67commit 2a5d703b02b52d65c65ee9f7928f158b919ab741Author: Sergey Beryozkin <[email protected]>-Date: Fri Jul 7 17:44:26 2023 +0100+AuthorDate: Fri Jul 7 17:44:26 2023 +0100+Commit: Sergey Beryozkin <[email protected]>+CommitDate: Fri Jul 7 17:44:26 2023 +0100Do not refresh OIDC session if the user is requesting logout@@ -1662,7 +1810,9 @@ index 51e1b9a932d..472c2743bc4 100644commit 2a057632d7f5fa3d1c77b9aa037263211c0e0290Author: rjtmahinay <[email protected]>-Date: Mon Jul 10 01:22:32 2023 +0800+AuthorDate: Mon Jul 10 01:22:32 2023 +0800+Commit: rjtmahinay <[email protected]>+CommitDate: Mon Jul 10 01:22:32 2023 +0800Add QuarkusApplication javadoc@@ -1680,7 +1830,9 @@ index 350685123d5..87d2220eb98 100644commit bca2d17491015ea1522f34517223b5a366aea73c (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:12:21 2023 -0400+AuthorDate: Tue Jul 11 18:12:21 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:12:21 2023 -0400Delete binary file@@ -1691,7 +1843,9 @@ Binary files a/trufflehog_3.42.0_linux_arm64.tar.gz and /dev/null differcommit afc6dc5d47f28366638da877ecb6b819c69e659bAuthor: John Smith <[email protected]>-Date: Mon Jul 10 12:21:33 2023 -0400+AuthorDate: Mon Jul 10 12:21:33 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Mon Jul 10 12:21:33 2023 -0400Change binary file@@ -1701,7 +1855,9 @@ Binary files a/trufflehog_3.42.0_linux_arm64.tar.gz and b/trufflehog_3.42.0_linucommit 638595917417c5c8a956937b28c5127719023363Author: John Smith <[email protected]>-Date: Mon Jul 10 12:20:35 2023 -0400+AuthorDate: Mon Jul 10 12:20:35 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Mon Jul 10 12:20:35 2023 -0400Add binary file@@ -1712,7 +1868,9 @@ Binary files /dev/null and b/trufflehog_3.42.0_linux_arm64.tar.gz differcommit ce0f5d1fe0272f180ccb660196f439c0c2f4ec8e (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:08:52 2023 -0400+AuthorDate: Tue Jul 11 18:08:52 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:08:52 2023 -0400Delete file@@ -1736,7 +1894,9 @@ index 635ef2c..0000000commit d606a729383371558473b70a6a7b1ca264b0d205Author: John Smith <[email protected]>-Date: Mon Jul 10 14:17:04 2023 -0400+AuthorDate: Mon Jul 10 14:17:04 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Mon Jul 10 14:17:04 2023 -0400Rename file@@ -1747,7 +1907,9 @@ rename to tzu.txtcommit 7bd16429f1f708746dabf970e54b05d2b4734997 (HEAD -> master)Author: John Smith <[email protected]>-Date: Tue Jul 11 18:10:49 2023 -0400+AuthorDate: Tue Jul 11 18:10:49 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Tue Jul 11 18:10:49 2023 -0400Change file@@ -1764,7 +1926,9 @@ index 5af88a8..c729cdb 100644commit c7062674c17192caa284615ab2fa9778c6602164 (HEAD -> master)Author: John Smith <[email protected]>-Date: Mon Jul 10 10:15:18 2023 -0400+AuthorDate: Mon Jul 10 10:15:18 2023 -0400+Commit: John Smith <[email protected]>+CommitDate: Mon Jul 10 10:15:18 2023 -0400Create files@@ -1824,10 +1988,11 @@ func expectedDiffs() []*Diff {PathB: "C++/1 \320\243\321\200\320\276\320\272/.idea/workspace.xml",LineStart: 29,Commit: &Commit{- Hash: "e50b135fd29e91b2fbb25923797f5ecffe59f359",- Author: "lionzxy <[email protected]>",- Date: newTime("Wed Mar 1 18:20:04 2017 +0300"),- Message: newStringBuilderValue("Все работает, но он не принимает :(\n"),+ Hash: "e50b135fd29e91b2fbb25923797f5ecffe59f359",+ Author: "lionzxy <[email protected]>",+ Committer: "lionzxy <[email protected]>",+ Date: newTime("Wed Mar 1 18:20:04 2017 +0300"),+ Message: newStringBuilderValue("Все работает, но он не принимает :(\n"),},contentWriter: newBufferWithContent([]byte("\n\n\n <state relative-caret-position=\"72\">\n <caret line=\"4\" column=\"0\" lean-forward=\"false\" selection-start-line=\"4\" selection-start-column=\"0\" selection-end-line=\"4\" selection-end-column=\"0\" />\n\n\n\n")),IsBinary: false,@@ -1836,10 +2001,11 @@ func expectedDiffs() []*Diff {PathB: "components/item.lua",LineStart: 9,Commit: &Commit{- Hash: "fd6e99e7a80199b76a694603be57c5ade1de18e7",- Author: "Jaliborc <[email protected]>",- Date: newTime("Mon Apr 25 16:28:06 2011 +0100"),- Message: newStringBuilderValue("Added Unusable coloring\n"),+ Hash: "fd6e99e7a80199b76a694603be57c5ade1de18e7",+ Author: "Jaliborc <[email protected]>",+ Committer: "Jaliborc <[email protected]>",+ Date: newTime("Mon Apr 25 16:28:06 2011 +0100"),+ Message: newStringBuilderValue("Added Unusable coloring\n\nNotes:\nMessage-Id: <[email protected]>\n"),},contentWriter: newBufferWithContent([]byte("\n\nlocal Unfit = LibStub('Unfit-1.0')\n\n\n")),IsBinary: false,@@ -1849,10 +2015,11 @@ func expectedDiffs() []*Diff {LineStart: 6,contentWriter: newBufferWithContent([]byte("\n\n <Script file=\"libs\\Unfit-1.0\\Unfit-1.0.lua\"/>\n\n\n\n")),Commit: &Commit{- Hash: "fd6e99e7a80199b76a694603be57c5ade1de18e7",- Author: "Jaliborc <[email protected]>",- Date: newTime("Mon Apr 25 16:28:06 2011 +0100"),- Message: newStringBuilderValue("Added Unusable coloring\n"),+ Hash: "fd6e99e7a80199b76a694603be57c5ade1de18e7",+ Author: "Jaliborc <[email protected]>",+ Committer: "Jaliborc <[email protected]>",+ Date: newTime("Mon Apr 25 16:28:06 2011 +0100"),+ Message: newStringBuilderValue("Added Unusable coloring\n\nNotes:\nMessage-Id: <[email protected]>\n"),},IsBinary: false,},@@ -1861,27 +2028,30 @@ func expectedDiffs() []*Diff {LineStart: 1,contentWriter: newBufferWithContent([]byte("Subproject commit 0000000000000000000000000000000000000000\n")),Commit: &Commit{- Hash: "fd6e99e7a80199b76a694603be57c5ade1de18e7",- Author: "Jaliborc <[email protected]>",- Date: newTime("Mon Apr 25 16:28:06 2011 +0100"),- Message: newStringBuilderValue("Added Unusable coloring\n"),+ Hash: "fd6e99e7a80199b76a694603be57c5ade1de18e7",+ Author: "Jaliborc <[email protected]>",+ Committer: "Jaliborc <[email protected]>",+ Date: newTime("Mon Apr 25 16:28:06 2011 +0100"),+ Message: newStringBuilderValue("Added Unusable coloring\n\nNotes:\nMessage-Id: <[email protected]>\n"),},IsBinary: false,},{Commit: &Commit{- Hash: "4727ffb7ad6dc5130bf4b4dd166e00705abdd018",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 22:26:11 2023 -0400"),- Message: strings.Builder{},+ Hash: "4727ffb7ad6dc5130bf4b4dd166e00705abdd018",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 22:26:11 2023 -0400"),+ Message: strings.Builder{},},},{Commit: &Commit{- Hash: "c904e0f5cd9f30ae520c66bd5f70806219fe7ca2",- Author: "John Smith <[email protected]>",- Date: newTime("Mon Jul 10 10:17:11 2023 -0400"),- Message: newStringBuilderValue("Empty Commit\n"),+ Hash: "c904e0f5cd9f30ae520c66bd5f70806219fe7ca2",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Mon Jul 10 10:17:11 2023 -0400"),+ Message: newStringBuilderValue("Empty Commit\n"),},},{@@ -1889,10 +2059,11 @@ func expectedDiffs() []*Diff {LineStart: 1,contentWriter: newBufferWithContent([]byte("Hello, world!\n")),Commit: &Commit{- Hash: "3d76a97faad96e0f326afb61c232b9c2a18dca35",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:03:54 2023 -0400"),- Message: strings.Builder{},+ Hash: "3d76a97faad96e0f326afb61c232b9c2a18dca35",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:03:54 2023 -0400"),+ Message: strings.Builder{},},IsBinary: false,},@@ -1901,10 +2072,11 @@ func expectedDiffs() []*Diff {LineStart: 1,contentWriter: newBufferWithContent([]byte("\n\n\n**/__pycache__/\n**/*.pyc\n")),Commit: &Commit{- Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",- Author: "Stephen <[email protected]>",- Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),- Message: newStringBuilderValue("Add travis testing\n"),+ Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",+ Author: "Stephen <[email protected]>",+ Committer: "Stephen <[email protected]>",+ Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),+ Message: newStringBuilderValue("Add travis testing\n"),},IsBinary: false,},@@ -1912,10 +2084,11 @@ func expectedDiffs() []*Diff {PathB: ".travis.yml",LineStart: 1,Commit: &Commit{- Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",- Author: "Stephen <[email protected]>",- Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),- Message: newStringBuilderValue("Add travis testing\n"),+ Hash: "df393b4125c2aa217211b2429b8963d0cefcee27",+ Author: "Stephen <[email protected]>",+ Committer: "Stephen <[email protected]>",+ Date: newTime("Wed Dec 06 14:44:41 2017 -0800"),+ Message: newStringBuilderValue("Add travis testing\n"),},contentWriter: newBufferWithContent([]byte(`language: pythonpython:@@ -1937,10 +2110,11 @@ python:PathB: "Makefile",LineStart: 1,Commit: &Commit{- Hash: "4218c39d99b5f30153f62471c1be1c1596f0a4d4",- Author: "Dustin Decker <[email protected]>",- Date: newTime("Thu Jan 13 12:02:24 2022 -0800"),- Message: newStringBuilderValue("Initial CLI w/ partially implemented Git source and demo detector (#1)\n"),+ Hash: "4218c39d99b5f30153f62471c1be1c1596f0a4d4",+ Author: "Dustin Decker <[email protected]>",+ Committer: "Dustin Decker <[email protected]>",+ Date: newTime("Thu Jan 13 12:02:24 2022 -0800"),+ Message: newStringBuilderValue("Initial CLI w/ partially implemented Git source and demo detector (#1)\n"),},contentWriter: newBufferWithContent([]byte(`PROTOS_IMAGE=us-docker.pkg.dev/thog-artifacts/public/go-ci-1.17-1@@ -1981,10 +2155,11 @@ protos:PathB: "plusLine.txt",LineStart: 1,Commit: &Commit{- Hash: "934cf5d255fd8e28b33f5a6ba64276caf0b284bf",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:43:22 2023 -0400"),- Message: newStringBuilderValue("Test toFile/plusLine parsing\n"),+ Hash: "934cf5d255fd8e28b33f5a6ba64276caf0b284bf",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:43:22 2023 -0400"),+ Message: newStringBuilderValue("Test toFile/plusLine parsing\n"),},contentWriter: newBufferWithContent([]byte("-- test\n++ test\n\n")),IsBinary: false,@@ -1993,10 +2168,11 @@ protos:PathB: "extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BackChannelLogoutTokenCache.java",LineStart: 45,Commit: &Commit{- Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",- Author: "Sergey Beryozkin <[email protected]>",- Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),- Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),+ Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",+ Author: "Sergey Beryozkin <[email protected]>",+ Committer: "Sergey Beryozkin <[email protected]>",+ Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),+ Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),},contentWriter: newBufferWithContent([]byte("\n\n public boolean containsTokenVerification(String token) {\n return cacheMap.containsKey(token);\n }\n\n\n\n\n")),IsBinary: false,@@ -2005,10 +2181,11 @@ protos:PathB: "extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java",LineStart: 1023,Commit: &Commit{- Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",- Author: "Sergey Beryozkin <[email protected]>",- Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),- Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),+ Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",+ Author: "Sergey Beryozkin <[email protected]>",+ Committer: "Sergey Beryozkin <[email protected]>",+ Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),+ Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),},contentWriter: newBufferWithContent([]byte("\n\n private boolean isRpInitiatedLogout(RoutingContext context, TenantConfigContext configContext) {\n\n\n")),IsBinary: false,@@ -2017,10 +2194,11 @@ protos:PathB: "extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java",LineStart: 1214,Commit: &Commit{- Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",- Author: "Sergey Beryozkin <[email protected]>",- Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),- Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),+ Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",+ Author: "Sergey Beryozkin <[email protected]>",+ Committer: "Sergey Beryozkin <[email protected]>",+ Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),+ Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),},contentWriter: newBufferWithContent([]byte("\n\n\n\n private class LogoutCall implements Function<SecurityIdentity, Uni<?>> {\n RoutingContext context;\n TenantConfigContext configContext;\n String idToken;\n\n LogoutCall(RoutingContext context, TenantConfigContext configContext, String idToken) {\n this.context = context;\n this.configContext = configContext;\n this.idToken = idToken;\n }\n\n @Override\n public Uni<Void> apply(SecurityIdentity identity) {\n if (isRpInitiatedLogout(context, configContext)) {\n LOG.debug(\"Performing an RP initiated logout\");\n fireEvent(SecurityEvent.Type.OIDC_LOGOUT_RP_INITIATED, identity);\n return buildLogoutRedirectUriUni(context, configContext, idToken);\n }\n if (isBackChannelLogoutPendingAndValid(configContext, identity)\n || isFrontChannelLogoutValid(context, configContext,\n identity)) {\n return removeSessionCookie(context, configContext.oidcConfig)\n .map(new Function<Void, Void>() {\n @Override\n public Void apply(Void t) {\n throw new LogoutException();\n }\n });\n\n }\n return VOID_UNI;\n }\n }\n\n")),IsBinary: false,@@ -2029,10 +2207,11 @@ protos:PathB: "integration-tests/oidc-wiremock/src/main/resources/application.properties",LineStart: 20,Commit: &Commit{- Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",- Author: "Sergey Beryozkin <[email protected]>",- Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),- Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),+ Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",+ Author: "Sergey Beryozkin <[email protected]>",+ Committer: "Sergey Beryozkin <[email protected]>",+ Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),+ Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),},contentWriter: newBufferWithContent([]byte("\n\n\nquarkus.oidc.code-flow.token.refresh-expired=true\nquarkus.oidc.code-flow.token.refresh-token-time-skew=5M\n\n\n")),IsBinary: false,@@ -2042,10 +2221,11 @@ protos:PathB: "integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java",LineStart: 6,Commit: &Commit{- Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",- Author: "Sergey Beryozkin <[email protected]>",- Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),- Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),+ Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",+ Author: "Sergey Beryozkin <[email protected]>",+ Committer: "Sergey Beryozkin <[email protected]>",+ Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),+ Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),},contentWriter: newBufferWithContent([]byte("\n\n\n\n\n\n")),IsBinary: false,@@ -2054,10 +2234,11 @@ protos:PathB: "integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java",LineStart: 76,Commit: &Commit{- Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",- Author: "Sergey Beryozkin <[email protected]>",- Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),- Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),+ Hash: "2a5d703b02b52d65c65ee9f7928f158b919ab741",+ Author: "Sergey Beryozkin <[email protected]>",+ Committer: "Sergey Beryozkin <[email protected]>",+ Date: newTime("Fri Jul 7 17:44:26 2023 +0100"),+ Message: newStringBuilderValue("Do not refresh OIDC session if the user is requesting logout\n"),},contentWriter: newBufferWithContent([]byte("\n\n // Logout\n\n\n\n")),IsBinary: false,@@ -2066,29 +2247,32 @@ protos:PathB: "core/runtime/src/main/java/io/quarkus/runtime/QuarkusApplication.java",LineStart: 3,Commit: &Commit{- Hash: "2a057632d7f5fa3d1c77b9aa037263211c0e0290",- Author: "rjtmahinay <[email protected]>",- Date: newTime("Mon Jul 10 01:22:32 2023 +0800"),- Message: newStringBuilderValue("Add QuarkusApplication javadoc\n\n* Fix #34463\n"),+ Hash: "2a057632d7f5fa3d1c77b9aa037263211c0e0290",+ Author: "rjtmahinay <[email protected]>",+ Committer: "rjtmahinay <[email protected]>",+ Date: newTime("Mon Jul 10 01:22:32 2023 +0800"),+ Message: newStringBuilderValue("Add QuarkusApplication javadoc\n\n* Fix #34463\n"),},contentWriter: newBufferWithContent([]byte("/**\n * This is usually used for command mode applications with a startup logic. The logic is executed inside\n * {@link QuarkusApplication#run} method before the main application exits.\n */\n")),IsBinary: false,},{Commit: &Commit{- Hash: "bca2d17491015ea1522f34517223b5a366aea73c",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:12:21 2023 -0400"),- Message: newStringBuilderValue("Delete binary file\n"),+ Hash: "bca2d17491015ea1522f34517223b5a366aea73c",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:12:21 2023 -0400"),+ Message: newStringBuilderValue("Delete binary file\n"),},},{PathB: "trufflehog_3.42.0_linux_arm64.tar.gz",Commit: &Commit{- Hash: "afc6dc5d47f28366638da877ecb6b819c69e659b",- Author: "John Smith <[email protected]>",- Date: newTime("Mon Jul 10 12:21:33 2023 -0400"),- Message: newStringBuilderValue("Change binary file\n"),+ Hash: "afc6dc5d47f28366638da877ecb6b819c69e659b",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Mon Jul 10 12:21:33 2023 -0400"),+ Message: newStringBuilderValue("Change binary file\n"),},contentWriter: newBufferWithContent([]byte("")),IsBinary: true,@@ -2096,38 +2280,42 @@ protos:{PathB: "trufflehog_3.42.0_linux_arm64.tar.gz",Commit: &Commit{- Hash: "638595917417c5c8a956937b28c5127719023363",- Author: "John Smith <[email protected]>",- Date: newTime("Mon Jul 10 12:20:35 2023 -0400"),- Message: newStringBuilderValue("Add binary file\n"),+ Hash: "638595917417c5c8a956937b28c5127719023363",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Mon Jul 10 12:20:35 2023 -0400"),+ Message: newStringBuilderValue("Add binary file\n"),},contentWriter: newBufferWithContent([]byte("")),IsBinary: true,},{Commit: &Commit{- Hash: "ce0f5d1fe0272f180ccb660196f439c0c2f4ec8e",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:08:52 2023 -0400"),- Message: newStringBuilderValue("Delete file\n"),+ Hash: "ce0f5d1fe0272f180ccb660196f439c0c2f4ec8e",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:08:52 2023 -0400"),+ Message: newStringBuilderValue("Delete file\n"),},},{Commit: &Commit{- Hash: "d606a729383371558473b70a6a7b1ca264b0d205",- Author: "John Smith <[email protected]>",- Date: newTime("Mon Jul 10 14:17:04 2023 -0400"),- Message: newStringBuilderValue("Rename file\n"),+ Hash: "d606a729383371558473b70a6a7b1ca264b0d205",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Mon Jul 10 14:17:04 2023 -0400"),+ Message: newStringBuilderValue("Rename file\n"),},},{PathB: "tzu",LineStart: 11,Commit: &Commit{- Hash: "7bd16429f1f708746dabf970e54b05d2b4734997",- Author: "John Smith <[email protected]>",- Date: newTime("Tue Jul 11 18:10:49 2023 -0400"),- Message: newStringBuilderValue("Change file\n"),+ Hash: "7bd16429f1f708746dabf970e54b05d2b4734997",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Tue Jul 11 18:10:49 2023 -0400"),+ Message: newStringBuilderValue("Change file\n"),},contentWriter: newBufferWithContent([]byte("\n\n\n\nSource: https://www.gnu.org/software/diffutils/manual/diffutils.html#An-Example-of-Unified-Format\n")),IsBinary: false,@@ -2136,10 +2324,11 @@ protos:PathB: "lao",LineStart: 1,Commit: &Commit{- Hash: "c7062674c17192caa284615ab2fa9778c6602164",- Author: "John Smith <[email protected]>",- Date: newTime("Mon Jul 10 10:15:18 2023 -0400"),- Message: newStringBuilderValue("Create files\n"),+ Hash: "c7062674c17192caa284615ab2fa9778c6602164",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Mon Jul 10 10:15:18 2023 -0400"),+ Message: newStringBuilderValue("Create files\n"),},contentWriter: newBufferWithContent([]byte("The Way that can be told of is not the eternal Way;\nThe name that can be named is not the eternal name.\nThe Nameless is the origin of Heaven and Earth;\nThe Named is the mother of all things.\nTherefore let there always be non-being,\n so we may see their subtlety,\nAnd let there always be being,\n so we may see their outcome.\nThe two are the same,\nBut after they are produced,\n they have different names.\n")),IsBinary: false,@@ -2148,10 +2337,11 @@ protos:PathB: "tzu",LineStart: 1,Commit: &Commit{- Hash: "c7062674c17192caa284615ab2fa9778c6602164",- Author: "John Smith <[email protected]>",- Date: newTime("Mon Jul 10 10:15:18 2023 -0400"),- Message: newStringBuilderValue("Create files\n"),+ Hash: "c7062674c17192caa284615ab2fa9778c6602164",+ Author: "John Smith <[email protected]>",+ Committer: "John Smith <[email protected]>",+ Date: newTime("Mon Jul 10 10:15:18 2023 -0400"),+ Message: newStringBuilderValue("Create files\n"),},contentWriter: newBufferWithContent([]byte("The Nameless is the origin of Heaven and Earth;\nThe named is the mother of all things.\n\nTherefore let there always be non-being,\n so we may see their subtlety,\nAnd let there always be being,\n so we may see their outcome.\nThe two are the same,\nBut after they are produced,\n they have different names.\nThey both may be called deep and profound.\nDeeper and more profound,\nThe door of all subtleties!\n")),IsBinary: false,@@ -2286,7 +2476,9 @@ index 0000000..5af88a8const singleCommitMultiDiff = `commit 70001020fab32b1fcf2f1f0e5c66424eae649826 (HEAD -> master, origin/master, origin/HEAD)Author: Dustin Decker <[email protected]>-Date: Mon Mar 15 23:27:16 2021 -0700+AuthorDate: Mon Mar 15 23:27:16 2021 -0700+Commit: Dustin Decker <[email protected]>+CommitDate: Mon Mar 15 23:27:16 2021 -0700Update aws@@ -2327,7 +2519,9 @@ index 239b415..2ee133b 100644const singleCommitSingleDiff = `commit 70001020fab32b1fcf2f1f0e5c66424eae649826 (HEAD -> master, origin/master, origin/HEAD)Author: Dustin Decker <[email protected]>-Date: Mon Mar 15 23:27:16 2021 -0700+AuthorDate: Mon Mar 15 23:27:16 2021 -0700+Commit: Dustin Decker <[email protected]>+CommitDate: Mon Mar 15 23:27:16 2021 -0700Update awsdiff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.goindex 870cec356..df8ebeb74 100644--- a/pkg/sources/git/git.go+++ b/pkg/sources/git/git.go@@ -562,29 +562,55 @@ func (s *Git) ScanCommits(ctx context.Context, repo *git.Repository, path stringbreak}- fullHash := diff.Commit.Hash+ commit := diff.Commit+ fullHash := commit.Hashif scanOptions.BaseHash != "" && scanOptions.BaseHash == fullHash {logger.V(1).Info("reached base commit", "commit", fullHash)break}+ email := commit.Author+ when := commit.Date.UTC().Format("2006-01-02 15:04:05 -0700")+if fullHash != lastCommitHash {depth++lastCommitHash = fullHashatomic.AddUint64(&s.metrics.commitsScanned, 1)logger.V(5).Info("scanning commit", "commit", fullHash)- }- if !scanOptions.Filter.Pass(diff.PathB) {- continue+ // Scan the commit metadata.+ // See https://github.com/trufflesecurity/trufflehog/issues/2683+ var (+ metadata = s.sourceMetadataFunc("", email, fullHash, when, remoteURL, 0)+ sb strings.Builder+ )+ sb.WriteString(email)+ sb.WriteString("\n")+ sb.WriteString(commit.Committer)+ sb.WriteString("\n")+ sb.WriteString(commit.Message.String())+ chunk := sources.Chunk{+ SourceName: s.sourceName,+ SourceID: s.sourceID,+ JobID: s.jobID,+ SourceType: s.sourceType,+ SourceMetadata: metadata,+ Data: []byte(sb.String()),+ Verify: s.verify,+ }+ if err := reporter.ChunkOk(ctx, chunk); err != nil {+ return err+ }}fileName := diff.PathBif fileName == "" {continue}- email := diff.Commit.Author- when := diff.Commit.Date.UTC().Format("2006-01-02 15:04:05 -0700")++ if !scanOptions.Filter.Pass(fileName) {+ continue+ }// Handle binary files by reading the entire file rather than using the diff.if diff.IsBinary {diff --git a/pkg/sources/git/git_test.go b/pkg/sources/git/git_test.goindex 324dac695..f1ec1083b 100644--- a/pkg/sources/git/git_test.go+++ b/pkg/sources/git/git_test.go@@ -180,18 +180,29 @@ func TestSource_Chunks_Integration(t *testing.T) {name: "remote repo, unauthenticated",repoURL: "https://github.com/dustin-decker/secretsandstuff.git",expectedChunkData: map[string]*byteCompare{+ "70001020fab32b1fcf2f1f0e5c66424eae649826-": {B: []byte("Dustin Decker <[email protected]>\nGitHub <[email protected]>\nUpdate aws\n")},"70001020fab32b1fcf2f1f0e5c66424eae649826-aws": {B: []byte("[default]\naws_access_key_id = AKIAXYZDQCEN4B6JSJQI\naws_secret_access_key = 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\noutput = json\nregion = us-east-2\n")},+ "a6f8aa55736d4a85be31a0048a4607396898647a-": {B: []byte("Dustin Decker <[email protected]>\nGitHub <[email protected]>\nUpdate bump\n")},"a6f8aa55736d4a85be31a0048a4607396898647a-bump": {B: []byte("\n\nf\n")},+ "73ab4713057944753f1bdeb80e757380e64c6b5b-": {B: []byte("Dustin <[email protected]>\nDustin <[email protected]>\nbump\n")},"73ab4713057944753f1bdeb80e757380e64c6b5b-bump": {B: []byte(" s \n\n")},+ "2f251b8c1e72135a375b659951097ec7749d4af9-": {B: []byte("Dustin <[email protected]>\nDustin <[email protected]>\nbump\n")},"2f251b8c1e72135a375b659951097ec7749d4af9-bump": {B: []byte(" \n\n")},+ "e6c8bbabd8796ea3cd85bfc2e55b27e0a491747f-": {B: []byte("Dustin Decker <[email protected]>\nGitHub <[email protected]>\nUpdate bump\n")},"e6c8bbabd8796ea3cd85bfc2e55b27e0a491747f-bump": {B: []byte("\noops \n")},+ "735b52b0eb40610002bb1088e902bd61824eb305-": {B: []byte("Dustin Decker <[email protected]>\nGitHub <[email protected]>\nUpdate bump\n")},"735b52b0eb40610002bb1088e902bd61824eb305-bump": {B: []byte("\noops\n")},+ "ce62d79908803153ef6e145e042d3e80488ef747-": {B: []byte("Dustin Decker <[email protected]>\nGitHub <[email protected]>\nCreate bump\n")},"ce62d79908803153ef6e145e042d3e80488ef747-bump": {B: []byte("\n")},// Normally we might expect to see this commit, and we may in the future.// But at the moment we're ignoring any commit unless it contains at least one non-space character.+ "27fbead3bf883cdb7de9d7825ed401f28f9398f1-": {B: []byte("Dustin <[email protected]>\nDustin <[email protected]>\noops\n")},"27fbead3bf883cdb7de9d7825ed401f28f9398f1-slack": {B: []byte("\n\n\nyup, just did that\n\ngithub_lol: \"ffc7e0f9400fb6300167009e42d2f842cd7956e2\"\n\noh, goodness. there's another one!\n")},+ "8afb0ecd4998b1179e428db5ebbcdc8221214432-": {B: []byte("Dustin <[email protected]>\nDustin <[email protected]>\nadd slack token\n")},"8afb0ecd4998b1179e428db5ebbcdc8221214432-slack": {B: []byte("oops might drop a slack token here\n\ngithub_secret=\"369963c1434c377428ca8531fbc46c0c43d037a0\"\n\nyup, just did that\n"), Multi: true},+ "8fe6f04ef1839e3fc54b5147e3d0e0b7ab971bd5-": {B: []byte("Dustin <[email protected]>\nDustin <[email protected]>\noops, accidently commited AWS token...\n")},"8fe6f04ef1839e3fc54b5147e3d0e0b7ab971bd5-aws": {B: []byte("blah blaj\n\nthis is the secret: AKIA2E0A8F3B244C9986\n\nokay thank you bye\n"), Multi: true},+ "84e9c75e388ae3e866e121087ea2dd45a71068f2-": {B: []byte("Dylan Ayrey <[email protected]>\nGitHub <[email protected]>\nUpdate aws\n")},"84e9c75e388ae3e866e121087ea2dd45a71068f2-aws": {B: []byte("\n\nthis is the secret: [Default]\nAccess key Id: AKIAILE3JG6KMS3HZGCA\nSecret Access Key: 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\n\nokay thank you bye\n"), Multi: false},},},@@ -199,6 +210,7 @@ func TestSource_Chunks_Integration(t *testing.T) {name: "remote repo, limited",repoURL: "https://github.com/dustin-decker/secretsandstuff.git",expectedChunkData: map[string]*byteCompare{+ "70001020fab32b1fcf2f1f0e5c66424eae649826-": {B: []byte("Dustin Decker <[email protected]>\nGitHub <[email protected]>\nUpdate aws\n")},"70001020fab32b1fcf2f1f0e5c66424eae649826-aws": {B: []byte("[default]\naws_access_key_id = AKIAXYZDQCEN4B6JSJQI\naws_secret_access_key = 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\noutput = json\nregion = us-east-2\n")},},scanOptions: ScanOptions{@@ -210,6 +222,7 @@ func TestSource_Chunks_Integration(t *testing.T) {name: "remote repo, main ahead of branch",repoURL: "https://github.com/bill-rich/bad-secrets.git",expectedChunkData: map[string]*byteCompare{+ "547865c6cc0da46622306902b1b66f7e25dd0412-": {B: []byte("bill-rich <[email protected]>\nbill-rich <[email protected]>\nAdd some_branch_file\n")},"547865c6cc0da46622306902b1b66f7e25dd0412-some_branch_file": {B: []byte("[default]\naws_access_key=AKIAYVP4CIPPH5TNP3SW\naws_secret_access_key=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\nregion=us-east-2\noutput=json\n\n#addibng a comment\n")},},scanOptions: ScanOptions{