Skip to content

Commit

Permalink
fix: default imports
Browse files Browse the repository at this point in the history
  • Loading branch information
atilafassina committed Oct 5, 2024
1 parent 77fc09e commit beb072b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ runs:
with:
cache: pnpm
node-version: "20"
- run: pnpm install --frozen-lockfile
- run: pnpm install
shell: bash
using: composite
26 changes: 0 additions & 26 deletions .github/workflows/accessibility-alt-text-bot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/prepare
- env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
uses: JoshuaKGoldberg/[email protected]

name: Contributors
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: JoshuaKGoldberg/[email protected]

name: Release
name: 📡 Publish to NPM

on:
push:
Expand Down
26 changes: 24 additions & 2 deletions src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
import { DEV_DEFAULT_CSP, PROD_DEFAULT_CSP } from "./lib/csp.js";
import { type HeaderNames } from "./types.js";
import { SELF, UNSAFE_EVAL, UNSAFE_INLINE } from "csp-header";
import { CSP, type HeaderNames } from "./types.js";

export const PROD_DEFAULT_CSP: CSP["value"] = {
"default-src": [SELF],
"frame-src": [SELF],
"script-src": [SELF],
"style-src": [SELF],
"style-src-elem": [SELF, UNSAFE_INLINE],
"connect-src": [SELF],
"img-src": [SELF],
"object-src": [],
};

export const DEV_DEFAULT_CSP: CSP["value"] = {
"default-src": [SELF],
"frame-src": [SELF],
"script-src": [SELF, UNSAFE_EVAL],
"style-src": [SELF],
"style-src-elem": [SELF, UNSAFE_INLINE],
"connect-src": [SELF, "ws://localhost:*"],
"img-src": [SELF],
"object-src": [],
};

export const HEADER_NAMES: HeaderNames = {
hsts: "Strict-Transport-Security",
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { type FetchEvent } from "@solidjs/start/server";
import { type SecHeaders } from "./types.js";
import crypto from "node:crypto";
import { appendHeader } from "vinxi/http";
import { DEFAULT_HEADERS, HEADER_NAMES } from "./defaults.js";
import { type SecHeaders } from "./types.js";
import { keyIsHeader } from "./utils.js";
import { generateCSP } from "./lib/csp.js";

Check failure on line 7 in src/index.ts

View workflow job for this annotation

GitHub Actions / Lint

Can't resolve './lib/csp.js' in '/home/runner/work/shieldwall/shieldwall/src'

Check failure on line 7 in src/index.ts

View workflow job for this annotation

GitHub Actions / release

Cannot find module './lib/csp.js' or its corresponding type declarations.

Check failure on line 7 in src/index.ts

View workflow job for this annotation

GitHub Actions / Build

Cannot find module './lib/csp.js' or its corresponding type declarations.

Check failure on line 7 in src/index.ts

View workflow job for this annotation

GitHub Actions / Type Check

Cannot find module './lib/csp.js' or its corresponding type declarations.
import { type FetchEvent } from "@solidjs/start/server";
import { appendHeader } from "vinxi/http";

export const secureRequest = (options?: SecHeaders) => (event: FetchEvent) => {
const settings: SecHeaders = { ...DEFAULT_HEADERS, ...options };
Expand Down

0 comments on commit beb072b

Please sign in to comment.