Title: Add defaults for cascading inherit fields and disable omitEmpty by EndPositive · Pull Request #687 · secureCodeBox/secureCodeBox · GitHub
Open Graph Title: Add defaults for cascading inherit fields and disable omitEmpty by EndPositive · Pull Request #687 · secureCodeBox/secureCodeBox
X Title: Add defaults for cascading inherit fields and disable omitEmpty by EndPositive · Pull Request #687 · secureCodeBox/secureCodeBox
Description: Closes #683 Description This PR, if applied, adds default values to the cascading inherit fields. Using omitEmpty on booleans has an implicit default of omitting false values completely golang/go#13284. Since the cascading hook regards inheritLabels and inheritAnnotations undefined field as true, it was impossible to set those fields to false. secureCodeBox/hooks/cascading-scans/hook/hook.ts Lines 161 to 165 in 79a279a let { inheritAnnotations, inheritLabels, inheritEnv, inheritVolumes } = scan.spec.cascades; return { annotations: mergeInheritedMap(scan.metadata.annotations, scanAnnotations, inheritAnnotations), labels: mergeInheritedMap(scan.metadata.labels, scanLabels, inheritLabels), secureCodeBox/hooks/cascading-scans/hook/scan-helpers.ts Lines 73 to 81 in 79a279a export function mergeInheritedMap(parentProps, ruleProps, inherit: boolean = true) { if (!inherit) { parentProps = {}; } return { ...parentProps, ...ruleProps // ruleProps overwrites any duplicate keys from parentProps } } Fixed by setting the default at CRD level with kubebuilders default annotation and deleting the omitEmpty tag. Results in all cascading scans to have the following fields by default: cascades: inheritAnnotations: true inheritEnv: false inheritLabels: true inheritVolumes: false matchExpressions: - key: securecodebox.io/intensive operator: In values: - light - medium - high - key: securecodebox.io/invasive operator: In values: - non-invasive - invasive inheritLabels and inheritAnnotations true by default #334 inheritEnv and inheritVolumes false by default #538 (comment) Checklist Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests. Make sure npm test runs for the whole project. Make codeclimate checks happy
Open Graph Description: Closes #683 Description This PR, if applied, adds default values to the cascading inherit fields. Using omitEmpty on booleans has an implicit default of omitting false values completely golang/go#1...
X Description: Closes #683 Description This PR, if applied, adds default values to the cascading inherit fields. Using omitEmpty on booleans has an implicit default of omitting false values completely golang/go#1...
Opengraph URL: https://github.com/secureCodeBox/secureCodeBox/pull/687
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:425cf655-791c-d2eb-f685-8610c26653ad |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | A6AC:3762B:D8472B:11927A4:698FC9DA |
| html-safe-nonce | f691b1621cfca34ca15f9601bd76f154d48725e0e96b0a0544295690a53020d1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkFDOjM3NjJCOkQ4NDcyQjoxMTkyN0E0OjY5OEZDOURBIiwidmlzaXRvcl9pZCI6IjUwNTQyODE3NDcyMTYxODk5MTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3d684c664c134d1d4d86577ef372041c8821819d9d3c612aa2581032649f4fb7 |
| hovercard-subject-tag | pull_request:746495641 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/secureCodeBox/secureCodeBox/pull/687/checks |
| twitter:image | https://avatars.githubusercontent.com/u/25148195?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/25148195?s=400&v=4 |
| og:image:alt | Closes #683 Description This PR, if applied, adds default values to the cascading inherit fields. Using omitEmpty on booleans has an implicit default of omitting false values completely golang/go#1... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/secureCodeBox/secureCodeBox git https://github.com/secureCodeBox/secureCodeBox.git |
| octolytics-dimension-user_id | 34573705 |
| octolytics-dimension-user_login | secureCodeBox |
| octolytics-dimension-repository_id | 80711933 |
| octolytics-dimension-repository_nwo | secureCodeBox/secureCodeBox |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 80711933 |
| octolytics-dimension-repository_network_root_nwo | secureCodeBox/secureCodeBox |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 00bbb8945a3943b287e04c68aff13cb5878ddde7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width