Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ updates:
day: "monday"
time: "06:00"
timezone: "Europe/Berlin"
ignore:
- dependency-name: "dtolnay/rust-toolchain"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/checkout@v7

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@1.120.0
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v7

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@1.120.0
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

Expand Down
68 changes: 33 additions & 35 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "vault"
version = "1.0.29"
authors = ["timglabisch <glabisch@easybill.de>"]
version = "1.0.30"
authors = ["Plattform Team <server@easybill.de>"]
edition = "2024"

[dependencies]
Expand Down
6 changes: 3 additions & 3 deletions src/commands/get_multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ pub fn get_multi(input: &str, key_map: &KeyMap) -> Result<()> {
Err(error) => {
errors.push(format!(
"could decode key {}. maybe it's not valid utf8?, error: {}",
&secret_key.secret, error
secret_key.secret, error
));
}
};
}
Err(error) => errors.push(format!(
"could not decrypt key {}, error: {}",
&secret_key.secret, error
secret_key.secret, error
)),
};
}
Expand All @@ -94,7 +94,7 @@ pub fn get_multi(input: &str, key_map: &KeyMap) -> Result<()> {
Err(error) => {
errors.push(format!(
"could decode template {}. error: {}",
&template.template, error
template.template, error
));
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl Crypto {

pub fn key_encrypt(public_key: &PublicKey, key: &[u8; KEY_SIZE]) -> Result<Vec<u8>> {
let rsa = openssl::rsa::Rsa::public_key_from_pem(public_key.data())
.with_context(|| format!("invalid public key {}", &public_key.name()))?;
.with_context(|| format!("invalid public key {}", public_key.name()))?;

// Since this is a low level function, we can only encrypt data that is less than the
// size of a signature minus the identifier marker of the padding (11 for PKCS1).
Expand All @@ -122,7 +122,7 @@ impl Crypto {

pub fn key_decrypt(private_key: &PrivateKey, encrypted_key: &[u8]) -> Result<Vec<u8>> {
let rsa = Rsa::private_key_from_pem(private_key.data())
.with_context(|| format!("invalid private key {}", &private_key.name()))?;
.with_context(|| format!("invalid private key {}", private_key.name()))?;

// The maximal encrypted data can only be the size of the signature minus the identifier
// marker of the padding (11 for PKCS1). The OpenSSL Rust crate currently doesn't properly
Expand Down
6 changes: 3 additions & 3 deletions src/key/key_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl KeyMap {
{
let secret_path = format!(
"./.vault/secrets/{subscription}/{username}.crypt",
subscription = &raw_subscription,
subscription = raw_subscription,
username = username
);

Expand Down Expand Up @@ -193,7 +193,7 @@ impl KeyMap {
lookup_paths.push(fs::read_dir(&config.path_private_key).with_context(|| {
format!(
"private key directory {path} is not readable",
path = &config.path_private_key
path = config.path_private_key
)
})?);

Expand Down Expand Up @@ -315,7 +315,7 @@ impl KeyMap {
let decoded_config_file: ConfigToml = toml::from_str(&raw_config).map_err(|_| {
anyhow!(
"could not parse toml file {file}",
file = &config_file_path.display()
file = config_file_path.display()
)
})?;

Expand Down
8 changes: 4 additions & 4 deletions src/rotate_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ fn rename_user(username_from: &str, username_to: &str) -> Result<()> {
if fs::metadata(&rename.to).is_ok() {
return Err(anyhow!(
"could not copy from {from} to {to}, file/dir already exists",
from = &rename.from,
to = &rename.to
from = rename.from,
to = rename.to
));
}

fs::rename(&rename.from, &rename.to).map_err(|error| {
anyhow!(
"could not copy from {from} to {to}, error: {error}",
from = &rename.from,
to = &rename.to,
from = rename.from,
to = rename.to,
)
})?;
}
Expand Down