> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oasm.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Finding

> 모든 어댑터가 내보내는 표준 출력 항목: 필드, 검증 규칙, 심각도 매핑

`Finding`은 표준 출력 항목입니다. `Execute`는 탐지된 문제마다 하나씩 스트리밍합니다.

```go theme={null}
package connector

type Finding struct {
    Name        string
    Severity    string
    Description string
    Tags        []string
    References  []string
    CVEID       []string
    CWEID       []string
    CVSSScore   float64
    CVSSMetrics string
    EPSSScore   float64
    Solution    string
    MatchedAt   string
    Host        string
    IP          string
    Timestamp   time.Time

    Synopsis         string
    Ports            []string
    Authors          []string
    VPRScore         float64
    BIDID            []string
    CEAID            []string
    IAVAID           []string
    PublicationDate  time.Time
    ModificationDate time.Time
    Confidence       float64
}
```

## 필드

| 그룹 | 필드 |
| - | - |
| 식별 | `Name`, `Severity`, `Timestamp` |
| 내용 | `Description`, `Solution`, `Tags`, `References` |
| 점수 | `CVEID`, `CWEID`, `CVSSScore`, `CVSSMetrics`, `EPSSScore`, `VPRScore` |
| 위치 | `MatchedAt`, `Host`, `IP` |
| 스캐너별 | `Synopsis`, `Ports`, `Authors`, `BIDID`, `CEAID`, `IAVAID`, `PublicationDate`, `ModificationDate`, `Confidence` |

0 값인 `Timestamp`는 잘못된 epoch 시간으로 전송되지 않고 전송 데이터에서 생략됩니다. 도구가 제공하지 않으면 설정하지 마세요.

## 검증

모든 발견 사항은 전송 전에 검증됩니다. 유효하지 않은 발견 사항은 **잡음이 아니라 프로토콜 위반**입니다. 실행이 중단되고 치명적 오류를 보고합니다.

```go theme={null}
func (f Finding) Validate() error
```

규칙:

* `Name`은 필수입니다.
* `Severity`는 허용된 다섯 가지 값 중 하나여야 합니다.

## 심각도

`Severity`는 닫힌 집합입니다. 그 밖의 값은 검증에 실패합니다.

```go theme={null}
var Severities = []string{"info", "low", "medium", "high", "critical"}
```

## 심각도 매핑

명시적인 표를 사용해 도구 자체의 척도를 다섯 값 enum으로 축소하세요. 추측하지 말고, 매핑되지 않은 값이 `Validate`에 도달하지 않게 하세요. 그러면 스트림이 종료됩니다.

```go theme={null}
func normalizeSeverity(s string) string {
    switch strings.ToLower(strings.TrimSpace(s)) {
    case "info", "low", "medium", "high", "critical":
        return strings.ToLower(strings.TrimSpace(s))
    case "unknown", "informational":
        return "info"
    default:
        return "info"
    }
}
```

> [!TIP]
>
> 스캐너가 enum 밖의 심각도(예: nuclei의 `unknown`)를 내보내면 발견 사항을 버리지 말고 `info`로 매핑하세요. 카탈로그는 모든 발견 사항 값을 엄격하게 취급하므로 어댑터 경계에서 정규화하세요.

## 출력을 발견 사항으로 매핑

원시 도구 결과 하나를 `connector.Finding`으로 매핑하는 `toFinding` 함수 하나를 유지하세요. 사용할 수 있는 이름이 없는 결과에는 오류를 반환해, 호출자가 전체 실행을 실패시키지 않고 건너뛸 수 있게 하세요.

```go theme={null}
func toFinding(raw ToolResult) (connector.Finding, error) {
    if raw.Name == "" {
        return connector.Finding{}, fmt.Errorf("finding has no name")
    }
    return connector.Finding{
        Name:        raw.Name,
        Severity:    normalizeSeverity(raw.Severity),
        Description: raw.Description,
        Solution:    raw.Remediation,
        MatchedAt:   raw.Matched,
        Host:        raw.Host,
        IP:          raw.IP,
        Tags:        raw.Tags,
        References:  raw.References,
        CVEID:       raw.CVEs,
        CWEID:       raw.CWEs,
        CVSSScore:   raw.CVSSScore,
        CVSSMetrics: raw.CVSSVector,
        Timestamp:   raw.Timestamp,
    }, nil
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.