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

Panic in PostCard middleware #64

Open

Description

@ilya-korotya
  • 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()
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions