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

ci: custom panic free audit tool #294

Merged
merged 12 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,40 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

panic-free-audit:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: setup environment
uses: ./.github/actions/setup

- name: run panic free analyzer
run: cargo run --manifest-path tools/panic_free_analyzer/Cargo.toml > tools/panic_free_analyzer/output.md
working-directory: .

- uses: the-guild-org/shared-config/setup@main
name: setup env
with:
nodeVersion: 20
packageManager: pnpm
packageManagerVersion: ${{ steps.versions.outputs.pnpm }}
workingDirectory: ./tests/graphql-over-http

- name: pnpm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_PR: ${{ github.event.pull_request.number }}
run: pnpm i
working-directory: tools/panic_free_analyzer

- name: run a js script to post the audit on github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_PR: ${{ github.event.pull_request.number }}
run: node postOnGithub.js
working-directory: tools/panic_free_analyzer
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"
members = ["bin/*", "libs/*", "plugins/*"]
exclude = ["bin/npm", "benchmark/server"]
exclude = ["bin/npm", "benchmark/server", "tools/panic_free_analyzer"]

[workspace.dependencies]
tokio = "1.35.1"
Expand Down
184 changes: 184 additions & 0 deletions tools/panic_free_analyzer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions tools/panic_free_analyzer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "safety_inspector"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regex = "1.10.2"
serde_json = "1.0.111"
walkdir = "2.4.0"
15 changes: 15 additions & 0 deletions tools/panic_free_analyzer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "panic_free_analyzer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^1.6.5"
}
}
100 changes: 100 additions & 0 deletions tools/panic_free_analyzer/panic-audit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 🚨 Rust Panic Audit: 202 Potential Panic Points Detected 🚨

## Crate: `e2e_tests`
📊 Total Usages: 49

- 🎁 `unwrap` usages: 49

## Crate: `vrl`
📊 Total Usages: 37

- 🔢 `array_index` usages: 3
- 🚨 `panic` usages: 1
- 🎁 `unwrap` usages: 32
- 🔎 `expect` usages: 1

## Crate: `jwt_auth`
📊 Total Usages: 31

- 🎁 `unwrap` usages: 29
- 🔢 `array_index` usages: 2

## Crate: `config`
📊 Total Usages: 14

- 🔎 `expect` usages: 3
- 🚨 `panic` usages: 3
- 🎁 `unwrap` usages: 8

## Crate: `common`
📊 Total Usages: 12

- 🎁 `unwrap` usages: 12

## Crate: `cors`
📊 Total Usages: 11

- 🎁 `unwrap` usages: 11

## Crate: `benches`
📊 Total Usages: 11

- 🔎 `expect` usages: 2
- 🎁 `unwrap` usages: 9

## Crate: `engine`
📊 Total Usages: 10

- 🔢 `array_index` usages: 1
- 🚨 `panic` usages: 1
- 🎁 `unwrap` usages: 8

## Crate: `cloudflare_worker`
📊 Total Usages: 8

- 🎁 `unwrap` usages: 8

## Crate: `server`
📊 Total Usages: 6

- 🚧 `unimplemented` usages: 6

## Crate: `persisted_documents`
📊 Total Usages: 4

- 🔎 `expect` usages: 4

## Crate: `conductor`
📊 Total Usages: 3

- 🚨 `panic` usages: 1
- 🔎 `expect` usages: 2

## Crate: `graphiql`
📊 Total Usages: 3

- 🎁 `unwrap` usages: 3

## Crate: `http_get`
📊 Total Usages: 1

- 🎁 `unwrap` usages: 1

## Crate: `napi`
📊 Total Usages: 1

- 🚨 `panic` usages: 1

## Crate: `disable_introspection`
📊 Total Usages: 1

- 🚨 `panic` usages: 1

## Crate: `wasm_polyfills`
📊 Total Usages: 0


## Crate: `match_content_type`
📊 Total Usages: 0


Loading