[Bug] Scanner verdict cache survives provider updates
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
main (f011099b)
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
- Enable file scanning and configure a valid scanner provider for a dataset policy.
- Upload a file and let the scanner return a clean verdict.
- Update the provider to a different scanner endpoint and credential, then verify the updated provider.
- Upload the same file content again as a new upload.
The second upload has the same content hash.
✔️ Expected Behavior
The updated scanner should receive the second upload, and its verdict should determine whether the file is allowed.
❌ Actual Behavior
The second upload reuses the clean record stored under the unchanged provider ID, so the updated scanner is not called. The default clean-verdict TTL is 24 hours, allowing the old result to be reused during that period.
This matches the code at f011099b: provider updates save the new configuration and credentials on the existing row, but neither updating nor testing the provider invalidates its stored scan verdicts. Verification only checks scanner connectivity. [1]
The upload path calls _reusable_record() before constructing the scanner. That lookup matches tenant ID, provider ID and content hash, without checking the provider’s configuration or credentials, so a cache hit skips the updated scanner entirely. These are database-backed FileScanRecord records, not a Redis cache. [2] [3]
There is also a broader impact: clean verdicts expire after the configured TTL (24 hours by default), but infected verdicts are reused indefinitely under the same provider ID. Both cases need consideration in a maintainer fix and regression coverage for provider changes. [3] [4]
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.