Skip to content

Add convenience functions for secure headers like Content-Security-Policy #5

Description

@royalicing

Could be something that accepts a generator function to help make a gnarly header like:
Content-Security-Policy: default-src 'self'; img-src *; media-src *; style-src 'self' 'unsafe-hashes' 'unsafe-inline' https://unpkg.com; script-src 'self'

function* ContentSecurityPolicy() {
  yield src.default('self');
  yield src.img(src.unsafeAny);
  yield src.media(src.unsafeAny);
  yield src.style('self', 'unsafe-hashes', 'unsafe-inline', new URL('https://unpkg.com'));
  yield src.script('self');
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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