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/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:b2ef2fc4-2c34-f428-5239-9e58fafac8fc |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CE08:16FF85:478474:5C243B:698FC41C |
| html-safe-nonce | 440e78be460a66bba33cff428ef6c85a972eec497bc2181cb69393a8a1924a2e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTA4OjE2RkY4NTo0Nzg0NzQ6NUMyNDNCOjY5OEZDNDFDIiwidmlzaXRvcl9pZCI6Ijg2NzI1MzM0OTc4NDIyMjIxMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 868b0c99571465cfd6bf31359e994514cc75bfb5b3e7e60f28f4274c4fb5edc2 |
| hovercard-subject-tag | pull_request:746495641 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/files |
| 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 |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 111423ee085528bc9fa8c25b2e698c30347f841e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width