Fix audit record authorization issues
- Wrap all artifactHit.update() calls with authz disable/enable - Ensures mcp-user can create and update audit records - Fixes ArtifactAuthorizationException on audit logging
Showing
1 changed file
with
12 additions
and
0 deletions
| ... | @@ -675,7 +675,13 @@ | ... | @@ -675,7 +675,13 @@ |
| 675 | artifactHit.runningTimeMillis = executionTime | 675 | artifactHit.runningTimeMillis = executionTime |
| 676 | artifactHit.wasError = "Y" | 676 | artifactHit.wasError = "Y" |
| 677 | artifactHit.errorMessage = e.message | 677 | artifactHit.errorMessage = e.message |
| 678 | |||
| 679 | ec.artifactExecution.disableAuthz() | ||
| 680 | try { | ||
| 678 | artifactHit.update() | 681 | artifactHit.update() |
| 682 | } finally { | ||
| 683 | ec.artifactExecution.enableAuthz() | ||
| 684 | } | ||
| 679 | 685 | ||
| 680 | result = [ | 686 | result = [ |
| 681 | content: [ | 687 | content: [ |
| ... | @@ -946,7 +952,13 @@ | ... | @@ -946,7 +952,13 @@ |
| 946 | artifactHit.runningTimeMillis = executionTime | 952 | artifactHit.runningTimeMillis = executionTime |
| 947 | artifactHit.wasError = "N" | 953 | artifactHit.wasError = "N" |
| 948 | artifactHit.outputSize = new JsonBuilder(result).toString().length() | 954 | artifactHit.outputSize = new JsonBuilder(result).toString().length() |
| 955 | |||
| 956 | ec.artifactExecution.disableAuthz() | ||
| 957 | try { | ||
| 949 | artifactHit.update() | 958 | artifactHit.update() |
| 959 | } finally { | ||
| 960 | ec.artifactExecution.enableAuthz() | ||
| 961 | } | ||
| 950 | 962 | ||
| 951 | } catch (Exception e) { | 963 | } catch (Exception e) { |
| 952 | def executionTime = (System.currentTimeMillis() - startTime) / 1000.0 | 964 | def executionTime = (System.currentTimeMillis() - startTime) / 1000.0 | ... | ... |
-
Please register or sign in to post a comment