Repository: kubernetes-sigs/security-profiles-operator
Pull request #1303 (2022-11-15 23:12:15)

build(deps): bump github/codeql-action from 2.1.31 to 2.1.32
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.31 to 2.1.32.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/github/codeql-action/blob/main/CHANGELOG.md">github/codeql-action's changelog</a>.</em></p>
<blockquote>
<h1>CodeQL Action Changelog</h1>
<h2>[UNRELEASED]</h2>
<ul>
<li>Go is now analyzed in the same way as other compiled languages such as C/C++, C#, and Java. This completes the rollout of the feature described in <a href="https://github.com/github/codeql-action/blob/main/#2127---06-oct-2022">CodeQL Action version 2.1.27</a>. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1322">#1322</a></li>
</ul>
<h2>2.1.32 - 14 Nov 2022</h2>
<ul>
<li>Update default CodeQL bundle version to 2.11.3. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1348">#1348</a></li>
<li>Update the ML-powered additional query pack for JavaScript to version 0.4.0. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1351">#1351</a></li>
</ul>
<h2>2.1.31 - 04 Nov 2022</h2>
<ul>
<li>The <code>rb/weak-cryptographic-algorithm</code> Ruby query has been updated to no longer report uses of hash functions such as <code>MD5</code> and <code>SHA1</code> even if they are known to be weak. These hash algorithms are used very often in non-sensitive contexts, making the query too imprecise in practice. For more information, see the corresponding change in the <a href="https://github-redirect.dependabot.com/github/codeql/pull/11129">github/codeql repository</a>. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1344">#1344</a></li>
</ul>
<h2>2.1.30 - 02 Nov 2022</h2>
<ul>
<li>Improve the error message when using CodeQL bundle version 2.7.2 and earlier in a workflow that runs on a runner image such as <code>ubuntu-22.04</code> that uses glibc version 2.34 and later. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1334">#1334</a></li>
</ul>
<h2>2.1.29 - 26 Oct 2022</h2>
<ul>
<li>Update default CodeQL bundle version to 2.11.2. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1320">#1320</a></li>
</ul>
<h2>2.1.28 - 18 Oct 2022</h2>
<ul>
<li>Update default CodeQL bundle version to 2.11.1. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1294">#1294</a></li>
<li>Replace uses of GitHub Actions command <code>set-output</code> because it is now deprecated. See more information in the <a href="https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/">GitHub Changelog</a>. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1301">#1301</a></li>
</ul>
<h2>2.1.27 - 06 Oct 2022</h2>
<ul>
<li>We are rolling out a feature of the CodeQL Action in October 2022 that changes the way that Go code is analyzed to be more consistent with other compiled languages like C/C++, C#, and Java. You do not need to alter your code scanning workflows. If you encounter any problems, please <a href="https://github.com/github/codeql-action/issues">file an issue</a> or open a private ticket with GitHub Support and request an escalation to engineering.</li>
</ul>
<h2>2.1.26 - 29 Sep 2022</h2>
<ul>
<li>Update default CodeQL bundle version to 2.11.0. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1267">#1267</a></li>
</ul>
<h2>2.1.25 - 21 Sep 2022</h2>
<ul>
<li>We will soon be rolling out a feature of the CodeQL Action that stores some information used to make future runs faster in the GitHub Actions cache. Initially, this will only be enabled on JavaScript repositories, but we plan to add more languages to this soon. The new feature can be disabled by passing the <code>trap-caching: false</code> option to your workflow's <code>init</code> step, for example if you are already using the GitHub Actions cache for a different purpose and are near the storage limit for it.</li>
<li>Add support for Python automatic dependency installation with Poetry 1.2 <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1258">#1258</a>.</li>
</ul>
<h2>2.1.24 - 16 Sep 2022</h2>
<p>No user facing changes.</p>
<h2>2.1.23 - 14 Sep 2022</h2>
<ul>
<li>Allow CodeQL packs to be downloaded from GitHub Enterprise Server instances, using the new <code>registries</code> input for the <code>init</code> action.  <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1221">#1221</a></li>
<li>Update default CodeQL bundle version to 2.10.5. <a href="https://github-redirect.dependabot.com/github/codeql-action/pull/1240">#1240</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/github/codeql-action/commit/4238421316c33d73aeea2801274dd286f157c2bb"><code>4238421</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/github/codeql-action/issues/1360">#1360</a> from github/update-v2.1.32-33b10be6</li>
<li><a href="https://github.com/github/codeql-action/commit/97be6233c47474b2a1e97b63152033b56c3c787b"><code>97be623</code></a> Update changelog for v2.1.32</li>
<li><a href="https://github.com/github/codeql-action/commit/33b10be6bf0b751c776ae2799b0f044885a8fa8f"><code>33b10be</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/github/codeql-action/issues/1348">#1348</a> from github/henrymercer/use-codeql-2.11.3</li>
<li><a href="https://github.com/github/codeql-action/commit/718930badf638c8740119d849514fa7e9e51c5b0"><code>718930b</code></a> Pin npm to latest v8 release to address failing PR check</li>
<li><a href="https://github.com/github/codeql-action/commit/76a77405c1b8a47eba00a58065006257ac78b871"><code>76a7740</code></a> Fix Python query identifier in file baseline information PR check</li>
<li><a href="https://github.com/github/codeql-action/commit/9452b6b86419d8a93dbcd8f170ba3b038c9925ae"><code>9452b6b</code></a> Merge branch 'main' into henrymercer/use-codeql-2.11.3</li>
<li><a href="https://github.com/github/codeql-action/commit/006bb00765df5ace47e70657a677e6ecd3b0d6a1"><code>006bb00</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/github/codeql-action/issues/1354">#1354</a> from github/edoardo/force-exit-on-timeout</li>
<li><a href="https://github.com/github/codeql-action/commit/d6f6ef4b0b0c3e0782ede504230ba3aecbf41c2e"><code>d6f6ef4</code></a> Force exit of process if a timeout has occurred</li>
<li><a href="https://github.com/github/codeql-action/commit/7c9e85e249d3e141c3efb486a47aa843f8186dde"><code>7c9e85e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/github/codeql-action/issues/1353">#1353</a> from kaeluka/add-ATM-0.4.0-to-changelog</li>
<li><a href="https://github.com/github/codeql-action/commit/fb3fdd7e158f390d238c7b155f77a6e587a4ee46"><code>fb3fdd7</code></a> add ATM 0.4.0 to changelog</li>
<li>Additional commits viewable in <a href="https://github.com/github/codeql-action/compare/c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898...4238421316c33d73aeea2801274dd286f157c2bb">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github/codeql-action&package-manager=github_actions&previous-version=2.1.31&new-version=2.1.32)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

k8s-ci-robot: Hi @dependabot[bot]. Thanks for your PR.

I'm waiting for a [kubernetes-sigs](https://github.com/orgs/kubernetes-sigs/people) member to verify that this patch is reasonable to test. If it is, they should reply with `/ok-to-test` on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should [join the org](https://git.k8s.io/community/community-membership.md#member) to skip this step.

Once the patch is verified, the new status will be reflected by the `ok-to-test` label.

I understand the commands that are listed [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
</details>

k8s-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/1303#" title="Author self-approved">dependabot[bot]</a>*
**Once this PR has been reviewed and has the lgtm label**, please assign jhrozek for approval by writing `/assign @jhrozek` in a comment. For more information see [the Kubernetes Code Review Process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process).

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/main/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["jhrozek"]} -->
k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/1303#" title="Author self-approved">dependabot[bot]</a>*, *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/1303#pullrequestreview-1182424451" title="LGTM">jhrozek</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/main/OWNERS)~~ [jhrozek]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/Dockerfile.ubi b/Dockerfile.ubi
index 925139212..5f7a8930e 100644
--- a/Dockerfile.ubi
+++ b/Dockerfile.ubi
@@ -12,17 +12,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# hash below referred to `:36` tag
-FROM registry.fedoraproject.org/fedora-minimal@sha256:b676cdd0fdefe33124325082d070c39558f1966a63dfd1193681a7900707d332 AS build
+# go-toolset uses RH's Go fork which uses OpenSSL for FIPS-certified crypto
+# if this is not desirable, pass -tags no_openssl to SPO build
+# see https://access.redhat.com/documentation/en-us/red_hat_developer_tools/2018.4/html/using_go_toolset/chap-changes
+# for more details
+
+# hash below referred to latest
+FROM registry.access.redhat.com/ubi8/go-toolset@sha256:5c33798716db98ce485d606451bef1dd7a6eb3b1422a67cbd10eacc870eb2de5 as build
 USER root
 WORKDIR /work
 
-RUN microdnf install -y \
-        git \
-        glibc-static \
-        golang-bin \
-        make \
-        libseccomp-static
+RUN dnf install -y \
+        libseccomp-devel
 
 ADD . /work
 RUN mkdir -p build
@@ -30,6 +31,9 @@ RUN mkdir -p build
 ARG APPARMOR_ENABLED=0
 ARG BPF_ENABLED=0
 
+# OCP in FIPS mode doesn't like statically linked SPO
+ARG STATIC_LINK=no
+
 RUN make
 
 # hash below referred to latest
@@ -37,6 +41,9 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal@sha256:33931dce809712888d1a8061
 ARG version
 USER root
 
+RUN microdnf install -y \
+        libseccomp
+
 LABEL name="Security Profiles Operator" \
       version=$version \
       description="The Security Profiles Operator makes it easier for cluster admins to manage their seccomp, SELinux or AppArmor profiles and apply them to Kubernetes' workloads."
diff --git a/Makefile b/Makefile
index 6901004c3..dbb9d7226 100644
--- a/Makefile
+++ b/Makefile
@@ -91,11 +91,18 @@ GO_PROJECT := sigs.k8s.io/$(PROJECT)
 LDVARS := \
 	-X $(GO_PROJECT)/internal/pkg/version.buildDate=$(BUILD_DATE) \
 	-X $(GO_PROJECT)/internal/pkg/version.version=$(VERSION)
+STATIC_LINK ?= yes
+ifeq ($(STATIC_LINK), yes)
+  EXTLDFLAGS := -extldflags "-static"
+else
+  EXTLDFLAGS :=
+endif
+
 LINKMODE_EXTERNAL ?= yes
 ifeq ($(LINKMODE_EXTERNAL), yes)
-  LDFLAGS := -s -w -linkmode external -extldflags "-static" $(LDVARS)
+  LDFLAGS := -s -w -linkmode external $(EXTLDFLAGS) $(LDVARS)
 else
-  LDFLAGS := -s -w -extldflags "-static" $(LDVARS)
+  LDFLAGS := -s -w $(EXTLDFLAGS) $(LDVARS)
 endif
 
 export CONTAINER_RUNTIME ?= $(if $(shell which podman 2>/dev/null),podman,docker)
diff --git a/examples/apparmorprofile-flux-controllers.yaml b/examples/apparmorprofile-flux-controllers.yaml
new file mode 100644
index 000000000..b85c26d8e
--- /dev/null
+++ b/examples/apparmorprofile-flux-controllers.yaml
@@ -0,0 +1,75 @@
+---
+apiVersion: security-profiles-operator.x-k8s.io/v1alpha1
+kind: AppArmorProfile
+metadata:
+  name: flux-controllers
+  namespace: security-profiles-operator
+  annotations:
+    description: AppArmor profile for the Flux Controllers.
+spec:
+  policy: |
+    #include <tunables/global>
+
+    profile flux-controllers flags=(attach_disconnected, mediate_deleted) {
+      include <abstractions/base>
+      include <abstractions/ssl_certs>
+      include <abstractions/gnupg>
+      include <abstractions/user-tmp>
+
+      # Allow udp/tcp, ipv4 and ipv6.
+      network inet stream,
+      network inet6 stream,
+      network tcp,
+      network udp, 
+
+      # Controller binaries.
+      /usr/local/bin/{source,helm,kustomize,image-automation,image-reflector,notification}-controller mrix,
+
+      # gpg is needed by kustomize-controller when using GPG decryption.
+      /usr/bin/gpg{,-agent} mrix,
+
+      # Some controllers are started via tini.
+      /sbin/tini mrix,
+
+      # git is needed by kustomize-controller when using remote bases.
+      /usr/bin/git mrix,
+
+      # Data storage locations.
+      # /data is used as artifact storage and base for File Server.
+      /data/ rwk,
+      /data/** rwk,
+
+      # Access to Kubernetes service account tokens.
+      /run/secrets/kubernetes.io/serviceaccount/** r,
+
+      /etc/{group,passwd,hosts} r,
+      /etc/{nsswitch,resolv}.conf r,
+
+      /proc/sys/net/core/somaxconn r,
+      /sys/kernel/mm/transparent_hugepage/hpage_pmd_size r,
+
+      # Deny raw and packet level network access.
+      deny network raw,
+      deny network packet,
+
+      # Allow read access to its own process files.
+      @{PROC}/@{pid}/ r,
+      @{PROC}/@{pid}/** r,
+
+      # The denied capabilities below will take precedence over any capabilities
+      # given at pod-level or by default from the container runtime.
+      deny capability net_bind_service, # not needed for ports above 1024.
+      deny capability audit_control,
+      deny capability dac_override,
+      deny capability sys_chroot,
+      deny capability sys_boot,
+      deny capability sys_module,
+      deny capability sys_admin,
+      deny capability sys_ptrace,
+      deny capability syslog,
+      deny capability net_raw,
+      deny capability net_admin,
+      deny capability mac_admin,
+      deny capability mac_override,
+      deny capability mknod,
+    }


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 3f7c0c82a..21aba8f5f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -29,11 +29,11 @@ jobs:
     runs-on: ubuntu-22.04
     steps:
       - uses: actions/checkout@v3
-      - uses: github/codeql-action/init@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898
+      - uses: github/codeql-action/init@4238421316c33d73aeea2801274dd286f157c2bb
         with:
           languages: go
-      - uses: github/codeql-action/autobuild@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898
-      - uses: github/codeql-action/analyze@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898
+      - uses: github/codeql-action/autobuild@4238421316c33d73aeea2801274dd286f157c2bb
+      - uses: github/codeql-action/analyze@4238421316c33d73aeea2801274dd286f157c2bb
 
   coverage:
     runs-on: ubuntu-22.04