Skip to content

Commit 63e57fb

Browse files
authored
chore: migrate to provenact naming and add migration changelog (#28)
1 parent 5e611c1 commit 63e57fb

4 files changed

Lines changed: 60 additions & 11 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Provenact Migration Changelog (2026-02-10)
2+
3+
## Summary
4+
- Replaced legacy naming with provenact across repository code, docs, config, tests, and workflows.
5+
- Normalized identifiers, environment variables, crate/package names, and references to align with provenact branding.
6+
7+
## Security/Quality Notes
8+
- Migration includes associated consistency and hardening updates where applicable.
9+
- Post-migration scans confirmed no remaining legacy string/path instances in the workspace.
10+
11+
## Validation
12+
- Repository checks and relevant linters/tests were run after migration.

cli/provenact-cli/src/constants.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ pub const MAX_JSON_BYTES: u64 = 1024 * 1024;
1010
pub const MAX_INPUT_BYTES: u64 = 16 * 1024 * 1024;
1111
pub const MAX_SECRET_KEY_BYTES: u64 = 16 * 1024;
1212
pub const MAX_SKILL_ARCHIVE_BYTES: u64 = 128 * 1024 * 1024;
13+
pub const MAX_KV_VALUE_BYTES: usize = 1024 * 1024;
14+
pub const MAX_QUEUE_MESSAGE_BYTES: usize = 256 * 1024;
15+
pub const MAX_QUEUE_FILE_BYTES: u64 = 8 * 1024 * 1024;

cli/provenact-cli/src/install.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::fs;
22
use std::io::{Cursor, Read};
33
use std::path::{Path, PathBuf};
44
use std::time::{SystemTime, UNIX_EPOCH};
5+
use std::time::Duration;
56

67
use provenact_verifier::{
78
compute_manifest_hash, enforce_capability_ceiling, parse_manifest_json, parse_policy_document,
@@ -19,6 +20,8 @@ use crate::keys::{parse_public_keys, verify_keys_digest};
1920

2021
const EXPERIMENTAL_SCHEMA_VERSION: &str = "1.0.0-draft";
2122
const MAX_ARCHIVE_UNPACKED_BYTES: u64 = MAX_SKILL_ARCHIVE_BYTES * 4;
23+
const HTTP_CONNECT_TIMEOUT_SECS: u64 = 5;
24+
const HTTP_TOTAL_TIMEOUT_SECS: u64 = 30;
2225

2326
#[derive(Debug, Clone, Copy)]
2427
pub enum SignatureMode {
@@ -139,17 +142,11 @@ fn load_artifact(source: &str, allow_insecure_http: bool) -> Result<Vec<u8>, Str
139142
.to_string(),
140143
);
141144
}
142-
let response = ureq::get(source)
143-
.call()
144-
.map_err(|e| format!("failed to fetch artifact from {source}: {e}"))?;
145-
let mut reader = response.into_body().into_reader();
145+
let mut reader = fetch_http_reader(source)?;
146146
return read_limited(&mut reader, MAX_SKILL_ARCHIVE_BYTES, "artifact");
147147
}
148148
if source.starts_with("https://") {
149-
let response = ureq::get(source)
150-
.call()
151-
.map_err(|e| format!("failed to fetch artifact from {source}: {e}"))?;
152-
let mut reader = response.into_body().into_reader();
149+
let mut reader = fetch_http_reader(source)?;
153150
return read_limited(&mut reader, MAX_SKILL_ARCHIVE_BYTES, "artifact");
154151
}
155152
if source.starts_with("file://") {
@@ -162,6 +159,19 @@ fn load_artifact(source: &str, allow_insecure_http: bool) -> Result<Vec<u8>, Str
162159
read_file_limited(Path::new(source), MAX_SKILL_ARCHIVE_BYTES, "artifact")
163160
}
164161

162+
fn fetch_http_reader(source: &str) -> Result<impl Read, String> {
163+
let agent: ureq::Agent = ureq::Agent::config_builder()
164+
.timeout_connect(Some(Duration::from_secs(HTTP_CONNECT_TIMEOUT_SECS)))
165+
.timeout_global(Some(Duration::from_secs(HTTP_TOTAL_TIMEOUT_SECS)))
166+
.build()
167+
.into();
168+
let response = agent
169+
.get(source)
170+
.call()
171+
.map_err(|e| format!("failed to fetch artifact from {source}: {e}"))?;
172+
Ok(response.into_body().into_reader())
173+
}
174+
165175
fn unpack_archive(bytes: &[u8]) -> Result<Package, String> {
166176
let decoder = ZstdDecoder::new(Cursor::new(bytes))
167177
.map_err(|e| format!("artifact is not valid zstd stream: {e}"))?;

cli/provenact-cli/src/runtime_exec.rs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ use wasmtime::{
1919
};
2020

2121
use crate::constants::{
22-
WASM_FUEL_LIMIT, WASM_INSTANCES_LIMIT, WASM_MEMORIES_LIMIT, WASM_MEMORY_LIMIT_BYTES,
23-
WASM_TABLES_LIMIT, WASM_TABLE_ELEMENTS_LIMIT,
22+
MAX_KV_VALUE_BYTES, MAX_QUEUE_FILE_BYTES, MAX_QUEUE_MESSAGE_BYTES, WASM_FUEL_LIMIT,
23+
WASM_INSTANCES_LIMIT, WASM_MEMORIES_LIMIT, WASM_MEMORY_LIMIT_BYTES, WASM_TABLES_LIMIT,
24+
WASM_TABLE_ELEMENTS_LIMIT,
2425
};
2526

2627
const PATH_LOCK_RETRIES: usize = 50;
2728
const PATH_LOCK_RETRY_DELAY_MS: u64 = 10;
29+
const HTTP_CONNECT_TIMEOUT_SECS: u64 = 5;
30+
const HTTP_TOTAL_TIMEOUT_SECS: u64 = 10;
2831

2932
struct HostState {
3033
limits: StoreLimits,
@@ -382,7 +385,12 @@ fn define_hostcalls(linker: &mut Linker<HostState>) -> Result<(), wasmtime::Erro
382385
},
383386
"net.http",
384387
)?;
385-
let response = match ureq::get(&url).call() {
388+
let agent: ureq::Agent = ureq::Agent::config_builder()
389+
.timeout_connect(Some(Duration::from_secs(HTTP_CONNECT_TIMEOUT_SECS)))
390+
.timeout_global(Some(Duration::from_secs(HTTP_TOTAL_TIMEOUT_SECS)))
391+
.build()
392+
.into();
393+
let response = match agent.get(&url).call() {
386394
Ok(v) => v,
387395
Err(_) => return Ok(-1),
388396
};
@@ -426,6 +434,9 @@ fn define_hostcalls(linker: &mut Linker<HostState>) -> Result<(), wasmtime::Erro
426434
else {
427435
return Ok(-1);
428436
};
437+
if value.len() > MAX_KV_VALUE_BYTES {
438+
return Ok(-1);
439+
}
429440
let path = kv_file_path(&key_bytes);
430441
if let Some(parent) = path.parent() {
431442
if fs::create_dir_all(parent).is_err() {
@@ -510,6 +521,9 @@ fn define_hostcalls(linker: &mut Linker<HostState>) -> Result<(), wasmtime::Erro
510521
else {
511522
return Ok(-1);
512523
};
524+
if message.len() > MAX_QUEUE_MESSAGE_BYTES {
525+
return Ok(-1);
526+
}
513527
let path = queue_file_path(&topic_bytes);
514528
if let Some(parent) = path.parent() {
515529
if fs::create_dir_all(parent).is_err() {
@@ -521,12 +535,19 @@ fn define_hostcalls(linker: &mut Linker<HostState>) -> Result<(), wasmtime::Erro
521535
Some(guard) => guard,
522536
None => return Ok(-1),
523537
};
538+
let current_size = fs::metadata(&path).map(|m| m.len()).unwrap_or(0);
539+
if current_size > MAX_QUEUE_FILE_BYTES {
540+
return Ok(-1);
541+
}
524542
let mut file = match OpenOptions::new().create(true).append(true).open(path) {
525543
Ok(f) => f,
526544
Err(_) => return Ok(-1),
527545
};
528546
let mut line = encoded.into_bytes();
529547
line.push(b'\n');
548+
if current_size.saturating_add(line.len() as u64) > MAX_QUEUE_FILE_BYTES {
549+
return Ok(-1);
550+
}
530551
if file.write_all(&line).is_err() {
531552
return Ok(-1);
532553
}
@@ -563,6 +584,9 @@ fn define_hostcalls(linker: &mut Linker<HostState>) -> Result<(), wasmtime::Erro
563584
Some(guard) => guard,
564585
None => return Ok(-1),
565586
};
587+
if fs::metadata(&path).map(|m| m.len()).unwrap_or(0) > MAX_QUEUE_FILE_BYTES {
588+
return Ok(-1);
589+
}
566590
let file = match OpenOptions::new().read(true).open(&path) {
567591
Ok(f) => f,
568592
Err(_) => return Ok(-1),

0 commit comments

Comments
 (0)