Skip to content

Commit b2aa4d7

Browse files
committed
chore(deps): update secrecy 0.8.0 -> 0.10.3
I diffed the actual crates.io contents via ```bash curl -L https://crates.io/api/v1/crates/secrecy/${VERSION}/download | tar -xf - ``` with `VERSION` as `0.8.0` and `0.10.3`, then diffing via git. It revealed nothing suspicious, with changes as claimed per their CHANGELOG.md. 0.10.0 had some breaking changes. `Secret<T>` is no longer a thing, instead there's `SecretBox<T>`. It turned out secrecy usage in bors is limited, and private keys are fed as PEM-encoded `String`s. For this, there's `SecretString`, which is just an alias for `SecretBox<str>`. Accepting it and converting to bytes in `create_github_client` simplifies code at the call sites a bit.
1 parent 61f79b5 commit b2aa4d7

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

Cargo.lock

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ http = "1.1.0"
4444
sha2 = "0.10"
4545
hmac = "0.12"
4646
hex = "0.4"
47-
secrecy = "0.8"
47+
secrecy = "0.10.3"
4848

4949
# Database
5050
sqlx = { version = "0.8.1", features = ["runtime-tokio", "tls-rustls", "postgres", "chrono"] }

src/bin/bors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn try_main(opts: Opts) -> anyhow::Result<()> {
8686
let client = create_github_client(
8787
opts.app_id.into(),
8888
"https://api.github.com".to_string(),
89-
opts.private_key.into_bytes().into(),
89+
opts.private_key.into(),
9090
)?;
9191
let repos = RepositoryLoader::new(client.clone())
9292
.load_repositories(&team_api)

src/github/api/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use anyhow::Context;
55
use arc_swap::ArcSwap;
66
use octocrab::models::{App, AppId, InstallationRepositories, Repository};
77
use octocrab::Octocrab;
8-
use secrecy::{ExposeSecret, SecretVec};
8+
use secrecy::{ExposeSecret, SecretString};
99

1010
use client::GithubRepositoryClient;
1111

@@ -23,9 +23,9 @@ fn base_github_html_url() -> &'static str {
2323
pub fn create_github_client(
2424
app_id: AppId,
2525
github_url: String,
26-
private_key: SecretVec<u8>,
26+
private_key: SecretString,
2727
) -> anyhow::Result<Octocrab> {
28-
let key = jsonwebtoken::EncodingKey::from_rsa_pem(private_key.expose_secret().as_ref())
28+
let key = jsonwebtoken::EncodingKey::from_rsa_pem(private_key.expose_secret().as_bytes())
2929
.context("Could not encode private key")?;
3030

3131
Octocrab::builder()

src/github/webhook.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl WebhookSecret {
3535
}
3636

3737
pub fn expose(&self) -> &str {
38-
self.0.expose_secret().as_str()
38+
self.0.expose_secret()
3939
}
4040
}
4141

src/tests/mocks/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl GitHubMockServer {
8585
create_github_client(
8686
default_app_id().into(),
8787
self.mock_server.uri(),
88-
GITHUB_MOCK_PRIVATE_KEY.as_bytes().to_vec().into(),
88+
GITHUB_MOCK_PRIVATE_KEY.into(),
8989
)
9090
.unwrap()
9191
}

0 commit comments

Comments
 (0)