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

Library and example implementation that extracts code context for any issue #54

Merged
merged 21 commits into from
Jan 2, 2024

Conversation

northdpole
Copy link
Contributor

@northdpole northdpole commented Dec 28, 2023

This PR :

  • adds a method that allows producers to add code context on issues
  • adds an optional field to the issue api that allows for adding contextual info

Code context is a few lines above and below the range for the finding.
This is useful both for reporting but most importantly for generating fixes and explaining the issues in a better way than the description from the tools

Left to do:

  • modify existing components to use the api field
  • modify existing SAST producers to use context

pkg/context/context_test.go Show resolved Hide resolved
pkg/context/context.go Outdated Show resolved Hide resolved
pkg/context/context_test.go Show resolved Hide resolved
pkg/context/context_test.go Show resolved Hide resolved
pkg/context/context_test.go Show resolved Hide resolved
northdpole and others added 4 commits December 28, 2023 00:12
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pkg/context/context_test.go Outdated Show resolved Hide resolved
pkg/context/context_test.go Outdated Show resolved Hide resolved
pkg/context/context_test.go Outdated Show resolved Hide resolved
pkg/context/context_test.go Outdated Show resolved Hide resolved
northdpole and others added 3 commits December 28, 2023 11:23
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pkg/testutil/createTmp.go Outdated Show resolved Hide resolved
components/producers/kics/main_test.go Outdated Show resolved Hide resolved
components/producers/python-bandit/main_test.go Outdated Show resolved Hide resolved
components/producers/python-bandit/main_test.go Outdated Show resolved Hide resolved
components/producers/semgrep/main_test.go Outdated Show resolved Hide resolved
components/producers/kics/main_test.go Outdated Show resolved Hide resolved
components/producers/python-bandit/main_test.go Outdated Show resolved Hide resolved
components/producers/python-bandit/main_test.go Outdated Show resolved Hide resolved
components/producers/python-bandit/main_test.go Outdated Show resolved Hide resolved
components/producers/semgrep/main_test.go Outdated Show resolved Hide resolved
components/producers/semgrep/main_test.go Outdated Show resolved Hide resolved
northdpole and others added 9 commits December 29, 2023 11:41
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
components/producers/terraform-tfsec/main_test.go Outdated Show resolved Hide resolved
components/producers/trufflehog/main_test.go Outdated Show resolved Hide resolved
components/producers/typescript-eslint/main_test.go Outdated Show resolved Hide resolved
components/producers/terraform-tfsec/main_test.go Outdated Show resolved Hide resolved
components/producers/typescript-eslint/main_test.go Outdated Show resolved Hide resolved
components/producers/typescript-eslint/main_test.go Outdated Show resolved Hide resolved
northdpole and others added 4 commits January 2, 2024 19:59
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@northdpole northdpole merged commit 7af44a1 into main Jan 2, 2024
6 checks passed
@northdpole northdpole deleted the add-context branch January 2, 2024 20:28
ptzianos pushed a commit to ptzianos/dracon that referenced this pull request Jan 31, 2024
… issue (smithy-security#54)

* add a small library that allows for adding code context to issues

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* migrate producers to add context segments

* Update components/producers/golang-gosec/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/kics/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/python-bandit/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/python-bandit/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/semgrep/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* tfsec

* trufflehog

* eslint

* lint

* Update components/producers/terraform-tfsec/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/trufflehog/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/typescript-eslint/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/typescript-eslint/types/eslint-issue.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Pavlos Tzianos <[email protected]>
northdpole added a commit that referenced this pull request Feb 15, 2024
… issue (#54)

* add a small library that allows for adding code context to issues

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update pkg/context/context_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* migrate producers to add context segments

* Update components/producers/golang-gosec/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/kics/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/python-bandit/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/python-bandit/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/semgrep/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* tfsec

* trufflehog

* eslint

* lint

* Update components/producers/terraform-tfsec/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/trufflehog/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/typescript-eslint/main_test.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update components/producers/typescript-eslint/types/eslint-issue.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant