Skip to content

Commit bb19f42

Browse files
committed
policy flag
1 parent 3208087 commit bb19f42

File tree

1 file changed

+8
-0
lines changed
  • openmetadata-service/src/main/java/org/openmetadata/service/resources/apps

1 file changed

+8
-0
lines changed

openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppMapper.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ private void validateAndAddBot(App app, String botName, boolean allowBotImperson
8787
throw BadRequestException.of("Invalid App: " + e.getMessage());
8888
}
8989
if (!CommonUtil.nullOrEmpty(botName)) {
90+
// When referencing an existing bot, allowBotImpersonation cannot be applied since
91+
// impersonation is configured on the bot user, not the app. Reject this combination
92+
// to avoid silent misconfiguration where the flag is ignored.
93+
if (allowBotImpersonation) {
94+
throw BadRequestException.of(
95+
"allowBotImpersonation cannot be used with a custom bot reference. "
96+
+ "Configure impersonation directly on the bot user instead.");
97+
}
9098
app.setBot(Entity.getEntityReferenceByName(BOT, botName, Include.NON_DELETED));
9199
} else {
92100
app.setBot(appRepository.createNewAppBot(app, allowBotImpersonation));

0 commit comments

Comments
 (0)