-
-
Notifications
You must be signed in to change notification settings - Fork 927
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
security: fix CVE 2024 52289 (#12113)
* initial migration Signed-off-by: Jens Langhammer <[email protected]> * migrate tests Signed-off-by: Jens Langhammer <[email protected]> * fix loading Signed-off-by: Jens Langhammer <[email protected]> * fix Signed-off-by: Jens Langhammer <[email protected]> * start dynamic ui Signed-off-by: Jens Langhammer <[email protected]> * initial ui Signed-off-by: Jens Langhammer <[email protected]> * add serialize Signed-off-by: Jens Langhammer <[email protected]> * add error message handling Signed-off-by: Jens Langhammer <[email protected]> * fix/add tests Signed-off-by: Jens Langhammer <[email protected]> * prepare docs Signed-off-by: Jens Langhammer <[email protected]> * migrate to new input Signed-off-by: Jens Langhammer <[email protected]> * fix tests Signed-off-by: Jens Langhammer <[email protected]> --------- Signed-off-by: Jens Langhammer <[email protected]> # Conflicts: # authentik/core/tests/test_transactional_applications_api.py
- Loading branch information
Showing
37 changed files
with
687 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
authentik/providers/oauth2/migrations/0024_remove_oauth2provider_redirect_uris_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 5.0.9 on 2024-11-04 12:56 | ||
from django.apps.registry import Apps | ||
|
||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_redirect_uris(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): | ||
from authentik.providers.oauth2.models import RedirectURI, RedirectURIMatchingMode | ||
|
||
OAuth2Provider = apps.get_model("authentik_providers_oauth2", "oauth2provider") | ||
|
||
db_alias = schema_editor.connection.alias | ||
for provider in OAuth2Provider.objects.using(db_alias).all(): | ||
uris = [] | ||
for old in provider.old_redirect_uris.split("\n"): | ||
mode = RedirectURIMatchingMode.STRICT | ||
if old == "*" or old == ".*": | ||
mode = RedirectURIMatchingMode.REGEX | ||
uris.append(RedirectURI(mode, url=old)) | ||
provider.redirect_uris = uris | ||
provider.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("authentik_providers_oauth2", "0023_alter_accesstoken_refreshtoken_use_hash_index"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="oauth2provider", | ||
old_name="redirect_uris", | ||
new_name="old_redirect_uris", | ||
), | ||
migrations.AddField( | ||
model_name="oauth2provider", | ||
name="_redirect_uris", | ||
field=models.JSONField(default=dict, verbose_name="Redirect URIs"), | ||
), | ||
migrations.RunPython(migrate_redirect_uris, lambda *args: ...), | ||
migrations.RemoveField( | ||
model_name="oauth2provider", | ||
name="old_redirect_uris", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.