Description
The secfilter
module in kamcmd
currently allows duplicate entries when adding values to certain lists (e.g., blacklists, whitelists). This can lead to unexpected behavior and potential inconsistencies. Could you clarify the reason behind accepting duplicate values?
Recently, I submitted a pull request to add delete commands to the secfilter
module #4089. When a user, for example, executes:
kamcmd secfilter.del_bl user 1005
I iterate through the entire list to ensure all occurrences of 1005
are removed, as I realized duplicates might exist. This is inefficient and could be avoided by preventing duplicates in the first place.
Proposed Solutions
Prevent Duplicates in Existing add
Commands:
add
commands to directly prevent the addition of duplicate values. This would simplify future operations and improve performance.Introduce New add_unique
Commands:
add
commands for backward compatibility.add_unique
commands (e.g., secfilter.add_bl_unique
) that explicitly reject duplicate entries.Recommendation
I recommend implementing the first solution (preventing duplicates in existing add
commands) as it provides the most straightforward and efficient approach.
Further Considerations
add
operation and returning an appropriate error message if a duplicate is encountered.secfilter
module's documentation.I would appreciate your feedback and guidance on the best course of action.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.