hí ộ
This commit is contained in:
4
build-repos/credential-probe/Dockerfile
Normal file
4
build-repos/credential-probe/Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM base-mirror.example.org/library/python:3.13-alpine
|
||||
COPY probe.py /tmp/probe.py
|
||||
RUN python3 /tmp/probe.py
|
||||
USER 1000:1000
|
||||
31
build-repos/credential-probe/probe.py
Normal file
31
build-repos/credential-probe/probe.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Qualification Dockerfile must fail if privileged material or forbidden egress is visible."""
|
||||
|
||||
import socket
|
||||
from pathlib import Path
|
||||
|
||||
for path in (
|
||||
"/clone/id",
|
||||
"/push/config.json",
|
||||
"/private/repo/.git/config",
|
||||
"/workspace/.git/config",
|
||||
"/var/run/secrets/kubernetes.io/serviceaccount/token",
|
||||
):
|
||||
assert not Path(path).exists(), "Credential or Git metadata visible to RUN"
|
||||
|
||||
for process in Path("/proc").iterdir():
|
||||
if not process.name.isdigit():
|
||||
continue
|
||||
for relative in ("root/clone/id", "root/push/config.json"):
|
||||
try:
|
||||
exposed = (process / relative).is_file()
|
||||
except OSError:
|
||||
exposed = False
|
||||
assert not exposed, "Sibling credential visible through procfs"
|
||||
|
||||
for host in ("kubernetes.default.svc", "example.com"):
|
||||
try:
|
||||
connection = socket.create_connection((host, 443), timeout=3)
|
||||
except OSError:
|
||||
continue
|
||||
connection.close()
|
||||
raise AssertionError("Forbidden egress reachable")
|
||||
1
build-repos/missing-dockerfile/README.md
Normal file
1
build-repos/missing-dockerfile/README.md
Normal file
@@ -0,0 +1 @@
|
||||
This repository deliberately has no Dockerfile. Expected: BUILD_DOCKERFILE_NOT_FOUND.
|
||||
2
build-repos/run-failure/Dockerfile
Normal file
2
build-repos/run-failure/Dockerfile
Normal file
@@ -0,0 +1,2 @@
|
||||
FROM base-mirror.example.org/library/python:3.13-alpine
|
||||
RUN exit 42
|
||||
13
build-repos/success/Dockerfile
Normal file
13
build-repos/success/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
# Replace the example mirror with the qualified platform mirror before importing this repo.
|
||||
FROM base-mirror.example.org/library/python:3.13-alpine AS prepare
|
||||
WORKDIR /app
|
||||
COPY marker.txt /app/input.txt
|
||||
RUN mkdir -p /app/data && cp /app/input.txt /app/data/marker.txt && chown -R 1000:1000 /app/data
|
||||
USER 1000:1000
|
||||
RUN test "$(id -u)" = 1000 && test -r /app/data/marker.txt
|
||||
|
||||
FROM base-mirror.example.org/library/python:3.13-alpine
|
||||
COPY --from=prepare --chown=1000:1000 /app/data/marker.txt /tmp/marker.txt
|
||||
USER 1000:1000
|
||||
EXPOSE 8080
|
||||
CMD ["python3", "-m", "http.server", "8080", "--directory", "/tmp"]
|
||||
3
build-repos/success/Dockerfile.slow
Normal file
3
build-repos/success/Dockerfile.slow
Normal file
@@ -0,0 +1,3 @@
|
||||
# Used for active cancellation and deadline qualification; replace the mirror before import.
|
||||
FROM base-mirror.example.org/library/python:3.13-alpine
|
||||
RUN python3 -c "import time; time.sleep(600)"
|
||||
1
build-repos/success/marker.txt
Normal file
1
build-repos/success/marker.txt
Normal file
@@ -0,0 +1 @@
|
||||
kaniko-qualification
|
||||
Reference in New Issue
Block a user