-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanitize user input #187
Sanitize user input #187
Conversation
A malicious user may be able to forge new log entries or may access unexpected resources.
public void SanitizeFileNameForValidFileNames() | ||
{ | ||
AssertSanitizeFileName("SQUIRRELGENESIS", "SQUIRRELGENESIS"); | ||
AssertSanitizeFileName("JUNIORARK.xyz", "JUNIORARK.xyz"); | ||
AssertSanitizeFileName("PEEVEDBEAM-ANT.MESS.abc", "PEEVEDBEAM-ANT.MESS.abc"); | ||
AssertSanitizeFileName("WEIRD WATER.example", "WEIRD WATER.example"); | ||
AssertSanitizeFileName("AUTOFIRE123.doc", "AUTOFIRE123.doc"); | ||
AssertSanitizeFileName("SUNNY(1).doc", "SUNNY(1).doc"); | ||
AssertSanitizeFileName("ODD_MONKEY.doc", "ODD_MONKEY.doc"); | ||
AssertSanitizeFileName("SILLY,MONKEY.docx", "SILLY,MONKEY.docx"); | ||
AssertSanitizeFileName("CamelCase.bat", "CamelCase.bat"); | ||
AssertSanitizeFileName("SLICKER-CHIPMUNK.bat", "SLICKER-CHIPMUNK.bat"); | ||
} | ||
|
||
[TestMethod] | ||
public void SanitizeFileNameForInvalidFileNames() | ||
{ | ||
AssertSanitizeFileName("CHIPMUNKWALK", " CHIPMUNKWALK "); | ||
AssertSanitizeFileName("SLEEPYBOUNCE", "SLEEPYBOUNCE\n"); | ||
AssertSanitizeFileName("PLOWARK", "PLOWARK\r"); | ||
AssertSanitizeFileName("JUNIORGLEE", "JUNIORGLEE\t"); | ||
AssertSanitizeFileName("LATENTROUTE34", "LATENTROUTE?34"); | ||
AssertSanitizeFileName("TRAWLSOUFFLE", "TRAWLSOUFFLE*"); | ||
AssertSanitizeFileName("VIOLENTIRON", "><VIOLENTIRON\"|"); | ||
AssertSanitizeFileName("YELLOWBAGEL", "YELLOWBAGEL://"); | ||
AssertSanitizeFileName("ZANYWATER", "ZANYWATER$"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REQ: Tests als DataRows umsetzten. So werden gleich alle tests ausgeführt auch wenn einer davon fehlschlägt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PP: Die gefixten Alerts mit Nr. Verlinken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wart noch kurz mit dem Review... Bin nur CodeQL am Testen 😅
/// <summary> | ||
/// GeoPilot API extensions. | ||
/// </summary> | ||
public static class Extensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PP: Umbenenn zu StringExtensions
, da diese Klasse genau das beinhaltet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Danke! Wartet bitte noch mit dem Review... ich schliesse diesen hier wieder 😅
This fixes some CodeQL code scanning alerts.