Skip to content

Commit

Permalink
[RAC][RBAC] Updates integration tests to use subfeature privileges (e…
Browse files Browse the repository at this point in the history
…lastic#18)

* update scripts, adds trial license tests for testing subfeature privilege access

* adds roles and users for testing update alerts as data with subfeature privileges
  • Loading branch information
dhurley14 authored and yctercero committed Jul 5, 2021
1 parent 8e98974 commit d2826e3
Show file tree
Hide file tree
Showing 11 changed files with 899 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class AlertsClient {
})
);

return res.body.get?._source;
return res.body;
} catch (error) {
this.auditLogger?.log(
alertAuditEvent({
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/rule_registry/server/routes/get_alert_by_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getAlertByIdRoute = (router: IRouter<RacRequestHandlerContext>) =>
),
t.exact(
t.partial({
indexName: t.string,
index: t.string,
})
),
])
Expand All @@ -41,8 +41,8 @@ export const getAlertByIdRoute = (router: IRouter<RacRequestHandlerContext>) =>
async (context, request, response) => {
try {
const alertsClient = await context.rac.getAlertsClient();
const { id, indexName } = request.query;
const alert = await alertsClient.get({ id, index: indexName });
const { id, index } = request.query;
const alert = await alertsClient.get({ id, index });
return response.ok({
body: alert,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
set -e

USER=${1:-'observer'}
ID=${2:-'DHEnOXoB8br9Z2X1fq_l'}

cd ./hunter && sh ./post_detections_role.sh && sh ./post_detections_user.sh
cd ../observer && sh ./post_detections_role.sh && sh ./post_detections_user.sh
Expand All @@ -18,4 +19,4 @@ cd ..
# Example: ./get_observability_alert.sh hunter
curl -v -k \
-u $USER:changeme \
-X GET "${KIBANA_URL}${SPACE_URL}/api/rac/alerts?id=DUgwMHoB4rQQN4aqv7Co&index=.alerts-observability-apm" | jq .
-X GET "${KIBANA_URL}${SPACE_URL}/api/rac/alerts?id=$ID&index=.alerts-observability-apm" | jq .
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"feature": {
"ml": ["read"],
"monitoring": ["all"],
"apm": ["all"],
"apm": ["minimal_read", "alerts_all"],
"ruleRegistry": ["all"],
"actions": ["read"],
"builtInAlerts": ["all"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ curl -s -k \
-H 'kbn-xsrf: 123' \
-u observer:changeme \
-X POST ${KIBANA_URL}${SPACE_URL}/api/rac/alerts \
-d "{\"ids\": $IDS, \"status\":\"$STATUS\", \"indexName\":\".alerts-observability-apm\"}" | jq .
-d "{\"ids\": $IDS, \"status\":\"$STATUS\", \"index\":\".alerts-observability-apm\"}" | jq .
Loading

0 comments on commit d2826e3

Please sign in to comment.