diff --git a/go.mod b/go.mod index ea4489792587..02d0c65e6e70 100644 --- a/go.mod +++ b/go.mod @@ -287,7 +287,7 @@ require ( github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/opencontainers/runc v1.3.0 // indirect + github.com/opencontainers/runc v1.3.3 // indirect github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect diff --git a/go.sum b/go.sum index 808b225ad5a2..76f6487553e1 100644 --- a/go.sum +++ b/go.sum @@ -610,8 +610,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/opencontainers/runc v1.3.0 h1:cvP7xbEvD0QQAs0nZKLzkVog2OPZhI/V2w3WmTmUSXI= -github.com/opencontainers/runc v1.3.0/go.mod h1:9wbWt42gV+KRxKRVVugNP6D5+PQciRbenB4fLVsqGPs= +github.com/opencontainers/runc v1.3.3 h1:qlmBbbhu+yY0QM7jqfuat7M1H3/iXjju3VkP9lkFQr4= +github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI= github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= diff --git a/internal/client-go/api_frontend.go b/internal/client-go/api_frontend.go index 5d78038c9194..4712a26334a5 100644 --- a/internal/client-go/api_frontend.go +++ b/internal/client-go/api_frontend.go @@ -1013,7 +1013,7 @@ func (r FrontendAPICreateBrowserLoginFlowRequest) Via(via string) FrontendAPICre return r } -// An optional identity schema to use for the registration flow. +// An optional identity schema to use for the login flow. func (r FrontendAPICreateBrowserLoginFlowRequest) IdentitySchema(identitySchema string) FrontendAPICreateBrowserLoginFlowRequest { r.identitySchema = &identitySchema return r @@ -2139,7 +2139,7 @@ func (r FrontendAPICreateNativeLoginFlowRequest) Via(via string) FrontendAPICrea return r } -// An optional identity schema to use for the registration flow. +// An optional identity schema to use for the login flow. func (r FrontendAPICreateNativeLoginFlowRequest) IdentitySchema(identitySchema string) FrontendAPICreateNativeLoginFlowRequest { r.identitySchema = &identitySchema return r diff --git a/internal/httpclient/api_frontend.go b/internal/httpclient/api_frontend.go index 5d78038c9194..4712a26334a5 100644 --- a/internal/httpclient/api_frontend.go +++ b/internal/httpclient/api_frontend.go @@ -1013,7 +1013,7 @@ func (r FrontendAPICreateBrowserLoginFlowRequest) Via(via string) FrontendAPICre return r } -// An optional identity schema to use for the registration flow. +// An optional identity schema to use for the login flow. func (r FrontendAPICreateBrowserLoginFlowRequest) IdentitySchema(identitySchema string) FrontendAPICreateBrowserLoginFlowRequest { r.identitySchema = &identitySchema return r @@ -2139,7 +2139,7 @@ func (r FrontendAPICreateNativeLoginFlowRequest) Via(via string) FrontendAPICrea return r } -// An optional identity schema to use for the registration flow. +// An optional identity schema to use for the login flow. func (r FrontendAPICreateNativeLoginFlowRequest) IdentitySchema(identitySchema string) FrontendAPICreateNativeLoginFlowRequest { r.identitySchema = &identitySchema return r diff --git a/oryx/go.mod b/oryx/go.mod index 767f2f3d6884..dd72edbe6adc 100644 --- a/oryx/go.mod +++ b/oryx/go.mod @@ -186,7 +186,7 @@ require ( github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/opencontainers/runc v1.3.0 // indirect + github.com/opencontainers/runc v1.3.3 // indirect github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/procfs v0.17.0 // indirect diff --git a/oryx/go.sum b/oryx/go.sum index 632e1db02f57..ca41f5436bc0 100644 --- a/oryx/go.sum +++ b/oryx/go.sum @@ -418,8 +418,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/opencontainers/runc v1.3.0 h1:cvP7xbEvD0QQAs0nZKLzkVog2OPZhI/V2w3WmTmUSXI= -github.com/opencontainers/runc v1.3.0/go.mod h1:9wbWt42gV+KRxKRVVugNP6D5+PQciRbenB4fLVsqGPs= +github.com/opencontainers/runc v1.3.3 h1:qlmBbbhu+yY0QM7jqfuat7M1H3/iXjju3VkP9lkFQr4= +github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI= github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= diff --git a/oryx/httpx/client_info.go b/oryx/httpx/client_info.go index 7bd62ff453de..1f966e485a59 100644 --- a/oryx/httpx/client_info.go +++ b/oryx/httpx/client_info.go @@ -6,13 +6,16 @@ package httpx import ( "net" "net/http" + "strconv" "strings" ) type GeoLocation struct { - City string - Region string - Country string + City string + Region string + Country string + Latitude *float64 + Longitude *float64 } func GetClientIPAddressesWithoutInternalIPs(ipAddresses []string) (string, error) { @@ -45,10 +48,25 @@ func ClientIP(r *http.Request) string { } } +func parseFloatHeaderValue(headerValue string) *float64 { + if headerValue == "" { + return nil + } + + val, err := strconv.ParseFloat(headerValue, 64) + if err != nil { + return nil + } + + return &val +} + func ClientGeoLocation(r *http.Request) *GeoLocation { return &GeoLocation{ - City: r.Header.Get("Cf-Ipcity"), - Region: r.Header.Get("Cf-Region-Code"), - Country: r.Header.Get("Cf-Ipcountry"), + City: r.Header.Get("Cf-Ipcity"), + Region: r.Header.Get("Cf-Region-Code"), + Country: r.Header.Get("Cf-Ipcountry"), + Longitude: parseFloatHeaderValue(r.Header.Get("Cf-Iplongitude")), + Latitude: parseFloatHeaderValue(r.Header.Get("Cf-Iplatitude")), } } diff --git a/oryx/otelx/semconv/events.go b/oryx/otelx/semconv/events.go index fcbfc1fe1d8f..7e9759a30ac1 100644 --- a/oryx/otelx/semconv/events.go +++ b/oryx/otelx/semconv/events.go @@ -24,17 +24,19 @@ func (a AttributeKey) String() string { } const ( - AttributeKeyIdentityID AttributeKey = "IdentityID" - AttributeKeyNID AttributeKey = "ProjectID" - AttributeKeyClientIP AttributeKey = "ClientIP" - AttributeKeyGeoLocationCity AttributeKey = "GeoLocationCity" - AttributeKeyGeoLocationRegion AttributeKey = "GeoLocationRegion" - AttributeKeyGeoLocationCountry AttributeKey = "GeoLocationCountry" - AttributeKeyWorkspace AttributeKey = "WorkspaceID" - AttributeKeySubscriptionID AttributeKey = "SubscriptionID" - AttributeKeyProjectEnvironment AttributeKey = "ProjectEnvironment" - AttributeKeyWorkspaceAPIKeyID AttributeKey = "WorkspaceAPIKeyID" - AttributeKeyProjectAPIKeyID AttributeKey = "ProjectAPIKeyID" + AttributeKeyIdentityID AttributeKey = "IdentityID" + AttributeKeyNID AttributeKey = "ProjectID" + AttributeKeyClientIP AttributeKey = "ClientIP" + AttributeKeyGeoLocationCity AttributeKey = "GeoLocationCity" + AttributeKeyGeoLocationRegion AttributeKey = "GeoLocationRegion" + AttributeKeyGeoLocationCountry AttributeKey = "GeoLocationCountry" + AttributeKeyGeoLocationLatitude AttributeKey = "GeoLocationLatitude" + AttributeKeyGeoLocationLongitude AttributeKey = "GeoLocationLongitude" + AttributeKeyWorkspace AttributeKey = "WorkspaceID" + AttributeKeySubscriptionID AttributeKey = "SubscriptionID" + AttributeKeyProjectEnvironment AttributeKey = "ProjectEnvironment" + AttributeKeyWorkspaceAPIKeyID AttributeKey = "WorkspaceAPIKeyID" + AttributeKeyProjectAPIKeyID AttributeKey = "ProjectAPIKeyID" ) func AttrIdentityID[V string | uuid.UUID](val V) otelattr.KeyValue { @@ -73,6 +75,12 @@ func AttrGeoLocation(val httpx.GeoLocation) []otelattr.KeyValue { if val.Region != "" { geoLocationAttributes = append(geoLocationAttributes, otelattr.String(AttributeKeyGeoLocationRegion.String(), val.Region)) } + if val.Latitude != nil { + geoLocationAttributes = append(geoLocationAttributes, otelattr.Float64(AttributeKeyGeoLocationLatitude.String(), *val.Latitude)) + } + if val.Longitude != nil { + geoLocationAttributes = append(geoLocationAttributes, otelattr.Float64(AttributeKeyGeoLocationLongitude.String(), *val.Longitude)) + } return geoLocationAttributes } diff --git a/selfservice/flow/login/handler.go b/selfservice/flow/login/handler.go index 3da1916edf04..301b31124317 100644 --- a/selfservice/flow/login/handler.go +++ b/selfservice/flow/login/handler.go @@ -352,7 +352,7 @@ type createNativeLoginFlow struct { // in: query Via string `json:"via"` - // An optional identity schema to use for the registration flow. + // An optional identity schema to use for the login flow. // // required: false // in: query @@ -473,7 +473,7 @@ type createBrowserLoginFlow struct { // in: query Via string `json:"via"` - // An optional identity schema to use for the registration flow. + // An optional identity schema to use for the login flow. // // required: false // in: query diff --git a/spec/api.json b/spec/api.json index dd637648e048..42a36d46ea13 100644 --- a/spec/api.json +++ b/spec/api.json @@ -6164,7 +6164,7 @@ } }, { - "description": "An optional identity schema to use for the registration flow.", + "description": "An optional identity schema to use for the login flow.", "in": "query", "name": "identity_schema", "schema": { @@ -6272,7 +6272,7 @@ } }, { - "description": "An optional identity schema to use for the registration flow.", + "description": "An optional identity schema to use for the login flow.", "in": "query", "name": "identity_schema", "schema": { diff --git a/spec/swagger.json b/spec/swagger.json index f24d8239eb05..5f7d430a523f 100755 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -1806,7 +1806,7 @@ }, { "type": "string", - "description": "An optional identity schema to use for the registration flow.", + "description": "An optional identity schema to use for the login flow.", "name": "identity_schema", "in": "query" } @@ -1893,7 +1893,7 @@ }, { "type": "string", - "description": "An optional identity schema to use for the registration flow.", + "description": "An optional identity schema to use for the login flow.", "name": "identity_schema", "in": "query" } diff --git a/x/err.go b/x/err.go index 5f783d07f096..3f893cd13e43 100644 --- a/x/err.go +++ b/x/err.go @@ -8,6 +8,7 @@ import ( "net/http" "github.com/gofrs/uuid" + "github.com/ory/herodot" )