Audited pkg/server/api/console/v1 for resolvers that touched tenant data without calling r.authorize, batchAuthorize, or Permission. Closed every gap so every data-bearing field goes through IAM (and produces an audit log entry when an organization_id is present). * High-severity reads now authorize: accessSourceResolver.Connector and ConnectionStatus, controlResolver.Regulatory/Contractual/RiskAssessment, electronicSignatureResolver.CertificateFileURL/Events, commonThirdPartyResolver.LogoURL, and the proper accessSourceResolver/accessReviewCampaignResolver/auditLogEntryResolver Organization resolvers (authorize + dataloader load, fixing the latent empty-name bug from the previous force-resolver no-op implementations). * TotalCount/DetectedCount aggregates now authorize the matching list action across access review, audit log, statement of applicability, detected tracker, tracker pattern, and tracker resource connections. * queryResolver.CommonThirdParties authorizes against the principal's identity via the new identity-scoped CommonThirdPartyCatalogPolicy. * Add ActionCommonThirdPartyGet/List, ActionElectronicSignatureGet probo action constants; wire ActionElectronicSignatureGet into ViewerPolicy and AuditorPolicy. * Implement AuthorizationAttributes on CommonThirdParty (no org) and ElectronicSignature (organization_id) so the authorizer can resolve attributes for the new actions. * Delete the dead "type AccessReview" GraphQL type (no Go constructor, no frontend reference) and drop its orphan resolver bundle. Signed-off-by: Bryan Frimin <bryan@probo.com>
66 lines
2.0 KiB
Go
66 lines
2.0 KiB
Go
package console_v1
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver
|
|
// implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
// Code generated by github.com/99designs/gqlgen version v0.17.90
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
|
|
"go.probo.inc/probo/pkg/probo"
|
|
"go.probo.inc/probo/pkg/server/api/console/v1/schema"
|
|
"go.probo.inc/probo/pkg/server/api/console/v1/types"
|
|
)
|
|
|
|
// CertificateFileURL is the resolver for the certificateFileUrl field.
|
|
func (r *electronicSignatureResolver) CertificateFileURL(ctx context.Context, obj *types.ElectronicSignature) (*string, error) {
|
|
if _, err := r.authorize(ctx, obj.ID, probo.ActionElectronicSignatureGet); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
signature, err := r.esign.GetSignatureByID(ctx, obj.ID)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("cannot load signature: %w", err)
|
|
}
|
|
|
|
if signature.CertificateFileID == nil {
|
|
return nil, nil
|
|
}
|
|
|
|
url, err := r.esign.GenerateCertificateFileURL(ctx, *signature.CertificateFileID, 1*time.Hour)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("cannot generate certificate file URL: %w", err)
|
|
}
|
|
|
|
return &url, nil
|
|
}
|
|
|
|
// Events is the resolver for the events field.
|
|
func (r *electronicSignatureResolver) Events(ctx context.Context, obj *types.ElectronicSignature) ([]*types.ElectronicSignatureEvent, error) {
|
|
if _, err := r.authorize(ctx, obj.ID, probo.ActionElectronicSignatureGet); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
events, err := r.esign.GetEventsBySignatureID(ctx, obj.ID)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("cannot load signature events: %w", err)
|
|
}
|
|
|
|
result := make([]*types.ElectronicSignatureEvent, len(events))
|
|
for i := range events {
|
|
result[i] = types.NewElectronicSignatureEvent(events[i])
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ElectronicSignature returns schema.ElectronicSignatureResolver implementation.
|
|
func (r *Resolver) ElectronicSignature() schema.ElectronicSignatureResolver {
|
|
return &electronicSignatureResolver{r}
|
|
}
|
|
|
|
type electronicSignatureResolver struct{ *Resolver }
|