• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 16479139152

23 Jul 2025 06:44PM UTC coverage: 57.491% (-0.008%) from 57.499%
16479139152

push

github

web-flow
build(deps): bump anchore/sbom-action from 0.20.2 to 0.20.4 (#5769)

Bumps [anchore/sbom-action](https://github.com/anchore/sbom-action) from 0.20.2 to 0.20.4.
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md)
- [Commits](https://github.com/anchore/sbom-action/compare/cee1b8e05...7b36ad622)

---
updated-dependencies:
- dependency-name: anchore/sbom-action
  dependency-version: 0.20.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

18623 of 32393 relevant lines covered (57.49%)

37.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.95
/internal/api/api.go
1
// SPDX-FileCopyrightText: Copyright 2024 The Minder Authors
2
// SPDX-License-Identifier: Apache-2.0
3

4
// Package api package api provides a gRPC interceptor that validates incoming requests.
5
package api
6

7
import (
8
        "context"
9
        "errors"
10

11
        "buf.build/go/protovalidate"
12
        "google.golang.org/grpc"
13
        "google.golang.org/grpc/codes"
14
        "google.golang.org/grpc/status"
15
        "google.golang.org/protobuf/proto"
16

17
        "github.com/mindersec/minder/internal/util"
18
)
19

20
// ProtoValidationInterceptor is a gRPC interceptor that validates incoming requests.
21
func ProtoValidationInterceptor(validator protovalidate.Validator) grpc.UnaryServerInterceptor {
1✔
22
        return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
4✔
23
                // Assert that req implements proto.Message
3✔
24
                msg, ok := req.(proto.Message)
3✔
25
                if !ok {
3✔
26
                        // Handle the error: req is not a proto.Message
×
27
                        return nil, status.Errorf(codes.Internal, "Request does not implement proto.Message")
×
28
                }
×
29

30
                // Validate the incoming request
31
                if err := validator.Validate(msg); err != nil {
5✔
32
                        var validationErr *protovalidate.ValidationError
2✔
33
                        if errors.As(err, &validationErr) {
4✔
34
                                return nil, util.UserVisibleError(codes.InvalidArgument, "%s", validationErr.Error())
2✔
35
                        }
2✔
36
                        // Default to generic validation error
37
                        return nil, status.Errorf(codes.InvalidArgument, "Validation failed: %v", err)
×
38
                }
39
                // Proceed to the handler
40
                return handler(ctx, req)
1✔
41
        }
42
}
43

44
// NewValidator creates a new validator.
45
func NewValidator() (protovalidate.Validator, error) {
1✔
46
        // TODO: add protovalidate.WithDescriptors() in the future
1✔
47
        return protovalidate.New()
1✔
48
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc