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

added substrate documentation #216

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6fd700e
Print info
jgcrosta Dec 3, 2024
791e532
Add test-cases and detector
jgcrosta Dec 3, 2024
858d988
Only use last segment of the call
jgcrosta Dec 3, 2024
169ca12
Delete incorrectly added file.
Helios-vmg Dec 4, 2024
65769b2
Update .gitignore.
Helios-vmg Dec 4, 2024
80d1ce3
Added test cases.
Helios-vmg Dec 4, 2024
44742c3
Moved decomposers to reusable module.
Helios-vmg Dec 4, 2024
8f6ad20
Use fully qualified path
jgcrosta Dec 4, 2024
db890cf
Merge branch 'develop' into add-print-info
jgcrosta Dec 4, 2024
214c4cd
Remove unwanted line
jgcrosta Dec 4, 2024
52ac0fc
Add test-cases and detector
jgcrosta Dec 4, 2024
ca36d56
Fix attr panic on `.tokens()`
jgcrosta Dec 4, 2024
3ac5946
Delete soroban detector and add small modification to rust detector
jgcrosta Dec 5, 2024
fed4141
Unify detectors, unify common. Remove unused stuff
jgcrosta Dec 5, 2024
999bdc6
Merge branch 'remove-known-vulnerabilities-tests' into add-print-info
Helios-vmg Dec 5, 2024
2d58059
Merge branch 'remove-known-vulnerabilities-tests' into 190-add-invali…
Helios-vmg Dec 5, 2024
dd16faa
Merge branch 'remove-known-vulnerabilities-tests' into 186-add-ensure…
Helios-vmg Dec 5, 2024
09de750
Fixed build error.
Helios-vmg Dec 5, 2024
7fc9dba
test_finding_presence() should ignore known_vulnerabilities.
Helios-vmg Dec 5, 2024
32038f9
Merge branch '186-add-ensure-none-detector' into develop
Helios-vmg Dec 5, 2024
0fcbab1
Merge branch '190-add-invalid-weight-info-detector' into develop
Helios-vmg Dec 5, 2024
4ce85d9
Filtered out false positives.
Helios-vmg Dec 6, 2024
ba94133
Merge branch 'develop' into saturating-arithmetic
Helios-vmg Dec 6, 2024
2819a5c
Regenerate Cargo.lock.
Helios-vmg Dec 6, 2024
db50110
Detector works.
Helios-vmg Dec 6, 2024
5ca0a67
Merge branch 'experimental' into 195-unify-unsafe-unwrap-detector
jgcrosta Dec 6, 2024
c85938b
add avoid-debug-info detector
Dec 6, 2024
2d30487
Merge branch 'experimental' into 194-remove-incorrect-exponentiation-…
jgcrosta Dec 6, 2024
027762f
Added test cases.
Helios-vmg Dec 6, 2024
54ef956
Merge branch 'experimental' into use-debug-detector
Dec 6, 2024
758dd14
fix errors
Dec 6, 2024
d549706
fix errors
Dec 6, 2024
40984ca
Finished vulnerable test cases.
Helios-vmg Dec 6, 2024
709e86d
Added remediated test cases.
Helios-vmg Dec 6, 2024
c140e65
Removed tests.
Helios-vmg Dec 6, 2024
b9f2cf4
Skip GetShortMessage().
Helios-vmg Dec 6, 2024
04a1a0c
cargo clippy
Helios-vmg Dec 6, 2024
3db7837
cargo fmt
Helios-vmg Dec 6, 2024
7439d6d
Merge pull request #197 from CoinFabrik/195-unify-unsafe-unwrap-detector
Helios-vmg Dec 6, 2024
d1b36ce
Merge pull request #198 from CoinFabrik/194-remove-incorrect-exponent…
Helios-vmg Dec 6, 2024
3a686dc
Merge pull request #199 from CoinFabrik/use-debug-detector
Helios-vmg Dec 6, 2024
63182a1
Merge pull request #200 from CoinFabrik/saturating-arithmetic
Helios-vmg Dec 6, 2024
51247ca
Version bump.
Helios-vmg Dec 6, 2024
35f35e0
Merge branch 'develop' into experimental
Helios-vmg Dec 17, 2024
4b10e0c
added substrate documentation
matiascabello Dec 18, 2024
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ report.md
env/
venv/
!/detectors/ink/.vscode/
__pycache__
__pycache__

.vs
/scripts/cs/run-tests/bin/
/scripts/cs/run-tests/obj/
launchSettings.json
basic.tar
2 changes: 1 addition & 1 deletion apps/cargo-scout-audit/Cargo.lock

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

2 changes: 1 addition & 1 deletion apps/cargo-scout-audit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ license = "MIT"
name = "cargo-scout-audit"
readme = "../../README.md"
repository = "https://github.com/coinfabrik/scout-audit"
version = "0.3.0"
version = "0.3.1"

[lib]
path = "src/lib.rs"
Expand Down
3 changes: 3 additions & 0 deletions apps/cargo-scout-audit/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use clap::{Parser, Subcommand, ValueEnum};
use std::path::PathBuf;
use thiserror::Error;

use crate::utils::print::print_info;

#[derive(Debug, Parser)]
#[clap(display_name = "cargo")]
pub struct Cli {
Expand Down Expand Up @@ -148,6 +150,7 @@ impl Scout {
}

pub fn validate(&self) -> Result<()> {
print_info("Validating CLI arguments...");
if let Some(path) = &self.output_path {
if path.is_dir() {
bail!(CliError::OutputPathIsDirectory(path.clone()));
Expand Down
7 changes: 6 additions & 1 deletion apps/cargo-scout-audit/src/detectors/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use super::{
library::Library,
source::download_git_repo,
};
use crate::{scout::blockchain::BlockChain, utils::telemetry::TracedError};
use crate::{
scout::blockchain::BlockChain,
utils::{print::print_info, telemetry::TracedError},
};

#[derive(Error, Debug)]
pub enum BuilderError {
Expand Down Expand Up @@ -61,12 +64,14 @@ impl<'a> DetectorBuilder<'a> {

#[tracing::instrument(skip_all, level = "debug")]
pub fn build(&self, bc: &BlockChain, used_detectors: &[String]) -> Result<Vec<PathBuf>> {
print_info("Compiling detectors...");
let all_library_paths = self.build_all_libraries(bc)?;
self.filter_detectors(&all_library_paths, used_detectors)
}

#[tracing::instrument(skip_all, level = "debug")]
pub fn get_detector_names(&self) -> Result<Vec<String>> {
print_info("Getting detector names...");
let mut all_names = Vec::new();
let libraries = self.get_all_libraries()?;

Expand Down
10 changes: 5 additions & 5 deletions apps/cargo-scout-audit/src/scout/nightly_runner.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(unused_imports)]
use anyhow::{anyhow, Context, Result};
use crate::utils::print::{print_error, print_info};
use anyhow::{Context, Result};
use current_platform::CURRENT_PLATFORM;
use lazy_static::lazy_static;
use std::{
Expand All @@ -8,8 +8,6 @@ use std::{
process::{Child, Command},
};

use crate::utils::print::print_error;

lazy_static! {
static ref LIBRARY_PATH_VAR: &'static str = match env::consts::OS {
"linux" => "LD_LIBRARY_PATH",
Expand All @@ -25,7 +23,7 @@ pub fn run_scout_in_nightly(toolchain: &str) -> Result<Option<Child>> {
use windows::{core::PCWSTR, Win32::System::LibraryLoader::SetDllDirectoryW};

let user_profile = env::var("USERPROFILE")
.map_err(|e| anyhow!("Unable to get user profile directory: {e}"))?;
.map_err(|e| anyhow::anyhow!("Unable to get user profile directory: {e}"))?;
let mut user_profile = std::path::PathBuf::from(user_profile);
user_profile.push(".rustup");
user_profile.push("toolchains");
Expand All @@ -40,6 +38,7 @@ pub fn run_scout_in_nightly(toolchain: &str) -> Result<Option<Child>> {
unsafe {
let _ = SetDllDirectoryW(PCWSTR(directory.as_ptr()));
}
print_info("Re-running scout with nightly toolchain...");
return Ok(None);
}

Expand Down Expand Up @@ -72,5 +71,6 @@ pub fn run_scout_in_nightly(toolchain: &str) -> Result<Option<Child>> {
let child = command
.spawn()
.with_context(|| "Failed to spawn scout with nightly toolchain")?;
print_info("Re-running scout with nightly toolchain...");
Ok(Some(child))
}
4 changes: 3 additions & 1 deletion apps/cargo-scout-audit/src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
config::ProfileConfig,
detectors::{get_excluded_detectors, get_filtered_detectors, list_detectors},
detectors_info::get_detectors_info,
print::print_error,
print::{print_error, print_info},
telemetry::TracedError,
},
};
Expand Down Expand Up @@ -223,6 +223,8 @@ fn run_dylint(
opts: &Scout,
inside_vscode: bool,
) -> Result<(bool, NamedTempFile)> {
print_info("Running scout...");

// Convert detectors paths to string
let detectors_paths: Vec<String> = detectors_paths
.iter()
Expand Down
8 changes: 8 additions & 0 deletions apps/cargo-scout-audit/src/utils/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ pub fn print_error(message: &str) {
println!("{}", pretty_error(message));
}

pub fn print_info(message: &str) {
println!("{}", pretty_info(message));
}

pub fn pretty_warning(message: &str) -> String {
format!("{} {}", "[WARNING]".yellow(), message)
}

pub fn pretty_error(message: &str) -> String {
format!("{} {}", "[ERROR]".red(), message)
}

pub fn pretty_info(message: &str) -> String {
format!("{} {}", "[INFO]".blue(), message)
}
Loading