T09 · Insecure Skill Coding Practices
- Location
scripts/karakeep-script.sh:95- Finding
Bookmark deletion is not protected by the required confirmation control
- Content
View full analysis
Vulnerability Details
File Location:
scripts/karakeep-script.sh, lines 95–108
Vulnerability Type: Missing confirmation for a destructive operation
Risk Level: MediumVulnerable Code
bash # Delete bookmark # Usage: kb-delete <bookmark_id> kb-delete() { check_config || return 1 local bookmark_id="$1" if [ -z "$bookmark_id" ]; then echo "Usage: kb-delete <bookmark_id>" return 1 fi curl -s -X DELETE "$KARAKEEP_API_URL/bookmarks/$bookmark_id" \ -H "Authorization: Bearer $KARAKEEP_API_KEY" echo "Deleted bookmark: $bookmark_id" }Technical Analysis
SKILL.mdexplicitly requires the user to be asked for confirmation before a bookmark is deleted. The implementation does not enforce that requirement: supplying a nonempty bookmark ID immediately sends an authenticated HTTPDELETErequest.Relying only on an instruction in the documentation is insufficient because the function can be invoked directly by an agent, automation, or user without following the documented workflow. The function also uses silent
curloutput without--failor HTTP status validation and unconditionally prints a deletion-success message. Consequently, unsuccessful requests can be represented as successful deletions.Attack Path
- The script is sourced in an environment containing a valid
KARAKEEP_SERVER_URLandKARAKEEP_API_KEY. - An agent, automation process, or user invokes
kb-deletewith the ID of an existing bookmark. - The function validates only that the ID is nonempty.
- It immediately sends an authenticated
DELETErequest without prompting for confirmation or requiring an explicit confirmation token. - The targeted bookmark is deleted if the configured API key is authorized.
- The function prints
Deleted bookmarkregardless of whether the server actually accepted the request.
Impact Assessment
Exploitation does not grant ...[truncated 440 chars]
- The script is sourced in an environment containing a valid
- Remediation
View remediation
Remediation Suggestions
- Require an explicit confirmation argument, such as
--confirm, before issuing the request. - For interactive use, display the target bookmark ID and require an exact confirmation response.
- Keep confirmation enabled by default; do not silently bypass it in noninteractive environments.
- Consider separating preparation and execution so the agent can present the planned deletion before it occurs.
- Use
curl --fail-with-bodyand inspect the exit status or HTTP status code. - Print the success message only after the server confirms successful deletion.
- Return a nonzero status on transport failures and non-successful HTTP responses.
- Apply equivalent safeguards to other destructive operations where user intent should be reconfirmed.
Example hardened pattern:
bash kb-delete() { check_config || return 1 local bookmark_id="$1" local confirmation="$2" if [ -z "$bookmark_id" ]; then echo "Usage: kb-delete <bookmark_id> --confirm" return 1 fi if [ "$confirmation" != "--confirm" ]; then echo "Deletion requires explicit confirmation." return 1 fi if curl --fail-with-body -sS -X DELETE \ "$KARAKEEP_API_URL/bookmarks/$bookmark_id" \ -H "Authorization: Bearer $KARAKEEP_API_KEY"; then echo "Deleted bookmark: $bookmark_id" else echo "Failed to delete bookmark: $bookmark_id" >&2 return 1 fi }- Require an explicit confirmation argument, such as
