Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Rules #32

Open
colinbes opened this issue Oct 11, 2017 · 2 comments
Open

Security Rules #32

colinbes opened this issue Oct 11, 2017 · 2 comments

Comments

@colinbes
Copy link

Finally getting to upgrade to Lift 3 (yay).

I am getting script-src content security warning due to lift-ng inserting js into page (inserting service calls) amongst others, eg

<script type="text/javascript">
  // <![CDATA[
  angular.module("bc.services",["lift-ng"]).factory("deviceService",["liftProxy", function(liftProxy{
  return {"getUsageTo": function(json) {return ...
);
// ]]>
</script>

Any suggestions or do I need to set script-src policy using LiftRules.securityRules as below?

scriptSources = List(
  ContentSourceRestriction.UnsafeEval,
      ContentSourceRestriction.UnsafeInline,
      ContentSourceRestriction.Self
   )
@joescii
Copy link
Owner

joescii commented Jan 12, 2018

Hey Colin! This one slipped off my radar. Did you get CSP configured for your needs? One of these days I hope to refactor lift-ng to not need this tweaking.

@colinbes
Copy link
Author

No problem. For now I have just set security policies via lift rules and also enabled extractInlineJavaScript. Not ideal (I think) but allows me to continue.

LiftRules.securityRules = () => {
  SecurityRules(content = Some(ContentSecurityPolicy(
    styleSources = List(
      ContentSourceRestriction.UnsafeInline,
      ContentSourceRestriction.All
    ),
    connectSources = List(
        ContentSourceRestriction.All
    ),
    scriptSources = List(
      ContentSourceRestriction.UnsafeEval,
      ContentSourceRestriction.UnsafeInline,
      ContentSourceRestriction.Self
    ),
    imageSources = List(
        ContentSourceRestriction.UnsafeInline,
        ContentSourceRestriction.Self
    )        
  )))
} 

LiftRules.extractInlineJavaScript = true 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants