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 <bryan@probo.com>
This commit is contained in:
@@ -30,9 +30,7 @@ import {
|
|||||||
useDialogRef,
|
useDialogRef,
|
||||||
} from "@probo/ui";
|
} from "@probo/ui";
|
||||||
|
|
||||||
import type { compliancePageReferenceMutationsDeleteMutation } from "#/__generated__/core/compliancePageReferenceMutationsDeleteMutation.graphql";
|
import { useDeleteCompliancePageReferenceMutation } from "#/pages/organizations/compliance-page/_lib/compliancePageReferenceMutations";
|
||||||
import { useMutation } from "#/lib/relay/useMutation";
|
|
||||||
import { deleteCompliancePageReferenceMutation } from "#/pages/organizations/compliance-page/_lib/compliancePageReferenceMutations";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -52,16 +50,10 @@ export function DeleteCompliancePageReferenceDialog({
|
|||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const ref = useDialogRef();
|
const ref = useDialogRef();
|
||||||
|
|
||||||
const [mutate, isDeleting] = useMutation<compliancePageReferenceMutationsDeleteMutation>(
|
const [deleteReference, isDeleting] = useDeleteCompliancePageReferenceMutation();
|
||||||
deleteCompliancePageReferenceMutation,
|
|
||||||
{
|
|
||||||
successMessage: __("Reference deleted successfully"),
|
|
||||||
errorToast: __("Failed to delete reference"),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
await mutate({
|
await deleteReference({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id: referenceId,
|
id: referenceId,
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ func (w *CacheStore) WarmCache(ctx context.Context) error {
|
|||||||
ctx,
|
ctx,
|
||||||
func(ctx context.Context, conn pg.Querier) error {
|
func(ctx context.Context, conn pg.Querier) error {
|
||||||
var domains coredata.CustomDomains
|
var domains coredata.CustomDomains
|
||||||
|
|
||||||
keepCertificateIDs, err := domains.LoadReferencedCertificateIDs(ctx, conn)
|
keepCertificateIDs, err := domains.LoadReferencedCertificateIDs(ctx, conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot load referenced certificate ids: %w", err)
|
return fmt.Errorf("cannot load referenced certificate ids: %w", err)
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ func (impl *Implm) Run(
|
|||||||
return err
|
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)
|
commonThirdPartyEnrichmentCfg, err := impl.buildCommonThirdPartyEnrichmentConfig(l, tp, r, fileManagerService)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -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))
|
r.logger.ErrorCtx(ctx, "cannot validate profile update", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
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))
|
r.logger.ErrorCtx(ctx, "cannot update identity", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
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))
|
r.logger.ErrorCtx(ctx, "cannot update profile", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ func (h *OAuthInitiateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
|||||||
|
|
||||||
compliancePage := complianceportal.CompliancePageFromContext(ctx)
|
compliancePage := complianceportal.CompliancePageFromContext(ctx)
|
||||||
portalBaseURL := complianceportal.CompliancePageBaseURLFromContext(ctx)
|
portalBaseURL := complianceportal.CompliancePageBaseURLFromContext(ctx)
|
||||||
|
|
||||||
if compliancePage == nil || portalBaseURL == nil {
|
if compliancePage == nil || portalBaseURL == nil {
|
||||||
httpserver.RenderError(w, http.StatusNotFound, errNotFound)
|
httpserver.RenderError(w, http.StatusNotFound, errNotFound)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ func (h *OAuth2Handler) handleAuthorizationCodeGrant(w http.ResponseWriter, r *h
|
|||||||
|
|
||||||
result, err := h.iam.OAuth2ServerService.ExchangeAuthorizationCode(
|
result, err := h.iam.OAuth2ServerService.ExchangeAuthorizationCode(
|
||||||
r.Context(),
|
r.Context(),
|
||||||
client.ExternalClientID,
|
client.ID.String(),
|
||||||
in.Code,
|
in.Code,
|
||||||
in.RedirectURI,
|
in.RedirectURI,
|
||||||
in.CodeVerifier,
|
in.CodeVerifier,
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ func MakeWithEntropy(s string) string {
|
|||||||
if maxBase < 1 {
|
if maxBase < 1 {
|
||||||
return suffix
|
return suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(base) > maxBase {
|
if len(base) > maxBase {
|
||||||
base = strings.Trim(base[:maxBase], "-")
|
base = strings.Trim(base[:maxBase], "-")
|
||||||
if base == "" {
|
if base == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user