mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-10-12 10:07:14 +02:00
fix harden preview against self XSS
Signed-off-by: RonniSkansing <rskansing@gmail.com>
This commit is contained in:
19 files changed
+421
-118
No files matched your search
@@ -170,6 +170,14 @@ func (c *CampaignTemplate) Validate() error {
|
||||
)
|
||||
}
|
||||
|
||||
// the redirect url is shown as a link in the admin area, so reject any
|
||||
// scheme other than http or https to keep a javascript url out of an href
|
||||
if v, err := c.AfterLandingPageRedirectURL.Get(); err == nil && v.String() != "" {
|
||||
if err := validate.ErrorIfInvalidURL(v.String()); err != nil {
|
||||
return validate.WrapErrorWithField(err, "afterLandingPageRedirectURL")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,19 @@ func (o *OAuthProvider) Validate() error {
|
||||
if err := validate.NullableFieldRequired("clientSecret", o.ClientSecret); err != nil {
|
||||
return err
|
||||
}
|
||||
// the auth url is opened in the operator browser during authorization, so
|
||||
// reject any scheme other than http or https to keep a javascript url out.
|
||||
// the token url is only called server side but is held to the same rule.
|
||||
if v, err := o.AuthURL.Get(); err == nil {
|
||||
if err := validate.ErrorIfNotHTTPURL(v.String()); err != nil {
|
||||
return validate.WrapErrorWithField(err, "authURL")
|
||||
}
|
||||
}
|
||||
if v, err := o.TokenURL.Get(); err == nil {
|
||||
if err := validate.ErrorIfNotHTTPURL(v.String()); err != nil {
|
||||
return validate.WrapErrorWithField(err, "tokenURL")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user