Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions test-pyramid/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os

import sentry_sdk
from pyramid.config import Configurator
from pyramid.response import Response
from waitress import serve

sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
environment=os.environ.get("ENV", "test"),
traces_sample_rate=1.0,
profiles_sample_rate=1.0,
debug=True,
_experiments={"trace_lifecycle": "stream"},
)


def index(request):
return Response("Hello from Pyramid!")


def error(request):
raise ValueError("help! an error!")


def message(request):
name = request.matchdict.get("name", "World")
return Response(f"Hello, {name}!")

Check failure

Code scanning / CodeQL

Reflected server-side cross-site scripting High test

Cross-site scripting vulnerability due to a
user-provided value
.


def create_app():
with Configurator() as config:
config.add_route("index", "/")
config.add_view(index, route_name="index")

config.add_route("error", "/error")
config.add_view(error, route_name="error")

config.add_route("message", "/message/{name}")
config.add_view(message, route_name="message")

app = config.make_wsgi_app()

return app


if __name__ == "__main__":
app = create_app()
print("Serving on http://localhost:8000")
serve(app, host="0.0.0.0", port=8000)
14 changes: 14 additions & 0 deletions test-pyramid/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]
name = "test-pyramid"
version = "0"
requires-python = ">=3.12"

dependencies = [
"ipdb>=0.13.13",
"pyramid>=2.0",
"sentry-sdk[pyramid]",
"waitress>=3.0",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }
12 changes: 12 additions & 0 deletions test-pyramid/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# exit on first error
set -euo pipefail

# Install uv if it's not installed
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# Run the script
uv run python main.py
Loading