Skip to content

Security hardening: URL encoding, SAS state isolation, JWT validation#8

Merged
System-Admins-ath merged 2 commits intomainfrom
copilot/find-issues-and-optimizations
Feb 20, 2026
Merged

Security hardening: URL encoding, SAS state isolation, JWT validation#8
System-Admins-ath merged 2 commits intomainfrom
copilot/find-issues-and-optimizations

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 20, 2026

Codebase audit found several security issues and a state corruption bug in the SAS URL preview flow.

Security fixes

  • ARM API path injectionsubscriptionId, resourceGroup, accountName interpolated raw into REST URL paths. Added _encArmSegment() wrapper using encodeURIComponent on all ARM URL path segments.

  • URL hash encoding — App link construction used #${item.name} without encoding, breaking URLs with special characters. Now uses encodeURIComponent.

  • JWT structure validation_parseJwt() blindly split and decoded without checking 3-part structure or that the payload is a non-null object.

State corruption fix

  • SAS preview mutated global state_showOpenSasModal called activateSasMode() on every keystroke to preview SAS URL metadata, temporarily corrupting CONFIG.storage and _SAS_STATE. Extracted a pure parseSasUrl() function that returns parsed metadata without side effects. activateSasMode() now delegates to it internally.
// Before: mutate global state → read → undo (race-prone)
const info = activateSasMode(raw);
const state = getSasState();
deactivateSasMode();

// After: read-only parse for preview
const info = parseSasUrl(raw);

Code quality

  • innerHTML → textContent in _showInfoModal's addRow() — uses textContent by default, innerHTML only when explicitly passing trusted HTML.
  • Silent catch blocks — added console.warn to metadata fetch failures in edit/upload flows.

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…tion, JWT validation

Co-authored-by: System-Admins-ath <94194707+System-Admins-ath@users.noreply.github.com>
Copilot AI changed the title [WIP] Review code base for issues and security vulnerabilities Security hardening: URL encoding, SAS state isolation, JWT validation Feb 20, 2026
@System-Admins-ath System-Admins-ath marked this pull request as ready for review February 20, 2026 21:55
@System-Admins-ath System-Admins-ath merged commit 84dca82 into main Feb 20, 2026
2 checks passed
@System-Admins-ath System-Admins-ath deleted the copilot/find-issues-and-optimizations branch February 20, 2026 21:55
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.

2 participants