-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9724131
commit 66fcb77
Showing
6 changed files
with
1,221 additions
and
1,171 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. | ||
// | ||
// This software (Documize Community Edition) is licensed under | ||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html | ||
// | ||
// You can operate outside the AGPL restrictions by purchasing | ||
// Documize Enterprise Edition and obtaining a commercial license | ||
// by contacting <sales@documize.com>. | ||
// | ||
// https://documize.com | ||
|
||
package stringutil | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
// CleanDBValue returns like query minus dodgy characters. | ||
func CleanDBValue(filter string) string { | ||
filter = strings.ReplaceAll(filter, " ", "") | ||
filter = strings.ReplaceAll(filter, " ' ", "") | ||
filter = strings.ReplaceAll(filter, "'", "") | ||
filter = strings.ReplaceAll(filter, " ` ", "") | ||
filter = strings.ReplaceAll(filter, "`", "") | ||
filter = strings.ReplaceAll(filter, " \" ", "") | ||
filter = strings.ReplaceAll(filter, "\"", "") | ||
filter = strings.ReplaceAll(filter, " -- ", "") | ||
filter = strings.ReplaceAll(filter, "--", "") | ||
filter = strings.ReplaceAll(filter, ";", "") | ||
filter = strings.ReplaceAll(filter, ":", "") | ||
filter = strings.ReplaceAll(filter, "~", "") | ||
filter = strings.ReplaceAll(filter, "!", "") | ||
filter = strings.ReplaceAll(filter, "#", "") | ||
filter = strings.ReplaceAll(filter, "%", "") | ||
filter = strings.ReplaceAll(filter, "*", "") | ||
filter = strings.ReplaceAll(filter, "\\", "") | ||
filter = strings.ReplaceAll(filter, "/", "") | ||
filter = strings.ReplaceAll(filter, "union select", "") | ||
filter = strings.ReplaceAll(filter, "UNION SELECT", "") | ||
filter = strings.ReplaceAll(filter, " from ", "") | ||
filter = strings.ReplaceAll(filter, " FROM ", "") | ||
filter = strings.ReplaceAll(filter, " OR 1=1 ", "") | ||
filter = strings.ReplaceAll(filter, " OR 1=1 ", "") | ||
filter = strings.ReplaceAll(filter, " = ", "") | ||
filter = strings.ReplaceAll(filter, "=", "") | ||
|
||
filter = strings.TrimSpace(filter) | ||
|
||
return filter | ||
} |
Oops, something went wrong.