Skip to content

Commit

Permalink
fix: minor doc and api improvements (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbystedt authored Jun 3, 2024
1 parent e0e0fab commit d0bd431
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
** [Generate Account Token](/dev_account_token.md)
** [Intention Lifecycle](/dev_intention_lifecycle.md)
** [Using Intentions to Access Vault](/dev_intention_usage.md)
** [Intetion Action Reference](/dev_intention_actions.md)
** [Intention Action Reference](/dev_intention_actions.md)
** [GitHub Actions](/github_actions.md)

* Operations
Expand Down
12 changes: 6 additions & 6 deletions docs/audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ All auth fields are custom to the Broker audit log.

| Field | Mandatory | Type | Description | Values |
| ----- | --------- | ---- | ----------- | ------ |
| auth.client_token | (grey lightbulb) | keyword | Vault client_token (wrapped) that is being provided to an application. Used for tracking usage in Vault audit Index. | See below. Hashed token |
| auth.exp | (grey lightbulb) | long | JWT Claim | See: Broker JWT |
| auth.iat | (grey lightbulb) | long | JWT Claim | See: Broker JWT |
| auth.nbf | (grey lightbulb) | long | JWT Claim | See: Broker JWT |
| auth.jti | (grey lightbulb) | keyword | JWT Claim | See: Broker JWT |
| auth.sub | (grey lightbulb) | keyword | JWT Claim | See: Broker JWT |
| auth.client_token | No | keyword | Vault client_token (wrapped) that is being provided to an application. Used for tracking usage in Vault audit Index. | See below. Hashed token |
| auth.exp | No| long | JWT Claim | See: [Broker JWT](operations_jwt.md) |
| auth.iat | No | long | JWT Claim | See: [Broker JWT](operations_jwt.md) |
| auth.nbf | No | long | JWT Claim | See: [Broker JWT](operations_jwt.md) |
| auth.jti | No | keyword | JWT Claim | See: [Broker JWT](operations_jwt.md) |
| auth.sub | No | keyword | JWT Claim | See: [Broker JWT](operations_jwt.md) |

### Tracking Broker Created tokens in Vault Audit

Expand Down
2 changes: 1 addition & 1 deletion docs/dev_intention_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| process-end | Indicates the ending of a process (shutting down of a service) |
| process-start | Indicates the starting of a process (starting up of a service) |

The actions are loosely based on Elastic Common Schema event.action which is "more specific than" event.category. The accepted values for event.category are a good starting point if you need to add a new value.
The actions are loosely based on Elastic Common Schema [event.action](https://www.elastic.co/guide/en/ecs/current/ecs-event.html#field-event-action) which is "more specific than" [event.category](https://www.elastic.co/guide/en/ecs/current/ecs-event.html#field-event-category). The [accepted values for event.category](https://www.elastic.co/guide/en/ecs/current/ecs-allowed-values-event-category.html) are a good starting point if you need to add a new value.

The first pass at defining actions directly used the event category and type fields. This proved difficult as the audit logs themselves are events (that should be categorized). The Elastic Common Schema definition for those fields, while logical, had to be twisted to define many actions, obscured what the action was and setting two or more fields was error prone. So, the action became a single separate field, but, we still want it to be similar to the event.action field.

Expand Down
4 changes: 4 additions & 0 deletions src/graph/graph.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ export class GraphController {
@Post('vertex/search')
@UseGuards(BrokerCombinedAuthGuard)
@ApiBearerAuth()
@ApiQuery({
name: 'collection',
required: true,
})
@ApiQuery({
name: 'edgeName',
required: false,
Expand Down
7 changes: 7 additions & 0 deletions src/graph/graph.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,13 @@ export class GraphService {
edgeName?: string,
edgeTarget?: string,
) {
if (CollectionNameEnum[collection] === undefined) {
throw new BadRequestException({
statusCode: 400,
message: 'Bad request',
error: '',
});
}
if ((edgeName === undefined) !== (edgeTarget === undefined)) {
throw new BadRequestException({
statusCode: 400,
Expand Down

0 comments on commit d0bd431

Please sign in to comment.