<commit_before>Feature: Validating URI HMAC
	To authenticate URIs a varification step can be added to configuration that will varify HMAC token passed as query string parameter. Only URIs with valid token will be processed. HMAC will only be valid if same secret key was used to generate it.

	Background:
		Given httpthumbnailer server is running at http://localhost:3100/health_check
		Given httpimagestore server is running at http://localhost:3000/ with the following configuration
		"""
		get "hello" "&:bar?" "&:hmac?" "&:foo?" {
			validate_hmac "#{hmac}" secret="pass<PASSWORD>" exclude="hmac" remove="hmac,nonce"
			output_text "valid"
		}

		post "test" "&:hmac?" {
			validate_hmac "#{hmac}" secret="pass123" exclude="hmac" remove="hmac"
			thumbnail "input" "thumbnail" operation="limit" width=100 height=100 format="jpeg" options="#{query_string_options}"
			output_image "thumbnail"
		}

		get "fake" "&:bar?" "&:hmac?" "&:request_uri?" {
			validate_hmac "#{hmac}" secret="pass123" exclude="hmac" remove="hmac,nonce"
			output_text "valid"
		}
		"""

	@validate-hmac
	Scenario: Properly authenticated URI
		When I do GET request http://localhost:3000/hello?hmac=cc67210148307affa1465ee5d146978b1f3278cb
		Then response status will be 200
		And response content type will be text/plain
		And response body will be CRLF ended lines
		"""<commit_msg>test with default remove<commit_after>Feature: Validating URI HMAC
	To authenticate URIs a varification step can be added to configuration that will varify HMAC token passed as query string parameter. Only URIs with valid token will be processed. HMAC will only be valid if same secret key was used to generate it.

	Background:
		Given httpthumbnailer server is running at http://localhost:3100/health_check
		Given httpimagestore server is running at http://localhost:3000/ with the following configuration
		"""
		get "hello" "&:bar?" "&:hmac?" "&:foo?" {
			validate_hmac "#{hmac}" secret="pass<PASSWORD>" exclude="hmac" remove="hmac,nonce"
			output_text "valid"
		}

		post "test" "&:hmac?" {
			validate_hmac "#{hmac}" secret="pass123" exclude="hmac"
			thumbnail "input" "thumbnail" operation="limit" width=100 height=100 format="jpeg" options="#{query_string_options}"
			output_image "thumbnail"
		}

		get "fake" "&:bar?" "&:hmac?" "&:request_uri?" {
			validate_hmac "#{hmac}" secret="pass123" exclude="hmac" remove="hmac,nonce"
			output_text "valid"
		}
		"""

	@validate-hmac
	Scenario: Properly authenticated URI
		When I do GET request http://localhost:3000/hello?hmac=cc67210148307affa1465ee5d146978b1f3278cb
		Then response status will be 200
		And response content type will be text/plain
		And response body will be CRLF ended lines
		"""
{'fraction_non_alphanumeric': 0.11282616685042264, 'fraction_numerical': 0.03969128996692393, 'mean_word_length': 5.116853932584269, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5084015', 'n_tokens_mistral': 1001, 'n_tokens_neox': 854, 'n_words': 282}