fix(workspace): gate fixes after the security pass — warn-only advisories, drift gate sees new files, PATH guard appends, literal rm path, prctl arguments as unsigned long
check-all.sh gains a warn-only cargo deny check advisories stage (no nightly job runs yet) and the ts-rs drift gate uses git status --porcelain so a new untracked type file fails too (same in ci.yml); rust-env.sh appends an absolute ~/.cargo/bin only; wasm-build.sh removes the literal packages/core-wasm/pkg; the worker passes the unused prctl arguments as c_ulong and its SAFETY comments no longer claim the kernel checks them.
This commit is contained in:
1 parent
6e2bbec4b0
commit
e58c7be362
5 files changed
+37
-17
No files matched your search
@@ -100,18 +100,22 @@ pub fn apply(limits: &Limits, seccomp: bool) -> Result<(), SandboxError> {
|
||||
/// `PR_SET_DUMPABLE 0` is the kernel-side stop, `RLIMIT_CORE 0` the belt.
|
||||
#[allow(unsafe_code)]
|
||||
fn disable_core_dumps() -> Result<(), SandboxError> {
|
||||
// SAFETY: prctl is a variadic FFI; for PR_SET_DUMPABLE the kernel reads one integer
|
||||
// (the new flag) and requires the three remaining arguments to be zero, which is what is
|
||||
// passed: no pointer, no memory of this process involved, and only this process's flag
|
||||
// changes. The return code is checked below.
|
||||
let rc = unsafe { libc::prctl(libc::PR_SET_DUMPABLE, 0, 0, 0, 0) };
|
||||
/// prctl reads its variadic arguments as unsigned long: the flag value and the
|
||||
/// arguments an option ignores are passed at that width.
|
||||
const NOT_DUMPABLE: libc::c_ulong = 0;
|
||||
const UNUSED: libc::c_ulong = 0;
|
||||
// SAFETY: prctl is a variadic FFI reading its extra arguments as unsigned long; for
|
||||
// PR_SET_DUMPABLE the kernel uses the first one (the new flag) and ignores the other
|
||||
// three, passed at that width: no pointer, no memory of this process involved, and only
|
||||
// this process's flag changes. The return code is checked below.
|
||||
let rc = unsafe { libc::prctl(libc::PR_SET_DUMPABLE, NOT_DUMPABLE, UNUSED, UNUSED, UNUSED) };
|
||||
if rc != 0 {
|
||||
return Err(SandboxError::Rlimit("PR_SET_DUMPABLE".to_owned()));
|
||||
}
|
||||
// SAFETY: PR_GET_DUMPABLE reads this process's flag; the four extra arguments must be
|
||||
// zero and are. The result is the flag (0 expected) or -1 on failure: any non-zero value
|
||||
// is refused below.
|
||||
let dumpable = unsafe { libc::prctl(libc::PR_GET_DUMPABLE, 0, 0, 0, 0) };
|
||||
// SAFETY: PR_GET_DUMPABLE reads this process's flag and ignores the extra arguments,
|
||||
// passed as unsigned-long zeros. The result is the flag (0 expected) or -1 on failure:
|
||||
// any non-zero value is refused below.
|
||||
let dumpable = unsafe { libc::prctl(libc::PR_GET_DUMPABLE, UNUSED, UNUSED, UNUSED, UNUSED) };
|
||||
if dumpable != 0 {
|
||||
return Err(SandboxError::Rlimit(format!(
|
||||
"PR_GET_DUMPABLE = {dumpable}"
|
||||
|
||||
Reference in new issue
Block a user