Skip to content

Commit 391c250

Browse files
committed
add USER to dockerfile for scanners
1 parent ba3fd40 commit 391c250

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ COPY --from=build /out /App
1414
COPY dab-config.json /App/dab-config.json
1515
WORKDIR /App
1616
ENV ASPNETCORE_URLS=http://+:5000
17+
18+
# Run as the non-root "app" user (UID/GID 64198) that ships with the
19+
# mcr.microsoft.com/dotnet/aspnet base image. DAB is just an ASP.NET Core
20+
# process and does not require root privileges. Declaring USER explicitly
21+
# sets the image's Config.User field so image scanners (e.g. Checkmarx One)
22+
# that require a non-root user in the final stage are satisfied.
23+
# Port 5000 is above 1024 so a non-root user can bind to it without CAP_NET_BIND_SERVICE.
24+
USER app
25+
1726
ENTRYPOINT ["dotnet", "Azure.DataApiBuilder.Service.dll"]

0 commit comments

Comments
 (0)