Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TravisCI source #1877

Merged
merged 8 commits into from
Oct 30, 2023
Merged

Add TravisCI source #1877

merged 8 commits into from
Oct 30, 2023

Conversation

dustin-decker
Copy link
Contributor

@dustin-decker dustin-decker commented Oct 9, 2023

Adds Travis CI scanning

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@dustin-decker dustin-decker marked this pull request as ready for review October 16, 2023 23:51
@dustin-decker dustin-decker requested review from a team as code owners October 16, 2023 23:51
Copy link
Collaborator

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like there's some circleci stuff that hasn't been updated after a copy-paste (annotated inline). i'll also leave the units stuff to @mcastorina to review.

@@ -306,6 +306,7 @@ func Start(ctx context.Context, options ...EngineOption) (*Engine, error) {
e.sourceManager = sources.NewManager(
sources.WithConcurrentSources(int(e.concurrency)),
sources.WithConcurrentUnits(int(e.concurrency)),
sources.WithSourceUnits(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcastorina are we ready for this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this tells the manager to use SourceUnits only if the source supports it, which right now would be filesystem and travisci.

pkg/engine/travisci.go Outdated Show resolved Hide resolved
pkg/engine/travisci.go Outdated Show resolved Hide resolved
pkg/engine/travisci.go Outdated Show resolved Hide resolved
pkg/sources/travisci/travisci.go Show resolved Hide resolved
if err != nil {
return fmt.Errorf("error finding repository: %w", err)
}
logger := ctx.Logger().WithValues("repo", *repo.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we 100% confident that repo is non-nil here? (i think this is just a go idiom i'm still becoming accustomed to.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, does the context logger already have kvps that carry information about the source itself? those might be nice to add if not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it depends on the implementation but that's generally the idiom.

Re: logger, I'm not sure but should to caller populate those (source id etc) consistently rather than the source being responsible?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the logger locally and this is what's printed, so it already has context (though missing source_id it seems).

{
  "level": "info-2",
  "ts": "2023-10-18T11:54:13-07:00",
  "logger": "trufflehog",
  "msg": "scanning repository",
  "job_id": 1,
  "source_manager_worker_id": "G26hU",
  "source_type": "SOURCE_TYPE_TRAVISCI",
  "source_name": "trufflehog - Travis CI",
  "unit": "26155351",
  "repo": "test-repo"
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it depends on the implementation but that's generally the idiom.

If we're not 100% confident that repo won't be nil (maybe Find is misbehaving, I guess) do you think it's worth adding a nil check for repo to avoid a potential panic?

BuildNumber: *build.Number,
JobNumber: *job.Number,
Link: fmt.Sprintf("https://app.travis-ci.com/github/%s/%s/jobs/%d", *job.Owner.Login, *repo.Name, *job.Id),
Public: !*repo.Private,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, why did we invert this property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is inverted?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source_metadatapb.TravisCI has a Public property but repo has a Private property

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this to stay more consistent with other source metadata.

}

for _, chunk := range reporter.Chunks {
if diff := pretty.Compare(chunk.SourceMetadata, tt.wantSourceMetadata); diff != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have been switching the notifiers over to use cmp because of that package's ability to exclude fields from the comparison. i can see that you don't need that capability here but the consistency could be nice. (cmp is also a google package, for what that's worth.)

pkg/sources/travisci/travisci.go Show resolved Hide resolved
pkg/sources/travisci/travisci.go Outdated Show resolved Hide resolved
return err
}
buildPageErrs++
if buildPageErrs >= 5 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could we constant-ify the 5.

Copy link
Collaborator

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

circleci stuff

if err != nil {
return fmt.Errorf("error finding repository: %w", err)
}
logger := ctx.Logger().WithValues("repo", *repo.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it depends on the implementation but that's generally the idiom.

If we're not 100% confident that repo won't be nil (maybe Find is misbehaving, I guess) do you think it's worth adding a nil check for repo to avoid a potential panic?

BuildNumber: *build.Number,
JobNumber: *job.Number,
Link: fmt.Sprintf("https://app.travis-ci.com/github/%s/%s/jobs/%d", *job.Owner.Login, *repo.Name, *job.Id),
Public: !*repo.Private,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source_metadatapb.TravisCI has a Public property but repo has a Private property

@dustin-decker dustin-decker merged commit 05fae15 into main Oct 30, 2023
7 of 8 checks passed
@dustin-decker dustin-decker deleted the travis-scanning branch October 30, 2023 14:28
haraldh referenced this pull request in matter-labs/vault-auth-tee Nov 3, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[trufflesecurity/trufflehog](https://togithub.com/trufflesecurity/trufflehog)
| action | minor | `v3.60.4` -> `v3.62.1` |

---

### Release Notes

<details>
<summary>trufflesecurity/trufflehog
(trufflesecurity/trufflehog)</summary>

###
[`v3.62.1`](https://togithub.com/trufflesecurity/trufflehog/releases/tag/v3.62.1)

[Compare
Source](https://togithub.com/trufflesecurity/trufflehog/compare/v3.62.0...v3.62.1)

#### What's Changed

- update kingpin import by
[@&#8203;dustin-decker](https://togithub.com/dustin-decker) in
[https://github.com/trufflesecurity/trufflehog/pull/2053](https://togithub.com/trufflesecurity/trufflehog/pull/2053)
- Re-add detector version by
[@&#8203;rosecodym](https://togithub.com/rosecodym) in
[https://github.com/trufflesecurity/trufflehog/pull/2060](https://togithub.com/trufflesecurity/trufflehog/pull/2060)
- Detector-Competition-Fix: Fix currencycloud.com API key by
[@&#8203;lc](https://togithub.com/lc) in
[https://github.com/trufflesecurity/trufflehog/pull/1917](https://togithub.com/trufflesecurity/trufflehog/pull/1917)
- Detector-Competition-Fix: Fix Bitcoin Average detector by
[@&#8203;lc](https://togithub.com/lc) in
[https://github.com/trufflesecurity/trufflehog/pull/1929](https://togithub.com/trufflesecurity/trufflehog/pull/1929)
- Detector-Competition-Fix: Update formio regex to match Jwt token by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/1935](https://togithub.com/trufflesecurity/trufflehog/pull/1935)
- Detector-Competition-Fix: Fix SalesBlink Detection & Verification by
[@&#8203;lc](https://togithub.com/lc) in
[https://github.com/trufflesecurity/trufflehog/pull/1950](https://togithub.com/trufflesecurity/trufflehog/pull/1950)
- Support multiple custom detectors by
[@&#8203;rosecodym](https://togithub.com/rosecodym) in
[https://github.com/trufflesecurity/trufflehog/pull/2064](https://togithub.com/trufflesecurity/trufflehog/pull/2064)
- \[chore] Fix SourceManager flaky test by
[@&#8203;mcastorina](https://togithub.com/mcastorina) in
[https://github.com/trufflesecurity/trufflehog/pull/2059](https://togithub.com/trufflesecurity/trufflehog/pull/2059)
- Centralize logic for checking archive extraction tools by
[@&#8203;ahrav](https://togithub.com/ahrav) in
[https://github.com/trufflesecurity/trufflehog/pull/2063](https://togithub.com/trufflesecurity/trufflehog/pull/2063)

**Full Changelog**:
trufflesecurity/trufflehog@v3.62.0...v3.62.1

###
[`v3.62.0`](https://togithub.com/trufflesecurity/trufflehog/releases/tag/v3.62.0)

[Compare
Source](https://togithub.com/trufflesecurity/trufflehog/compare/v3.61.0...v3.62.0)

#### What's Changed

- Update module github.com/aws/aws-sdk-go to v1.46.6 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2013](https://togithub.com/trufflesecurity/trufflehog/pull/2013)
- Update module github.com/bradleyfalzon/ghinstallation/v2 to v2.8.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2014](https://togithub.com/trufflesecurity/trufflehog/pull/2014)
- Update module github.com/charmbracelet/lipgloss to v0.9.1 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2015](https://togithub.com/trufflesecurity/trufflehog/pull/2015)
- Update module github.com/go-logr/logr to v1.3.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2025](https://togithub.com/trufflesecurity/trufflehog/pull/2025)
- Update module github.com/getsentry/sentry-go to v0.25.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2022](https://togithub.com/trufflesecurity/trufflehog/pull/2022)
- Update module github.com/google/go-containerregistry to v0.16.1 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2026](https://togithub.com/trufflesecurity/trufflehog/pull/2026)
- Update module github.com/google/uuid to v1.4.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2027](https://togithub.com/trufflesecurity/trufflehog/pull/2027)
- Update module github.com/hashicorp/golang-lru to v0.6.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2028](https://togithub.com/trufflesecurity/trufflehog/pull/2028)
- Update module github.com/rabbitmq/amqp091-go to v1.9.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2030](https://togithub.com/trufflesecurity/trufflehog/pull/2030)
- Detector-Competition-Feat: Added LemonSqueezy API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/2017](https://togithub.com/trufflesecurity/trufflehog/pull/2017)
- Update module github.com/prometheus/client_golang to v1.17.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2029](https://togithub.com/trufflesecurity/trufflehog/pull/2029)
- Detector-Competition-Feat: Added Budibase API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/2016](https://togithub.com/trufflesecurity/trufflehog/pull/2016)
- Update github.com/bodgit/sevenzip to v1.4.3 by
[@&#8203;rgmz](https://togithub.com/rgmz) in
[https://github.com/trufflesecurity/trufflehog/pull/2039](https://togithub.com/trufflesecurity/trufflehog/pull/2039)
- Update module go.uber.org/mock to v0.3.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2038](https://togithub.com/trufflesecurity/trufflehog/pull/2038)
- Update module github.com/xanzy/go-gitlab to v0.93.2 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2031](https://togithub.com/trufflesecurity/trufflehog/pull/2031)
- Update module github.com/snowflakedb/gosnowflake to v1.6.25 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2042](https://togithub.com/trufflesecurity/trufflehog/pull/2042)
- Update module github.com/launchdarkly/go-server-sdk/v6 to v6.1.1 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2043](https://togithub.com/trufflesecurity/trufflehog/pull/2043)
- Update module go.uber.org/zap to v1.26.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2044](https://togithub.com/trufflesecurity/trufflehog/pull/2044)
- Update module google.golang.org/api to v0.148.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2045](https://togithub.com/trufflesecurity/trufflehog/pull/2045)
- Developed Deno Deploy Detector by
[@&#8203;rgmz](https://togithub.com/rgmz) in
[https://github.com/trufflesecurity/trufflehog/pull/2040](https://togithub.com/trufflesecurity/trufflehog/pull/2040)
- Detector-Competition-Feat: Added Stripo API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/2018](https://togithub.com/trufflesecurity/trufflehog/pull/2018)
- fix(deps): update module sigs.k8s.io/yaml to v1.4.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2047](https://togithub.com/trufflesecurity/trufflehog/pull/2047)
- Detector-Competition-Feat: Added Reply.io API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/2019](https://togithub.com/trufflesecurity/trufflehog/pull/2019)
- fix(deps): update module github.com/go-git/go-git/v5 to v5.10.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2023](https://togithub.com/trufflesecurity/trufflehog/pull/2023)
- adding 'token' keyword to regex for github_old by
[@&#8203;ankushgoel27](https://togithub.com/ankushgoel27) in
[https://github.com/trufflesecurity/trufflehog/pull/2037](https://togithub.com/trufflesecurity/trufflehog/pull/2037)
- Remove verify flag from Aho-Corasick core by
[@&#8203;rosecodym](https://togithub.com/rosecodym) in
[https://github.com/trufflesecurity/trufflehog/pull/2010](https://togithub.com/trufflesecurity/trufflehog/pull/2010)
- Add TravisCI source by
[@&#8203;dustin-decker](https://togithub.com/dustin-decker) in
[https://github.com/trufflesecurity/trufflehog/pull/1877](https://togithub.com/trufflesecurity/trufflehog/pull/1877)

**Full Changelog**:
trufflesecurity/trufflehog@v3.61.0...v3.62.0

###
[`v3.61.0`](https://togithub.com/trufflesecurity/trufflehog/releases/tag/v3.61.0)

[Compare
Source](https://togithub.com/trufflesecurity/trufflehog/compare/v3.60.4...v3.61.0)

#### What's Changed

- Detector-Competition-Fix: Fix/Remove Happi Detection & Verification by
[@&#8203;lc](https://togithub.com/lc) in
[https://github.com/trufflesecurity/trufflehog/pull/2003](https://togithub.com/trufflesecurity/trufflehog/pull/2003)
- Detector-Competition-Fix: Fix/Remove Flowdock detector by
[@&#8203;lc](https://togithub.com/lc) in
[https://github.com/trufflesecurity/trufflehog/pull/2004](https://togithub.com/trufflesecurity/trufflehog/pull/2004)
- Add temp directory management by
[@&#8203;codevbus](https://togithub.com/codevbus) in
[https://github.com/trufflesecurity/trufflehog/pull/1878](https://togithub.com/trufflesecurity/trufflehog/pull/1878)
- Fix binary handling by
[@&#8203;bill-rich](https://togithub.com/bill-rich) in
[https://github.com/trufflesecurity/trufflehog/pull/1999](https://togithub.com/trufflesecurity/trufflehog/pull/1999)
- Detector-Competition-Fix: Fix SurveyBot Verification by
[@&#8203;lc](https://togithub.com/lc) in
[https://github.com/trufflesecurity/trufflehog/pull/1948](https://togithub.com/trufflesecurity/trufflehog/pull/1948)
- Detector-Competition-Feat: Added BetterStack API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/1987](https://togithub.com/trufflesecurity/trufflehog/pull/1987)
- Detector-Competition-Feat: Added ZeroTier API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/1988](https://togithub.com/trufflesecurity/trufflehog/pull/1988)
- Detector-Competition-Feat: Added AppOptics API token detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/1989](https://togithub.com/trufflesecurity/trufflehog/pull/1989)
- Detector-Competition-Feat: Add Metabase Session Secret Detector by
[@&#8203;fumblehool](https://togithub.com/fumblehool) in
[https://github.com/trufflesecurity/trufflehog/pull/1902](https://togithub.com/trufflesecurity/trufflehog/pull/1902)
- Add Coinbase Wallet-as-a-Service detector by
[@&#8203;rgmz](https://togithub.com/rgmz) in
[https://github.com/trufflesecurity/trufflehog/pull/1895](https://togithub.com/trufflesecurity/trufflehog/pull/1895)
- Chore(deps): Bump google.golang.org/grpc from 1.56.2 to 1.56.3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/trufflesecurity/trufflehog/pull/2009](https://togithub.com/trufflesecurity/trufflehog/pull/2009)
- Update module github.com/TheZeroSlave/zapsentry to v1.19.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2012](https://togithub.com/trufflesecurity/trufflehog/pull/2012)
- Update module cloud.google.com/go/secretmanager to v1.11.3 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/trufflesecurity/trufflehog/pull/2011](https://togithub.com/trufflesecurity/trufflehog/pull/2011)

**Full Changelog**:
trufflesecurity/trufflehog@v3.60.4...v3.61.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/matter-labs/vault-auth-tee).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuMzEuNSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants