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

Limit formats allowed to make requests #735

Closed
andrewferk opened this issue Sep 16, 2016 · 1 comment
Closed

Limit formats allowed to make requests #735

andrewferk opened this issue Sep 16, 2016 · 1 comment

Comments

@andrewferk
Copy link

All endpoints seem to support url parameters, x-www-form-urlencoded, json, and headers. Would it be better security to limit the formats allowed for the requests? If so, is there an easy way to do that now?

class AuthenticationTest < ActionDispatch::IntegrationTest

  setup do
    @user = create(:user)
    @sign_in_url = '/auth/sign_in'
  end

  describe 'sign in' do
    test 'with email and password x-www-form-urlencoded' do
      post @sign_in_url, params: {email: @user.email, password: @user.password}
      assert_equal 200, status
    end

    test 'with email and password headers' do
      post @sign_in_url, headers: {email: @user.email, password: @user.password}
      assert_equal 200, status
    end

    test 'with email and password url params' do
      post "#{@sign_in_url}?email=#{@user.email}&password=#{@user.password}"
      assert_equal 200, status
    end

    test 'with email and password json' do
      post @sign_in_url, as: :json, params: {email: @user.email, password: @user.password}
      assert_equal 200, status
    end
  end
end

Thanks!

@andrewferk andrewferk changed the title Limit formats allowed to use make requests Limit formats allowed to make requests Sep 17, 2016
@zachfeldman
Copy link
Contributor

Hi there @andrewferk ,

In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error!

If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it.

Hope all is well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants