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
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mfvargo
Copy link
Contributor

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;
        },
      },
    };
  }
@mfvargo mfvargo added the enhancement New feature or request label Jan 22, 2021
@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
@evantahler evantahler added good first issue Good for newcomers help wanted Extra attention is needed labels Jan 22, 2021
@actionhero actionhero deleted a comment from Bankbatbay May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants