Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Panic in PostCard middleware #64

Open
ilya-korotya opened this issue Nov 25, 2020 · 0 comments
Open

Panic in PostCard middleware #64

ilya-korotya opened this issue Nov 25, 2020 · 0 comments

Comments

@ilya-korotya
Copy link

ilya-korotya commented Nov 25, 2020

  • Panic
  • If I sent Credit Card form from the front end. With short card number and cvv I will get panic in PostCard middleware.
  • HTTP request for reproducing:
    Replace 172.18.8.101 with your front-end IP address.
curl 'http://172.18.8.101:30001/cards' \
  -H 'Connection: keep-alive' \
  -H 'Accept: */*' \
  -H 'X-Requested-With: XMLHttpRequest' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36' \
  -H 'Content-Type: application/json; charset=UTF-8' \
  -H 'Origin: http://172.18.8.101:30001' \
  -H 'Referer: http://172.18.8.101:30001/basket.html' \
  -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7' \
  -H 'Cookie: md.sid=s%3AoEWQJlzlgwD2HtBqUJ-1MV5zWihejnE6.5FoM0HWGAwqnr6dUs6JMr92IujZCEietb3EvzDyzkAs; logged_in=oEWQJlzlgwD2HtBqUJ-1MV5zWihejnE6' \
  --data-binary '{"longNum":"asd","expires":"asd","ccv":"asd"}' \
  --compressed \
  --insecure

Unit test:

func TestShortMaskCC(t *testing.T) {
	defer func() {
		if r := recover(); r != nil {
			t.Error("This code will call panic")
		}
	}()
	test1 := "123"
	c := Card{LongNum: test1}
	c.MaskCC()
}
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant