Skip to content

Soft version supporting only OpenSSL / Apache mod php - #3

Merged
mroest merged 23 commits into
mainfrom
feature/soft-worker
Apr 30, 2026
Merged

mroest merged 23 commits into
mainfrom
feature/soft-worker

Conversation

@mroest

@mroest mroest commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Transition to an OpenSSL-only version, simplify backend and key configurations, and improve error handling. Introduce performance benchmarking and implement brute-force rate limiting for authentication failures. Update documentation for clarity and add an initial draft of the OWASP ASVS 5.0 Level 1 security audit report.

mroest and others added 22 commits April 28, 2026 20:58
Co-authored-by: Copilot <copilot@github.com>
- Add hrtime-based debug logging to SignController and DecryptController;
  each request logs 'sign completed'/'decrypt completed' with durationMs,
  algorithm, and backend name at LOG_LEVEL=debug
- Extensively fix tools/comprehensive-perf-test.sh to match actual
  implementation:
  - Fix log grep patterns to match new debug messages
  - Fix BACKEND_ERRORS grep (ExceptionSubscriber never logs; use level_name)
  - Fix docker logs --since to use relative 'Xm' format (Docker on this
    version ignores bare Unix timestamps)
  - Fix set -euo pipefail + grep -c interaction (wrap analysis with set +e)
  - Fix declare -A usage (not supported in bash 3.2 on macOS); rewrite
    per-phase table in portable awk
  - Fix restore_log_level() not called when stats collector is stopped
  - Fix hey output parsing (double-% percentile lines, [200] leading spaces)
  - Fix memory parsing (strip / <limit> portion before unit detection)
  - Optimise compute_stats() to single sort pass
- Add docs/performance-benchmark-report.md with results from a 481-second
  four-phase load test (454,274 requests, 0 errors, 0 restarts)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CI workflow was running 'docker compose run --rm app composer check'
which triggered the compose.yaml bind mount (.:/var/www/html). This
overwrote the vendor/ directory baked into the dev image, making
vendor/bin/phplint (and other dev tools) unavailable on CI.

Fix CI by using 'docker run' directly against the built image, which
runs checks against the exact image artifact without any volume mounts.

Also add a named volume for vendor/ in compose.yaml so that local
development correctly uses the image-installed dependencies rather than
an empty host directory.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the named vendor volume with an entrypoint script in the dev
image stage. On container startup, composer install runs against the
bind-mounted source tree, ensuring vendor/ is always in sync with
composer.lock without requiring a named volume or image rebuild.

When arguments are passed (e.g. docker run ... composer check in CI),
the entrypoint runs composer install and then execs the given command
instead of starting Apache.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The base image's /entrypoint.sh handles Apache user setup, cache clear,
directory permissions, and execs the CMD. Chain into it so upstream
changes continue to take effect.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove tests/, phpunit.xml.dist, phpcs.xml, and .phplint.yml from
.dockerignore so PHPStan, PHPUnit, PHPCS and phplint can find them
when running composer check inside the dev image.

Restrict the push trigger to main so feature branches don't run CI
twice (once for push, once for the pull_request event).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace COPY . . in prod stage with explicit copies of only runtime
files (src, config, bin, public, templates, composer files, .env).
Test and dev-tool files (tests/, phpcs.xml, phpunit.xml.dist,
phpstan.neon, phpstan-baseline.neon, .phplint.yml) are now only
copied in the dev stage.

Files must not be in .dockerignore so the dev-stage COPY commands
can access them from the build context.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ng Apache

When docker run is called with arguments (e.g. composer check), the
entrypoint was ignoring them and always launching apache2-foreground,
causing the CI 'Run checks' step to hang indefinitely.

Add an exec "$@" branch: if arguments are provided, execute them
directly; otherwise fall through to the default Apache startup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the Apache startup command to CMD in the Dockerfile so the
entrypoint only does setup (optional composer install) and then
always delegates via 'exec "$@"'.

This is the standard Docker pattern: CMD provides the default
arguments to ENTRYPOINT, and 'docker run ... composer check'
overrides CMD cleanly without any conditional logic in the script.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@mroest mroest left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

7 findings across 2 security violations, 2 requests for change, and 3 optional improvements. Finding #6 (dual log lines in controllers) was intentionally withdrawn — tools/comprehensive-perf-test.sh greps for the debug-level messages to extract timing statistics.

Comment thread config/packages/cache.yaml Resolved
Comment thread src/Security/TokenAuthenticator.php Resolved
Comment thread phpunit.xml.dist Resolved
Comment thread src/Config/ConfigLoader.php Resolved
Comment thread src/Service/KeyRegistry.php Resolved
Comment thread src/Controller/HealthController.php Resolved
Comment thread src/Backend/OpenSslBackend.php Resolved
@mroest
mroest merged commit e759f47 into main Apr 30, 2026
1 check passed
@mroest
mroest deleted the feature/soft-worker branch April 30, 2026 10:04
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