fix permissions of files to allow running as non-root by plevart · Pull Request #10515 · swagger-api/swagger-ui · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

fix permissions of files to allow running as non-root #10515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

plevart
Copy link

@plevart plevart commented Jul 3, 2025

Description

Fix file and directory permissions of the docker image. Some were to broad, some were not adequate.

This is a fix for issue #10505

Motivation and Context

With this fix, I'm able to run the image in the OpenShift where the UID of the process is chosen by the OpenShift. It should work with any UID.

How Has This Been Tested?

I deployed the image into the OpenShift environment.

My PR contains...

A change to the Dockerfile which consists of:

Files copied into the /etc/nginx/templates/ directory need not have permission 0666 (writable for all) since they are never (over)written, just read. They now have permission 0644 (standard writable for root only).

Executable scripts copied into the /docker-entrypoint.d/ directory had permission 0555 (read execute for all), but it is more standard to have permission 0755 (also write for root). Root can write to any file regardless of permission, so this is just making the permission reflect the ability.

Files copied into the /usr/share/nginx/html/ directory need not have permission 0666 (writable for all) since they are never (over)written, just read. They now have permission 0644 (standard writable for root only). Except one: swagger-initializer.js, which is chmod-ed later.

Files copied into the /usr/share/nginx/configurator directory need not have permission 0666 (writable for all) since they are never (over)written, just read. They now have permission 0644 (standard writable for root only).

Permission 0777 (read write execute for all) is needed just for directories that will be written to (files created into):
/etc/nginx/conf.d/ /usr/share/nginx/html/ /var/cache/nginx/ /var/run/

Non-executable files that will be overwritten need only 0666 (read write for all):
/etc/nginx/conf.d/default.conf /usr/share/nginx/html/swagger-initializer.js

The directories that are auto-created while copying files need to have the executable permission (standard for reading only is 0755) so files can be searched in them:
/etc/nginx/templates /usr/share/nginx/configurator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.