From 4b4e7ea1f83b86359dc3039c88d0c29e5dee4758 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Mon, 20 Jul 2026 10:38:25 +0200 Subject: [PATCH] Fix OAuth code exchange and go lint Authorization-code exchange used ExternalClientID, which is empty for registered clients and broke e2e token grants. Pass the authenticated client's GID instead. Also satisfy wsl_v5 blank-line rules, wire the delete reference dialog through its mutation hook, and name the filemanager logger. Signed-off-by: Bryan Frimin --- .../DeleteCompliancePageReferenceDialog.tsx | 14 +++----------- pkg/certmanager/cache_store.go | 1 + pkg/probod/probod.go | 2 +- .../api/complianceportal/v1/auth_resolvers.go | 3 +++ .../complianceportal/v1/oauth_initiate_handler.go | 1 + pkg/server/api/connect/v1/oauth2_handler.go | 2 +- pkg/slug/slug.go | 1 + 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/console/src/components/compliancePage/DeleteCompliancePageReferenceDialog.tsx b/apps/console/src/components/compliancePage/DeleteCompliancePageReferenceDialog.tsx index a929246c1..ecef11cc7 100644 --- a/apps/console/src/components/compliancePage/DeleteCompliancePageReferenceDialog.tsx +++ b/apps/console/src/components/compliancePage/DeleteCompliancePageReferenceDialog.tsx @@ -30,9 +30,7 @@ import { useDialogRef, } from "@probo/ui"; -import type { compliancePageReferenceMutationsDeleteMutation } from "#/__generated__/core/compliancePageReferenceMutationsDeleteMutation.graphql"; -import { useMutation } from "#/lib/relay/useMutation"; -import { deleteCompliancePageReferenceMutation } from "#/pages/organizations/compliance-page/_lib/compliancePageReferenceMutations"; +import { useDeleteCompliancePageReferenceMutation } from "#/pages/organizations/compliance-page/_lib/compliancePageReferenceMutations"; type Props = { children: React.ReactNode; @@ -52,16 +50,10 @@ export function DeleteCompliancePageReferenceDialog({ const { __ } = useTranslate(); const ref = useDialogRef(); - const [mutate, isDeleting] = useMutation( - deleteCompliancePageReferenceMutation, - { - successMessage: __("Reference deleted successfully"), - errorToast: __("Failed to delete reference"), - }, - ); + const [deleteReference, isDeleting] = useDeleteCompliancePageReferenceMutation(); const handleDelete = async () => { - await mutate({ + await deleteReference({ variables: { input: { id: referenceId, diff --git a/pkg/certmanager/cache_store.go b/pkg/certmanager/cache_store.go index 619392e18..c3b171a88 100644 --- a/pkg/certmanager/cache_store.go +++ b/pkg/certmanager/cache_store.go @@ -60,6 +60,7 @@ func (w *CacheStore) WarmCache(ctx context.Context) error { ctx, func(ctx context.Context, conn pg.Querier) error { var domains coredata.CustomDomains + keepCertificateIDs, err := domains.LoadReferencedCertificateIDs(ctx, conn) if err != nil { return fmt.Errorf("cannot load referenced certificate ids: %w", err) diff --git a/pkg/probod/probod.go b/pkg/probod/probod.go index 1c6bb41cc..31718033d 100644 --- a/pkg/probod/probod.go +++ b/pkg/probod/probod.go @@ -378,7 +378,7 @@ func (impl *Implm) Run( return err } - fileManagerService := filemanager.NewService(pgClient, baseURL, s3Client, l) + fileManagerService := filemanager.NewService(pgClient, baseURL, s3Client, l.Named("filemanager")) commonThirdPartyEnrichmentCfg, err := impl.buildCommonThirdPartyEnrichmentConfig(l, tp, r, fileManagerService) if err != nil { diff --git a/pkg/server/api/complianceportal/v1/auth_resolvers.go b/pkg/server/api/complianceportal/v1/auth_resolvers.go index 67d521d7c..ef2de83dd 100644 --- a/pkg/server/api/complianceportal/v1/auth_resolvers.go +++ b/pkg/server/api/complianceportal/v1/auth_resolvers.go @@ -61,6 +61,7 @@ func (r *mutationResolver) UpdateFullName(ctx context.Context, input types.Updat } r.logger.ErrorCtx(ctx, "cannot validate profile update", log.Error(err)) + return nil, gqlutils.Internal(ctx) } } @@ -77,6 +78,7 @@ func (r *mutationResolver) UpdateFullName(ctx context.Context, input types.Updat } r.logger.ErrorCtx(ctx, "cannot update identity", log.Error(err)) + return nil, gqlutils.Internal(ctx) } @@ -87,6 +89,7 @@ func (r *mutationResolver) UpdateFullName(ctx context.Context, input types.Updat } r.logger.ErrorCtx(ctx, "cannot update profile", log.Error(err)) + return nil, gqlutils.Internal(ctx) } } diff --git a/pkg/server/api/complianceportal/v1/oauth_initiate_handler.go b/pkg/server/api/complianceportal/v1/oauth_initiate_handler.go index 4ba6ef984..738ef3672 100644 --- a/pkg/server/api/complianceportal/v1/oauth_initiate_handler.go +++ b/pkg/server/api/complianceportal/v1/oauth_initiate_handler.go @@ -60,6 +60,7 @@ func (h *OAuthInitiateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) compliancePage := complianceportal.CompliancePageFromContext(ctx) portalBaseURL := complianceportal.CompliancePageBaseURLFromContext(ctx) + if compliancePage == nil || portalBaseURL == nil { httpserver.RenderError(w, http.StatusNotFound, errNotFound) return diff --git a/pkg/server/api/connect/v1/oauth2_handler.go b/pkg/server/api/connect/v1/oauth2_handler.go index 079fab3b5..2bfacb499 100644 --- a/pkg/server/api/connect/v1/oauth2_handler.go +++ b/pkg/server/api/connect/v1/oauth2_handler.go @@ -466,7 +466,7 @@ func (h *OAuth2Handler) handleAuthorizationCodeGrant(w http.ResponseWriter, r *h result, err := h.iam.OAuth2ServerService.ExchangeAuthorizationCode( r.Context(), - client.ExternalClientID, + client.ID.String(), in.Code, in.RedirectURI, in.CodeVerifier, diff --git a/pkg/slug/slug.go b/pkg/slug/slug.go index 1394235dc..5308c0d4e 100644 --- a/pkg/slug/slug.go +++ b/pkg/slug/slug.go @@ -61,6 +61,7 @@ func MakeWithEntropy(s string) string { if maxBase < 1 { return suffix } + if len(base) > maxBase { base = strings.Trim(base[:maxBase], "-") if base == "" {