feat: enhance CI workflow, add CORS handling, and update documentation#288
Merged
Conversation
- Added Stellar CLI installation and WASM optimization steps to CI workflow. - Improved CORS middleware to default to localhost in development. - Added tests for CORS functionality. - Updated architecture and development documentation for clarity and completeness.
…iggerPoll method to SorobanEventWorker
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Implement Contract CI, Deployment, Documentation, and CORS Security
Summary
Implement Stellar contract CI/CD automation, contract deployment script, developer documentation, and CORS origin whitelisting to improve the development workflow and security posture.
scripts/deploy.sh) to build, optimize, and deploy contracts.Type of Change
Related Issues
Closes #248, Closes #249, Closes #250, Closes #251
Changes Made
1. CI Workflow Enhancement (#248)
.github/workflows/ci.ymlcurl -fsSL https://github.com/stellar/stellar-cli/raw/main/install.sh | sh -s -- --install-depscargo build --target wasm32-unknown-unknown --releaseto compile WASM contractstellar contract optimizestep to optimize generated WASM binaries for deploymentactions/upload-artifact@v42. Contract Deployment Script (#249)
scripts/deploy.sh(new)--networkand--source-accountCLI argumentsstellar contract deployto submit contract to networkdeploy/deployment-info.json(network, WASM path, optimized WASM path, contract ID, raw output)3. Developer Documentation (#250)
docs/DEVELOPMENT.md(new)stellarCLI,jq)scripts/deploy.shdocs/ARCHITECTURE.md(updated)4. CORS Security (#251)
backend/src/app.tsCORS_ALLOWED_ORIGINSenvironment variable (comma-separated list)http://localhost:3000in development when env var is unset{ error: 'CORS origin not allowed' }JSON responsebackend/.env.example(updated)CORS_ALLOWED_ORIGINSusage and development defaultbackend/tests/cors.test.ts(new)Testing
Test Coverage
Test Results
Backend Test Suite (Vitest):
tests/claimable.service.test.ts: ✓ 6 passedtests/cors.test.ts: ✓ 1 passed (new test for CORS 403 response)tests/deprecated.test.ts: ✓ 2 passedtests/rate-limiter.test.ts: ✓ 2 passedtests/stream.test.ts: ✓ 3 passedTotal: 5 test files, 14 tests — all passing
Fixed Issues During Implementation
backend/src/controllers/sse.controller.ts: Madesubscribehandler async to supportawaiton Prisma queriesnpx prisma generateTest Steps
CORS validation:
Verify test file
cors.test.tspasses.Manual CORS test (when server running):
Deploy script validation (requires Stellar testnet setup):
Breaking Changes
Potential Breaking Change: CORS is now restricted by default in production.
http://localhost:3000only. Production requires explicitCORS_ALLOWED_ORIGINSenv var. Non-matching origins receive 403 instead of silent rejection.Migration Guide:
CORS_ALLOWED_ORIGINSto comma-separated list of allowed frontend URLs (e.g.,https://app.flowfi.xyz,https://flowfi.xyz).CORS_ALLOWED_ORIGINS..envis not set (defaults tohttp://localhost:3000).Screenshots/Demo
N/A (infrastructure/backend changes)
Checklist
Additional Notes
scripts/deploy.shrequiresstellarCLI andjqto be available in the environment. CI installs both; local developers should followdocs/DEVELOPMENT.md.npx prisma generateis run before tests if schema changes.