From f8bdde2e22234e2ee5ca4d4b0b6f555cab95c93b Mon Sep 17 00:00:00 2001 From: Matthias Glastra Date: Wed, 2 Oct 2024 14:31:18 +0200 Subject: [PATCH] chore: Fix linux tracing in commandrun. Signed-off-by: Matthias Glastra --- attestation/commandrun/tracing_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/attestation/commandrun/tracing_linux.go b/attestation/commandrun/tracing_linux.go index 90eb9c24..bebf8032 100644 --- a/attestation/commandrun/tracing_linux.go +++ b/attestation/commandrun/tracing_linux.go @@ -42,7 +42,7 @@ type ptraceContext struct { processes map[int]*ProcessInfo exitCode int hash []cryptoutil.DigestValue - environmentBlockList map[string]struct{} + sensitiveEnvList map[string]struct{} } func enableTracing(c *exec.Cmd) { @@ -57,7 +57,7 @@ func (r *CommandRun) trace(c *exec.Cmd, actx *attestation.AttestationContext) ([ mainProgram: c.Path, processes: make(map[int]*ProcessInfo), hash: actx.Hashes(), - environmentBlockList: r.environmentBlockList, + sensitiveEnvList: r.sensitiveEnvList, } if err := pctx.runTrace(); err != nil { @@ -201,7 +201,7 @@ func (p *ptraceContext) handleSyscall(pid int, regs unix.PtraceRegs) error { if err == nil { allVars := strings.Split(string(environ), "\x00") filteredEnviron := make([]string, 0) - environment.FilterEnvironmentArray(allVars, p.environmentBlockList, func(_, _, varStr string) { + environment.FilterEnvironmentArray(allVars, p.sensitiveVarsList, map[string]struct{}{}, func(_, _, varStr string) { filteredEnviron = append(filteredEnviron, varStr) })