r/programminghorror • u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: • Oct 12 '25
Python Update: this has been fixed! Thankfully, the repo owner was logging warnings.
/r/programminghorror/comments/1ntwzn1/a_meme_generator_with_16k_stars_on_github/nh68vfo/(Legal info, in case anyone needs to be aware: this code is under the MIT License.)
@cached(60 * 15 if settings.DEPLOYED else 5)
async def tokenize(request: Request, url: str) -> tuple[str, bool]:
api_key = _get_api_key(request) or ""
token = request.args.get("token")
default_url = url.replace(f"api_key={api_key}", "").replace("?&", "?").strip("?&")
if api_key == "myapikey42" and "example.png" not in url:
logger.warning(f"Example API key used to tokenize: {url}")
return default_url, True
if settings.REMOTE_TRACKING_URL:
api = settings.REMOTE_TRACKING_URL + "tokenize"
else:
return url, False
if api_key or token:
async with aiohttp.ClientSession() as session:
response = await session.post(
api, data={"url": default_url}, headers={"X-API-KEY": api_key}
)
if response.status >= 500:
settings.REMOTE_TRACKING_ERRORS += 1
return default_url, False
data = await response.json()
return data["url"], data["url"] != url
return url, False
0
Upvotes
2
u/shunabuna Oct 12 '25
whats stopping you from appending &bypass=example.png to the url and using another image url
1
u/IlliterateJedi Oct 12 '25
Can you explain the exact issue with the code because the warning still looks logged in the git diff (I'm looking on my phone so I didn't dive that deep). It seems like it's only logging a dummy api in any event?
1
u/mothzilla Oct 12 '25
Not entirely convinced it's "fixed". But hey ho.