(t *testing.T)
| 257 | } |
| 258 | |
| 259 | func TestFrontmatterHashInputSizeLimit(t *testing.T) { |
| 260 | // S-6 compliance: inputs exceeding 1 MiB MUST fail with a deterministic error. |
| 261 | oversizedValue := strings.Repeat("a", maxFrontmatterHashInputBytes+1) |
| 262 | customReader := func(filePath string) ([]byte, error) { |
| 263 | switch filePath { |
| 264 | case "/test/workflow.md": |
| 265 | return []byte("---\ndescription: " + oversizedValue + "\n---\n\n# Workflow\n"), nil |
| 266 | default: |
| 267 | return nil, os.ErrNotExist |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | _, err := ComputeFrontmatterHashFromFileWithReader("/test/workflow.md", nil, customReader) |
| 272 | require.Error(t, err, "Should reject oversized normalized frontmatter input") |
| 273 | require.EqualError(t, err, "frontmatter hash input exceeds 1048576 bytes after normalization") |
| 274 | |
| 275 | _, err = ComputeFrontmatterHashFromFileWithReader("/test/workflow.md", nil, customReader) |
| 276 | require.Error(t, err, "Should return the same deterministic error on repeated calls") |
| 277 | require.EqualError(t, err, "frontmatter hash input exceeds 1048576 bytes after normalization") |
| 278 | } |
nothing calls this directly
no test coverage detected