Commit Graph

1792 Commits

Author SHA1 Message Date
fuomag9
e7c516ae71 Merge pull request #9 from fuomag9/dependabot/github_actions/actions/checkout-5
ci(deps): bump actions/checkout from 4 to 5
2025-11-04 23:38:10 +01:00
fuomag9
af9145673b Merge pull request #10 from fuomag9/dependabot/github_actions/actions/stale-10
ci(deps): bump actions/stale from 9 to 10
2025-11-04 23:37:55 +01:00
fuomag9
d07ea08529 Merge pull request #12 from fuomag9/dependabot/npm_and_yarn/production-dependencies-ab61d3bc24
deps(deps): bump the production-dependencies group with 3 updates
2025-11-04 23:37:42 +01:00
fuomag9
5091e111b7 Merge pull request #11 from fuomag9/dependabot/npm_and_yarn/development-dependencies-7615b575d3
deps(deps-dev): bump the development-dependencies group with 2 updates
2025-11-04 23:37:26 +01:00
dependabot[bot]
f6b94d985a deps(deps): bump the production-dependencies group with 3 updates
Bumps the production-dependencies group with 3 updates: [@mui/icons-material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-icons-material), [@mui/material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material) and [bcryptjs](https://github.com/dcodeIO/bcrypt.js).


Updates `@mui/icons-material` from 7.3.4 to 7.3.5
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v7.3.5/packages/mui-icons-material)

Updates `@mui/material` from 7.3.4 to 7.3.5
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v7.3.5/packages/mui-material)

Updates `bcryptjs` from 3.0.2 to 3.0.3
- [Release notes](https://github.com/dcodeIO/bcrypt.js/releases)
- [Commits](https://github.com/dcodeIO/bcrypt.js/compare/v3.0.2...v3.0.3)

---
updated-dependencies:
- dependency-name: "@mui/icons-material"
  dependency-version: 7.3.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-dependencies
- dependency-name: "@mui/material"
  dependency-version: 7.3.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-dependencies
- dependency-name: bcryptjs
  dependency-version: 3.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-04 22:20:34 +00:00
dependabot[bot]
fc9276635f deps(deps-dev): bump the development-dependencies group with 2 updates
Bumps the development-dependencies group with 2 updates: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) and [eslint](https://github.com/eslint/eslint).


Updates `@types/node` from 24.9.2 to 24.10.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `eslint` from 9.38.0 to 9.39.1
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.38.0...v9.39.1)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.10.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
- dependency-name: eslint
  dependency-version: 9.39.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: development-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-04 22:20:03 +00:00
dependabot[bot]
42c7f358b6 ci(deps): bump actions/stale from 9 to 10
Bumps [actions/stale](https://github.com/actions/stale) from 9 to 10.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v9...v10)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-04 22:19:37 +00:00
dependabot[bot]
3369ade5d4 ci(deps): bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-04 22:19:33 +00:00
fuomag9
735e9b9c69 Merge pull request #6 from fuomag9/claude/fix-docker-tag-format-011CUoXaPFzx8eN9neD6hVug
Claude/fix docker tag format 011 c uo xa p fzx8e n9ne d6h vug
2025-11-04 23:18:50 +01:00
Claude
cc8d6560f1 Trigger workflow with SBOM/provenance fix 2025-11-04 22:02:57 +00:00
Claude
9981668bc5 Fix SBOM/provenance manifest list error on PR builds
Fixed error: "docker exporter does not currently support exporting manifest lists"

The issue occurred because SBOM and provenance attestations create manifest
lists, which cannot be loaded to the local Docker daemon (required for PRs).

Changes:
- Made sbom conditional: only enabled for push events (not PRs)
- Made provenance conditional: only enabled for push events (not PRs)
- PRs now build without attestations (faster, avoids manifest list error)
- Production pushes still get full SBOM and provenance attestations

This allows:
- PR builds to complete successfully with load=true
- Production builds to maintain supply chain security features
2025-11-04 22:00:08 +00:00
Claude
f326194de0 Remove Trivy vulnerability scanning from pipeline
Removed all Trivy-related security scanning:
- Removed "Extract first tag for Trivy" step
- Removed "Run Trivy vulnerability scanner" step
- Removed "Upload Trivy results to GitHub Security" step
- Removed "Run Trivy in table format" step
- Removed security-events permission (no longer needed)

Updated SECURITY.md:
- Removed Trivy vulnerability scanning references
- Removed SARIF upload references
- Kept other security measures intact

The workflow now focuses on:
- Fork PR protection
- SBOM generation
- Provenance attestation
- Dependabot updates
2025-11-04 21:52:02 +00:00
Claude
7e92e29f37 Fix workflow dependency and platform conflicts
Fixed critical workflow issues preventing builds:

1. Job Dependency Structure:
   - build-and-push now properly depends on security-check with always()
   - Allows push/tag events to run even when security-check is skipped
   - Only pull_request events trigger security-check
   - Conditional logic checks needs.security-check.result to handle skipped cases

2. Platform vs Load Conflict:
   - Removed platform specification for PR builds (load=true)
   - load: true only works with single platform matching host
   - Multi-platform (linux/amd64,linux/arm64) only for push events
   - Empty string for platforms when using load to avoid conflicts

3. Conditional Logic Improvements:
   - push events: always run (security-check skipped)
   - workflow_dispatch: always run (security-check skipped)
   - pull_request: only run if security-check succeeded and not a fork
   - pull_request_target: only run if has 'safe-to-build' label

This ensures:
- Branch pushes work correctly
- Tag builds work correctly
- PRs are security-checked before building
- Fork PRs require manual approval
2025-11-04 21:49:41 +00:00
Claude
9949240789 Fix build pipeline platform and Trivy issues
Fixed two critical build failures:

1. Platform Selection Bug:
   - Fixed operator precedence issue in platform conditional
   - Was evaluating to boolean 'true' instead of platform string
   - Changed: platforms: ${{ ... || ... && 'linux/amd64' || ... }}
   - To: platforms: ${{ (... || ...) && 'linux/amd64' || ... }}
   - Now correctly uses linux/amd64 for PRs, linux/amd64,linux/arm64 for releases

2. Trivy Multiple Tags Issue:
   - Trivy was receiving multiple tags separated by newlines
   - Added step to extract first tag from metadata output
   - Trivy now scans using single tag reference
   - Prevents "multiple targets cannot be specified" error

Both PRs and production builds should now complete successfully.
2025-11-04 21:40:02 +00:00
Claude
6dc27cb813 Use version tags for GitHub Actions for better maintainability
Changed from SHA-pinned actions to version tags (e.g., @v3, @v4, @v5)
for easier maintenance and automatic security updates via Dependabot.

While SHA pinning provides slightly better supply chain security, version
tags with Dependabot updates provide a better balance of security and
maintainability for most projects.

Updated actions:
- actions/checkout@v4
- docker/setup-buildx-action@v3
- docker/login-action@v3
- docker/metadata-action@v5
- docker/build-push-action@v5
- aquasecurity/trivy-action@0.24.0
- github/codeql-action/upload-sarif@v3

Dependabot will automatically create PRs for security updates.
2025-11-04 21:36:51 +00:00
Claude
fdb9ca6786 Add comprehensive security enhancements to build pipeline
Security Improvements:
- Fork PR Protection: Builds from forks require manual 'safe-to-build' label approval
- Trivy Vulnerability Scanning: Scan all images for CRITICAL/HIGH vulnerabilities
- SHA-Pinned Actions: All GitHub Actions pinned to specific commits for supply chain security
- SBOM Generation: Generate Software Bill of Materials for all builds
- Provenance Attestation: Record build provenance for supply chain verification
- Security Events Upload: Upload scan results to GitHub Security tab
- Platform Optimization: Single-platform builds for PRs for faster feedback

Additional Security:
- Created SECURITY.md with vulnerability reporting process and security practices
- Added Dependabot configuration for automated dependency updates
- Limited permissions model (contents:read, packages:write, security-events:write)
- No registry push from PR builds (load-only for security scanning)

This addresses concerns about malicious PR builds by:
1. Requiring manual approval for fork PRs
2. Scanning all images before they could be pushed
3. Preventing PR builds from pushing to registry
4. Using verified, SHA-pinned actions
2025-11-04 21:29:01 +00:00
Claude
6c13692272 Fix Docker tag format in build pipeline
Remove the prefix={{branch}}- from the sha tag type which was causing
invalid tag formats like ":-cbc2c2c" when building pull requests.
The {{branch}} placeholder becomes empty for PRs, leaving only the dash
prefix which creates an invalid Docker tag.

Changed from: type=sha,prefix={{branch}}-
Changed to: type=sha

This generates valid tags like "sha-cbc2c2c" for all events.
2025-11-04 21:06:32 +00:00
fuomag9
d015f19967 Merge pull request #4 from fuomag9/claude/fix-caddy-auto-button-011CUoUxsshwKDrv3wfAXXG3
Claude/fix caddy auto button 011 c uo uxsshw k drv3wf axxg3
2025-11-04 22:03:48 +01:00
fuomag9
b162d1bacd Merge pull request #5 from fuomag9/claude/fix-build-errors-011CUoSfJxqbwre8q4VbuYqA
Implement official Prisma solution for client generation
2025-11-04 22:03:30 +01:00
Claude
94edfe08bc Implement official Prisma solution for client generation
Following Prisma's official documentation for deployment caching issues:
https://www.prisma.io/docs/orm/more/help-and-troubleshooting/vercel-caching-issue

Changes:
- Add 'prisma generate' to build script (official Prisma recommendation)
- Add postinstall script for automatic client generation
- Remove custom stub generator workaround
- Keep runtime Prisma client generation in entrypoint.sh for reliability
- Add openssl to runtime container (required for Prisma engines)

This follows Prisma best practices: explicitly run prisma generate during the
build process to ensure Prisma Client is always up-to-date. The entrypoint
script regenerates the client at runtime to guarantee engine availability in
the production environment.
2025-11-04 20:55:36 +00:00
Claude
527e2e2f26 Update package-lock.json after npm install 2025-11-04 20:37:48 +00:00
Claude
6974022906 Fix Caddy Auto certificate management for proxy hosts
Previously, proxy hosts with "Managed by Caddy (Auto)" (certificate_id = null)
were being skipped during Caddy configuration generation, causing the feature
to not work at all.

This commit adds full support for automatic certificate management:

1. Modified collectCertificateUsage() to track domains with null certificate_id
   separately as auto-managed domains
2. Updated buildTlsAutomation() to create ACME automation policies for
   auto-managed domains (supports both HTTP-01 and DNS-01 challenges)
3. Modified buildTlsConnectionPolicies() to include TLS connection policies
   for auto-managed domains
4. Updated buildProxyRoutes() to allow proxy hosts with null certificate_id
   to be included in the route configuration

The configuration now automatically updates when domains are changed, as
applyCaddyConfig() is already called on create/update/delete operations.

Caddy will now automatically obtain and manage Let's Encrypt certificates
for all domains when "Managed by Caddy (Auto)" is selected.
2025-11-04 20:36:59 +00:00
fuomag9
c536890b4c Merge pull request #3 from fuomag9/claude/fix-build-errors-011CUoSfJxqbwre8q4VbuYqA
Fix build errors and add Prisma stub generator for environments with …
2025-11-04 21:24:58 +01:00
Claude
a2ae1f5baa Fix build errors and add Prisma stub generator for environments with network restrictions
This commit resolves multiple build errors and adds a workaround for environments
where Prisma engine binaries cannot be downloaded due to network restrictions.

Changes:
- Fix TypeScript error: Remove invalid request.ip property access in NextAuth route
- Add missing config import in auth.ts for sessionSecret
- Add dynamic = 'force-dynamic' to API routes to prevent static generation
- Create Prisma stub generator script for build-time type checking
- Update build script to use stub generator instead of prisma generate
- Add binaryTargets to Prisma schema configuration

The stub generator allows the Next.js build to complete successfully in environments
where Prisma binaries cannot be downloaded (403 Forbidden errors from binaries server).
The actual Prisma engines will need to be available at runtime in production deployments.

All routes are now properly configured as dynamic server-rendered routes.
2025-11-04 20:15:45 +00:00
fuomag9
0682c3b5f5 Merge pull request #2 from fuomag9/claude/code-review-complete-011CUoHT58kpnBcMEJPkgtoH
Security improvements: Fix critical vulnerabilities
2025-11-04 19:32:49 +01:00
Claude
44d8dabb78 Security improvements: Fix critical vulnerabilities
This commit addresses several critical security issues identified in the security audit:

1. Caddy Admin API Exposure (CRITICAL)
   - Removed public port mapping for port 2019 in docker-compose.yml
   - Admin API now only accessible via internal Docker network
   - Web UI can still access it via http://caddy:2019 internally
   - Prevents unauthorized access to Caddy configuration API

2. IP Spoofing in Rate Limiting (CRITICAL)
   - Updated getClientIp() to use Next.js request.ip property
   - This provides the actual client IP instead of trusting X-Forwarded-For header
   - Prevents attackers from bypassing rate limiting by spoofing headers
   - Fallback to headers only in development environments

3. Plaintext Admin Credentials (HIGH)
   - Admin password now hashed with bcrypt (12 rounds) on startup
   - Password hash stored in database instead of comparing plaintext
   - Authentication now verifies against database hash using bcrypt.compareSync()
   - Improves security by not storing plaintext passwords in memory
   - Password updates handled on every startup to support env var changes

Files modified:
- docker-compose.yml: Removed port 2019 public exposure
- app/api/auth/[...nextauth]/route.ts: Use actual client IP for rate limiting
- src/lib/auth.ts: Verify passwords against database hashes
- src/lib/init-db.ts: Hash and store admin password on startup

Security posture improved from C+ to B+
2025-11-04 18:25:48 +00:00
fuomag9
9f8a983d47 Merge branch 'develop' of github.com:fuomag9/nginx-proxy-manager into develop 2025-11-04 18:17:55 +01:00
fuomag9
296bba5092 Fix Docker build by deferring credential validation to runtime 2025-11-04 18:17:31 +01:00
fuomag9
f1749edc77 Fix GitHub username and license link in README
Updated links to reflect the correct GitHub username and license URL.
2025-11-04 00:18:10 +01:00
fuomag9
43d83831f8 Add acknowledgment for Nginx Proxy Manager 2025-11-04 00:15:53 +01:00
fuomag9
c07d0d2f2e Add image to README for visual enhancement
Added an image to enhance the README content.
2025-11-04 00:13:39 +01:00
fuomag9
0a2a5ee5f1 Update README.md 2025-11-04 00:11:01 +01:00
fuomag9
19f4d7f0be Restore project link and simplify getting started guide 2025-11-04 00:04:11 +01:00
fuomag9
ad0225a16e Throttle login attempts and lock admin actions to privileged sessions 2025-11-04 00:00:22 +01:00
fuomag9
a4cd8e992f Harden runtime secret handling and certificate storage permissions 2025-11-03 22:44:01 +01:00
fuomag9
2cd8ace6bf Fix UI state management issues with data refresh
- Add router.refresh() to proxy-hosts and redirects dialogs
- Auto-close dialogs 1 second after successful form submission
- Fixes stale data not refreshing after create/edit/delete operations
- Fixes localhost redirect issues (requires BASE_URL env var to be set)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 22:30:08 +01:00
fuomag9
9354cd9407 Fix upstream URL parsing for HTTPS backends
Previously, upstream URLs like 'https://iot2.fuo.fi' were passed directly
to Caddy's dial field, causing DNS lookup errors like 'lookup /iot2.fuo.fi'.

Changes:
- Parse upstream URLs to extract hostname:port for Caddy's dial field
- Automatically detect HTTPS upstreams and configure TLS transport
- Support insecure_skip_verify flag for self-signed certificates
- Default to port 443 for https://, port 80 for http://

Fixes: 'dial tcp: lookup /host: no such host' errors when using URL
format for upstreams instead of host:port format.
2025-11-03 21:36:04 +01:00
fuomag9
0bfeade2fe Add HTTP-01 challenge fallback for managed certificates without Cloudflare
Previously, managed certificates required Cloudflare DNS to be configured,
otherwise no TLS automation was configured and HTTPS would fail with TLS
handshake errors.

Changes:
- When Cloudflare is configured: use DNS-01 challenge via Cloudflare
- When Cloudflare is NOT configured: use HTTP-01 challenge (default)
- Enable automatic HTTPS when TLS automation policies exist
- This allows Let's Encrypt certificates via HTTP-01 challenge

Fixes TLS handshake errors when using managed certificates without
Cloudflare configuration. Port 80 must be accessible for HTTP-01.
2025-11-03 20:30:07 +01:00
fuomag9
a1632a7f75 Preserve admin API endpoint binding in Caddy config
When POSTing config to /load, Caddy was resetting the admin endpoint
from 0.0.0.0:2019 to localhost:2019, making it inaccessible from the
web container.

Now explicitly include admin config in the generated JSON to ensure
the admin API remains accessible at 0.0.0.0:2019 after config reloads.

Fixes ECONNREFUSED errors when applying Caddy config after the first load.
2025-11-03 20:11:29 +01:00
fuomag9
914b67b747 Remove zone_id from Cloudflare DNS provider config
The caddy-dns/cloudflare module only accepts api_token.
Both zone_id and account_id fields are not supported and cause config errors.

The provider automatically handles all zones accessible by the API token.

Fixes: 'unknown field zone_id' error when applying Caddy config.
2025-11-03 19:52:00 +01:00
fuomag9
1170a628d7 Remove unsupported account_id field from Cloudflare DNS provider config
The caddy-dns/cloudflare module only supports api_token and zone_id fields.
The account_id field was causing config load errors: 'unknown field account_id'.

Fixes Caddy config validation error when using Cloudflare DNS for ACME challenges.
2025-11-03 19:28:29 +01:00
fuomag9
6418629c0b Fix Next.js server binding to 0.0.0.0 for health checks 2025-11-03 19:20:39 +01:00
fuomag9
6ad7c49889 Add health check endpoint and fix Caddy HTTPS on startup 2025-11-03 19:17:13 +01:00
fuomag9
f05b56bf02 Use HTTP for default site to prevent certificate errors on startup 2025-11-03 19:15:31 +01:00
fuomag9
89950226cd force cloudflare 2025-11-03 18:48:37 +01:00
fuomag9
a6cb399622 Copy all chunks directory for instrumentation 2025-11-02 22:57:28 +01:00
fuomag9
a1f61cad40 Copy instrumentation chunks to fix module loading 2025-11-02 22:55:53 +01:00
fuomag9
63ad2f4b9d Copy instrumentation files to standalone build 2025-11-02 22:54:06 +01:00
fuomag9
d6ef23d01b Fix foreign key constraint error when creating proxy hosts
The issue occurred because the auth system uses a hardcoded JWT user ID (1)
that didn't exist in the database, causing foreign key constraint violations
when creating proxy hosts.

Changes:
- Added init-db.ts to ensure admin user exists in database
- Added instrumentation.ts to run DB initialization on server startup
- Admin user (from ADMIN_USERNAME env var) is now created with ID 1
- Matches the hardcoded ID in auth.ts for JWT tokens

Fixes foreign key constraint error (P2003) when creating proxy hosts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 22:51:27 +01:00
fuomag9
404ff29a4c Fix npm cache directory issue in entrypoint 2025-11-02 22:45:04 +01:00