refactor: remove naive XSS blocking and extract magic numbers #90
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.
Title: refactor: remove naive XSS blocking and extract magic numbers
Description:
Do not block <script> at the validation layer.
Data Integrity: If the database refuses to store text, it is essentially corrupting user intent.
Database Role: Should store text faithfully; use parameterized queries to prevent SQL Injection.
Frontend Role: Should render text safely; use escaping/sanitization to prevent XSS.
Result: Blocking input creates false security and breaks valid inputs.
Extracted Constants: Magic numbers (e.g., 10000, 255) are now defined as MAX_TASK_LENGTH, MAX_SESSION_ID_LENGTH, etc., at the top of the file.
3. Backend Factory Refactor
createBackendinfactory.tsto solve a race condition where `initialize(could be called twice on the same backend instance.
creation. Each path now returns early upon success, making the initialization logic deterministic
and safer.
4. Vector Interface Standardization
initialize(): Promise<void>to theVectorBackendinterface.implement a standard async startup sequence.
5. Unified Backend Lifecycle
2 - Fix: Added
initialize(): Promise<void>toGraphBackendandLearningBackendinterfaces.3 - Improvement: All backend types (Vector, Graph, Learning) now share a consistent async
lifecycle contract. This enables predictable startup orchestration and future-proofs the system fo
complex backends (e.g., Rust/WASM bridges, remote connections) that require initialization time.