Skip to content

Production config, reply pipeline and STIX/TAXII conformance - #37

Merged
laugiov merged 1 commit into
mainfrom
fix/urgent-blackhat
Aug 6, 2026
Merged

Production config, reply pipeline and STIX/TAXII conformance#37
laugiov merged 1 commit into
mainfrom
fix/urgent-blackhat

Conversation

@laugiov

@laugiov laugiov commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Improvements to the production startup/config, the reply pipeline draft-reuse logic, and STIX 2.1 / TAXII feed conformance. Full test suite (unit + integration + functional) green; PHPStan level 8 and php-cs-fixer clean.

- Validate required configuration at startup; create the initial admin with a provided or generated password
- docker-compose.prod: publish app/n8n on loopback; run n8n as a non-root user
- Reply pipeline: only reuse a prior draft when the validator confirmed it
- STIX/TAXII: UTC Z timestamps, created/modified on attack-patterns, valid relationship time bounds, de-duplicate shared objects

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens production boot/security defaults, hardens the LLM reply retry pipeline to fail closed on unverified security, and updates STIX 2.1 / TAXII feed generation to better match OASIS conformance expectations.

Changes:

  • Production: add a fail-fast secret policy check and switch to creating the initial admin at boot with either ADMIN_PASSWORD or a generated one-time password; stop seeding a known default admin hash in SQL.
  • n8n/compose: run n8n as a non-root user in prod and bind exposed service ports to loopback by default.
  • STIX/TAXII + LLM pipeline: enforce STIX timestamp shape/relationship semantics, dedupe STIX objects by id, and change retry best-of-3 behavior to only allow security-clean drafts.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
n8n/n8n-init.sh Drops root assumptions and updates workflow import fallback to run directly (now needs to remain compatible with root-based dev compose usage).
infra/docker/backend/prod-seed-reference.sql Removes seeded default admin credentials from prod SQL seed.
infra/docker/backend/docker-entrypoint-prod.sh Adds secret validation command and boot-time initial admin creation with optional generated password.
docker-compose.prod.yml Binds backend/n8n ports to loopback by default and runs n8n as non-root node.
backend-symfony/tests/Unit/Security/SecretPolicyTest.php Unit coverage for prod-only secret policy behavior and weak/default detection.
backend-symfony/tests/Unit/Application/Stix/TtpAttackPatternBuilderTest.php Updates relationship stop_time expectations to match STIX 2.1 constraints.
backend-symfony/tests/Unit/Application/Stix/StixOasisConformanceTest.php Adds STIX/OASIS conformance guards (timestamp shape, stop_time, dedupe).
backend-symfony/tests/Unit/Application/LLM/RetryCoordinatorTest.php Updates validator payload shape and adds fail-closed security rejection tests.
backend-symfony/tests/Unit/Application/LLM/RetryCoordinatorMutationTest.php Updates mutation tests for new fail-closed behavior on validator exceptions.
backend-symfony/tests/Unit/Application/LLM/RetryCoordinatorAuditTest.php Adjusts audit tests for validator payload changes (security_pass).
backend-symfony/tests/Functional/Console/CheckSecretsCommandTest.php Functional tests for the prod secret-check console command exit behavior.
backend-symfony/src/UI/Console/CheckSecretsCommand.php Introduces app:security:check-secrets to enforce secret policy in prod.
backend-symfony/src/Security/SecretPolicy.php Implements prod-only secret validation against published defaults and weak markers.
backend-symfony/src/Application/Taxii/TaxiiService.php Dedupes envelope objects by id and changes ISO8601 formatting to UTC-Z with milliseconds.
backend-symfony/src/Application/Stix/TtpAttackPatternBuilder.php Omits invalid/equal stop_time on STIX relationships for single-point sightings.
backend-symfony/src/Application/Stix/ThreatActorStixBuilder.php Adds deterministic created/modified timestamps for MITRE attack-pattern objects.
backend-symfony/src/Application/Stix/StixObjectDeduplicator.php Adds a utility to preserve order while collapsing duplicate STIX objects by id.
backend-symfony/src/Application/LLM/RetryCoordinator.php Restricts best-of-3 fallback to drafts that the validator marked security_pass=true.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread n8n/n8n-init.sh
Comment on lines +114 to +118
# ─── 0. Ensure data directory exists ───
# This runs as the non-root node user (uid 1000). The n8n image ships
# /home/node/.n8n owned by node, so the named volume inherits that ownership —
# no privileged chown is needed.
log "Ensuring /home/node/.n8n exists..."
Comment thread n8n/n8n-init.sh
Comment on lines +309 to 312
# Fallback: CLI import (works without auth but workflows may not be visible to admin).
# Runs as the node user directly (the container is no longer root).
if n8n import:workflow --input="$wf_file" 2>/dev/null; then
log " Imported (CLI): $wf_name"
Comment on lines 882 to 886
try {
return (new \DateTimeImmutable($value))->format(\DateTimeInterface::ATOM);
$dt = $value === '' ? new \DateTimeImmutable('now', $utc) : new \DateTimeImmutable($value);
} catch (\Exception) {
return (new \DateTimeImmutable())->format(\DateTimeInterface::ATOM);
$dt = new \DateTimeImmutable('now', $utc);
}
@laugiov
laugiov merged commit 073419d into main Aug 6, 2026
9 checks passed
@laugiov
laugiov deleted the fix/urgent-blackhat branch August 6, 2026 12:31
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.

2 participants