Use clientip.Extract for esign and session IP capture
Several HTTP entry points still parsed RemoteAddr directly, so behind a layer-7 proxy they recorded the load balancer IP instead of the signer's. Route NDA acceptance, signing events, document sign/approve, and session updates through clientip.Extract, which honors Forwarded and X-Forwarded-For when trustedproxy allows them. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
@@ -7,13 +7,13 @@ package trust_v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"go.gearno.de/kit/log"
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
"go.probo.inc/probo/pkg/esign"
|
||||
"go.probo.inc/probo/pkg/server/api/authn"
|
||||
"go.probo.inc/probo/pkg/server/api/clientip"
|
||||
"go.probo.inc/probo/pkg/server/api/compliancepage"
|
||||
"go.probo.inc/probo/pkg/server/api/trust/v1/schema"
|
||||
"go.probo.inc/probo/pkg/server/api/trust/v1/types"
|
||||
@@ -27,10 +27,7 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
|
||||
httpReq = gqlutils.HTTPRequestFromContext(ctx)
|
||||
)
|
||||
|
||||
signerIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
|
||||
if signerIP == "" {
|
||||
signerIP = httpReq.RemoteAddr
|
||||
}
|
||||
signerIP := clientip.Extract(httpReq)
|
||||
|
||||
signature, err := r.esign.AcceptSignature(
|
||||
ctx,
|
||||
@@ -59,10 +56,7 @@ func (r *mutationResolver) RecordSigningEvent(ctx context.Context, input types.R
|
||||
httpReq = gqlutils.HTTPRequestFromContext(ctx)
|
||||
)
|
||||
|
||||
actorIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
|
||||
if actorIP == "" {
|
||||
actorIP = httpReq.RemoteAddr
|
||||
}
|
||||
actorIP := clientip.Extract(httpReq)
|
||||
|
||||
if err := r.esign.RecordEvent(
|
||||
ctx,
|
||||
|
||||
Reference in New Issue
Block a user