#2024.6, issue with GEOIP object in policy

1 messages · Page 1 of 1 (latest)

abstract inlet
#

After updating to 2024.6 my geoip policy no longer works.

    result = True
else:
    result = context["geoip"].country.iso_code in ['PL', 'DE']
return result```
Policy that worked in 2024.4.2
#

Full exception trace:
Error in 2024.6:

    "asn": {
        "asn": XXXXX,
        "as_org": "XXXXX",
        "network": "XXXXX"
    },
    "geo": {
        "lat": XXXXX,
        "city": "XXXXX",
        "long": XXXXX,
        "country": "PL",
        "continent": "EU"
    },
    "binding": {
        "pk": "XXXXX",
        "app": "authentik_policies",
        "name": "Binding from Flow vyre-auth (vyre-auth) #1 to Policy vyre-ip-geoblock-only-pl",
        "model_name": "policybinding"
    },
    "message": "Traceback (most recent call last):\n  File \"vyre-ip-geoblock-only-pl\", line 7, in <module>\n  File \"vyre-ip-geoblock-only-pl\", line 5, in handler\nbuiltins.AttributeError: 'dict' object has no attribute 'country'",
    "request": {
        "obj": {
            "pk": "XXXXX",
            "app": "authentik_flows",
            "name": "vyre-auth",
            "model_name": "flow"
        },
        "user": {
            "pk": 1,
            "email": "",
            "username": "AnonymousUser",
            "is_anonymous": true
        },
        "debug": false,
        "context": {
            "asn": {
                "asn": XXXXX,
                "as_org": "XXXXX",
                "network": "XXXXX"
            },
            "geoip": {
                "lat": XXXXX,
                "city": "XXXXX",
                "long": XXXXX,
                "country": "PL",
                "continent": "EU"
            }
        },
        "http_request": null
    },
    "policy_uuid": "XXXXX",
    "http_request": {
        "args": {
            "next": "/"
        },
        "path": "/api/v3/flows/executor/vyre-auth/",
        "method": "GET",
        "user_agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36"
    }
}
User
{
    "pk": 1,
    "email": "",
    "username": "AnonymousUser",
    "is_anonymous": true
}```
#

Just looking at it quickly it seems that "geoip" was changed to "geo"

outer plover
#

No, the name is the same

#

It was changed to a dictionary though so you have to use [""] instead of . to access child members

#

We’ll need to update the release notes for this or revert the behaviour cc @icy hedge

abstract inlet
#

Thanks for clarification, I'll change it on my end in the meantime and follow the release notes in case it's reverted

#

the documentation still uses old notation

icy hedge
#

I'll get those changes to the release notes in, and update the docs