fix(worker): security audit of R0 — no core dumps, tkill/tgkill limited to SIGABRT on self, mmap without PROT_EXEC, Broken outcome for a broken child environment, frame vs canvas check, unsafe denied with local allows, sandbox tests and derivation on the release profile (syscall marker); wasm proof exports behind a feature; ci: release-images hardened (typed input via env, advisories gate, ephemeral builder, env secrets + logout, ref gate, pinned checkout)
This commit is contained in:
1 parent
9d3e0294e2
commit
11813f5560
14 files changed
+293
-58
No files matched your search
@@ -133,6 +133,7 @@ fn map_image_error(error: ImageError) -> Reject {
|
||||
}
|
||||
|
||||
/// Encodes an RGBA buffer as lossy WebP through libwebp (D-R4: C confined to this process).
|
||||
#[allow(unsafe_code)]
|
||||
pub fn encode_webp(rgba: &[u8], width: u32, height: u32, quality: f32) -> Result<Vec<u8>, Reject> {
|
||||
let expected = (width as usize)
|
||||
.checked_mul(height as usize)
|
||||
@@ -164,6 +165,7 @@ pub fn encode_webp(rgba: &[u8], width: u32, height: u32, quality: f32) -> Result
|
||||
}
|
||||
|
||||
/// Version of the libwebp linked into this binary, as (major, minor, revision).
|
||||
#[allow(unsafe_code)]
|
||||
pub fn libwebp_version() -> (u8, u8, u8) {
|
||||
// SAFETY: a pure getter of the FFI without arguments or side effects.
|
||||
let packed = unsafe { libwebp_sys::WebPGetEncoderVersion() };
|
||||
@@ -235,8 +237,11 @@ impl TestHooks {
|
||||
#[cfg(feature = "test-hooks")]
|
||||
fn run_after_sandbox(&self, stdout: &mut dyn Write, stderr: &mut dyn Write) -> Option<i32> {
|
||||
if !self.seccomp {
|
||||
// Marker for crates/worker/scripts/derive-seccomp.sh: syscalls after this line
|
||||
// are the ones the filter must allow.
|
||||
// Marker for crates/worker/scripts/derive-seccomp.sh: one `sched_yield`, a syscall
|
||||
// the decode path never makes, right where the filter would be installed. The
|
||||
// syscalls after it are the ones the filter must allow. (A string marker is not
|
||||
// readable by strace once PR_SET_DUMPABLE is 0.)
|
||||
std::thread::yield_now();
|
||||
let _ = stderr.write_all(b"SECCOMP-MARKER\n");
|
||||
}
|
||||
match self.action? {
|
||||
|
||||
Reference in new issue
Block a user