Skip to content

Add "Act as" Support - #134

Merged
mtsvetanov071 merged 9 commits into
mainfrom
act-as
Sep 3, 2026
Merged

Add "Act as" Support#134
mtsvetanov071 merged 9 commits into
mainfrom
act-as

Conversation

@simeongelovski

Copy link
Copy Markdown
Collaborator

No description provided.

@hyperspace-pr-bot

Copy link
Copy Markdown

👋 Hi — I'm PR Bot, your SAP code review assistant.

I'll automatically review your pull requests for code quality, security, and SAP compliance. Get an overview of what I do →

What I do

  • Summarize your pull request changes
  • Review code for quality, correctness, and reliability
  • Suggest fixes when a pipeline job fails

Key commands

Command Description
/review [--all] Trigger a code review. Add --all to include files excluded by excluded_paths.
/summarize Generate a PR summary
/ask <question> Ask about the current changes
/help See all available commands
Configure me for your team

Create .hyperspace/pull_request_bot.json in your repository:

{
  "$schema": "https://devops-insights-pr-bot.cfapps.eu10-004.hana.ondemand.com/schema/pull_request_bot.json",
  "features": {
    "control_panel": false,
    "summarize": {
      "auto_generate_summary": true,
      "auto_insert_summary": true,
      "auto_run_on_draft_pr": true,
      "use_custom_summarize_prompt": false,
      "use_custom_summarize_output_template": false,
      "excluded_paths": [],
      "auto_exclude_authors": []
    },
    "review": {
      "auto_generate_review": true,
      "auto_run_on_draft_pr": false,
      "use_custom_review_focus": false,
      "excluded_paths": [],
      "auto_exclude_authors": []
    },
    "sonar_fix": {
      "enable": true,
      "excluded_rules": []
    },
    "pipeline_fix": {
      "enable": true
    }
  },
  "excluded_paths": []
}

Full configuration reference →

*This introduction message will be shown to you only once, you will not see it in future PRs.

@hyperspace-pr-bot

Copy link
Copy Markdown

Summary

The following content is AI-generated and provides a summary of the pull request:


Add "Act as" Support via common Payload Overrides for Audit Event Identity Fields

New Features

✨ Introduces a payload-based override mechanism for the common section of Audit Log NG events, enabling callers to supply identity fields (such as userInitiatorId, userImpersonatedId, userInitiatorContext, and userImpersonatedContext) per-request. This enables "act-as" / impersonation scenarios (e.g., SAP Support user acting on behalf of a business user) without relying solely on UserInfo.

Key behaviors:

  • Overrides are supplied via a "common" key in the event payload (e.g., data.put("common", Map.of("userInitiatorId", ...))).
  • Only allow-listed fields are applied; absent or null entries leave computed defaults untouched.
  • Override values take precedence over UserInfo-derived defaults for all event types: data access, data modification, config change, and security events.
  • For legacy security events (v1), userInitiatorId/userImpersonatedId map to native v1 metadata fields, while UserContext objects are carried in origEvent.customDetails.
  • The SAP support-user signal is now represented via userInitiatorContext.type = USER_TYPE_SAP_SUPPORT_USER instead of the old sap_support_user boolean in customDetails.
  • Data schema version updated from audit-logging-v2.1.6 to v2.2.0.

Changes

  • AuditLogNGHandler.java: Added COMMON_OVERRIDE_KEY / COMMON_OVERRIDE_FIELDS constants and new helper methods (commonOverride, commonOverrides, applyCommonOverridesFromPayload, resolveUserInitiatorContext, resolveInitiatorUser, addLegacySecurityCustomDetails). Updated buildEventCommonSection, buildLegacySecurityEventMetadata, buildDataAccessAlsEvent, buildDataModificationAlsEvent, and buildConfigChangeEvent to accept and apply payload overrides. Bumped schema version constant.

  • AuditLogNGHandlerTest.java: Added comprehensive tests covering full-override, partial-override (keeping defaults), and override-precedence-over-UserInfo scenarios for all event types. Updated existing SAP support-user tests to reflect the new userInitiatorContext-based representation.

  • pom.xml: Bumped project version from 0.0.5 to 0.1.0.


  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.31.9

  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: issue_comment.created
  • Correlation ID: d9d70970-a78a-11f1-91bf-2b953110ff14
  • File Content Strategy: Full file content
  • Summary Prompt: Default Prompt
  • Output Template: Default Template

@hyperspace-pr-bot hyperspace-pr-bot Bot deleted a comment from mtsvetanov071 Sep 3, 2026
@mtsvetanov071 mtsvetanov071 changed the title Act as Add "Act as" Support Sep 3, 2026

@hyperspace-pr-bot hyperspace-pr-bot 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.

The PR introduces a payload-driven common override mechanism for audit event identity fields (v2.2.0 schema bump) with good test coverage across all event types. The main issue found is that "userInitiatorContext" and "userImpersonatedContext" are listed in COMMON_OVERRIDE_FIELDS while those same fields are already handled by resolveUserInitiatorContext called just before applyCommonOverridesFromPayload — this creates a redundant double-write that is coincidentally harmless today but fragile against future refactoring. Please address the open comment before merging.

PR Bot Information

Version: 1.31.9

  • Correlation ID: e4a59ba0-a78a-11f1-88cc-b0343f435e6b
  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: issue_comment.created

@hyperspace-pr-bot hyperspace-pr-bot Bot deleted a comment from mtsvetanov071 Sep 3, 2026
mtsvetanov071
mtsvetanov071 previously approved these changes Sep 3, 2026
@mtsvetanov071
mtsvetanov071 merged commit e00f08d into main Sep 3, 2026
4 checks passed
@mtsvetanov071
mtsvetanov071 deleted the act-as branch September 3, 2026 12:01
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.

2 participants