You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-30Lines changed: 35 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,51 +13,36 @@ This project isn't just a `Dockerfile`; it's a complete, secure software lifecyc
13
13
- ✅ **Hardened Base Image:** Built on `node:22-alpine` and patches OS packages (`apk upgrade`) during the build to mitigate known vulnerabilities.
14
14
- ✅ **Supply Chain Scanned:** Runs `npm audit` as a mandatory, blocking security gate during the Docker build.
15
15
- ✅ **Least Privilege:** Creates and runs as a dedicated, unprivileged `appuser` instead of `root`.
16
-
- ✅ **Continuous Vulnerability Scanning:** A GitHub Actions workflow (`pr-scan.yml`) automatically scans every pull request with Trivy to prevent new vulnerabilities from being merged.
16
+
- ✅ **Continuous Vulnerability Scanning:** A GitHub Actions workflow (`build-and-scan.yml`) automatically scans every pull request with Trivy to prevent new vulnerabilities from being merged.
17
17
- ✅ **Automated Dependency Management:** Dependabot is configured to automatically create pull requests for updates to the base image, `npm` packages, and the CI/CD actions themselves.
18
18
- ✅ **Formal Security Policies:** Includes a `SECURITY.md` file with a clear policy for vulnerability reporting.
19
19
20
20
## What is included
21
21
22
-
-`Dockerfile` — audited build that performs `apk` upgrades, updates `npm`, creates a non-root user, installs dependencies from `package.json`, runs `npm audit`, and sets the `ENTRYPOINT` to `npx gemini`.
23
-
-`package.json` — minimal file with a dependency on `@google/gemini-cli`.
24
-
-**`.github/workflows/`**: Contains two authoritative workflows:
25
-
-**`pr-scan.yml`**: Builds and scans every pull request.
26
-
-**`release.yml`**: Securely publishes a new versioned image to a container registry upon the creation of a GitHub Release.
22
+
-**`Dockerfile`**: audited build that performs `apk` upgrades, updates `npm`, creates a non-root user, installs dependencies from `package.json`, runs `npm audit`, and sets the `ENTRYPOINT` to `npx gemini`.
23
+
-**`package.json`**: minimal file with a dependency on `@google/gemini-cli`.
24
+
-**`.github/workflows/`**: Contains one authoritative workflow:
25
+
-**`build-and-scan.yml`**: Builds and scans every pull request. Securely publishes a new versioned image to a container registry upon the creation of a GitHub Release.
27
26
-**`.github/dependabot.yml`**: Configuration for automated dependency updates.
28
27
-**`SECURITY.md`**: The official security policy for the project.
29
-
```
30
28
31
-
- The Dockerfile runs `npm audit` during build. In CI you may want to tune the audit policy or run more advanced supply-chain scanning.
32
-
- The image runs as a non-root user. Confirm that any filesystem paths and environment variables used by `gemini` are writable by `appuser`.
33
-
```markdown
29
+
The Dockerfile runs `npm audit` during build. In CI you may want to tune the audit policy or run more advanced supply-chain scanning. The image runs as a non-root user. Confirm that any filesystem paths and environment variables used by `gemini` are writable by `appuser`.
30
+
34
31
## Image summary (from last local scan)
35
32
36
33
- Image: `secure-gemini-cli:latest`
37
34
- OS: alpine 3.22.2
38
35
- Size: ~656.6 MB
39
36
- Trivy scan report (full JSON): `trivy-report.json` (saved in the project root)
40
37
41
-
Trivy findings (quick summary):
42
-
43
-
- I parsed and searched the saved `trivy-report.json` in this repository for vulnerability records. No vulnerability objects were found in the report.
44
-
45
-
Severity counts (from `trivy-report.json`):
46
-
47
-
- CRITICAL: 0
48
-
- HIGH: 0
49
-
- MEDIUM: 0
50
-
- LOW: 0
51
-
- UNKNOWN: 0
52
-
53
38
If you'd like a deeper supply-chain audit (for example, run `npm audit` locally and attempt auto-fixes, or re-run Trivy with a different policy), I can add step-by-step remediation guidance. Otherwise this image's saved scan contains no findings to triage.
54
39
55
40
## Build locally
56
41
57
42
Run the following from the `secure-gemini` directory:
58
43
59
44
```powershell
60
-
docker build -t secure-gemini-cli:latest .
45
+
docker build -t secure-gemini-cli:latest
61
46
```
62
47
63
48
If `npm audit` fails during the Docker build (it may, depending on transient vulnerabilities), you can temporarily allow the build to continue locally by changing the Dockerfile audit step to a non-blocking command (not recommended for CI):
@@ -70,12 +55,16 @@ I recommend addressing audit findings before publishing the image.
70
55
71
56
## Run
72
57
58
+
This image is hosted on GitHub Container Registry (GHCR) and requires a GitHub Personal Access Token (PAT) with the `read:packages` scope for authentication.
59
+
60
+
**Full instructions on token creation and running the image can be found in [USAGE.md](USAGE.md).**
61
+
62
+
The final command requires your Gemini API key:
63
+
73
64
```powershell
74
-
docker run --rm secure-gemini-cli:latest --help
65
+
docker run -it --rm -e GEMINI_API_KEY="YOUR-GEMINI-API-KEY" secure-gemini-cli:latest
75
66
```
76
67
77
-
Because the image uses `npx` as the entrypoint it will run the `gemini` CLI.
78
-
79
68
## How to re-run Trivy locally
80
69
81
70
If you want to re-run the Trivy scan locally (recommended after changes):
@@ -94,10 +83,10 @@ docker run --rm aquasec/trivy:latest image secure-gemini-cli:latest
94
83
95
84
## Git / Commit
96
85
97
-
If you'd like to commit the approved configuration locally, run these PowerShell steps (replace `<your-username>` when adding the remote):
86
+
If you'd like to commit the approved configuration locally, run these PowerShell steps (replace `<folder-location>` and `<your-username>` when adding the remote):
98
87
99
88
```powershell
100
-
cd "D:\My Documents\Docker Projects\secure-gemini"
89
+
cd "<folder-location>"
101
90
# create .gitignore if you haven't already
102
91
@"
103
92
node_modules/
@@ -121,13 +110,29 @@ git push -u origin main
121
110
122
111
## CI: Build and scan
123
112
124
-
A GitHub Actions workflow (`.github/workflows/docker-build-scan.yml`) is included to build and scan the image with Trivy on push to `main`. This performs an automated check and can be adjusted to fail the build on specific severities.
113
+
A GitHub Actions workflow (`.github/workflows/build-and-scan.yml`) is included to build and scan the image with Trivy on push to `main`. This performs an automated check and can be adjusted to fail the build on specific severities.
125
114
126
-
To publish the image from CI (GHCR / Docker Hub), add the appropriate secrets to your repository and enable the `docker-build-scan-publish.yml` workflow. Required secrets for Docker Hub: `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` (or use GHCR with `GITHUB_TOKEN`).
115
+
To publish the image from CI (GHCR / Docker Hub), add the appropriate secrets to your repository and enable the `build-and-scan.yml` workflow. Required secrets for Docker Hub: `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` (or use GHCR with `GITHUB_TOKEN`).
127
116
128
117
## Notes
129
118
130
119
- The Dockerfile runs `npm audit` during build. In CI you may want to tune the audit policy or run more advanced supply-chain scanning.
131
120
- The image runs as a non-root user. Confirm that any filesystem paths and environment variables used by `gemini` are writable by `appuser`.
132
121
122
+
### Key Milestones Achieved:
123
+
124
+
1. Strategy: Shifted from an insecure, ad-hoc installation to a secure, containerised architecture.
125
+
126
+
2. Governance: Established a formal SECURITY.md policy, a LICENSE, and README.md documentation.
127
+
128
+
3. Hardening: Implemented base image vulnerability patching and least-privilege (non-root) execution.
129
+
130
+
4. Supply Chain Security: Integrated mandatory npm audit security gates and a robust `build-and-scan.yml` workflow with Trivy.
131
+
132
+
5. Configuration Management: Codified the entire secure build process in a version-controlled Dockerfile and Git repository.
133
+
134
+
6. Automation: Deployed a full CI/CD pipeline for secure releases and configured Dependabot for proactive, automated dependency management.
135
+
136
+
7. Verification: Successfully validated the entire process with a final, successful local build.
This document provides the high-level security policy for projects that use the `profile-template` as their base. It is intended to be a canonical, easy-to-find security statement that repository owners can adapt per-repo where necessary.
3
+
This document outlines the security policy for the `secure-gemini` project.
4
4
5
5
## Supported Versions
6
6
7
-
Security support depends on the project's branch or release strategy. Repository maintainers should keep their project's dependencies and CI/CD configurations up to date.
7
+
This project provides a configuration (`Dockerfile`) for building a secure container image. The security of the final image is dependent on the versions of the components at build time. I am committed to keeping the configuration in the `main` branch up-to-date with the latest secure practices.
8
8
9
-
| Version | Supported |
10
-
| ------- | --------- |
11
-
|`main` (or `master`) branch |:white_check_mark:|
9
+
| Version | Supported |
10
+
| ------- | ------------------|
11
+
|`master` branch |:white_check_mark:|
12
12
| Releases (Tags) |:white_check_mark:|
13
-
| Older commits |:x:|
13
+
| Older commits |:x:|
14
14
15
-
Users are responsible for pulling the latest changes and rebuilding any artifacts (for example container images) to receive security updates.
15
+
**User Responsibility:**Users are responsible for pulling the latest changes from the `master` branch and rebuilding their images to ensure they have the most recent security patches and dependency versions. My CI/CD pipeline (`pr-scan.yml`) continuously validates the security of the `main` branch.
16
16
17
17
## Reporting a Vulnerability
18
18
19
-
We take security vulnerabilities seriously and prefer coordinated disclosure. Please do not file security reports as public issues.
19
+
I take all security vulnerabilities seriously. I believe in coordinated disclosure and appreciate the community's help in keeping our project secure.
20
20
21
-
Preferred reporting methods:
21
+
**How to Report a Vulnerability:**
22
22
23
-
1. Use GitHub's private vulnerability reporting feature (the "Security" tab) when available.
24
-
2. Email the primary maintainer. (Update the email address in the repository's README to a monitored address.)
23
+
Please **DO NOT** report security vulnerabilities through public GitHub issues.
25
24
26
-
What to expect from us:
25
+
Instead, please report them directly via one of the following methods:
26
+
***Primary Method:** Use GitHub's private vulnerability reporting feature, available under the "Security" tab of this repository.
27
27
28
-
1. Acknowledge receipt within 72 hours.
29
-
2. Provide an initial assessment of impact and validity.
30
-
3. Work on a fix and provide updates until a patch is released.
31
-
4. Coordinate public disclosure after a fix is published.
28
+
**What to Expect:**
32
29
33
-
## Security responsibilities
30
+
When you report a vulnerability, I will make every effort to:
31
+
1. Acknowledge receipt of your report within 72 hours.
32
+
2. Provide an initial assessment of the vulnerability's validity and impact.
33
+
3. If the vulnerability is accepted, I will work on a fix and aim to release a patch.
34
+
4. Keep you informed of our progress. I will coordinate with you on the public disclosure of the vulnerability after a fix has been released.
34
35
35
-
Maintainers should:
36
-
37
-
- Keep CI workflows (tests, linting, and security scanners) up to date.
38
-
- Regularly update base images and dependencies.
39
-
- Use secret scanning and dependency vulnerability scanning where available.
40
-
- Provide clear instructions for reproducing and verifying fixes.
41
-
42
-
If you are a contributor or user with security questions, please consult this document and contact the maintainers using the reporting methods above.
0 commit comments