refactor: code quality fixes#631
Closed
Ayaz-Microsoft wants to merge 3 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR focuses on code quality and security hardening across the frontend and backend by replacing potentially risky patterns (regex/Math.random/SHA1) and tightening runtime defaults (Swagger exposure, security headers).
Changes:
- Frontend: replace a URL-stripping regex with a linear helper; update UUID generation to use
crypto.randomUUID()/ secure random bytes. - Backend: replace SHA1 with SHA256 for partition key derivation; restrict Swagger UI to Development only; refine Azure credential selection in Development.
- Ops: add common security headers in the frontend IIS
web.config.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| App/frontend-app/src/components/documentViewer/pageNumberTab.tsx | Replaces URL prefix-stripping regex with a helper function. |
| App/frontend-app/src/components/chat/chatRoom.tsx | Updates UUID generation to use cryptographically secure APIs. |
| App/frontend-app/public/web.config | Adds security-related HTTP response headers. |
| App/backend-api/Microsoft.GS.DPS/Storage/Components/CosmosDBEntityBase.cs | Switches partition key hashing from SHA1 to SHA256. |
| App/backend-api/Microsoft.GS.DPS.Host/Program.cs | Gates Swagger/SwaggerUI to Development environment. |
| App/backend-api/Microsoft.GS.DPS.Host/Helpers/AzureCredentialHelper.cs | Uses ChainedTokenCredential for Development to support AKS + local dev flows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ter compatibility
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Purpose
Code quality enhancement
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information