From 3239e2a1f2ef5d9a4c16b9b4e7528f127cfc2928 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Wed, 6 Sep 2023 13:01:28 -0400 Subject: [PATCH] UI: Restrict regex pattern for OAuth secrets The current regex pattern will successfully match if the cache variable contains the pattern anywhere inside the string. Let's restrict the regex pattern such that it requires the pattern to be precisely between the beginning and end of the string with no other characters in between those anchor points. --- UI/cmake/feature-restream.cmake | 2 +- UI/cmake/feature-twitch.cmake | 2 +- UI/cmake/feature-youtube.cmake | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UI/cmake/feature-restream.cmake b/UI/cmake/feature-restream.cmake index 813d45971..de3a5ac72 100644 --- a/UI/cmake/feature-restream.cmake +++ b/UI/cmake/feature-restream.cmake @@ -1,5 +1,5 @@ if(RESTREAM_CLIENTID - AND RESTREAM_HASH MATCHES "(0|[a-fA-F0-9]+)" + AND RESTREAM_HASH MATCHES "^(0|[a-fA-F0-9]+)$" AND TARGET OBS::browser-panels) target_sources(obs-studio PRIVATE auth-restream.cpp auth-restream.hpp) target_enable_feature(obs-studio "Restream API connection" RESTREAM_ENABLED) diff --git a/UI/cmake/feature-twitch.cmake b/UI/cmake/feature-twitch.cmake index 099f4c8e0..f160fb6cd 100644 --- a/UI/cmake/feature-twitch.cmake +++ b/UI/cmake/feature-twitch.cmake @@ -1,5 +1,5 @@ if(TWITCH_CLIENTID - AND TWITCH_HASH MATCHES "(0|[a-fA-F0-9]+)" + AND TWITCH_HASH MATCHES "^(0|[a-fA-F0-9]+)$" AND TARGET OBS::browser-panels) target_sources(obs-studio PRIVATE auth-twitch.cpp auth-twitch.hpp) target_enable_feature(obs-studio "Twitch API connection" TWITCH_ENABLED) diff --git a/UI/cmake/feature-youtube.cmake b/UI/cmake/feature-youtube.cmake index d6675964e..c7e7e9cb0 100644 --- a/UI/cmake/feature-youtube.cmake +++ b/UI/cmake/feature-youtube.cmake @@ -1,7 +1,7 @@ if(YOUTUBE_CLIENTID AND YOUTUBE_SECRET - AND YOUTUBE_CLIENTID_HASH MATCHES "(0|[a-fA-F0-9]+)" - AND YOUTUBE_SECRET_HASH MATCHES "(0|[a-fA-F0-9]+)") + AND YOUTUBE_CLIENTID_HASH MATCHES "^(0|[a-fA-F0-9]+)$" + AND YOUTUBE_SECRET_HASH MATCHES "^(0|[a-fA-F0-9]+)$") target_sources( obs-studio PRIVATE # cmake-format: sortable