github.com/google/osv-scalibr@v0.4.1/artifact/image/testfixtures/symlink-attack/Dockerfile (about)

     1  # Use Alpine as the builder since the final image is built on scratch
     2  # which doesn't contain the `ln` command to generate symlinks.
     3  FROM alpine:latest as builder
     4  
     5  RUN mkdir dir1
     6  
     7  RUN ln -s ../../secret.txt /dir1/attack-symlink.txt
     8  RUN ln -s /../secret.txt /dir1/attack-symlink-absolute.txt
     9  
    10  # - root
    11  #   - dir1
    12  #     - attack-symlink.txt -> ../../secret.txt
    13  #     - attack-symlink-absolute.txt -> /../secret.txt
    14  
    15  FROM scratch
    16  
    17  # Must copy over the entire directory to preserve the symlinks.
    18  COPY --from=builder /dir1/ /dir1/