feat: add CORS validation, environment configuration matrix, config schema validation, and notification compatibility tests - #767
Open
amanosiadnan-cmyk wants to merge 1 commit into
Conversation
…chema validation, and notification compatibility tests Co-authored-by: Cursor <cursoragent@cursor.com>
|
@amanosiadnan-cmyk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
closes #689
closes #693
closes #694
closes #702
PR Description
Summary
Implements the required production architecture and configuration improvements for Notify-Chain:
• #689: Add CORS Configuration Validation (listener/src/utils/cors-validator.ts, listener/src/config.ts)
• #693: Add Environment Configuration Documentation Matrix (docs/ENVIRONMENT_MATRIX.md, ENVIRONMENT_VARIABLES_AND_SECRETS.md)
• #694: Add Configuration Schema Validation (listener/src/config-schema.ts, listener/src/config.ts)
• #702: Add Notification Schema Compatibility Tests (listener/src/tests/notification-schema-compatibility.test.ts)
────────────────────────────────────────
Detailed Changes by Issue
Add CORS Configuration Validation #689 — Add CORS Configuration Validation
• Created validateCorsOrigin in listener/src/utils/cors-validator.ts to strictly validate allowed origins during application startup.
• Validates URI scheme (requiring http: or https:), rejects malformed origins, and prevents trailing path segments.
• Restricts wildcard origin (*) in production/staging environments, preventing silent fallback to insecure permissive settings.
• Integrated into validateConfig() in listener/src/config.ts and added comprehensive unit tests in listener/src/utils/cors-validator.test.ts.
Add Environment Configuration Documentation Matrix #693 — Add Environment Configuration Documentation Matrix
• Created a single reference table in docs/ENVIRONMENT_MATRIX.md detailing every supported environment variable, data types, required/optional/conditional status, default values,
sensitivity levels (Public vs Secret), and applicable environments (Development, Staging, Production).
• Cross-referenced in docs/LISTENER-CONFIGURATION.md and ENVIRONMENT_VARIABLES_AND_SECRETS.md.
Add Configuration Schema Validation #694 — Add Configuration Schema Validation
• Implemented ConfigurationSchemaValidator in listener/src/config-schema.ts defining explicit type constraints, numeric range limits (e.g. min/max ports, timing bounds), and
allowed enumerated values.
• Integrated into validateConfig to ensure all configuration errors pinpoint the exact offending field path (e.g. [scheduler.pollIntervalMs]).
• Added unit test suite in listener/src/config-schema.test.ts.
Add Notification Schema Compatibility Tests #702 — Add Notification Schema Compatibility Tests
• Added test suite in listener/src/tests/notification-schema-compatibility.test.ts covering consumer payload formats across Discord webhooks, generic webhooks, email, and SMS.
• Verified backward and forward schema compatibility, version stamping (CURRENT_NOTIFICATION_VERSION = 1), and clear error reporting on schema violations.