Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config option for strict API parameter filtering: api.config.general.rejectActionWithExtraParams #1704

Open
mfvargo opened this issue Jan 22, 2021 · 0 comments

Comments

@mfvargo
Copy link

@mfvargo mfvargo commented Jan 22, 2021

We had an issue where an api user was using the incorrect parameters on an API call. Having this feature would have made the API fail instead of proceeding. The bug would been found earlier.

I can see where this would be a hassle on many cases, But it would be nice for new projects.

I suppose it could be a global config item that could be overridden at the individual action level:

For Example:

export class SessionLogin extends Action {
  constructor() {
    super();
    this.name = "login";
    this.description = "login a user on the site";
    this.rejectActionWithTooManyParams = true; // apply this rule on this specific action
    this.inputs = {
      email: { required: true },
      password: { required: true },
      token: { required: false },
      asDefendantRep: {
        required: false,
        default: false,
        formatter: (param) => {
          return param !== "false" && param !== false;
        },
      },
    };
  }
@evantahler evantahler changed the title Config option for strict API paramter filtering: rejectActionWithTooManyParams Config option for strict API parameter filtering: api.config.general.rejectActionWithExtraParams Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants