Skip to content

rgw: Verify key id before sending to Barbican - #65010

Merged
adamemerson merged 1 commit into
ceph:mainfrom
irq0:pr/verify-barbican-keyid-before-sending
Sep 12, 2025
Merged

adamemerson merged 1 commit into
ceph:mainfrom
irq0:pr/verify-barbican-keyid-before-sending

Conversation

@irq0

@irq0 irq0 commented Aug 13, 2025 •

Copy link
Copy Markdown
Member

request_key_from_barbican is called with a raw user-defined key id. To prevent issues like path injection match against a UUID4 regex first. Add this check close to the Barbican calls, as other KMS backends have other key format definitions.

Barbican secret ids are defined as "uuid" and matched against Python's UUID 4 parser.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

`request_key_from_barbican` is called with a raw user-defined key id.
To prevent issues like path injection match against a UUID4 regex
first. Add this check close to the Barbican calls, as other KMS
backends have other key format definitions.

Barbican secret ids are defined as "uuid" and matched against Python's
UUID 4 parser.

Signed-off-by: Marcel Lauhoff <[email protected]>
On-behalf-of: SAP [email protected]
@irq0
irq0 requested a review from a team as a code owner August 13, 2025 09:25
Comment thread src/rgw/rgw_kms.cc
optional_yield y,
std::string& actual_key) {
if (!validate_barbican_key_id(key_id)) {
return -EINVAL;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This could also very well be ENOENT (-> 404 NoSuchKey).

The difference becomes more relevant with github.com//pull/61256 where ENOKEY is treated as permanent error (longer negative cache entry by default) and ENOENT as transient (shorter default cache entry).

Ideally we would not cache validation errors at all to prevent an attacker to fill the cache with negative entries.

@irq0

irq0 commented Aug 13, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check

@irq0

irq0 commented Aug 13, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@irq0

irq0 commented Aug 13, 2025

Copy link
Copy Markdown
Member Author

jenkins test api

@irq0

irq0 commented Aug 14, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check

@irq0

irq0 commented Aug 18, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check

@irq0

irq0 commented Aug 18, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@irq0

irq0 commented Aug 21, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@irq0

irq0 commented Aug 21, 2025

Copy link
Copy Markdown
Member Author

jenkins test make check

@anrao19

anrao19 commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

@irq0

irq0 commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

Would a backport of this fix to Squid and Tentacle be welcome? If so, I can open the corresponding PRs.

@adamemerson

Copy link
Copy Markdown
Contributor

Would a backport of this fix to Squid and Tentacle be welcome? If so, I can open the corresponding PRs.

Very much so!

@irq0

irq0 commented Oct 10, 2025

Copy link
Copy Markdown
Member Author

Very much so!

Cool. Could you help me out with setting https://tracker.ceph.com/issues/73484 into the right status to do the backporting process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants