Skip to content

squid: rgw: add Keystone scope and application credential info to ops log - #68627

Merged
batrick merged 1 commit into
ceph:squidfrom
fa-at-pulsit:wip-73702-rgw-keystone-scope-squid
Oct 20, 2026
Merged

batrick merged 1 commit into
ceph:squidfrom
fa-at-pulsit:wip-73702-rgw-keystone-scope-squid

Conversation

@fa-at-pulsit

Copy link
Copy Markdown
Contributor

Backport of #66111 to the
squid release branch.

Tracker: https://tracker.ceph.com/issues/76067
Original feature tracker: https://tracker.ceph.com/issues/73702

Description

Adds a new keystone_scope field to the RGW ops log entry, containing the
authenticated Keystone project, user, domain, role list, and (when applicable)
the application credential {id, name, restricted}.

Emission is gated by a new rgw_keystone_log_scope_info config option
(default: false), so existing operators are unaffected unless they opt
in. The field is encoded as struct version 16 of rgw_log_entry,
backward compatible with prior versions.

Backport notes

The squid branch lacks the prerequisite commit on main that introduced the
keystone_user field on rgw::auth::RemoteApplier::AuthInfo. To keep this
backport self-contained, the patch additionally:

  • adds the keystone_user member and constructor parameter to AuthInfo
    (src/rgw/rgw_auth.h)
  • threads token.get_user_name() through the keystone engines
    (src/rgw/rgw_auth_keystone.cc)
  • supplies an empty keystone_user placeholder at the LDAP and STS call
    sites (src/rgw/rgw_rest_s3.cc)
  • assigns entry.user = info.keystone_user in rgw_auth.cc

All other hunks (the rgw::keystone::ScopeInfo struct, rgw_log_entry
encoding bump to v16, ops-log JSON emission, yaml options, CMakeLists)
are identical to the main commit.

Testing

Verified end-to-end against a local Keystone + RGW deployment:

  • keystone_scope populated in the ops-log JSONL output for both
    password-token and application-credential authentication
  • application_credential block present ({id, name, restricted}) when
    the token is scoped via an app credential
  • 50/50 ops-log entries valid JSONL under burst load (no encoding
    regression from the v16 bump)
  • Existing S3 / LDAP / STS auth paths continue to log correctly with the
    empty keystone_user placeholder

Contribution Guidelines

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)

@fa-at-pulsit
fa-at-pulsit requested review from a team as code owners April 27, 2026 08:47
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ideepika

Copy link
Copy Markdown
Member

jenkins retest this please

@idryomov
idryomov removed the request for review from a team April 27, 2026 09:22
@dmick

dmick commented Apr 27, 2026

Copy link
Copy Markdown
Member

Why is build-sig requested as a reviewer? (or likely several others, like ceph-volume, and crimson, and...) Are you confused about the point of having groups for code review?

@phlogistonjohn

Copy link
Copy Markdown
Contributor

@dmick the initial issue was that the base branch was set wrong:

fa-at-pulsit changed the base branch from main to squid 11 hours ago

Mistargeted branches is a frequent cause of PRs that end up touching excessive numbers of files and since github doesn't know better it uses the codeowners for all those owners.

github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

@s0nea

s0nea commented Sep 22, 2026

Copy link
Copy Markdown
Member

jenkins test make check

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

/audit retest

@github-actions

Copy link
Copy Markdown

🔄 Audit Retest Triggered by @fa-at-pulsit.

View workflow run

github-actions[bot]

This comment was marked as outdated.

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

/config check ok

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

/audit retest

@github-actions

Copy link
Copy Markdown

🔄 Audit Retest Triggered by @fa-at-pulsit.

View workflow run

github-actions[bot]

This comment was marked as outdated.

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

Backport audit correctly flagged this as a deviation from a clean cherry-pick of #66111. Reason documented in the commit's Conflicts: block: squid lacks Ali's #53365 (47166556c5b), which introduced keystone_user on AuthInfo. This backport carries the equivalent AuthInfo changes (new field + ctor arg, population in both Keystone auth paths, std::string() at the LDAP/STS call sites in rgw_rest_s3.cc).

Functional result matches applying #53365 then #66111 in sequence.

Could someone review and apply /audit override (or the label) if the approach looks right, and add ci-approved so the gated checks can run? Thanks.

@adamemerson

Copy link
Copy Markdown
Contributor

/audit override

@github-actions

Copy link
Copy Markdown

✅ Audit Override Applied by @adamemerson.

View workflow run

Fixes: https://tracker.ceph.com/issues/73702
On-behalf-of: SAP <[email protected]>
Signed-off-by: Filipp Akinfiev <[email protected]>

Conflicts:
    src/rgw/rgw_auth.h
    src/rgw/rgw_auth.cc
    src/rgw/rgw_auth_keystone.cc
    src/rgw/rgw_rest_s3.cc
    - Squid lacks Ali Masarwa's PR ceph#53365 (commit 4716655),
      which introduced the keystone_user field on
      rgw::auth::RemoteApplier::AuthInfo. This backport therefore
      also carries the equivalent AuthInfo changes: the new
      keystone_user field and constructor argument, the two
      Keystone auth paths that populate it, and std::string()
      placeholders at the LDAP and STS call sites in
      rgw_rest_s3.cc.

(cherry picked from commit 3180812)
@github-actions

Copy link
Copy Markdown

⚠️ Audit Override Removed

New commits were pushed to this PR, so the previous override has been removed.

View workflow run

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ceph Release Engineering Audit Report

Commit Parity Visualizer

BACKPORT PR #68627 SOURCE PR SOURCE STATUS
80f81d3 rgw: Add Keystone scope information to ops logging PR #66111 3180812 rgw: Add Keystone scope information to ops logging

Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations

⚠️ WARNING: Cherry-pick conflicts or deviations were found that require component lead review.

A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.

This does not necessarily indicate an issue but a maintainer should review.

**Click to expand conflict summaries.**

Deviation in Backport 80f81d3 (cherry-pick of 3180812)

Affected File(s)

Range Diff

Click to expand
--- Original (3180812e)
+++ Backport (80f81d31)
@@ -3,3 +3,19 @@
 Fixes: https://tracker.ceph.com/issues/73702
 On-behalf-of: SAP <[email protected]>
 Signed-off-by: Filipp Akinfiev <[email protected]>
+
+Conflicts:
+    src/rgw/rgw_auth.h
+    src/rgw/rgw_auth.cc
+    src/rgw/rgw_auth_keystone.cc
+    src/rgw/rgw_rest_s3.cc
+    - Squid lacks Ali Masarwa's PR #53365 (commit 47166556c5b),
+      which introduced the keystone_user field on
+      rgw::auth::RemoteApplier::AuthInfo. This backport therefore
+      also carries the equivalent AuthInfo changes: the new
+      keystone_user field and constructor argument, the two
+      Keystone auth paths that populate it, and std::string()
+      placeholders at the LDAP and STS call sites in
+      rgw_rest_s3.cc.
+
+(cherry picked from commit 3180812e54197784ba5b7fc7027e62553144e175)

================================================================================
RANGE DIFF
================================================================================

1:  3180812e541 ! 1:  80f81d31382 rgw: Add Keystone scope information to ops logging
    @@ Commit message
         On-behalf-of: SAP <[email protected]>
         Signed-off-by: Filipp Akinfiev <[email protected]>
     
    +    Conflicts:
    +        src/rgw/rgw_auth.h
    +        src/rgw/rgw_auth.cc
    +        src/rgw/rgw_auth_keystone.cc
    +        src/rgw/rgw_rest_s3.cc
    +        - Squid lacks Ali Masarwa's PR #53365 (commit 47166556c5b),
    +          which introduced the keystone_user field on
    +          rgw::auth::RemoteApplier::AuthInfo. This backport therefore
    +          also carries the equivalent AuthInfo changes: the new
    +          keystone_user field and constructor argument, the two
    +          Keystone auth paths that populate it, and std::string()
    +          placeholders at the LDAP and STS call sites in
    +          rgw_rest_s3.cc.
    +
    +    (cherry picked from commit 3180812e54197784ba5b7fc7027e62553144e175)
    +
    + ## PendingReleaseNotes ##
    +@@
    +   Benchmarks showed that the lower thread count improves throughput and reduces latency
    +   on NVMe and HDD based environments. Users with specific workload requirements can
    +   tune this value; see also ``rgw_max_concurrent_requests``.
    ++* RGW: New Keystone scope logging options for the ops log. When
    ++  ``rgw_keystone_scope_enabled`` is true (default false), operations
    ++  authenticated via Keystone include scope information (project, domain,
    ++  roles, and, for application-credential auth, the credential metadata)
    ++  in the ops log. Human-readable names are opt-in via
    ++  ``rgw_keystone_scope_include_user`` (default false, GDPR-friendly) —
    ++  opaque IDs are always logged so operators can correlate with Keystone
    ++  without exposing names. Role names can be omitted via
    ++  ``rgw_keystone_scope_include_roles`` (default true).
    + 
    + 
    + * DASHBOARD: A new Overview landing page provides an at-a-glance cluster summary
    +
      ## src/common/options/rgw.yaml.in ##
     @@ src/common/options/rgw.yaml.in: options:
        - '1'
    @@ src/rgw/CMakeLists.txt: set(librgw_common_srcs
     
      ## src/rgw/rgw_auth.cc ##
     @@ src/rgw/rgw_auth.cc: void rgw::auth::RemoteApplier::write_ops_log_entry(rgw_log_entry& entry) const
    +   if (account) {
          entry.account_id = account->id;
        }
    -   entry.user = info.keystone_user;
    ++  entry.user = info.keystone_user;
     +
     +  if (info.keystone_scope.has_value()) {
     +    entry.keystone_scope = info.keystone_scope;
    @@ src/rgw/rgw_auth.h
      #define RGW_USER_ANON_ID "anonymous"
      
     @@ src/rgw/rgw_auth.h: public:
    +     const uint32_t acct_type;
          const std::string access_key_id;
          const std::string subuser;
    -     const std::string keystone_user;
    ++    const std::string keystone_user;
     +    const std::optional<rgw::keystone::ScopeInfo> keystone_scope;
      
        public:
          enum class acct_privilege_t {
     @@ src/rgw/rgw_auth.h: public:
    +              const acct_privilege_t level,
                   const std::string access_key_id,
                   const std::string subuser,
    -              const std::string keystone_user,
     -             const uint32_t acct_type=TYPE_NONE)
    ++             const std::string keystone_user,
     +             const uint32_t acct_type=TYPE_NONE,
     +             std::optional<rgw::keystone::ScopeInfo> keystone_scope=std::nullopt)
          : acct_user(acct_user),
            acct_name(acct_name),
            perm_mask(perm_mask),
    -@@ src/rgw/rgw_auth.h: public:
    +       is_admin(acct_privilege_t::IS_ADMIN_ACCT == level),
            acct_type(acct_type),
            access_key_id(access_key_id),
    -       subuser(subuser),
    --      keystone_user(keystone_user) {
    +-      subuser(subuser) {
    ++      subuser(subuser),
     +      keystone_user(keystone_user),
     +      keystone_scope(std::move(keystone_scope)) {
          }
    @@ src/rgw/rgw_auth_keystone.cc: TokenEngine::get_creds_info(const TokenEngine::tok
          /* Suggested account name for the authenticated user. */
          rgw_user(token.get_project_id()),
     @@ src/rgw/rgw_auth_keystone.cc: TokenEngine::get_creds_info(const TokenEngine::token_envelope_t& token
    +     level,
          rgw::auth::RemoteApplier::AuthInfo::NO_ACCESS_KEY,
          rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
    -     token.get_user_name(),
     -    TYPE_KEYSTONE
    ++    token.get_user_name(),
     +    TYPE_KEYSTONE,
     +    std::move(keystone_scope)
      };
    @@ src/rgw/rgw_auth_keystone.cc: EC2Engine::get_creds_info(const EC2Engine::token_e
          /* Suggested account name for the authenticated user. */
          rgw_user(token.get_project_id()),
     @@ src/rgw/rgw_auth_keystone.cc: EC2Engine::get_creds_info(const EC2Engine::token_envelope_t& token,
    +     level,
          access_key_id,
          rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
    -     token.get_user_name(),
     -    TYPE_KEYSTONE
    ++    token.get_user_name(),
     +    TYPE_KEYSTONE,
     +    std::move(keystone_scope)
        };
    @@ src/rgw/rgw_auth_keystone.cc: EC2Engine::get_creds_info(const EC2Engine::token_e
     
      ## src/rgw/rgw_keystone.cc ##
     @@ src/rgw/rgw_keystone.cc: void rgw::keystone::TokenEnvelope::User::decode_json(JSONObj *obj)
    -   JSONDecoder::decode_json("domain", domain, obj);
    +   JSONDecoder::decode_json("roles", roles_v2, obj);
      }
      
     +void rgw::keystone::TokenEnvelope::ApplicationCredential::decode_json(JSONObj *obj)
    @@ src/rgw/rgw_keystone.cc: void rgw::keystone::TokenEnvelope::User::decode_json(JS
     +  JSONDecoder::decode_json("restricted", restricted, obj, true);
     +}
     +
    - void rgw::keystone::TokenEnvelope::decode(JSONObj* const root_obj)
    + void rgw::keystone::TokenEnvelope::decode_v3(JSONObj* const root_obj)
      {
        std::string expires_iso8601;
    -@@ src/rgw/rgw_keystone.cc: void rgw::keystone::TokenEnvelope::decode(JSONObj* const root_obj)
    +@@ src/rgw/rgw_keystone.cc: void rgw::keystone::TokenEnvelope::decode_v3(JSONObj* const root_obj)
        JSONDecoder::decode_json("roles", roles, root_obj, true);
        JSONDecoder::decode_json("project", project, root_obj, true);
      
    @@ src/rgw/rgw_keystone.h: public:
        std::list<Role> roles;
     +  std::optional<ApplicationCredential> app_cred;
      
    -   void decode(JSONObj* obj);
    - 
    +   void decode_v3(JSONObj* obj);
    +   void decode_v2(JSONObj* obj);
     
      ## src/rgw/rgw_keystone_scope.cc (new) ##
     @@
    @@ src/rgw/rgw_log.h: struct rgw_log_entry {
          DECODE_FINISH(p);
        }
        void dump(ceph::Formatter *f) const;
    +
    + ## src/rgw/rgw_rest_s3.cc ##
    +@@ src/rgw/rgw_rest_s3.cc: rgw::auth::s3::LDAPEngine::get_creds_info(const rgw::RGWToken& token) const noex
    +     acct_privilege_t::IS_PLAIN_ACCT,
    +     rgw::auth::RemoteApplier::AuthInfo::NO_ACCESS_KEY,
    +     rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
    ++    std::string(),  // keystone_user (not applicable for LDAP)
    +     TYPE_LDAP
    +   };
    + }
    +@@ src/rgw/rgw_rest_s3.cc: rgw::auth::s3::STSEngine::get_creds_info(const STS::SessionToken& token) const n
    +     (token.is_admin) ? acct_privilege_t::IS_ADMIN_ACCT: acct_privilege_t::IS_PLAIN_ACCT,
    +     token.access_key_id,
    +     rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
    ++    std::string(),  // keystone_user (not applicable for STS)
    +     token.acct_type
    +   };
    + }

How to proceed:

  • Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git Conflicts: block intact) and include an explanation for changes.
  • Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
  • Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting /audit override.

Be familiar with the rules and guidelines for writing backports.


🛟 Need Help?

If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.

📋 Component Lead / Release Manager

To override the audit failure, apply releng-audit-override label or comment /audit override.


⚠️ Note: Automated audit checks will be suspended on future pushes to prevent comment spam while you work.

When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.

View workflow run

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

@adamemerson - force-pushed 80f81d3 (small clang+dbstore fix in rgw_keystone_scope.h: switched to #include "include/common_fwd.h" to match main). Audit deviation is unchanged - same Ali-equivalent AuthInfo files.
Force-push reset ci-approved and releng-audit-override. Could you re-apply both? RTD also hit the shallow-fetch race again (infra flake, needs retrigger). Thanks!

@adamemerson

Copy link
Copy Markdown
Contributor

jenkins test docs

@adamemerson

Copy link
Copy Markdown
Contributor

/audit override

@github-actions

Copy link
Copy Markdown

✅ Audit Override Applied by @adamemerson.

View workflow run

@anrao19

anrao19 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@anrao19

anrao19 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to squid integration testing by anuchaithra started 2026-09-28-05:33.

pr testing completed and approved by @ivancich, more details in https://tracker.ceph.com/issues/80955.
@fa-at-pulsit , if further is not needed then this can be merged

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.

9 participants