Skip to content

Commit

Permalink
Tighten up cors settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Sep 16, 2024
1 parent 981b9e2 commit 6450e68
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
4 changes: 1 addition & 3 deletions ooniapi/services/ooniauth/src/ooniauth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ async def lifespan(app: FastAPI):
app, metric_namespace="ooniapi", metric_subsystem="ooniauth"
)

# TODO: temporarily enable all
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origin_regex="^https://[-A-Za-z0-9]+(\.test)?\.ooni\.(org|io)$",
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down
3 changes: 1 addition & 2 deletions ooniapi/services/oonifindings/src/oonifindings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ async def lifespan(app: FastAPI):
app, metric_namespace="ooniapi", metric_subsystem="oonifindings"
)

# TODO: temporarily enable all
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origin_regex="^https://[-A-Za-z0-9]+(\.test)?\.ooni\.(org|io)$",
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ async def lifespan(app: FastAPI):
app, metric_namespace="ooniapi", metric_subsystem="oonimeasurements"
)

# TODO: temporarily enable all
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origin_regex="^https://[-A-Za-z0-9]+(\.test)?\.ooni\.(org|io)$",
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down
3 changes: 1 addition & 2 deletions ooniapi/services/ooniprobe/src/ooniprobe/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ async def lifespan(app: FastAPI):
app, metric_namespace="ooniapi", metric_subsystem="ooniprobe"
)

# TODO: temporarily enable all
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origin_regex="^https://[-A-Za-z0-9]+(\.test)?\.ooni\.(org|io)$",
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
Expand Down
4 changes: 1 addition & 3 deletions ooniapi/services/oonirun/src/oonirun/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ async def lifespan(app: FastAPI):
app, metric_namespace="ooniapi", metric_subsystem="oonirun"
)

# TODO: temporarily enable all
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origin_regex="^https://[-A-Za-z0-9]+(\.test)?\.ooni\.(org|io)$",
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down

0 comments on commit 6450e68

Please sign in to comment.