UnSecureDataError when reading JSON value
See original GitHub issueAffects version: 3.3.0
I have the following key defining a stringified JSON as value stored in Redis:
$ redis-cli -h localhost -p 16379
localhost:16379> get packing:product_scan_220000000111
"{\"shipping_information_id\": 1, \"scanned_product\": {\"id\": 43, \"barcode\": \"220000000111\", \"dimensions\": [334, 36]}, \"added_products\": [], \"packing_auto\": true}"
localhost:16379>
Using this code:
from cashews import cache
...
cache.setup(f"redis://{cfg.redis.host}:{cfg.redis.port}/0",
password=redis_password,
prefix="packing")
result = await cache.get("packing:product_scan_220000000111")
I get an UnSecureDataError
:
Traceback (most recent call last):
File "/home/automation/lib/python3.7/site-packages/aiorun.py", line 212, in new_coro
await coro
File "/home/automation/packing/application.py", line 136, in main
":product_scan_220000000111")
File "/home/automation/packing/application.py", line 39, in cache_logging_middleware
return await call(*args, **kwargs)
File "/home/automation/lib/python3.7/site-packages/cashews/validation.py", line 63, in _invalidate_middleware
return await call(*args, key=key, **kwargs)
File "/home/automation/lib/python3.7/site-packages/cashews/wrapper.py", line 50, in _auto_init
return await call(*args, **kwargs)
File "/home/automation/lib/python3.7/site-packages/cashews/disable_control.py", line 12, in _is_disable_middleware
return await call(*args, **kwargs)
File "/home/automation/lib/python3.7/site-packages/cashews/serialize.py", line 35, in get
return await self._get_value(await super().get(key), key, default=default)
File "/home/automation/lib/python3.7/site-packages/cashews/serialize.py", line 39, in _get_value
return self._process_value(value, key, default=default)
File "/home/automation/lib/python3.7/site-packages/cashews/serialize.py", line 59, in _process_value
raise UnSecureDataError()
cashews.serialize.UnSecureDataError
It the serializer parses the value and splits it on ‘_’ for some check, but I completely miss the background for this.
Is this expected? How can I read this value properly in cashews?
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
What Is JSON and How to Handle an “Unexpected Token” Error
The first thing to do in this situation is to confirm where the error is happening exactly. To ensure the error happens on...
Read more >Error when posting data with cURL - json - Stack Overflow
Your data in -d doesn't seem to be in json format. Try jsonlint to validate json format. Or if you are trying to...
Read more >What is a JSON Injection and How to Prevent it? - Comparitech
We explain everything you need to know about JSON Injection attack, including how it works, and how to detect and prevent it.
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >How to debug "Error while reading data, error message ...
Ensure JSON is valid , search on google or click on the url: “json online viewer” · you may have an invalid JSON...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh, great, haven’t even noticed that possibility 😃 The community may forgive you the breaking change 😉
@rkrell
With a shame I can say that it is possible to get value without any serialization. I did very silly mistake with naming (english is not native for me, I don’t know how it can happened) -
set_row
,get_row
. It should beraw
of courseSo I going to fix this naming without backward compatibility ( for versions 4.x.x)