{"id":15064728,"url":"https://github.com/nizos/csp-docker","last_synced_at":"2026-01-28T05:57:40.823Z","repository":{"id":252942424,"uuid":"841974876","full_name":"nizos/csp-docker","owner":"nizos","description":"A Docker-based environment for testing and experimenting with Content Security Policies (CSP)","archived":false,"fork":false,"pushed_at":"2024-08-22T05:45:35.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T10:14:37.066Z","etag":null,"topics":["content-security-policy","csp","docker","docker-compose","nginx","security-headers","server"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nizos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T12:21:43.000Z","updated_at":"2024-08-22T05:45:38.000Z","dependencies_parsed_at":"2024-08-13T15:22:22.790Z","dependency_job_id":"eb81a245-ad5d-4e98-88c1-0dc22aa019a8","html_url":"https://github.com/nizos/csp-docker","commit_stats":null,"previous_names":["nizos/csp-docker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nizos%2Fcsp-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nizos%2Fcsp-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nizos%2Fcsp-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nizos%2Fcsp-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nizos","download_url":"https://codeload.github.com/nizos/csp-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243790999,"owners_count":20348385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["content-security-policy","csp","docker","docker-compose","nginx","security-headers","server"],"created_at":"2024-09-25T00:25:48.954Z","updated_at":"2026-01-28T05:57:35.768Z","avatar_url":"https://github.com/nizos.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSP Docker\n\n## Overview\n\nThis project provides a Docker-based environment for testing and experimenting with Content Security Policies (CSP) in Nginx.\n\nThis setup allows developers to quickly modify HTML, CSS, and Nginx configuration files, with immediate reflection of\nchanges in the running container. It's designed for ease of use, making it an ideal tool for experimentation.\n\n## Get Started\n\n### Prerequisites\n\nBefore getting started, ensure you have the following installed on your machine:\n\n- [Docker](https://docs.docker.com/get-docker/)\n- [Docker Compose](https://docs.docker.com/compose/install/)\n\n### Quick Start\n\n**Clone the Repository**:\n\n```shell\ngit clone https://github.com/nizos/csp-docker.git\ncd csp-docker\n```\n\n**Build and Start the Docker Container**:\n\nRun the following command to build the Docker image and start the container:\n\n```shell\ndocker-compose up --build -d\n```\n\nThis command will:\n\n- Build the Docker image if it's not already built.\n- Start the container in detached mode, with the necessary files and configurations mounted as volumes.\n\nOnce the container is running, you can access the application by navigating to [localhost:8080](http://localhost:8080) in your web browser.\n\n## Usage\n\n### Making Changes\n\n#### HTML \u0026 CSS \n\nAny changes you make to the files in the `site` directory (`index.html`, `style.css`) will be automatically updated in the running container.\n\n#### Nginx Configuration\n\nIf you edit the `nginx.conf` file in the `nginx` directory, you'll need to reload Nginx to apply the changes.\n\n### To Reload Nginx\n\nAfter editing the Nginx configuration file, reload Nginx with:\n\n```shell\ndocker exec csp-container nginx -s reload\n```\n\n### To Exec into the Container\n\nIf you need to access the container's shell, use the following command:\n\n```shell\ndocker exec -it csp-container /bin/sh\n```\n\nThis command opens an interactive shell session inside the running container.\n\n## Tips and Tricks\n\n### Calculating the SHA-256 Hash of a File\n\nTo set up a CSP with specific hashes, you may need to calculate the SHA-256 hash of a file.\nHere’s how to do it on different operating systems:\n\n#### On Linux and macOS:\n\n```shell\nopenssl dgst -sha256 -binary yourfile.txt | openssl base64\n```\n\n#### On Windows (using PowerShell):\n\n```shell\nGet-FileHash yourfile.txt -Algorithm SHA256 | ForEach-Object { [convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($_.Hash)) }\n```\n\n### Helpful Resources\n\n- [Nginx Documentation](https://nginx.org/en/docs/)\n- [Docker Documentation](https://docs.docker.com/)\n- [Content Security Policy (CSP) Guide](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n- [CSP Evaluator](https://csp-evaluator.withgoogle.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnizos%2Fcsp-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnizos%2Fcsp-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnizos%2Fcsp-docker/lists"}