mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-31 18:20:45 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63d7a2b997 | ||
|
|
7681f2904d | ||
|
|
378ad688b7 | ||
|
|
c6487ed632 | ||
|
|
62a6974004 | ||
|
|
998288261a | ||
|
|
8ab7167eaf |
@@ -1,9 +1,16 @@
|
||||
/* Fira Code, including characters used by Rich output, like the "heavy right-pointing angle bracket ornament", not included in Google Fonts */
|
||||
@import url(https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css);
|
||||
/* Noto Color Emoji for emoji support with the same font everywhere */
|
||||
@import url(https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap);
|
||||
|
||||
/* Override default code font in Material for MkDocs to Fira Code */
|
||||
:root {
|
||||
--md-code-font: "Fira Code", monospace;
|
||||
--md-code-font: "Fira Code", monospace, "Noto Color Emoji";
|
||||
}
|
||||
|
||||
/* Override default regular font in Material for MkDocs to include Noto Color Emoji */
|
||||
:root {
|
||||
--md-text-font: "Roboto", "Noto Color Emoji";
|
||||
}
|
||||
|
||||
.termynal-comment {
|
||||
|
||||
@@ -7,6 +7,20 @@ hide:
|
||||
|
||||
## Latest Changes
|
||||
|
||||
## 0.122.1
|
||||
|
||||
### Fixes
|
||||
|
||||
* 🐛 Fix hierarchical security scope propagation. PR [#5624](https://github.com/fastapi/fastapi/pull/5624) by [@kristjanvalur](https://github.com/kristjanvalur).
|
||||
|
||||
### Docs
|
||||
|
||||
* 💅 Update CSS to explicitly use emoji font. PR [#14415](https://github.com/fastapi/fastapi/pull/14415) by [@tiangolo](https://github.com/tiangolo).
|
||||
|
||||
### Internal
|
||||
|
||||
* ⬆ Bump markdown-include-variants from 0.0.5 to 0.0.6. PR [#14418](https://github.com/fastapi/fastapi/pull/14418) by [@YuriiMotov](https://github.com/YuriiMotov).
|
||||
|
||||
## 0.122.0
|
||||
|
||||
### Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
|
||||
|
||||
__version__ = "0.122.0"
|
||||
__version__ = "0.122.1"
|
||||
|
||||
from starlette import status as status
|
||||
|
||||
|
||||
@@ -278,7 +278,9 @@ def get_dependant(
|
||||
use_security_scopes = security_scopes or []
|
||||
if isinstance(param_details.depends, params.Security):
|
||||
if param_details.depends.scopes:
|
||||
use_security_scopes.extend(param_details.depends.scopes)
|
||||
use_security_scopes = use_security_scopes + list(
|
||||
param_details.depends.scopes
|
||||
)
|
||||
sub_dependant = get_dependant(
|
||||
path=path,
|
||||
call=param_details.depends.dependency,
|
||||
|
||||
@@ -17,5 +17,5 @@ griffe-warnings-deprecated==1.1.0
|
||||
# For griffe, it formats with black
|
||||
black==25.1.0
|
||||
mkdocs-macros-plugin==1.4.1
|
||||
markdown-include-variants==0.0.5
|
||||
markdown-include-variants==0.0.6
|
||||
python-slugify==8.0.4
|
||||
|
||||
45
tests/test_security_scopes_dont_propagate.py
Normal file
45
tests/test_security_scopes_dont_propagate.py
Normal file
@@ -0,0 +1,45 @@
|
||||
# Ref: https://github.com/tiangolo/fastapi/issues/5623
|
||||
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from fastapi import FastAPI, Security
|
||||
from fastapi.security import SecurityScopes
|
||||
from fastapi.testclient import TestClient
|
||||
from typing_extensions import Annotated
|
||||
|
||||
|
||||
async def security1(scopes: SecurityScopes):
|
||||
return scopes.scopes
|
||||
|
||||
|
||||
async def security2(scopes: SecurityScopes):
|
||||
return scopes.scopes
|
||||
|
||||
|
||||
async def dep3(
|
||||
dep1: Annotated[List[str], Security(security1, scopes=["scope1"])],
|
||||
dep2: Annotated[List[str], Security(security2, scopes=["scope2"])],
|
||||
):
|
||||
return {"dep1": dep1, "dep2": dep2}
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/scopes")
|
||||
def get_scopes(
|
||||
dep3: Annotated[Dict[str, Any], Security(dep3, scopes=["scope3"])],
|
||||
):
|
||||
return dep3
|
||||
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_security_scopes_dont_propagate():
|
||||
response = client.get("/scopes")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"dep1": ["scope3", "scope1"],
|
||||
"dep2": ["scope3", "scope2"],
|
||||
}
|
||||
Reference in New Issue
Block a user