Skip to content

Proposal: Enforce safe URI schemes (http/https) for ACS URL #242

@tyage

Description

@tyage

SamlIdp::Request#valid? validates the host of the ACS URL but does not check the scheme.
This allows URLs like javascript://whitelisted-host.com/%0aalert(1) to pass validation if the host is whitelisted.

When such a URL is used as a form action, it leads to XSS. This is currently reproducible in the spec/rails_app where saml_acs_url is rendered in the saml_post.html.erb template:

How about enforcing http or https schemes by default in the validation logic?

def valid?
  # ...
  return false unless ['http', 'https'].include?(URI(response_url.to_s).scheme)
  # ...
end

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