Skip to content

chore(config): validate additionalProperties on all schema objects (AROSLSRE-233)#5360

Open
raelga wants to merge 4 commits into
mainfrom
raelga/schema-additional-properties
Open

chore(config): validate additionalProperties on all schema objects (AROSLSRE-233)#5360
raelga wants to merge 4 commits into
mainfrom
raelga/schema-additional-properties

Conversation

@raelga
Copy link
Copy Markdown
Collaborator

@raelga raelga commented May 21, 2026

AROSLSRE-233

What

Add additionalProperties: false to the 5 object definitions that were missing it and a CI validation check to prevent regressions.

Why

JSON Schema defaults to allowing additional properties. Without explicit additionalProperties: false, typos in config.yaml (e.g. stoargeAccount instead of storageAccount) are silently accepted.

Testing

  • make verify passes (includes new verify-schema target)
  • make lint passes
  • New Go program at hack/verify-schema-additional-properties/ checks all definitions

Definitions fixed

Definition Purpose
certificateRef Key vault certificate reference
entraApplication Entra ID application config
hcpBackups HCP backup storage config
k8sDeploymentStrategy Kubernetes deployment strategy
k8sRollingUpdateDeploymentStrategy Rolling update params

Copilot AI review requested due to automatic review settings May 21, 2026 14:33
@openshift-ci openshift-ci Bot requested review from roivaz and sclarkso May 21, 2026 14:33
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: raelga

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@raelga raelga changed the title fix: add additionalProperties to all schema object definitions (AROSLSRE-233) chore: validate additionalProperties on all schema objects (AROSLSRE-233) May 21, 2026
@raelga raelga changed the title chore: validate additionalProperties on all schema objects (AROSLSRE-233) chore(config): validate additionalProperties on all schema objects (AROSLSRE-233) May 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens config validation by explicitly disallowing unknown fields in several JSON Schema object definitions and adds a CI-time verification step to prevent missing additionalProperties from regressing.

Changes:

  • Add additionalProperties: false to five previously-permissive schema definitions in config/config.schema.json.
  • Introduce a new Go-based verifier (hack/verify-schema-additional-properties/) and wire it into make verify via a verify-schema target.
  • Add the new verifier module to the workspace (go.work) so go run works from the repo root.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Makefile Adds verify-schema and runs it as part of make verify.
hack/verify-schema-additional-properties/main.go New verifier that checks for presence of additionalProperties on root + top-level definitions.
hack/verify-schema-additional-properties/go.mod Declares the verifier as a standalone Go module in the workspace.
go.work Includes the new verifier module so workspace builds/runs succeed.
config/config.schema.json Adds additionalProperties: false to the five missing object definitions.

Comment thread hack/verify-schema-additional-properties/main.go Outdated
Copilot finished work on behalf of raelga May 21, 2026 15:48
Copilot AI review requested due to automatic review settings May 21, 2026 15:58
@raelga raelga force-pushed the raelga/schema-additional-properties branch from 874d68f to fee8f2b Compare May 21, 2026 15:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread hack/verify-schema-additional-properties/main.go
Comment thread hack/verify-schema-additional-properties/main.go
raelga added 3 commits May 22, 2026 08:54
…SRE-233)

Add additionalProperties: false to the 5 object definitions that were
missing it: certificateRef, entraApplication, hcpBackups,
k8sDeploymentStrategy, k8sRollingUpdateDeploymentStrategy.

Add verify-schema target to CI that checks all object definitions
in config.schema.json have additionalProperties set, preventing
regressions when new definitions are added.
…rties

The verifier only checked root and top-level definitions but not nested
objects under properties, patternProperties, or items. Rewrite to walk
the full schema tree recursively.

Fix the 13 nested objects found by the recursive check.
Handle nodes that define properties/patternProperties without explicit
type: object, support array form of type, and recurse into not subtrees.
Copilot AI review requested due to automatic review settings May 22, 2026 06:57
@raelga raelga force-pushed the raelga/schema-additional-properties branch from 90b73b3 to 4f61721 Compare May 22, 2026 06:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment on lines +15 to +19
// verify-schema-additional-properties checks that all object definitions in a
// JSON schema file have an "additionalProperties" field set. Without it, the
// schema silently allows unexpected properties, defeating typo detection.
//
// Exit code is 1 if any object definitions are missing the field.
Comment on lines +136 to +142
if len(missing) > 0 {
fmt.Fprintf(os.Stderr, "ERROR: %d object definition(s) missing additionalProperties in %s:\n", len(missing), path)
for _, m := range missing {
fmt.Fprintf(os.Stderr, " - %s\n", m)
}
fmt.Fprintf(os.Stderr, "\nAdd \"additionalProperties\": false (or true) to each definition.\n")
exitCode = 1
Comment thread config/config.schema.json Outdated
Comment on lines +2534 to +2560
"imageRegistryPolicy": {
"type": "object",
"properties": {
"extraAllowedRegistries": {
"type": "array",
"items": {
"type": "string"
}
},
"validationActions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Deny",
"Audit",
"Warn"
]
}
}
},
"additionalProperties": false,
"required": [
"extraAllowedRegistries",
"validationActions"
]
},
Comment thread config/config.schema.json Outdated
Comment on lines +2534 to +2538
"imageRegistryPolicy": {
"type": "object",
"properties": {
"extraAllowedRegistries": {
"type": "array",
… wording

Remove the imageRegistryPolicy schema definition that was reintroduced
by rebase drift from the reverted FSI VAP PR (#4690). The definition is
not referenced by any config property.

Update verifier comments and error messages from "object definitions"
to "object schemas" to reflect recursive validation scope.
Copilot AI review requested due to automatic review settings May 26, 2026 13:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

}

func (n schemaNode) isObject() bool {
if len(n.Properties) > 0 || len(n.PatternProperties) > 0 || n.AdditionalProperties != nil {
Comment on lines +78 to +91
for _, child := range node.PatternProperties {
walkSchema(child, joinPath(path, "(patternProperty)"), missing)
}
if node.Items != nil {
walkSchema(*node.Items, joinPath(path, "(items)"), missing)
}
for _, child := range node.AllOf {
walkSchema(child, path, missing)
}
for _, child := range node.OneOf {
walkSchema(child, path, missing)
}
for _, child := range node.AnyOf {
walkSchema(child, path, missing)
Comment thread config/config.schema.json
Comment on lines 1069 to 1081
"properties": {
"version": {
"type": "string"
},
"bundle": {
"$ref": "#/definitions/containerImage"
}
},
"required": [
"bundle"
]
],
"additionalProperties": false
},
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 26, 2026

@raelga: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-parallel a2809cd link true /test e2e-parallel

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants