fix(directory): harden VMACS query construction#226
Open
rlorenzo wants to merge 1 commit into
Open
Conversation
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
==========================================
- Coverage 44.49% 44.49% -0.01%
==========================================
Files 895 895
Lines 51655 51656 +1
Branches 4812 4813 +1
==========================================
Hits 22983 22983
- Misses 28108 28109 +1
Partials 564 564
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
Pull request overview
This PR hardens the Directory area’s VMACS lookup by URL-encoding the loginID value before it’s interpolated into the outbound query string, preventing reserved characters from altering the request.
Changes:
- Encode
loginIDviaUri.EscapeDataString(loginID ?? string.Empty)before building the VMACS query URL. - Remove a no-op
.ToString()call on an already-stringinterpolated value.
- URL-encode the login ID (Uri.EscapeDataString) before interpolating it into the VMACS query URL so reserved characters can't alter the request. - Extract the fixed AUTH token into a named VmacsAuthToken constant instead of a magic literal in the URL string. - Drop a no-op .ToString() on the interpolated string. loginID is a DB-sourced campus login (low exploitability) and the AUTH token is a fixed internal-endpoint value, so this is hygiene/hardening, not a vulnerability fix.
c372293 to
2767fcb
Compare
rlorenzo
commented
Jun 17, 2026
| public class VMACSService | ||
| { | ||
| // Fixed token required by the internal VMACS trust endpoint (not a rotating secret). | ||
| private const string VmacsAuthToken = "06232005"; |
Contributor
Author
There was a problem hiding this comment.
@bsedwards Should this be a config value?
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.
What
Two small hardening changes to
VMACSService.Search:Uri.EscapeDataString(loginID ?? string.Empty)before interpolating into the query URL, so reserved characters can't alter the request. Also drops a no-op.ToString().AUTHtoken to a named constant —VmacsAuthTokeninstead of a magic literal in the URL string.Why
Both surfaced during the CodeQL/agy review work.
loginIDis a DB-sourced campus login (AaudUser.LoginId, passed by bothDirectoryControllercall sites), so exploitability is low; theAUTHvalue is a fixed internal-endpoint token, not a rotating secret. This is hygiene, not a vulnerability fix.Scope note
The agy review suggested further changes (read the response stream directly instead of string→bytes→
MemoryStream, and externalize the token/URL via config + DI). Those are behavior-adjacent / architectural and were deliberately kept out to keep this PR scoped; recommend a separate ticket for the static→DI refactor.