Skip to content

feat(source-integrity): Implement Source Integrity checking#25371

Open
olivergondza wants to merge 30 commits intoargoproj:masterfrom
olivergondza:proposal-source-policies-poc
Open

feat(source-integrity): Implement Source Integrity checking#25371
olivergondza wants to merge 30 commits intoargoproj:masterfrom
olivergondza:proposal-source-policies-poc

Conversation

@olivergondza
Copy link
Contributor

@olivergondza olivergondza commented Nov 20, 2025

Implements #25148

This replaces the former GPG feature with a more general mechanism to enforce integrity. The design enables introducing various kinds of sources (OCI/Helm) and using various verification mechanisms in the future.

  • This maintains the manifest API functionality (AppProject's .spec.signatureKeys), but it is interpreting it using the new implementation (no duplicated code, some regression risk)
    • It is applied to all git-based application sources - not just the first one.
  • The AppProject GPG signing keys management is labeled deprecated from now on (UI, CLI, CR), encouraging users to switch to Source Integrity managed through project manifest.
  • The ability to manage Source Integrity criteria through UI and CLI is left out - only configurable through the Custom Resource. Adding/removing GPG keys (repo-server keyring management) is left unchanged.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • [WIP] I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • [WIP] I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • [n.a] Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Presentation of an application failing Source Integrity criteria:

Screenshot From 2026-02-23 13-32-19 Screenshot From 2026-02-23 13-33-06 Screenshot From 2026-02-23 13-32-34

@olivergondza olivergondza requested a review from a team as a code owner November 20, 2025 16:07
@bunnyshell
Copy link

bunnyshell bot commented Nov 20, 2025

❌ Preview Environment undeployed from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@olivergondza
Copy link
Contributor Author

This is still WIP. Filed for CI feedback...

@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch 4 times, most recently from 71850e2 to 53d5533 Compare November 26, 2025 13:02
@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch from 09dae5d to 0b618a1 Compare November 27, 2025 13:44
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 77.90179% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.68%. Comparing base (c13ba1e) to head (fabce0a).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
util/git/client.go 67.66% 39 Missing and 15 partials ⚠️
pkg/apis/application/v1alpha1/source_integrity.go 59.25% 11 Missing ⚠️
reposerver/repository/repository.go 70.00% 4 Missing and 5 partials ⚠️
util/sourceintegrity/source_integrity.go 91.81% 5 Missing and 4 partials ⚠️
cmd/util/project.go 0.00% 4 Missing ⚠️
controller/state.go 83.33% 3 Missing and 1 partial ⚠️
cmd/argocd/commands/project.go 57.14% 3 Missing ⚠️
server/gpgkey/gpgkey.go 0.00% 3 Missing ⚠️
server/application/application.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #25371      +/-   ##
==========================================
+ Coverage   62.66%   62.68%   +0.02%     
==========================================
  Files         412      414       +2     
  Lines       55564    55795     +231     
==========================================
+ Hits        34818    34976     +158     
- Misses      17424    17478      +54     
- Partials     3322     3341      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch from 0b618a1 to de3d402 Compare November 28, 2025 13:33
Copy link
Member

@blakepettersson blakepettersson left a comment

Choose a reason for hiding this comment

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

All in all I think this is great, awesome work!

I've added a few questions/thoughts, LMK what you think

@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch 4 times, most recently from 36c6663 to 3362313 Compare December 1, 2025 20:22
@olivergondza olivergondza requested review from a team as code owners December 4, 2025 13:08
@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch 3 times, most recently from c6aac44 to d04c6fa Compare December 10, 2025 13:20
@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch 2 times, most recently from 27c964a to 826199b Compare December 15, 2025 11:51
@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch 2 times, most recently from 183de87 to fcca2c9 Compare January 2, 2026 09:07
@olivergondza
Copy link
Contributor Author

@jannfis, @blakepettersson, @pasha-codefresh, the implementation is complete. Please review.

@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch from 96e2a51 to 707740f Compare January 5, 2026 10:53
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch from 5491ff0 to 01bacb0 Compare March 14, 2026 07:58
})
}

func TestNamespacedSyncToUnsignedCommit(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests moved to app_management_source_integrity_test.go‎ and extended.

})
}

func TestSyncToUnsignedCommit(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests moved to app_multiple_sources_source_integrity_test.go.


The GnuPG verification requires populating the Argo CD GnuPG keyring, and configuring source integrity policies for your repositories.

## Managing Argo CD GnuPG keyring
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved from the old location, renamed, unchanged.

Copy link
Member

Choose a reason for hiding this comment

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

I believe mkdocs supports redirects for dropped pages. Can you add a redirect for the old gpg verification page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I see we do not use the redirect plugin, and I do not want to pull it in just for this. So I kept nothing but a note on the old location informing about the eventual removal, and linked to the new approach.

@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch from e542849 to 66202dc Compare March 14, 2026 10:45
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
@olivergondza olivergondza force-pushed the proposal-source-policies-poc branch from 66202dc to 8f2e093 Compare March 14, 2026 12:51
Copy link
Member

@blakepettersson blakepettersson left a comment

Choose a reason for hiding this comment

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

I think this in general is in great shape!

I do think we need to have at least CLI support for source integrity, by adding new CLI commands, and ideally (if possible) we should migrate the existing commands to set/unset source-integrity (if the legacy signature keys are not already in use, then that should instead be used).

I'll defer the nitty-gritty of the GPG signing logic to @jannfis

Each application can be a subject or multiple checks, and the sync will be enabled only when all criteria are met.

> [!NOTE]
> Source Integrity Verification is only configured through `AppProject` manifests at this point. CLI and UI are not supported.
Copy link
Member

Choose a reason for hiding this comment

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

I do think we should at least have CLI support for this, if not also UI (which we'd default to use source integrity if not already used)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, and CLI is something I intend to work on next. Although, I propose to add it in a separate PR once this is merged, not to add few hundreds LOC to this already giant PR. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I'd be fine having this in a separate PR 👍

@blakepettersson blakepettersson modified the milestones: v3.5, v3.3 Mar 16, 2026
Comment on lines -28 to +29
// Request to verify the signature when generating the manifests (only for Git repositories)
bool verifySignature = 16;
// Source integrity constrains to verify the sources before use
github.com.argoproj.argo_cd.v3.pkg.apis.application.v1alpha1.SourceIntegrity sourceIntegrity = 16;
Copy link
Member

Choose a reason for hiding this comment

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

This would be a breaking API change. Do we have a path to deprecate/remove the old verify style API results?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Let me re-add verifyResult and signatureInfo here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@crenshaw-dev, backward compatibility is restored.

…fication

Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants