Skip to content

fix: update Open Graph and Twitter image URLs, add robots.txt, enhanc…#90

Closed
debdevops wants to merge 4 commits intomainfrom
security/fix-critical-issues
Closed

fix: update Open Graph and Twitter image URLs, add robots.txt, enhanc…#90
debdevops wants to merge 4 commits intomainfrom
security/fix-critical-issues

Conversation

@debdevops
Copy link
Copy Markdown
Owner

This pull request introduces several important security, configuration, and usability improvements across both the frontend and backend of the ServiceHub application. The most significant changes focus on strengthening connection string validation, enforcing stricter security practices for encryption keys, updating CORS and authentication settings, and improving user-facing messaging and metadata.

Security improvements:

  • Enforced that the encryption key for connection string protection must be set to a cryptographically random value in non-development environments, throwing an exception if not configured properly (ConnectionStringProtector.cs). This change also updates the constructor to require the host environment for this check and updates all related unit tests to provide a mock environment. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
  • Added SSRF (Server-Side Request Forgery) prevention by restricting allowed Service Bus endpoints to only those ending with .servicebus.windows.net (ServiceBusClientFactory.cs).

Configuration and authentication:

  • Updated the CORS allowed origins to the correct production URL in appsettings.Production.json.
  • Enabled authentication by default in appsettings.json ("Authentication": { "Enabled": true }).

Frontend and user experience:

  • Removed the warning toast about using RootManageSharedAccessKey in the connection string on the frontend, simplifying the connection flow for users (ConnectPage.tsx).
  • Updated Open Graph and Twitter image metadata to use .png instead of .svg for better compatibility (index.html). [1] [2]
  • Added a robots.txt file to allow all crawlers and provide a sitemap reference (public/robots.txt).

API and validation:

  • Increased the maximum allowed connection string length from 2048 to 4096 characters, and slightly reduced the allowed lengths for display name and description in CreateNamespaceRequest.cs.
  • Improved error messaging for connection test failures in the API to provide a more generic message and clarified logging. [1] [2]

These changes collectively enhance the security and reliability of the application, ensure correct configuration for production deployments, and improve the overall user and developer experience.…e security checks, and improve connection string validation

…e security checks, and improve connection string validation
- Implemented rate limiting and same-origin enforcement for SPA token generation endpoint to prevent abuse.
- Updated RedactingLogger to return a no-op disposable from BeginScope to avoid null dereference issues.
- Enhanced ApiKeyAuthenticationMiddleware to include OwnerId in context for tenant isolation.
- Added OwnerId and ConnectionStringHash properties to Namespace entity for improved tenant isolation and deduplication.
- Introduced GetByOwnerAsync method in INamespaceRepository to enforce per-caller isolation.
- Improved InMemoryNamespaceRepository to handle OwnerId and ConnectionStringHash correctly, ensuring data integrity.
- Updated ServiceBusClientFactory to provide safer error messages for invalid connection strings.
- Added telemetry filters to redact sensitive data in Application Insights telemetry.
- Created unit tests for new features and enhancements, ensuring robust coverage for telemetry and namespace functionalities.
- Updated appsettings.Production.json to restrict allowed hosts for enhanced security.
- Changed Open Graph and Twitter meta tags to use PNG image instead of SVG.
- Added robots.txt to allow all user agents and specify sitemap location.
- Updated namespace existence check in INamespaceRepository to include owner ID.
- Modified InMemoryNamespaceRepository to implement the new owner ID check.
- Enhanced ConnectionStringProtector to derive keys using HKDF and PBKDF2 for better security.
- Updated unit tests for InMemoryNamespaceRepository to reflect changes in ExistsAsync method.
@debdevops debdevops closed this Apr 6, 2026
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.

1 participant