-
Notifications
You must be signed in to change notification settings - Fork 2
Install slither #11
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
Merged
Merged
Install slither #11
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c0afaca
feat: add Slither static analysis support and update README with inst…
YukiTsuchida bae35b8
feat: implement structured initialization for PacketAcknowledgementCa…
YukiTsuchida 5208554
fix: correct capitalization of workflow name and simplify conditional…
YukiTsuchida fad9fe2
fix: update PR comment condition to check for results count instead o…
YukiTsuchida c23c9ac
test: ci
YukiTsuchida 5d7dc1f
fix: simplify initialization of PacketAcknowledgementCall in getPacke…
YukiTsuchida 0cbcb61
fix: remove unnecessary paths from filter in Slither configuration
YukiTsuchida 28ae6c7
Merge remote-tracking branch 'origin' into install-slither
YukiTsuchida cb95837
fix: update Slither action to version 0.4.1
YukiTsuchida 75becac
fix: remove submodule checkout from Slither workflow
YukiTsuchida File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| module.exports = async ({ github, context, header, body }) => { | ||
| const body2 = body | ||
| .replaceAll("%8D", "\r") | ||
| .replaceAll("%0A", "\n") | ||
| .replaceAll("%25", "%"); | ||
| const comment = [header, body2].join("\n"); | ||
|
|
||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.number, | ||
| }); | ||
|
|
||
| const botComment = comments.find( | ||
| (comment) => | ||
| // github-actions bot user | ||
| comment.user.id === 41898282 && comment.body.startsWith(header) | ||
| ); | ||
|
|
||
| const requestBody = { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: comment, | ||
| }; | ||
| if (botComment) { | ||
| requestBody.comment_id = botComment.id; | ||
| await github.rest.issues.updateComment(requestBody); | ||
| } else { | ||
| requestBody.issue_number = context.payload.number; | ||
| await github.rest.issues.createComment(requestBody); | ||
| } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Slither | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| slither: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Slither Analysis | ||
| uses: crytic/slither-action@v0.4.1 | ||
| id: slither | ||
| with: | ||
| slither-config: slither.config.json | ||
| sarif: results.sarif | ||
| fail-on: none | ||
| slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/ | ||
|
|
||
| - name: Format slither output | ||
| id: formatted_slither | ||
| run: | | ||
| value=$(echo "${{ steps.slither.outputs.stdout }}" | sed -e '1d') | ||
| value="${value//'%'/'%25'}" | ||
| value="${value//$'\n'/'%0A'}" | ||
| value="${value//$'\r'/'%0D'}" | ||
| echo "value=${value}" >> $GITHUB_OUTPUT | ||
| count=$(jq '[.runs[].results[]] | length' results.sarif 2>/dev/null || echo 0) | ||
| echo "results_count=${count}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create/update checklist as PR comment | ||
| if: ${{ github.event_name == 'pull_request' && steps.formatted_slither.outputs.results_count != '0' }} | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| script: | | ||
| const script = require(".github/scripts/slither_pr_comment") | ||
| const header = '# Slither report' | ||
| const body = `${{ steps.formatted_slither.outputs.value }}` | ||
| const comment = [header, body].join("\n"); | ||
| await script({github, context, header, body}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "exclude_dependencies": true, | ||
| "exclude_informational": true, | ||
| "filter_paths": "node_modules|src/proto" | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied from https://github.com/datachainlab/mutb-sc-poc