Open
Description
There appears to be something dodgy going on when PR Badge processes JavaScript or injects output into the badge. This was made evident when I attempted to do some more advanced JavaScript processing of the payload
data:
- label: Howdy
message: "$payload.pull_request.labels.filter(label => label.name.toLowerCase().includes('blocked')).map(label => label.name.replace(/blocked /i, '')).join(', ')"
when: "$payload.pull_request.labels.filter(label => label.name.toLowerCase().includes('blocked'))"
The result is the following badge in my PR:
'/red) [<img width="16" alt="Powered by Pull Request Badge" src="https://user-images.githubusercontent.com/1393946/111216524-d2bb8e00-85d4-11eb-821b-ed4c00989c02.png">](https://pullrequestbadge.com/?utm_medium=github&utm_source=NetsoftHoldings&utm_campaign=badge_info)<!-- PR-BADGE: PLEASE DO NOT REMOVE THIS COMMENT -->
- PR Badge could have a dedicated facility for surfacing errors that occur during processing in a nice and clean way.
- PR Badge should probably ensure it correctly treats the input and output data at the correct level of injection and using the correct degree of escaping to avoid causing poor JavaScript to be generated or worse, permitting an unexpected degree of code injection. I suspect there are data injection issues at multiple levels going on here at the same time.
- It would be nice if there were facilities for dumping full objects, such as the
$payload
, for testing, but also to display or pass JSON on to eg. web requests. Ideally amessage: $payload
would just show me the full payload as a JSON string without any hoopla.
Metadata
Metadata
Assignees
Labels
No labels