Skip to content

Commit beccb4c

Browse files
committed
Fix URL parameter injection in shared graph URL handling
restrict share id regex to prevent injection of arbitrary query parameters.
1 parent ce8f5ed commit beccb4c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

actrun.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if [ -x "$CACHED_BINARY" ]; then
6161
echo "✅ Using cached actrun $VERSION"
6262

6363
# Process shared URL if first argument matches the pattern
64-
if [ $# -gt 0 ] && [[ "$1" =~ ^https://app\.actionforge\.dev/shared/(.+\.act)$ ]]; then
64+
if [ $# -gt 0 ] && [[ "$1" =~ ^https://app\.actionforge\.dev/shared/([a-zA-Z0-9_-]+\.act)$ ]]; then
6565
share_id="${BASH_REMATCH[1]}"
6666
echo "🔗 Fetching shared graph: $share_id"
6767

@@ -134,7 +134,7 @@ chmod +x "$CACHED_BINARY"
134134
echo "✅ Unpacked actrun $VERSION"
135135

136136
# Process shared URL if first argument matches the pattern
137-
if [ $# -gt 0 ] && [[ "$1" =~ ^https://app\.actionforge\.dev/shared/(.+\.act)$ ]]; then
137+
if [ $# -gt 0 ] && [[ "$1" =~ ^https://app\.actionforge\.dev/shared/([a-zA-Z0-9_-]+\.act)$ ]]; then
138138
share_id="${BASH_REMATCH[1]}"
139139
echo "🔗 Fetching shared graph: $share_id"
140140

core/graph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ var sharedURLPattern = regexp.MustCompile(`^https://app\.actionforge\.dev/shared
10491049
const shareAPIURL = "https://app.actionforge.dev/api/v2/share/graph/read"
10501050

10511051
func IsSharedGraphURL(graphURL string) bool {
1052-
return strings.HasPrefix(graphURL, "https://")
1052+
return sharedURLPattern.MatchString(graphURL)
10531053
}
10541054

10551055
func ParseSharedGraphURL(graphURL string) (string, bool) {

0 commit comments

Comments
 (0)