Repository navigation
🔒 Make kwatch secure by default - #632
Merged
Merged
Conversation
# Conflicts: # Dockerfile # RELEASES.md # docs/configuration.md
Retry the Secret read, never save a new key after a failed read, and re-read the Secret when another writer stored a key first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes kwatch secure by default for the next release.
Changes
deploy/deploy.yamlno longer grants*/*list/watch; its ClusterRole is the chart'srbac.mode=least-privilegelist (custom resources behave as in that mode:permission_deniedin /health coverage; Helmrbac.mode=fullstays for CRDs). Newdeploy/deploy-no-secrets.yamlis the same file without Secret access (nosecretsin the ClusterRole,KWATCH_WATCH_SECRETS=false); an architecture test keeps the two identical apart from that. Release/publish workflows,SHA256SUMSandcheck-release-consistency.shnow cover the variant.networkPolicy.enabled: true) and mirrored in both manifests. Ingress to 8060 from the release namespace only (kubelet probes need no rule: Kubernetes never blocks a pod's own node;kubeletCIDRsstays for plugins that do). Egress: DNS, API server ports, kubelet 10250, CoreDNS 9153 (kube-dns pods only) and 443 always (api.kwatch.dev, api.github.com, providers). Opt out withnetworkPolicy.enabled=false; newnetworkPolicy.extraEgress(oldegressstill renders).kwatch-digest-key(shipped pre-created and empty by the chart and both manifests,helm.sh/resource-policy: keep). Role grants get/update on that name only, nocreate(RBAC cannot scope create by name; same pattern as the license instance Secret). kwatch still creates the Secret if it is missing and allowed. An existing key is migrated into the Secret on first start (digests stay stable) and then deleted from state; if the Secret cannot be used the key stays in the state file.internal/redactbefore caching (init_wait still reads them). Env values kept for dependency checks now store onlyhost:port(no user, password, path, query); URL userinfo is stripped from other kept values.watch.configmaps(chart value, config key,KWATCH_WATCH_CONFIGMAPS, RBAC), default true. False removes ConfigMap RBAC and the watch; coverage showsdisabled_by_configand dependent checks report they cannot verify, likewatch.secrets=false.upgrader.notifyProviders: [...]routes the update notice to the named providers (empty = all). Names must be configured underalert, validated.Generated references, chart README/values/schema, docs and RELEASES.md updated.
What kwatch.sh must do (kwatch.dev/apps/web, not changed here)
deploy/deploy.yaml. Decline: applydeploy/deploy-no-secrets.yaml. Both are fetched from the release tag and verified throughSHA256SUMS, which now listsdeploy/deploy-no-secrets.yamltoo (publish.yml's expected-list check was updated). Releases before this one lack the file, so 8000 only offer the choice for versions that have it.KWATCH_WATCH_SECRETSenv). Stop printing "turn this off with watch.secrets"; with the variant the RBAC is actually removed.kwatch-digest-keyorkwatch-license-instance.Checks run
Targeted Go tests (config, config/crd, delivery, upgrader, inventory/kube, app, architecture),
deploy/chart/test_helm.sh, manifest parity, release consistency, line-check, diff-check, docs-verify.CI must verify
Full
make ci, e2e (labele2e): kind runs with the new NetworkPolicy and manifest RBAC, andtest_helm_upgrade.sh/lifecycle need a cluster. Active probes, non-443 providers and proxies needextraEgress/extraEgressPortsnow.Also in this PR
state.retention.{incidents,changes,evidence,recording},state.maxSizeMiB(startup only)./metrics(healthCheck.metricsToken/KWATCH_METRICS_TOKEN, chartmetrics.tokenSecret)./healthno longer shows the leader pod identity or a raw leadership-loss reason.*/*rule covered it).redact.entropy),redact.allow,redact.extraPatterns, new bare-format patterns; whole-line base64 now shows[redacted].