aws / aws/aws-appsync-community

Feature request: Function to sanitize messages and avoid XSS

Open
#148 0 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

If a request/response contains a malicious script, it would be nice to have a function that automatically sanitizes the string.

Doing it manually, e.g. replacing
`$util.toJson($ctx.result)`
with
`$util.toJson($util.str.toReplace($ctx.result, "script", ""))`
has the risk of inconsistencies and missing exploits.

A sanitize function could look like this instead:
`$util.toJson($util.str.sanitizeHtml($ctx.result))`

Contributor guide

Open the contributing guide

Research direction

The issue names the $util.toJson, $util.str.toReplace, and proposed $util.str.sanitizeHtml entry points, but no implementation files or tests. First locate the existing string utility definitions and the project's testing approach, then establish which malicious-script cases must be covered. Done means the proposed utility consistently sanitizes request or response strings without requiring manual replacements.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql
Domain
api, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.