Skip to content

Instantly share code, notes, and snippets.

@Xe
Last active October 15, 2017 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xe/417bd57649a456ddfcfacda21148fdeb to your computer and use it in GitHub Desktop.
Save Xe/417bd57649a456ddfcfacda21148fdeb to your computer and use it in GitHub Desktop.
mage goroot leak proof of concept
[~/t/d/mage-goroot]
»»»» docker build -t xena/mage-alpine-poc . 1|08:12:03
Sending build context to Docker daemon 3.584kB
Step 1/5 : FROM xena/alpine
---> 76965968fd6b
Step 2/5 : RUN apk add --no-cache mage
---> Running in 8d5e2d303b4f
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch https://xena.greedo.xeserv.us/pkg/alpine/edge/core/x86_64/APKINDEX.tar.gz
(1/14) Installing binutils-libs (2.28-r2)
(2/14) Installing binutils (2.28-r2)
(3/14) Installing gmp (6.1.2-r1)
(4/14) Installing isl (0.18-r0)
(5/14) Installing libgomp (6.4.0-r5)
(6/14) Installing libatomic (6.4.0-r5)
(7/14) Installing pkgconf (1.3.9-r0)
(8/14) Installing libgcc (6.4.0-r5)
(9/14) Installing mpfr3 (3.1.5-r1)
(10/14) Installing mpc1 (1.0.3-r1)
(11/14) Installing libstdc++ (6.4.0-r5)
(12/14) Installing gcc (6.4.0-r5)
(13/14) Installing go (1.9.1-r0)
(14/14) Installing mage (1.0-r0)
Executing busybox-1.27.1-r0.trigger
OK: 287 MiB in 31 packages
---> cf5880a833ae
Removing intermediate container 8d5e2d303b4f
Step 3/5 : COPY /proj /root/go/src/cetacean.club/proj
---> 24799b00a422
Step 4/5 : WORKDIR /root/go/src/cetacean.club/proj
---> b11c9f8454c9
Removing intermediate container 0b887ce991f7
Step 5/5 : RUN mage -l
---> Running in e1ccbe8dcec7
Error: mage.go:6:2: could not import context (cannot find package "context" in any of:
/Users/finchnat/src/github.com/golang/go/src/context (from $GOROOT)
/root/go/src/context (from $GOPATH))
The command '/bin/sh -c mage -l' returned a non-zero code: 1
FROM xena/alpine
RUN apk add --no-cache mage
COPY /proj /root/go/src/cetacean.club/proj
WORKDIR /root/go/src/cetacean.club/proj
RUN mage -l
// +build mage
package main
import (
"context"
)
func Build() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_ = ctx
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment