Hi All,
One of our business requirements is to allow special characters as a part of the data which will be saved into couchbase. Is it safe to allow special characters like ’ , ‘’ , @ , () , / , * into the the database ? We are concerned about Injection and XSS.
Appreciate if any can provide some guidance on how to safely allow special characters
Couchbase is key value store.
key is string, value can be JSON or binary
special characters you refer will be part of string. what ever JSON spec allowed those allowed. JSON spec tells what is escape characters how to escape them.
You can pass the data as parameter values, as long as they’re valid characters. Depending on how/where you’re constructing the values, the escaping rules will vary. (e.g. if using the Java SDK with string literals, then Java rules for quoting special characters in string literals apply).
Of course in this example JSON rules still apply - just to how the characters are provided as the parameter data.
The result from the API is JSON (note the valid escaping is still present); SDKs will typically process this for you and provide the returned data in native types.
Yes, using named or positional parameters instead of putting the values directly in the query string is a good technique to protect against SQL injection.