Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`PATCH /v1/software/{id}/analysis` and `PATCH /v1/catalogs/{id}/analysis`
answer `500` on SQLite. Namespaces may now nest at most 64 objects and
arrays, and deeper ones get `422` on both databases.
- An analysis number outside the PostgreSQL `numeric` range, such as
`1e131072`, made the analysis `PATCH` answer `500` on PostgreSQL.
Numbers must now fit a float64, with an exponent between -16383 and
16383 and at most 16383 digits after the decimal point, and others get
`422` on both databases.
- The analysis of a software or catalog grew without limit when each
`PATCH` added a new namespace. A merged document larger than 1 MiB is
now rejected with `422` and nothing is written. Patches that only remove
Expand Down
72 changes: 72 additions & 0 deletions analysis_numbers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package main

import (
"encoding/json"
"net/http"
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

// TestAnalysisNumbersOutsideStorableRange checks that numbers PostgreSQL
// can't store as numeric are refused with 422 on both dialects, instead of
// failing the write with 500 on PostgreSQL only.
func TestAnalysisNumbersOutsideStorableRange(t *testing.T) {
for _, resource := range []struct{ table, id, title string }{
{"software", rootSoftwareID, "can't update Software analysis"},
{"catalogs", swissID, "can't update Catalog analysis"},
} {
t.Run(resource.table, func(t *testing.T) {
loadFixtures(t)

patch := func(number string) (int, map[string]any) {
t.Helper()

body := `{"ns":{"v":1,"x":` + number + `}}`
req, err := newTestRequest(http.MethodPatch, "/v1/"+resource.table+"/"+resource.id+"/analysis",
strings.NewReader(body))
require.NoError(t, err)
req.Header.Set("Authorization", goodToken)
req.Header.Set("Content-Type", "application/merge-patch+json")

res, err := app.Test(req, -1)
require.NoError(t, err)

defer res.Body.Close()

var result map[string]any
require.NoError(t, json.NewDecoder(res.Body).Decode(&result))

return res.StatusCode, result
}

for number, detail := range map[string]string{
"1e131072": "numbers must fit a float64 without rounding to zero or infinity",
"-1e1000000": "numbers must fit a float64 without rounding to zero or infinity",
"1e-20000": "numbers must fit a float64 without rounding to zero or infinity",
"1" + strings.Repeat("0", 140000): "numbers must fit a float64 without rounding to zero or infinity",
"0e-20000": "numbers must have an exponent between -16383 and 16383",
"1." + strings.Repeat("0", 20000): "numbers must not have more than 16383 digits after the decimal point",
} {
code, result := patch(number)

assert.Equal(t, http.StatusUnprocessableEntity, code, number[:min(len(number), 16)])
assert.Equal(t, resource.title, result["title"])
assert.Equal(t, "analysis.ns: "+detail, result["detail"])
}

code, result := patch("1.7976931348623157e308")
require.Equal(t, http.StatusOK, code, result)

// The merged document holds only this namespace, so none of the
// refused patches was stored.
assert.Len(t, result, 1)

namespace, ok := result["ns"].(map[string]any)
require.True(t, ok, result)
assert.InDelta(t, 1.7976931348623157e308, namespace["x"], 0)
})
}
}
94 changes: 80 additions & 14 deletions internal/common/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"strconv"
"strings"
"time"

jsonpatch "github.com/evanphx/json-patch/v5"
Expand All @@ -19,8 +22,19 @@ var (
errAnalysisUnexpectedDB = errors.New("unexpected database value type for analysis")
errAnalysisAddTimestamp = errors.New("could not add the 't' timestamp")
errAnalysisTooDeep = fmt.Errorf("must not nest objects and arrays deeper than %d levels", MaxAnalysisDepth)
errAnalysisNumberRange = errors.New("numbers must fit a float64 without rounding to zero or infinity")
errAnalysisNumberScale = fmt.Errorf("numbers must not have more than %d digits after the decimal point",
maxAnalysisNumberScale)
errAnalysisExponent = fmt.Errorf("numbers must have an exponent between -%d and %d",
maxAnalysisNumberScale, maxAnalysisNumberScale)
)

// maxAnalysisNumberScale is how many digits after the decimal point a
// number may have. PostgreSQL stores jsonb numbers as numeric, which
// refuses more than this, so 1.000... with 20000 zeros fits a float64
// but can't be stored.
const maxAnalysisNumberScale = 16383

// MaxAnalysisDepth is how many objects and arrays a namespace may nest,
// the namespace object itself included. SQLite refuses JSON nested deeper
// than 1000 levels, so a namespace must stay well below that to be merged
Expand Down Expand Up @@ -162,33 +176,85 @@ func WithTimestamps(analysis AnalysisData, now time.Time) (AnalysisData, error)
return result, nil
}

// jsonDepth answers how deeply objects and arrays nest in data, 0 for a
// scalar. On invalid JSON it answers the depth reached before the error.
func jsonDepth(data []byte) int {
// checkValues walks data and answers errAnalysisTooDeep when objects and
// arrays nest deeper than MaxAnalysisDepth, or the checkNumber error of
// the first number both dialects can't store and read back. On invalid
// JSON it stops at the error and answers nil, leaving the report to
// json.Unmarshal.
func checkValues(data []byte) error {
decoder := json.NewDecoder(bytes.NewReader(data))
depth, maxDepth := 0, 0
decoder.UseNumber()

depth := 0

for {
token, err := decoder.Token()
if err != nil {
return maxDepth
// io.EOF ends a valid document, checkNamespace reports the
// rest through json.Unmarshal.
return nil //nolint:nilerr
}

switch token {
case json.Delim('{'), json.Delim('['):
depth++
maxDepth = max(maxDepth, depth)
case json.Delim('}'), json.Delim(']'):
depth--
switch token := token.(type) {
case json.Delim:
if token == '{' || token == '[' {
depth++
if depth > MaxAnalysisDepth {
return errAnalysisTooDeep
}
} else {
depth--
}
case json.Number:
if err := checkNumber(string(token)); err != nil {
return err
}
}
}
}

// checkNumber answers an error for a JSON number literal PostgreSQL can't
// store as numeric or a float64 can't hold: a number that rounds to
// infinity, or to zero while having a nonzero digit, an exponent beyond
// maxAnalysisNumberScale either way, or more than maxAnalysisNumberScale
// digits after the decimal point once the exponent is applied, as in 1.0
// followed by 20000 zeros. Most JSON clients read numbers into a float64.
func checkNumber(literal string) error {
value, err := strconv.ParseFloat(literal, 64)
if err != nil || math.IsInf(value, 0) {
return errAnalysisNumberRange
}

mantissa, exponent, _ := strings.Cut(strings.ToLower(literal), "e")
_, fraction, _ := strings.Cut(mantissa, ".")

if value == 0 && strings.ContainsAny(mantissa, "123456789") {
return errAnalysisNumberRange
}

// Zero takes any exponent as a float64, 0e-20000 included, but
// PostgreSQL keeps the scale the exponent implies.
exp := 0
if exponent != "" {
exp, err = strconv.Atoi(exponent)
if err != nil || exp < -maxAnalysisNumberScale || exp > maxAnalysisNumberScale {
return errAnalysisExponent
}
}

if len(fraction)-exp > maxAnalysisNumberScale {
return errAnalysisNumberScale
}

return nil
}

// checkNamespace checks that raw is a JSON object with an integer "v"
// between 1 and 999, nesting at most MaxAnalysisDepth levels.
// between 1 and 999, nesting at most MaxAnalysisDepth levels and holding
// only numbers checkNumber accepts.
func checkNamespace(raw json.RawMessage) error {
if jsonDepth(raw) > MaxAnalysisDepth {
return errAnalysisTooDeep
if err := checkValues(raw); err != nil {
return err
}

var meta namespaceMeta
Expand Down
80 changes: 80 additions & 0 deletions internal/common/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package common

import (
"encoding/json"
"fmt"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -177,6 +178,85 @@ func TestWithTimestamps(t *testing.T) {
})
}

func TestCheckNumber(t *testing.T) {
zeros := strings.Repeat("0", maxAnalysisNumberScale)

for _, tc := range []struct {
literal string
want error
}{
{"0", nil},
{"-0", nil},
{"42", nil},
{"-1.5", nil},
{"1E+308", nil},
{"1.7976931348623157e308", nil},
{"4.9e-324", nil},
{"0e16383", nil},
{"0e-16383", nil},
{"0." + zeros, nil},
{"1e400", errAnalysisNumberRange},
{"1e131072", errAnalysisNumberRange},
{"-1e1000000", errAnalysisNumberRange},
{"1" + strings.Repeat("0", 140000), errAnalysisNumberRange},
{"1e-400", errAnalysisNumberRange},
{"1e-20000", errAnalysisNumberRange},
{"0." + zeros + "1", errAnalysisNumberRange},
{"0e-20000", errAnalysisExponent},
{"0e20000", errAnalysisExponent},
{"0e99999999999999999999", errAnalysisExponent},
{"0e-99999999999999999999", errAnalysisExponent},
{"1." + zeros + "0", errAnalysisNumberScale},
{"0." + zeros + "0", errAnalysisNumberScale},
{"1." + zeros + "e-1", errAnalysisNumberScale},
{"0.0e-16383", errAnalysisNumberScale},
} {
name := tc.literal
if len(name) > 32 {
name = fmt.Sprintf("%s... (%d bytes)", name[:16], len(name))
}

t.Run(name, func(t *testing.T) {
assert.Equal(t, tc.want, checkNumber(tc.literal))
})
}
}

func TestWithTimestampsNumbers(t *testing.T) {
now := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)

t.Run("refuses a number nested in an array", func(t *testing.T) {
input := AnalysisData{
"scanner": json.RawMessage(`{"v": 1, "x": [{"y": 1e400}]}`),
}

_, err := WithTimestamps(input, now)

assert.EqualError(t, err,
"analysis.scanner: numbers must fit a float64 without rounding to zero or infinity")
})

t.Run("refuses a number as v", func(t *testing.T) {
input := AnalysisData{
"scanner": json.RawMessage(`{"v": 1e-20000}`),
}

_, err := WithTimestamps(input, now)

assert.ErrorIs(t, err, errAnalysisNumberRange)
})

t.Run("keeps numbers inside strings", func(t *testing.T) {
input := AnalysisData{
"scanner": json.RawMessage(`{"v": 1, "x": "1e400"}`),
}

_, err := WithTimestamps(input, now)

assert.NoError(t, err)
})
}

func TestCheckAnalysisSize(t *testing.T) {
payload := func(size int) json.RawMessage {
return json.RawMessage(`{"v":1,"x":"` + strings.Repeat("a", size) + `"}`)
Expand Down
6 changes: 6 additions & 0 deletions open-catalog-api.oas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@
a JSON object with an integer "v" field.
Objects and arrays may nest at most 64 levels in a namespace, the
namespace object included. A deeper namespace is rejected with 422.
Numbers must fit a float64 without rounding to zero or infinity,
with an exponent between -16383 and 16383 and at most 16383 digits
after the decimal point. Other numbers are rejected with 422.
The merged document may take at most 1048576 bytes (1 MiB) as
compact JSON. A patch that would make it larger is rejected with 422
and nothing is written. A patch that only removes namespaces is
Expand Down Expand Up @@ -912,7 +915,7 @@
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/TooManyRequests'
operationId: get-bundle

Check notice on line 918 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-method-name-in-operationId

Avoid using method names in operationIds.
patch:
summary: Update a Bundle
description: Update a Bundle by its id
Expand Down Expand Up @@ -958,7 +961,7 @@
- bundles
security:
- bearerAuth: []
operationId: delete-bundle

Check notice on line 964 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-method-name-in-operationId

Avoid using method names in operationIds.
responses:
'204':
$ref: '#/components/responses/NoContent'
Expand Down Expand Up @@ -1057,7 +1060,7 @@
in: query
name: to
description: Only logs before this time (RFC 3339 datetime)
- schema:

Check notice on line 1063 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/paths/~1logs/get/parameters/5/schema
type: string
maxLength: 255
example: 'BAD publiccode'
Expand Down Expand Up @@ -1134,7 +1137,7 @@
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/TooManyRequests'
operationId: get-log

Check notice on line 1140 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-method-name-in-operationId

Avoid using method names in operationIds.
patch:
summary: Update a Log
description: >
Expand Down Expand Up @@ -1180,7 +1183,7 @@
- logs
security:
- bearerAuth: []
operationId: delete-log

Check notice on line 1186 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-method-name-in-operationId

Avoid using method names in operationIds.
responses:
'204':
$ref: '#/components/responses/NoContent'
Expand Down Expand Up @@ -1336,7 +1339,7 @@
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/TooManyRequests'
operationId: get-event

Check notice on line 1342 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-method-name-in-operationId

Avoid using method names in operationIds.
/catalogs:
get:
summary: List all Catalogs
Expand Down Expand Up @@ -1562,6 +1565,9 @@
a JSON object with an integer "v" field.
Objects and arrays may nest at most 64 levels in a namespace, the
namespace object included. A deeper namespace is rejected with 422.
Numbers must fit a float64 without rounding to zero or infinity,
with an exponent between -16383 and 16383 and at most 16383 digits
after the decimal point. Other numbers are rejected with 422.
The merged document may take at most 1048576 bytes (1 MiB) as
compact JSON. A patch that would make it larger is rejected with 422
and nothing is written. A patch that only removes namespaces is
Expand Down Expand Up @@ -2305,7 +2311,7 @@
type: object
additionalProperties: false
properties:
message:

Check warning on line 2314 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-maxlength

Strings (non enum) must specify a maximum length. #/paths/~1publishers~1%7BpublisherId%7D~1logs/post/requestBody/content/application~1json/schema/properties/message "message.maxLength" property must be defined

Check notice on line 2314 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/paths/~1publishers~1%7BpublisherId%7D~1logs/post/requestBody/content/application~1json/schema/properties/message
type: string
minLength: 1
required:
Expand Down Expand Up @@ -2749,7 +2755,7 @@
schema:
$ref: '#/components/schemas/Error'
schemas:
AnalysisData:

Check warning on line 2758 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-constrained-additionalProperties

Objects should not allow unconstrained additionalProperties. Disable them with `additionalProperties: false` or add `maxProperties`.
title: AnalysisData
type: object
nullable: true
Expand Down Expand Up @@ -2777,14 +2783,14 @@
readOnly: true
description: Timestamp of the last write (RFC 3339 datetime).
example: '2024-01-15T10:30:00Z'
additionalProperties: true

Check warning on line 2786 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-no-additionalProperties

Objects should not allow unconstrained additionalProperties. Disable them with `additionalProperties: false` or add `maxProperties`.
example:
acme-security-scanner:
v: 1
t: "2024-01-15T10:30:00Z"
vulnerabilities: 0
grade: "A"
AnalysisPatch:

Check warning on line 2793 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-constrained-additionalProperties

Objects should not allow unconstrained additionalProperties. Disable them with `additionalProperties: false` or add `maxProperties`.
title: AnalysisPatch
type: object
nullable: true
Expand All @@ -2810,7 +2816,7 @@
readOnly: true
description: Timestamp of the last write (RFC 3339 datetime).
example: '2024-01-15T10:30:00Z'
additionalProperties: true

Check warning on line 2819 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-no-additionalProperties

Objects should not allow unconstrained additionalProperties. Disable them with `additionalProperties: false` or add `maxProperties`.
example:
acme-security-scanner:
v: 1
Expand Down Expand Up @@ -2861,7 +2867,7 @@
- move
- copy
- test
path:

Check notice on line 2870 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/JsonPatchRequest/items/properties/path
type: string
maxLength: 255
description: >
Expand All @@ -2872,7 +2878,7 @@
value:
description: The value to set. Required for add, replace, and test operations.
example: 'name: My Software'
from:

Check notice on line 2881 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/JsonPatchRequest/items/properties/from
type: string
maxLength: 255
description: Source JSON Pointer. Required for move and copy operations.
Expand All @@ -2888,11 +2894,11 @@
pattern: >-
[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}
readOnly: true
name:

Check notice on line 2897 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Bundle/properties/name
type: string

Check notice on line 2898 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in string.
minLength: 1

Check notice on line 2899 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 1.
maxLength: 255

Check notice on line 2900 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 255.
description:

Check notice on line 2901 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Bundle/properties/description
type: string
maxLength: 1000
active:
Expand Down Expand Up @@ -2929,11 +2935,11 @@
type: object
additionalProperties: false
properties:
name:

Check notice on line 2938 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/BundlePost/properties/name
type: string

Check notice on line 2939 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in string.
minLength: 1

Check notice on line 2940 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 1.
maxLength: 255

Check notice on line 2941 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 255.
description:

Check notice on line 2942 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/BundlePost/properties/description
type: string
maxLength: 1000
active:
Expand All @@ -2957,11 +2963,11 @@
type: object
additionalProperties: false
properties:
name:

Check notice on line 2966 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/BundlePatch/properties/name
type: string

Check notice on line 2967 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in string.
minLength: 1

Check notice on line 2968 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 1.
maxLength: 255

Check notice on line 2969 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 255.
description:

Check notice on line 2970 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/BundlePatch/properties/description
type: string
maxLength: 1000
active:
Expand Down Expand Up @@ -3093,13 +3099,13 @@
description: Unique identifier of the Catalog
example: 'a1b2c3d4-e5f6-4789-abcd-ef0123456789'
readOnly: true
name:

Check notice on line 3102 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Catalog/properties/name
type: string

Check notice on line 3103 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in string.
minLength: 1

Check notice on line 3104 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 1.
maxLength: 255

Check notice on line 3105 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in 255.
description: Human-readable name of the catalog

Check notice on line 3106 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in Human-readable name of the catalog.
example: 'Public Software Catalog'

Check notice on line 3107 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

use-recommended-names-in-schemas

Use recommended variable names in Public Software Catalog.
alternativeId:

Check notice on line 3108 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Catalog/properties/alternativeId
type: string
description: >
Optional alternative user-provided identifier for this Catalog.
Expand All @@ -3118,7 +3124,7 @@
description: Whether this Catalog is active or not
default: true
example: true
publishersNamespace:

Check notice on line 3127 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Catalog/properties/publishersNamespace
type: string
maxLength: 255
description: >
Expand All @@ -3127,7 +3133,7 @@
each publiccode.yml organisation field equals
this prefix + the publisher alternativeId.
example: 'urn:x-italian-pa:'
scopes:

Check warning on line 3136 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-array-boundaries

Schema of type array must specify maxItems and minItems. #/components/schemas/Catalog/properties/scopes "scopes.minItems" property must be defined
type: array
maxItems: 20
description: >
Expand All @@ -3140,7 +3146,7 @@
string up to 64 characters is accepted. An empty or
absent list means the catalog is thematic and not tied
to a specific place.
items:

Check notice on line 3149 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Catalog/properties/scopes/items
type: string
minLength: 1
maxLength: 64
Expand All @@ -3148,7 +3154,7 @@
example:
- 'iso3166:IT'
- 'm49:150'
sources:

Check warning on line 3157 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-array-boundaries

Schema of type array must specify maxItems and minItems. #/components/schemas/Catalog/properties/sources "sources.minItems" property must be defined
type: array
maxItems: 100
description: >
Expand Down Expand Up @@ -3183,7 +3189,7 @@
type: object
additionalProperties: false
properties:
driver:

Check notice on line 3192 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/CatalogSource/properties/driver
type: string
maxLength: 64
description: >
Expand All @@ -3206,7 +3212,7 @@
Optional arguments for the driver (e.g. a JSON
configuration file URL).
example: ['https://example.org/config.json']
items:

Check notice on line 3215 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/CatalogSource/properties/args/items
type: string
minLength: 1
maxLength: 2048
Expand Down Expand Up @@ -3607,7 +3613,7 @@
The 255 character limit applies to the URL as stored, after
normalization percent-encodes non ASCII letters. A URL
containing whitespace is rejected with 422.
secret:

Check notice on line 3616 in open-catalog-api.oas.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

sec-string-pattern-or-format-or-enum

Strings (non enum) must specify a pattern or a format. #/components/schemas/Webhook/properties/secret
type: string
minLength: 16
maxLength: 256
Expand Down
Loading