-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update toolchain + fix security advisories (BAC-1432) (#6)
- Loading branch information
Showing
14 changed files
with
90 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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,9 @@ | ||
[advisories] | ||
ignore = [ | ||
# ignore this one since serde_cbor is unmaintained and is a | ||
# core part of IC libraries | ||
"RUSTSEC-2021-0127", | ||
# ignore this one for now since rsa is only used internally via | ||
# sqlx and should not be exposed to an external caller | ||
"RUSTSEC-2023-0071", | ||
] |
This file contains 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,29 @@ | ||
name: security | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: ["main", "staging"] | ||
paths: | ||
- "**/Cargo.toml" | ||
- "**/Cargo.lock" | ||
- ".cargo/audit.toml" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: sudo apt install pkg-config | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: actions-rs/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,22 +1,16 @@ | ||
use candid::parser::typing::{check_file_with_options, CheckFileOptions}; | ||
use candid::pretty::candid::compile; | ||
use candid_parser::check_file_with_imports; | ||
use instrumented_error::Result; | ||
use std::collections::BTreeSet; | ||
use std::path::{Path, PathBuf}; | ||
|
||
/// Combines all imported candid files into a single file. | ||
#[tracing::instrument] | ||
pub fn combine_candid_files(path: &Path, output_file: &str) -> Result<BTreeSet<PathBuf>> { | ||
pub fn combine_candid_files(path: &Path, output_file: &str) -> Result<Vec<PathBuf>> { | ||
let candid_path = Path::new(path); | ||
let result = check_file_with_options( | ||
candid_path, | ||
&CheckFileOptions { | ||
pretty_errors: false, | ||
combine_actors: true, | ||
}, | ||
)?; | ||
let result = check_file_with_imports(candid_path)?; | ||
// export the did to all defined networks | ||
let contents = candid::bindings::candid::compile(&result.types, &result.actor); | ||
let contents = compile(&result.0, &result.1); | ||
std::fs::write(output_file, contents)?; | ||
|
||
Ok(result.imports) | ||
Ok(result.2) | ||
} |
This file contains 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,19 +1,24 @@ | ||
use ic_agent::agent::http_transport::ReqwestHttpReplicaV2Transport; | ||
use ic_agent::agent::http_transport::ReqwestTransport; | ||
use ic_agent::identity::AnonymousIdentity; | ||
use ic_agent::Agent; | ||
use ic_crypto_utils_threshold_sig_der::parse_threshold_sig_key_from_der; | ||
use ic_validator_ingress_message::IngressMessageVerifier; | ||
use ic_types::messages::UserQuery; | ||
use ic_validator_ingress_message::{HttpRequestVerifier, IngressMessageVerifier}; | ||
use instrumented_error::Result; | ||
use std::sync::Arc; | ||
|
||
pub async fn try_new_ingress_verifier(url: &str) -> Result<IngressMessageVerifier> { | ||
pub type IcHttpRequestVerifier = Arc<dyn HttpRequestVerifier<UserQuery> + Send + Sync>; | ||
|
||
pub async fn try_new_ingress_verifier(url: &str) -> Result<IcHttpRequestVerifier> { | ||
let agent: Agent = Agent::builder() | ||
.with_transport(ReqwestHttpReplicaV2Transport::create(url)?) | ||
.with_transport(ReqwestTransport::create(url)?) | ||
.with_arc_identity(Arc::new(AnonymousIdentity)) | ||
.build()?; | ||
agent.fetch_root_key().await?; | ||
let public_key = parse_threshold_sig_key_from_der(&agent.read_root_key())?; | ||
Ok(IngressMessageVerifier::builder() | ||
.with_root_of_trust(public_key) | ||
.build()) | ||
Ok(Arc::new( | ||
IngressMessageVerifier::builder() | ||
.with_root_of_trust(public_key) | ||
.build(), | ||
)) | ||
} |
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[toolchain] | ||
channel = "1.73.0" | ||
channel = "1.77.2" | ||
components = ["rustfmt", "clippy"] | ||
targets = ["wasm32-unknown-unknown"] |