Skip to content
Snippets Groups Projects
Commit 85d2813e authored by Pavel Břoušek's avatar Pavel Břoušek
Browse files

chore: merge branch 'security_text' into 'main'

feat: check_saml.py security text support

Closes PRX-355

See merge request perun-proxy-aai/python/perun-proxy-utils!47
parents 25ff3521 36ce42d3
Branches
Tags
1 merge request!47feat: check_saml.py security text support
Pipeline #373100 passed
...@@ -186,6 +186,12 @@ def get_args(): ...@@ -186,6 +186,12 @@ def get_args():
action="store_true", action="store_true",
help="skip security image check when remember me is used", help="skip security image check when remember me is used",
) )
parser.add_argument(
"--security-text-check",
action="store_true",
help="perform security text check when remember me is used, "
"security image check will be automatically skipped",
)
parser.add_argument( parser.add_argument(
"--cache-timeout", "--cache-timeout",
type=int, type=int,
...@@ -203,7 +209,11 @@ def get_args(): ...@@ -203,7 +209,11 @@ def get_args():
help="check for presence of state and code parameters in the result", help="check for presence of state and code parameters in the result",
) )
return parser.parse_args() args = parser.parse_args()
if args.security_text_check:
args.skip_security_image_check = True
return args
def replace_host_in_url(hosts, url, headers): def replace_host_in_url(hosts, url, headers):
...@@ -499,6 +509,15 @@ class SAMLChecker: ...@@ -499,6 +509,15 @@ class SAMLChecker:
login_form_html, login_form_url = self.initial_request(self.args.url) login_form_html, login_form_url = self.initial_request(self.args.url)
if self.args.verbose >= 3: if self.args.verbose >= 3:
print(login_form_html) print(login_form_html)
if (
self.args.security_text_check
and "class='security-image-text'" not in login_form_html
):
self.finish(
"Missing security text on the login page.",
"CRITICAL",
)
if ( if (
not self.args.skip_security_image_check not self.args.skip_security_image_check
and "class='antiphishing-img'" not in login_form_html and "class='antiphishing-img'" not in login_form_html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment