Skip to content

[API Policies] Prompt Template Policy Issue #695

@DakshithaS

Description

@DakshithaS

Overview

Double URL decoding vulnerability in query parameter processing leads to incorrect parameter values and malformed prompts.


Issue Details

Double URL Decoding of Query Parameters

File: prompttemplate.go (lines 186-202)

Description:
The code performs double URL decoding on query parameter values. The url.ParseQuery function already returns URL-decoded values, but the code then calls url.QueryUnescape on values[0], causing incorrect double-decoding.

Example:

Original: %2520 (URL-encoded %20)
ParseQuery: %20 (first decode)
QueryUnescape: (space character) (second decode - INCORRECT)

Proposed Fix:
Remove the url.QueryUnescape call since url.ParseQuery already handles decoding.

Impact:
Template parameters will have incorrect values, leading to malformed prompts and potential security issues.

Reference

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions