Skip to content

Add keyless support to verify-conforma-konflux-ta release pipeline task also#3158

Open
simonbaird wants to merge 8 commits intoconforma:mainfrom
simonbaird:keyless-support-in-release-task
Open

Add keyless support to verify-conforma-konflux-ta release pipeline task also#3158
simonbaird wants to merge 8 commits intoconforma:mainfrom
simonbaird:keyless-support-in-release-task

Conversation

@simonbaird
Copy link
Member

Bring the changes from the verify-enterprise-contract task, used in Konflux Integration Tests, added in PR #3140, over to the verify-conforma-konflux-ta task, used in Konflux release pipeline, so we can support keyless verification in the release pipeline also.

Ref: https://issues.redhat.com/browse/EC-1652

@qodo-code-review
Copy link
Contributor

Review Summary by Qodo

Add keyless signing support to verify-conforma-konflux-ta release pipeline task

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add keyless signing support to release pipeline task with CERTIFICATE_IDENTITY and
  CERTIFICATE_OIDC_ISSUER parameters
• Refactor bash script to use consistent --flag=value style and environment variables for all
  parameters
• Change timeout from 100h to 0 to indicate no timeout, letting Tekton handle timeouts
• Improve parameter descriptions for clarity on keyless vs traditional signing verification
• Enhance consistency between verify-enterprise-contract and verify-conforma-konflux-ta tasks
Diagram
flowchart LR
  A["Release Pipeline Task"] -->|Add keyless params| B["CERTIFICATE_IDENTITY<br/>CERTIFICATE_OIDC_ISSUER"]
  A -->|Refactor script| C["Consistent arg handling<br/>--flag=value style"]
  A -->|Update timeout| D["0 timeout<br/>Tekton manages"]
  B -->|Conditional logic| E["Keyless or Traditional<br/>Signing verification"]
  C -->|Use env vars| F["All params via<br/>environment variables"]
Loading

Grey Divider

File Changes

1. tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml ✨ Enhancement +111/-40

Add keyless signing and refactor argument handling

• Added CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER parameters for keyless verification support
• Refactored validate script to use consistent --flag=value argument style and environment variables
• Changed timeout from 100h to 0 to indicate no timeout, allowing Tekton to manage timeouts
• Improved PUBLIC_KEY parameter description to clarify it's for traditional signing and will be
 ignored if keyless params provided
• Added conditional logic to use keyless or traditional signing based on provided parameters
• Moved all parameter references to environment variables for safer handling

tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml


2. tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml ✨ Enhancement +34/-32

Improve parameter descriptions and argument consistency

• Enhanced CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER parameter descriptions with guidance on
 mutual requirement and PUBLIC_KEY override behavior
• Improved PUBLIC_KEY parameter description to clarify it's for traditional signing
• Refactored argument handling to use consistent --flag=value style instead of mixed styles
• Changed timeout from 100h to 0 to indicate no timeout
• Updated --show-successes to use explicit true value for consistency

tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml


3. docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc 📝 Documentation +3/-1

Document keyless verification parameters

• Added documentation for CERTIFICATE_IDENTITY parameter for keyless verification
• Added documentation for CERTIFICATE_OIDC_ISSUER parameter for keyless verification
• Enhanced PUBLIC_KEY parameter description to clarify it's for traditional signing and will be
 ignored if keyless params provided
• Added guidance that both keyless parameters should be provided together

docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc


View more (1)
4. docs/modules/ROOT/pages/verify-enterprise-contract.adoc 📝 Documentation +3/-3

Enhance keyless parameter documentation

• Enhanced CERTIFICATE_IDENTITY parameter description with guidance on mutual requirement with
 CERTIFICATE_OIDC_ISSUER
• Enhanced CERTIFICATE_OIDC_ISSUER parameter description with guidance on mutual requirement with
 CERTIFICATE_IDENTITY
• Improved PUBLIC_KEY parameter description to clarify it's for traditional signing and will be
 ignored if keyless params provided
• Added clarity that PUBLIC_KEY param will be ignored if keyless parameters are provided

docs/modules/ROOT/pages/verify-enterprise-contract.adoc


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Mar 4, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Keyless ignored if policy has key 🐞 Bug ⛨ Security
Description
Even when the task passes --certificate-identity/--certificate-oidc-issuer, Conforma only uses
keyless identity when the resolved policy’s PublicKey is empty; otherwise it prioritizes the
public-key workflow and ignores identity. With the default policy commonly containing publicKey,
users may believe they enabled keyless verification but actually still run key-based verification
(or get unexpected failures).
Code

tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml[R321-330]

+        if [ -n "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
+          cmd_args+=(
+            --certificate-identity="${CERTIFICATE_IDENTITY}"
+            --certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
+          )
+        elif [ -n "${PUBLIC_KEY}" ]; then
+          cmd_args+=(
+            --public-key="${PUBLIC_KEY}"
+          )
+        fi
Evidence
The task conditionally adds certificate flags instead of --public-key, but Conforma’s policy
implementation treats "keyless" strictly as PublicKey == "" and only applies/validates identity in
that case. Tests explicitly assert public-key workflow takes priority over keyless identity when a
public key is present, and the repo’s acceptance baseline shows policies typically include
publicKey.

tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml[319-330]
internal/policy/policy.go[126-129]
internal/policy/policy.go[248-269]
internal/policy/policy_test.go[363-372]
acceptance/baselines/happy-output.json[39-45]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The task now supports keyless flags, but Conforma only enables keyless verification when the resolved policy has an empty `publicKey`. If the referenced EnterpriseContractPolicy still contains `publicKey`, keyless identity/issuer flags will not take effect.

## Issue Context
This can lead to silent misconfiguration: users provide `CERTIFICATE_IDENTITY`/`CERTIFICATE_OIDC_ISSUER` expecting keyless identity enforcement, but Conforma prioritizes the public-key workflow when `publicKey` is present.

## Fix Focus Areas
- docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc[24-27]
- docs/modules/ROOT/pages/verify-enterprise-contract.adoc[35-38]
- tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml[52-85]
- tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml[59-92]

(Optionally consider a code change in Conforma to allow identity flags to override publicKey, but that’s beyond task-only changes.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Task READMEs stale vs YAML 🐞 Bug ✧ Quality
Description
The task YAML/docs now describe keyless verification parameters and updated PUBLIC_KEY semantics,
but the task README.md files still describe PUBLIC_KEY as the signature verification input and omit
CERTIFICATE_* parameters. This increases the chance that users configure the task incorrectly when
following the README-based installation flow.
Code

tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml[R52-85]

    - name: PUBLIC_KEY
      type: string
      description: >-
-        Public key used to verify signatures. Must be a valid k8s cosign
-        reference, e.g. k8s://my-space/my-secret where my-secret contains
-        the expected cosign.pub attribute.
+        Public key used to verify traditional long-lived signatures. Must be a
+        valid k8s cosign reference, e.g. k8s://my-space/my-secret where
+        my-secret contains the expected cosign.pub attribute. Required for
+        traditional signing key verification. Will be ignored if
+        CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER are provided.
      default: ""

    - name: REKOR_HOST
      type: string
      description: Rekor host for transparency log lookups
      default: ""

+    - name: CERTIFICATE_IDENTITY
+      type: string
+      description: >-
+        Expected identity in the signing certificate for keyless verification.
+        This should be the email or URI that was used when signing.
+        You should provide both CERTIFICATE_OIDC_ISSUER and CERTIFICATE_IDENTITY
+        for keyless verification. The PUBLIC_KEY param will be ignored if these
+        are provided.
+      default: ""
+
+    - name: CERTIFICATE_OIDC_ISSUER
+      type: string
+      description: >-
+        Expected OIDC issuer in the signing certificate for keyless verification.
+        This should match the issuer that provided the identity token used for signing.
+        You should provide both CERTIFICATE_OIDC_ISSUER and CERTIFICATE_IDENTITY for
+        keyless verification. The PUBLIC_KEY param will be ignored if these are provided.
+      default: ""
+
Evidence
The task YAML defines CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER, but the corresponding
task README parameter list does not mention them and still uses the old PUBLIC_KEY description. The
same mismatch exists for verify-enterprise-contract.

tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml[52-85]
tasks/verify-conforma-konflux-ta/0.1/README.md[20-26]
tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml[74-91]
tasks/verify-enterprise-contract/0.1/README.md[29-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Task README.md parameter documentation is out of date relative to the task YAML and site docs, omitting keyless parameters and still describing PUBLIC_KEY as the primary signature verification input.

## Issue Context
Users often install and configure tasks by reading `tasks/&lt;task&gt;/&lt;ver&gt;/README.md`. Stale docs can lead to incorrect configuration and failed or weaker-than-expected verification.

## Fix Focus Areas
- tasks/verify-conforma-konflux-ta/0.1/README.md[15-46]
- tasks/verify-enterprise-contract/0.1/README.md[13-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@simonbaird
Copy link
Member Author

For reviewers: The important functional change is in the top commit. You can look at that separately to understand the new keyless support. The other commits about are more about tidying and consistency. For review it might be easier to look at them one by one.

Comment on lines +321 to +330
if [ -n "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
cmd_args+=(
--certificate-identity="${CERTIFICATE_IDENTITY}"
--certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
)
elif [ -n "${PUBLIC_KEY}" ]; then
cmd_args+=(
--public-key="${PUBLIC_KEY}"
)
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Action required

1. Keyless ignored if policy has key 🐞 Bug ⛨ Security

Even when the task passes --certificate-identity/--certificate-oidc-issuer, Conforma only uses
keyless identity when the resolved policy’s PublicKey is empty; otherwise it prioritizes the
public-key workflow and ignores identity. With the default policy commonly containing publicKey,
users may believe they enabled keyless verification but actually still run key-based verification
(or get unexpected failures).
Agent Prompt
## Issue description
The task now supports keyless flags, but Conforma only enables keyless verification when the resolved policy has an empty `publicKey`. If the referenced EnterpriseContractPolicy still contains `publicKey`, keyless identity/issuer flags will not take effect.

## Issue Context
This can lead to silent misconfiguration: users provide `CERTIFICATE_IDENTITY`/`CERTIFICATE_OIDC_ISSUER` expecting keyless identity enforcement, but Conforma prioritizes the public-key workflow when `publicKey` is present.

## Fix Focus Areas
- docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc[24-27]
- docs/modules/ROOT/pages/verify-enterprise-contract.adoc[35-38]
- tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml[52-85]
- tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml[59-92]

(Optionally consider a code change in Conforma to allow identity flags to override publicKey, but that’s beyond task-only changes.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link
Member Author

@simonbaird simonbaird Mar 4, 2026

Choose a reason for hiding this comment

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

This was suggested in #3140 also. My thinking is I'd rather not add a layer of bash param validation. I guess we could go harder in that direction and remove the "else" part of the logic.

Not sure what Conforma would do if it received the keyless params and a public key, but we could try it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Code Implementation 🛠️

Implementation: Add explicit warnings in the validate step when keyless parameters are partially provided or when keyless parameters are provided but verification may still fall back to key-based verification due to policy configuration. Keep existing argument selection behavior (keyless takes precedence over PUBLIC_KEY when both keyless params are set).

Suggested change
if [ -n "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
cmd_args+=(
--certificate-identity="${CERTIFICATE_IDENTITY}"
--certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
)
elif [ -n "${PUBLIC_KEY}" ]; then
cmd_args+=(
--public-key="${PUBLIC_KEY}"
)
fi
if [ -n "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
cmd_args+=(
--certificate-identity="${CERTIFICATE_IDENTITY}"
--certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
)
echo "INFO: Keyless parameters provided. Note: if the referenced policy configuration still sets a publicKey, Conforma may prioritize key-based verification." >&2
elif [ -n "${CERTIFICATE_IDENTITY}" ] || [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
echo "WARNING: Only one of CERTIFICATE_IDENTITY/CERTIFICATE_OIDC_ISSUER was provided. Keyless verification requires both; falling back to PUBLIC_KEY/policy configuration if available." >&2
if [ -n "${PUBLIC_KEY}" ]; then
cmd_args+=(
--public-key="${PUBLIC_KEY}"
)
fi
elif [ -n "${PUBLIC_KEY}" ]; then
cmd_args+=(
--public-key="${PUBLIC_KEY}"
)
fi

See review comment here

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
acceptance 54.86% <ø> (ø)
generative 18.14% <ø> (ø)
integration 26.99% <ø> (ø)
unit 68.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

st3penta
st3penta previously approved these changes Mar 5, 2026
Copy link
Contributor

@st3penta st3penta left a comment

Choose a reason for hiding this comment

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

thanks for tidying up the task args, looks much cleaner this way

@simonbaird
Copy link
Member Author

Needs a rebase on #3118.

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

Adds keyless (certificate/OIDC) verification alongside traditional public-key verification. Introduces CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER across docs and tasks; tasks now build dynamic cmd_args, conditionally use certificate vs public-key flags, and extend VSA, retry, retry/backoff, operational knobs, and output handling.

Changes

Cohort / File(s) Summary
Documentation
docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc, docs/modules/ROOT/pages/verify-enterprise-contract.adoc
Added CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER docs for keyless verification; clarified PUBLIC_KEY behavior and that it is ignored when certificate params provided; added/updated defaults and many operational knobs (IGNORE_REKOR, TUF_MIRROR, SSL_CERT_DIR, retry settings, VSA/attestation, OCI/storage, WORKERS, EFFECTIVE_TIME, HOME, EXTRA_RULE_DATA, etc.).
Verify Conforma Konflux Task
tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
Added CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER params; replaced static EC_ARGS with cmd_args; conditional certificate vs public-key flag construction; added VSA enablement/attestation handling, dedicated attestation-output-dir, conditional copying of VSA artifacts and report JSON; broadened env propagation (REKOR, IGNORE_REKOR, RETRY_, ENABLE_VSA, ATTESTATION_FORMAT, VSA_, WORKERS, INFO, EFFECTIVE_TIME, EXTRA_RULE_DATA, HOMEDIR).
Verify Enterprise Contract Task
tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml
Added CERTIFICATE_IDENTITY param; updated PUBLIC_KEY and CERTIFICATE_OIDC_ISSUER descriptions; switched to equals-style flags (--flag="${VAR}"), conditional certificate/issuer vs public-key flag generation; unified output/retry/timeout flags; command executed via exec ec "${cmd_args[@]}"; updated env/paths to use HOMEDIR.
Makefile
Makefile
Added logic to preserve/restore deleted feature snapshots when running a single feature test: insert/remove @focus markers, and if UPDATE_SNAPS set, restore deleted snapshots from git.

Sequence Diagram(s)

sequenceDiagram
    participant Task as Task Executor
    participant EC as Conforma/EC CLI
    participant OIDC as OIDC Provider
    participant Rekor as Transparency Log
    participant VSA as VSA/Attestation Service

    Task->>EC: Build cmd_args from params (cert identity/issuer OR public key, retries, VSA flags, outputs)
    alt Certificate-based verification
        Task->>EC: Execute with --certificate-identity="..." --certificate-oidc-issuer="..."
        EC->>OIDC: Validate certificate identity via OIDC issuer
        OIDC-->>EC: Identity assertion / certificate info
    else Public-key verification
        Task->>EC: Execute with --public-key="..."
        EC->>EC: Verify signature against provided public key
    end
    EC->>Rekor: Consult/submit to transparency log (unless IGNORE_REKOR=true)
    Rekor-->>EC: Rekor response
    alt ENABLE_VSA
        EC->>VSA: Upload attestation / request VSA signing
        VSA-->>EC: Attestation/VSA result & artifacts
        EC-->>Task: Write attestation-output-dir, copy artifacts to configured VSA output path
    end
    EC-->>Task: Return verification status and outputs (text/json/appstudio reports)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main change: adding keyless verification support to the verify-conforma-konflux-ta task, matching the changeset's primary objective.
Description check ✅ Passed Description is directly related to the changeset, explaining the port of keyless verification from verify-enterprise-contract to verify-conforma-konflux-ta with issue reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@simonbaird
Copy link
Member Author

Rebase done.

See the commentary being removed for explanation. It's been over a
year since that was supported, so should be safe to use it now,
(fingers crossed I guess?).

See commits 73f183e and
b7c7d0e from
https://issues.redhat.com/browse/EC-1030 .

Misc cleanup while working on...

Ref: https://issues.redhat.com/browse/EC-1652
- Use --flag=value style consistently instead of a mix of styles
- Remove needless quoting when preparing args
- Do the quoting consistently when it is needed

Ref: https://issues.redhat.com/browse/EC-1652
- Make some of the bash more consistent with the
  verify-enterprise-contract ITS task.
- Use vars for all params instead of referencing params directly in
  the bash.
- Use --flag=value flag style consistently.
- Remove some unneeded quoting and use consistent quoting style
  where it is needed.

I'm about to add some new params for keyless signing, and this
commit is meant to make that change tider and easier to review.

Ref: https://issues.redhat.com/browse/EC-1652
A fixup for conforma#3118.

Looks like we don't need it until later in the task, so remove the
initial place where it was being calculated but not used.

Also add a fixme descibing the problem what was mentioned by Qodo in
the conforma#3118 PR.
This was added to the verify-enterprise-contract task very recently
in PR conforma#3140, specifically in commit da68f18. Here we're bring the
same change to the verify-conforma-konflux-ta which is the one used
by the Konflux release pipeline.

This commit also contains some param description improvements, which
are "back-ported" to the other task as well.

Ref: https://issues.redhat.com/browse/EC-1652
@simonbaird simonbaird force-pushed the keyless-support-in-release-task branch from cae552e to 51b498e Compare March 5, 2026 21:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml`:
- Line 315: The snapshot input path is hardcoded as the literal flag value
"--images=/tekton/home/snapshot.json"; change it to use the HOMEDIR variable
instead (e.g., replace the hardcoded path with
"--images=${HOMEDIR}/snapshot.json" or the pipeline's equivalent variable
substitution) so the step that reads the snapshot uses the overridden HOMEDIR;
update the step that constructs the --images flag to reference the HOMEDIR
environment/parameter (symbol: the "--images=..." flag and the HOMEDIR
variable).

In `@tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml`:
- Line 267: The validate step is hardcoding the snapshot path via
"--images=/tekton/home/snapshot.json" which breaks when the HOMEDIR parameter is
changed; update the argument to use the parameterized HOMEDIR (replace the
literal path with the HOMEDIR variable used in this task) so the flag becomes
something like "--images=$(params.HOMEDIR)/snapshot.json" (or the file's
existing variable syntax) ensuring the validate step references HOMEDIR rather
than the hardcoded "/tekton/home".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c527df33-9674-452f-918c-8d13eac988eb

📥 Commits

Reviewing files that changed from the base of the PR and between 1d37a50 and cae552e.

📒 Files selected for processing (4)
  • docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc
  • docs/modules/ROOT/pages/verify-enterprise-contract.adoc
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml (1)

264-268: ⚠️ Potential issue | 🟠 Major

Avoid hardcoded snapshot path in validate arguments.

Line 267 hardcodes /tekton/home/snapshot.json, which bypasses the configurable HOMEDIR path used by reduce.

Proposed fix
         cmd_args=(
           validate
           image
-          --images=/tekton/home/snapshot.json
+          --images="${HOMEDIR}/snapshot.json"
           --policy="${POLICY_CONFIGURATION}"
         )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml` around
lines 264 - 268, The validate command args currently hardcode
/tekton/home/snapshot.json in the cmd_args tuple (the validate image invocation
using --images), which bypasses the configurable HOMEDIR used by reduce; update
the --images argument to reference the HOMEDIR variable (e.g.,
--images="${HOMEDIR}/snapshot.json" or the same snapshot path variable used by
reduce) so the validate invocation uses the configurable home directory and not
a hardcoded path, ensuring consistency with reduce and other steps that rely on
HOMEDIR and preserving the existing POLICY_CONFIGURATION usage.
tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml (1)

312-316: ⚠️ Potential issue | 🟠 Major

Use HOMEDIR for the snapshot input path in validate.

Line 315 hardcodes /tekton/home/snapshot.json, but snapshot generation is tied to HOMEDIR. If HOMEDIR is overridden, validation reads the wrong path.

Proposed fix
         cmd_args=(
           validate
           image
-          --images=/tekton/home/snapshot.json
+          --images="${HOMEDIR}/snapshot.json"
           --policy="${POLICY_CONFIGURATION}"
         )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml` around
lines 312 - 316, The validate command currently hardcodes the snapshot path as
/tekton/home/snapshot.json; update the cmd_args construction where validate
image is assembled to use the HOMEDIR variable instead (e.g. replace the
hardcoded "/tekton/home/snapshot.json" with "${HOMEDIR}/snapshot.json") so the
validation reads the snapshot from the same HOMEDIR used during snapshot
generation; ensure the --images argument uses the HOMEDIR-based path and keep
the surrounding args (validate, image, --policy="${POLICY_CONFIGURATION}")
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml`:
- Around line 312-316: The validate command currently hardcodes the snapshot
path as /tekton/home/snapshot.json; update the cmd_args construction where
validate image is assembled to use the HOMEDIR variable instead (e.g. replace
the hardcoded "/tekton/home/snapshot.json" with "${HOMEDIR}/snapshot.json") so
the validation reads the snapshot from the same HOMEDIR used during snapshot
generation; ensure the --images argument uses the HOMEDIR-based path and keep
the surrounding args (validate, image, --policy="${POLICY_CONFIGURATION}")
unchanged.

In `@tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml`:
- Around line 264-268: The validate command args currently hardcode
/tekton/home/snapshot.json in the cmd_args tuple (the validate image invocation
using --images), which bypasses the configurable HOMEDIR used by reduce; update
the --images argument to reference the HOMEDIR variable (e.g.,
--images="${HOMEDIR}/snapshot.json" or the same snapshot path variable used by
reduce) so the validate invocation uses the configurable home directory and not
a hardcoded path, ensuring consistency with reduce and other steps that rely on
HOMEDIR and preserving the existing POLICY_CONFIGURATION usage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3a013171-703c-4478-863a-11b0086b3fe9

📥 Commits

Reviewing files that changed from the base of the PR and between cae552e and 51b498e.

📒 Files selected for processing (4)
  • docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc
  • docs/modules/ROOT/pages/verify-enterprise-contract.adoc
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml

We use it elsewhere, but this one was still hard-coded. Good catch
by @coderabbitai.

Ref: https://issues.redhat.com/browse/EC-1652
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml`:
- Around line 273-282: The script currently allows partial keyless configuration
by only checking paired CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER or
falling back to PUBLIC_KEY, which can silently accept a single set variable;
update the conditional logic around CERTIFICATE_IDENTITY,
CERTIFICATE_OIDC_ISSUER and PUBLIC_KEY to fail-fast: detect when exactly one of
the keyless parameters is set (e.g., CERTIFICATE_IDENTITY without
CERTIFICATE_OIDC_ISSUER or vice versa) and emit an error/exit with a clear
message instead of continuing, otherwise proceed to append the correct args to
cmd_args as before; locate and modify the block that references
CERTIFICATE_IDENTITY, CERTIFICATE_OIDC_ISSUER, PUBLIC_KEY and cmd_args to
implement this validation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a914bed-a148-477f-b58c-7e57967e9c29

📥 Commits

Reviewing files that changed from the base of the PR and between 51b498e and 455c717.

📒 Files selected for processing (2)
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml

The review bots complain because if you set one of the two required
keyless params, but not the other, you might be surprised that it
falls back to using the public key.

It's a fair point, so let's avoid that by committing to only try
keyless verification if either of the params are found.

The bots want us to check explicitly that both are provided, but I'm
still keen to avoid adding weak bash param sanitization when we
should have stronger, better, and well-tested sanitization already
in golang. (And if we don't then we should add it.)

Ref: https://issues.redhat.com/browse/EC-1652
I've been runnning `make feature_ta_task_validate_image` and `make
feature_task_validate_image` frequently and I'm tired of restoring
the deleted snaps manually.

Maybe there's another way to do this, but I don't want to go
looking under the hood with the snapshot update mechanisms.

Minor convenience tweak while working on...

Ref: https://issues.redhat.com/browse/EC-1652
@github-actions github-actions bot added size: XL and removed size: L labels Mar 6, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml (1)

273-282: ⚠️ Potential issue | 🟠 Major

Require keyless params as a pair before bypassing PUBLIC_KEY.

At Line 273, using || means a single keyless value disables the PUBLIC_KEY path and passes an empty peer flag. That contradicts the parameter contract and can silently run with unintended verification inputs.

Suggested fix
-        if [ -n "${CERTIFICATE_IDENTITY}" ] || [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
+        if { [ -n "${CERTIFICATE_IDENTITY}" ] && [ -z "${CERTIFICATE_OIDC_ISSUER}" ]; } || \
+           { [ -z "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; }; then
+          echo "Both CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER must be set together." >&2
+          exit 1
+        fi
+
+        if [ -n "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
           cmd_args+=(
             --certificate-identity="${CERTIFICATE_IDENTITY}"
             --certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
           )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml` around
lines 273 - 282, The current condition uses [ -n "${CERTIFICATE_IDENTITY}" ] ||
[ -n "${CERTIFICATE_OIDC_ISSUER}" ] which allows a single keyless var to
override PUBLIC_KEY and pass empty certificate flags; change the logic so both
CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER must be non-empty (use logical
AND) before appending --certificate-identity/--certificate-oidc-issuer to
cmd_args, otherwise fall back to the existing PUBLIC_KEY branch (and ensure you
don't append empty flags to cmd_args); reference the variables
CERTIFICATE_IDENTITY, CERTIFICATE_OIDC_ISSUER, PUBLIC_KEY and the cmd_args array
when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Around line 155-157: The Makefile target that runs when UPDATE_SNAPS is set
can call `xargs git checkout` with no input and fail; modify the conditional
block that uses `git ls-files 'features/__snapshots__/*.snap' --deleted | xargs
git checkout` so it first checks for empty output (or uses xargs's
no-run-if-empty behavior) and only invokes `git checkout` when there are paths
to restore; refer to the UPDATE_SNAPS conditional and the pipeline that pipes
ls-files into xargs to locate and update the logic.

In `@tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml`:
- Around line 321-330: The current conditional adds certificate keyless flags if
either CERTIFICATE_IDENTITY or CERTIFICATE_OIDC_ISSUER is set, which can emit
empty/partial flags and drop PUBLIC_KEY; change the logic in the block that
builds cmd_args so that you only append --certificate-identity and
--certificate-oidc-issuer to cmd_args when both CERTIFICATE_IDENTITY and
CERTIFICATE_OIDC_ISSUER are non-empty (i.e., test both with -n), otherwise fall
through to the elif that appends --public-key when PUBLIC_KEY is set; ensure you
do not append any certificate flags when one of the pair is missing to avoid
sending empty keyless flags.

---

Duplicate comments:
In `@tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml`:
- Around line 273-282: The current condition uses [ -n "${CERTIFICATE_IDENTITY}"
] || [ -n "${CERTIFICATE_OIDC_ISSUER}" ] which allows a single keyless var to
override PUBLIC_KEY and pass empty certificate flags; change the logic so both
CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER must be non-empty (use logical
AND) before appending --certificate-identity/--certificate-oidc-issuer to
cmd_args, otherwise fall back to the existing PUBLIC_KEY branch (and ensure you
don't append empty flags to cmd_args); reference the variables
CERTIFICATE_IDENTITY, CERTIFICATE_OIDC_ISSUER, PUBLIC_KEY and the cmd_args array
when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 523414f1-a668-4951-952d-0195f55dcb60

📥 Commits

Reviewing files that changed from the base of the PR and between 455c717 and 1adcdde.

📒 Files selected for processing (3)
  • Makefile
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml

Comment on lines +155 to +157
@if [ -n "$$UPDATE_SNAPS" ]; then \
git ls-files 'features/__snapshots__/*.snap' --deleted | xargs git checkout; \
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid failing feature_% when there are no deleted snapshots to restore.

At Line 156, xargs git checkout can run git checkout with no paths, which fails and aborts the target under -e. Guard the empty-input case.

Suggested fix
-	`@if` [ -n "$$UPDATE_SNAPS" ]; then \
-	  git ls-files 'features/__snapshots__/*.snap' --deleted | xargs git checkout; \
-	fi
+	`@if` [ -n "$$UPDATE_SNAPS" ]; then \
+	  git ls-files --deleted -- 'features/__snapshots__/*.snap' | xargs -r git checkout --; \
+	fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@if [ -n "$$UPDATE_SNAPS" ]; then \
git ls-files 'features/__snapshots__/*.snap' --deleted | xargs git checkout; \
fi
`@if` [ -n "$$UPDATE_SNAPS" ]; then \
git ls-files --deleted -- 'features/__snapshots__/*.snap' | xargs -r git checkout --; \
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 155 - 157, The Makefile target that runs when
UPDATE_SNAPS is set can call `xargs git checkout` with no input and fail; modify
the conditional block that uses `git ls-files 'features/__snapshots__/*.snap'
--deleted | xargs git checkout` so it first checks for empty output (or uses
xargs's no-run-if-empty behavior) and only invokes `git checkout` when there are
paths to restore; refer to the UPDATE_SNAPS conditional and the pipeline that
pipes ls-files into xargs to locate and update the logic.

Comment on lines +321 to +330
if [ -n "${CERTIFICATE_IDENTITY}" ] || [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
cmd_args+=(
--certificate-identity="${CERTIFICATE_IDENTITY}"
--certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
)
elif [ -n "${PUBLIC_KEY}" ]; then
cmd_args+=(
--public-key="${PUBLIC_KEY}"
)
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Enforce paired keyless inputs before switching away from PUBLIC_KEY.

Line 321 currently switches to keyless mode when either variable is set. With partial input, this bypasses PUBLIC_KEY and sends an empty keyless flag, which is unsafe and inconsistent with the parameter descriptions.

Suggested fix
-        if [ -n "${CERTIFICATE_IDENTITY}" ] || [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
+        if { [ -n "${CERTIFICATE_IDENTITY}" ] && [ -z "${CERTIFICATE_OIDC_ISSUER}" ]; } || \
+           { [ -z "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; }; then
+          echo "Both CERTIFICATE_IDENTITY and CERTIFICATE_OIDC_ISSUER must be set together." >&2
+          exit 1
+        fi
+
+        if [ -n "${CERTIFICATE_IDENTITY}" ] && [ -n "${CERTIFICATE_OIDC_ISSUER}" ]; then
           cmd_args+=(
             --certificate-identity="${CERTIFICATE_IDENTITY}"
             --certificate-oidc-issuer="${CERTIFICATE_OIDC_ISSUER}"
           )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml` around
lines 321 - 330, The current conditional adds certificate keyless flags if
either CERTIFICATE_IDENTITY or CERTIFICATE_OIDC_ISSUER is set, which can emit
empty/partial flags and drop PUBLIC_KEY; change the logic in the block that
builds cmd_args so that you only append --certificate-identity and
--certificate-oidc-issuer to cmd_args when both CERTIFICATE_IDENTITY and
CERTIFICATE_OIDC_ISSUER are non-empty (i.e., test both with -n), otherwise fall
through to the elif that appends --public-key when PUBLIC_KEY is set; ensure you
do not append any certificate flags when one of the pair is missing to avoid
sending empty keyless flags.

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