Skip to content

Embed license data in binaries at build time with runtime validation and automatic community license - #302

Merged
makr-code merged 7 commits into
developfrom
copilot/compile-license-data-into-binaries
Jan 9, 2026
Merged

makr-code merged 7 commits into
developfrom
copilot/compile-license-data-into-binaries

Conversation

Copilot AI commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

Enables customer-specific ThemisDB builds with embedded license data for offline deployments. License information is compiled into the binary at build time via CMake JSON parsing and validated/displayed at server startup. CMake automatically uses a default community license when no license file is specified.

Implementation

Build-time embedding:

  • CMake reads JSON license file and generates compile-time constants
  • No external dependencies; uses regex parsing for JSON extraction
  • Validates license edition matches build edition
  • Auto-detects and uses community license (config/license_community_default.json) when no license file specified

Runtime validation:

  • License displayed at startup with expiry tracking (30-day warning)
  • HTTP endpoints expose license data: /health (masked key), /version (full details)
  • Thread-safe date calculations with platform-specific functions

Security:

  • License key masked in public endpoints (first 8 chars only)
  • Automatic cleanup of license files in CI/CD workflows
  • RSA signature verification placeholder ready for implementation

Usage

# Build with automatic community license (default)
cmake -B build -S .
cmake --build build --config Release

# Build with custom license for enterprise
cmake -B build -S . \
  -DTHEMIS_EDITION=ENTERPRISE \
  -DTHEMIS_LICENSE_FILE=config/license.json

# License JSON structure
{
  "organization_name": "Company GmbH",
  "license_key": "THEMIS-ENT-2026-XXX",
  "edition": "ENTERPRISE",
  "expiry_date": "2027-12-31",
  "max_nodes": 100,
  "max_cores": -1,
  "max_storage_tb": -1
}

Default Community License

When no license file is specified, CMake automatically embeds:

  • Organization: ThemisDB Community
  • License Key: THEMIS-COMMUNITY-OPENSOURCE
  • Edition: COMMUNITY
  • Expiry: 9999-12-31 (perpetual)
  • Limits: 1 node, unlimited cores/storage

API Response

GET /version
{
  "license": {
    "organization_name": "Company GmbH",
    "license_key": "THEMIS-ENT-2026-ABCD1234-EXAMPLE",
    "edition": "ENTERPRISE",
    "valid": true,
    "days_until_expiry": 365,
    "limits": {
      "max_nodes": 100,
      "max_cores": -1,
      "max_storage_tb": -1
    }
  }
}

Files

Core:

  • include/themis/license_info.h - License data structure and API
  • src/utils/license_info.cpp - Runtime access with embedded constants
  • cmake/CMakeLists.txt - Build-time JSON parsing and macro generation with auto-detection
  • src/main_server.cpp - Startup display and validation
  • src/server/http_server.cpp - HTTP endpoint integration

Documentation:

  • docs/en/guides/LICENSE_EMBEDDING_GUIDE.md - Build process, CI/CD examples (DE/EN)
  • docs/de/guides/LICENSE_EMBEDDING_EPSERVER.md - epServer integration workflows
  • config/license_example.json - Enterprise license template
  • config/license_community_example.json - Community license template
  • config/license_community_default.json - Default community license (auto-used)

Supports offline deployments, air-gapped environments, and automated CI/CD builds with GitHub Actions, Jenkins, GitLab CI, and Docker examples provided.

Original prompt

Wir haben Editionen für die Kosten erhoben werden. Diese sollen individuell mit lizenzdaten kompiliert werden. D.h. die Unternehmensdaten sollen in den binärdaten eingewebt und beim start der Themis geprüft und angezeigt werden. Was ist vorhanden und wie realisieren wir das (offline und CI/CD -- egserver)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add company data embedding in binary for Themis Embed license data in binaries at build time with runtime validation Jan 9, 2026
Copilot AI requested a review from makr-code January 9, 2026 05:57
@makr-code

Copy link
Copy Markdown
Owner

@copilot cmake soll automatisch community license benutzen wenn kein anderes file angegeben wird.

Copilot AI commented Jan 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot cmake soll automatisch community license benutzen wenn kein anderes file angegeben wird.

Implementiert in cf04dc1. CMake verwendet jetzt automatisch config/license_community_default.json wenn keine Lizenzdatei angegeben wird.

Build ohne Lizenzangabe:

cmake -B build -S .
# Output: "No license file specified, using default community license: config/license_community_default.json"

Die Standard-Community-Lizenz enthält:

  • Organization: ThemisDB Community
  • License Key: THEMIS-COMMUNITY-OPENSOURCE
  • Edition: COMMUNITY
  • Expiry: 9999-12-31 (perpetual)
  • Limits: 1 node, unlimited cores/storage

Copilot AI changed the title Embed license data in binaries at build time with runtime validation Embed license data in binaries at build time with runtime validation and automatic community license Jan 9, 2026
@makr-code
makr-code marked this pull request as ready for review January 9, 2026 06:20
@makr-code
makr-code merged commit 0e96318 into develop Jan 9, 2026
@makr-code makr-code added this to the v1.0.2 milestone Mar 11, 2026
Copilot AI added a commit that referenced this pull request May 19, 2026
…back MODIFY, HTTP/2 RAII, Voice JWT auth

Stub #302 (CRITICAL): VoiceApiHandler now accepts optional AuthMiddleware;
validateBearerToken() delegates to auth_->authorize(token,"voice:access").
Stub #280 (HIGH): RopeApiHandler::requireAccess() enforces scope-based RBAC
via AuthMiddleware::extractBearerToken + auth_->authorize, HTTP 403 on deny.
Stub #297 (MEDIUM): applyPluginValidation() signature changed to non-const ref;
MODIFY case applies modified_comment/modified_metadata before persisting.
Stub #298 (MEDIUM): Http2Session ResponseBuffer promoted to named struct in header;
response_buffers_ map with shared_ptr replaces all raw new/delete calls.
Security Hardening Epic marked COMPLETE in src/ROADMAP.md.
Tests: test_stub_remediation_297_298_280_302.cpp + CMakeLists entry.

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/9caa5bd2-9ad9-4aa7-b5e2-2aefedef1209

Co-authored-by: makr-code <[email protected]>
Copilot AI added a commit that referenced this pull request May 20, 2026
…302, #308-311 (10 stubs)

- #290: DistributedTrainer::AllReduceCpuFn injection API; allreduce_cpu() delegates to injected fn, falls back to local-scale for world_size=1
- #291: AdaptiveShardRouter::NlpContextFn injection API; prepareQueryContext() delegates to NLP provider, falls back to keyword patterns
- #296: FeedbackStore::SpamKeywordsProviderFn (static setSpamKeywordsProvider); getSpamKeywords() uses provider when set
- #297: FeedbackStore::applyPluginValidation() (non-const FeedbackEntry&); MODIFY path applies modified_comment/modified_metadata
- #298: Http2Session RAII ResponseBuffer via shared_ptr + response_buffers_ map; no more raw new/delete; sendResponse+sendServerPush+onStreamCloseCallback updated
- #302: VoiceApiHandler::TokenValidatorFn (static setTokenValidatorFn); validateBearerToken() delegates to injected JWT validator
- #308: VoiceAssistant::deleteSession() hard-delete (throws out_of_range if not found); handleDeleteSession() returns HTTP 404 on not-found
- #309: GPUMemoryManager::NvmlTemperatureFn (static setNvmlTemperatureFn); CUDA updateGPUHealth() queries injected fn
- #310: AutoRebalancer::signOperation() all UNSIGNED fallbacks replaced with std::runtime_error (fail-closed)
- #311: PaxosStatePersistence::persistAccept() ConsensusLogEntry populated with index/term/data JSON

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/138b1d85-2afa-4f88-ba0a-761fe11a5fbd

Co-authored-by: makr-code <[email protected]>
makr-code added a commit that referenced this pull request Jun 30, 2026
…ity-stubs

Remove critical security stubs #279 #302: 2PC phase-2 fanout + voice API JWT validation
Copilot AI added a commit that referenced this pull request Jul 19, 2026
- Verify Roadmap Priorities Alignment: P0 wave properly scoped, phases 1-6 concrete/measurable, dates realistic
- Voice API Bearer-Token JWT/OIDC Validation (#302): Correctly marked completed with full implementation evidence
- Verify Future Enhancements Alignment: All 5 design constraints have Target dates, 6/6 interfaces implemented
- Test Coverage Evidence: tests/server/test_server_activation_profile.cpp with 9 passing test cases
- Build Target Verification: module_server_test_server_activation_profile_focused with TIMEOUT=120s, LABELS=server,api
- PRODUCTION_REQUIREMENTS.md Sync: Transport, auth, JWT, rate-limiting, session lifecycle all verified
- Gap Analysis Tracking: 2,172 verified gaps, 654 actionable, P0 remediation wave linked to Q2 2026

All priority validation items passed. Module evidence complete and consistent.
Non-blocking recommendations: Move #302 to CHANGELOG.md on release, document Phase 1 audit results.

Co-authored-by: Copilot <[email protected]>
Copilot AI pushed a commit that referenced this pull request Jul 19, 2026
…nce report

- Update src/server/ROADMAP.md with validation timestamp (2026-07-19)
- Add P0 remediation wave status (2,172 verified gaps; 654 actionable)
- Mark Voice API JWT/OIDC Validation (#302) as validated
- Create ISSUE_5622_CLOSURE_REPORT.md with full acceptance criteria verification
- Create ISSUE_5622_GITHUB_CLOSURE_COMMENT.md for issue closure

All acceptance criteria met (8/8):
- Roadmap priorities properly scoped and measurable
- JWT/OIDC Validation (#302) correctly marked completed
- 9 test cases with 100% pass rate
- Build target validated (TIMEOUT=120s, LABELS=server,api)
- PRODUCTION_REQUIREMENTS.md alignment verified
- Gap analysis synchronized (2,172 gaps; P0 wave linked to Q2 2026)
- Future enhancements aligned with target dates
- Module status confirmed production-ready

Validation timestamp: 2026-07-19T11:32:56Z
Recommendation: Ready for Issue #5622 closure
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