diff options
Diffstat (limited to 'src/api/sanitization.js')
-rw-r--r-- | src/api/sanitization.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/api/sanitization.js b/src/api/sanitization.js new file mode 100644 index 0000000..95c8810 --- /dev/null +++ b/src/api/sanitization.js @@ -0,0 +1,14 @@ +function sanitizeRepoName(dirty) +{ + const valid_repo_name = /^[a-zA-Z0-9\.\-_]+$/; + return valid_repo_name.test(dirty); +} + +function sanitizeCommitID(dirty) +{ + const valid_commit_id = /^[a-fA-F0-9]{40}$/; + return valid_commit_id.test(dirty); +} + +module.exports.sanitizeRepoName = sanitizeRepoName; +module.exports.sanitizeCommitID = sanitizeCommitID;
\ No newline at end of file |