Skip to content

feat: complete security baseline and secure configuration - #67

Merged
lahiruudayakumara merged 49 commits into
opencorex-org:mainfrom
lahiruudayakumara:dev
Jul 26, 2026
Merged

lahiruudayakumara merged 49 commits into
opencorex-org:mainfrom
lahiruudayakumara:dev

Conversation

@lahiruudayakumara

Copy link
Copy Markdown
Contributor

Summary

Completes the foundation security baseline with an actionable threat model, fail-closed production configuration, data-protection rules, hardened HTTP responses, CI security gates, and governed risk exceptions.

Closes #17

Changes

Threat model and data protection

  • Document protected assets, authorized and hostile actors, and trust boundaries
  • Threat-model taxpayer, officer, administrator, integration, database, queue, document, observability, and deployment paths
  • Define abuse cases, mitigations, detection signals, and residual deployment risks
  • Classify secrets, taxpayer data, financial records, security evidence, internal configuration, and public information
  • Define encryption, access, logging, retention, legal-hold, export, backup, and disposal requirements

Secure configuration

  • Require an explicit development, test, or production environment
  • Fail production startup unless TLS termination is confirmed
  • Require production secrets through absolute injected-file references
  • Reject raw production database, OIDC, object-storage, and SMTP secrets
  • Apply the same configuration validation to the API, worker, and scheduler
  • Add a credential-free production configuration template

Runtime hardening

  • Add and test:
    • Strict-Transport-Security
    • Content-Security-Policy
    • Permissions-Policy
    • X-Content-Type-Options
    • X-Frame-Options
    • Referrer-Policy
    • Cross-Origin-Opener-Policy
    • Cross-Origin-Resource-Policy
    • Cache-Control: no-store
  • Continue using the minimal non-root runtime container

CI and supply-chain security

  • Validate secure configuration and exception policy in CI
  • Scan source for vulnerabilities, secrets, and IaC misconfiguration
  • Retain existing dependency, license, CodeQL, and container scanning
  • Generate and scan source and image SBOMs
  • Retain SBOM artifacts for security investigations
  • Continue requiring commit-pinned GitHub Actions and committed dependency lockfiles

Security exceptions and incident response

  • Define a machine-validated security-exception format
  • Require an accountable owner, expiry date, affected controls, compensating controls, and recorded risk acceptance
  • Reject incomplete or expired exceptions in CI
  • Require security-maintainer review through CODEOWNERS
  • Prohibit exceptions for cross-tenant access, secret exposure, authentication bypass, ledger integrity, and audit immutability failures
  • Expand private vulnerability reporting, evidence preservation, notification, and exercise guidance

Verification

make security-baseline
make go-format-check go-lint go-test
go build ./...
go tool actionlint .github/workflows/security.yml .github/workflows/container-build.yml
bash scripts/ci/validate-workflows.sh

…ctor scripts, configuration validation, and CI workflows.
…tooling, setup scripts, and configurable Docker services
…service orchestration, and updated documentation
…gates, and document formal release management procedures.
… contract linting while upgrading to Go 1.25.0
…th Redocly, and update CI workflows for schema validation and CodeQL.
…ability requirements in the architecture and development guidelines.
… to application scope, and enhance API error reporting.
…deterministic calculation, and authorization controls
…step versioned payments for payment-to-assessment logic
…ledger balance tracking, and reversal operations with idempotency support
…, reproducible TypeScript client generation, and event schema validation.
…d enhanced observability middleware with sensitive data masking
…with structured logging, and expanded operational runbooks
…ns, readiness checks, and observability middleware with sensitive data redaction
… documentation, and automated compliance validation scripts
…del, and establish security exception procedures.
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@lahiruudayakumara, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 39023623-6c87-46f8-b0e9-05c1fadbcfe2

📥 Commits

Reviewing files that changed from the base of the PR and between 987dfba and e119119.

📒 Files selected for processing (36)
  • .env.production.example
  • .github/CODEOWNERS
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/workflows/container-build.yml
  • .github/workflows/security.yml
  • Makefile
  • apps/api/cmd/api/main.go
  • apps/api/http.go
  • apps/api/http_test.go
  • apps/scheduler/cmd/scheduler/main.go
  • apps/worker/cmd/worker/main.go
  • database/migrations/000002_audit_outbox_observability.up.sql
  • database/queries/outbox.sql
  • deploy/observability/openrevenue-alerts.yml
  • deploy/observability/openrevenue-dashboard.json
  • docs/architecture/event-architecture.md
  • docs/operations/observability.md
  • docs/operations/runbooks.md
  • docs/security/data-protection.md
  • docs/security/incident-response.md
  • docs/security/secrets-management.md
  • docs/security/secure-development.md
  • docs/security/threat-model.md
  • internal/platform/application/metrics.go
  • internal/platform/application/ports.go
  • internal/platform/application/unit_of_work.go
  • internal/platform/application/unit_of_work_test.go
  • pkg/config/security.go
  • pkg/config/security_test.go
  • pkg/middleware/middleware.go
  • pkg/middleware/observability_test.go
  • pkg/problem/problem.go
  • scripts/ci/validate-security-baseline.sh
  • scripts/dev/validate-config.sh
  • security/exceptions/README.md
  • security/exceptions/template.yml.example
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@lahiruudayakumara
lahiruudayakumara enabled auto-merge (squash) July 26, 2026 03:13
@lahiruudayakumara
lahiruudayakumara merged commit 0399658 into opencorex-org:main Jul 26, 2026
13 checks passed
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.

Complete security baseline, threat model, and secure configuration

1 participant