github.com/prebid/prebid-server/v2@v2.18.0/.semgrep/adapter/bid-type-switch-check.yml (about)

     1  rules:
     2    - id: bid-type-switch-check
     3      message: The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to $ORTBTYPE. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the [MType](https://github.com/prebid/openrtb/blob/main/openrtb2/bid.go#L334) field in the response to accurately determine the media type for the impression.
     4      languages:
     5        - go
     6      severity: WARNING
     7      patterns:
     8        - pattern-inside: |
     9            switch $BIDTYPE {
    10            case ...:
    11              return $ORTBTYPE, nil
    12            }
    13        - metavariable-regex:
    14            metavariable: $BIDTYPE
    15            regex: ^(?!bid\.MType$).*$
    16        - metavariable-pattern:
    17            metavariable: $ORTBTYPE
    18            patterns:
    19              - pattern-either:
    20                  - pattern: openrtb_ext.$W
    21              - metavariable-regex:
    22                  metavariable: $W
    23                  regex: BidType*