Fix critical validator/security bugs and harden StitchEDC for production #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Typecheck | |
| run: npm run lint | |
| - name: Unit tests | |
| run: npm test | |
| - name: Dependency audit | |
| run: npm audit --audit-level=high | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Python validator smoke test | |
| run: | | |
| python3 -c " | |
| import json, subprocess, sys | |
| sys.path.insert(0, '.') | |
| from validate_schema import validate_study_setup | |
| # Minimal structurally-valid canonical design to smoke-test the | |
| # Python validator import path and exit-code contract stay intact. | |
| design = { | |
| 'protocol': {'protocol_id': 'NCT-CI-01', 'title': 'CI Smoke Test', 'phase': 'III', 'sponsor': 'CI', 'target_enrollment': 10}, | |
| 'fields': [], 'forms': [], 'events': [], 'epochs': [], 'item_groups': [], | |
| 'stages': [], 'arms': [], 'code_lists': [], 'visit_form_matrix': [], | |
| 'eligibility': {'inclusion_rules': [], 'exclusion_rules': []}, | |
| 'edit_checks': [], 'derivations': [], 'endpoints': [], 'estimands': [], | |
| 'door_rankings': [], 'analysis_gates': [] | |
| } | |
| result = validate_study_setup(design) | |
| assert result['valid'] is True, result | |
| print('Python validator smoke test passed.') | |
| " | |
| - name: Build | |
| run: npm run build |