Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Feature Request: Allow/Deny fields to be submitted #10

Open
unusualbob opened this issue Oct 11, 2020 · 0 comments
Open

Feature Request: Allow/Deny fields to be submitted #10

unusualbob opened this issue Oct 11, 2020 · 0 comments

Comments

@unusualbob
Copy link

It would be nice to be able to allow/deny fields to be included in xray events based on options on schemas.

For example, it would be nice to be able to log queries, without logging PII or secret fields.

Something like:

const UserSchema = new Schema({
  accountType: {
    type: String,
    enum: ['a, 'b', 'c', 'd'],
    validators: ...
  },
  firstName: {
    type: String,
    lowercase: true,
    validators: ...,
    xrayAllowed: false
  },
  lastName: {
    type: String,
    lowercase: true,
    validators: ...,
    xrayAllowed: false
  },
  loginCount: {
    type: Number,
    validators: ...
  },
});

Or whitelist version:

const UserSchema = new Schema({
  accountType: {
    type: String,
    enum: ['a, 'b', 'c', 'd'],
    validators: ...,
    xrayAllowed: true
  },
  firstName: {
    type: String,
    lowercase: true,
    validators: ...
  },
  lastName: {
    type: String,
    lowercase: true,
    validators: ...
  },
  loginCount: {
    type: Number,
    validators: ...,
    xrayAllowed: true
  },
});

A query or update output would be something like:

{
  accountType: {
   $in: ['a', 'b']
  },
  firstName: {
    $in: ['xraySanitized', 'xraySanitized']
  },
  loginCount: {
    $gt: 1
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant