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

43 secure output route #46

Merged
merged 30 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
14b29eb
[Task] #43 create color pallette
Type-Style Feb 14, 2024
513315d
[Task] #43 create color pallette
Type-Style Feb 14, 2024
b4f99c5
[Task] #43 cleanup colors and svg
Type-Style Feb 14, 2024
cc6b8c3
[Task] #41 remove test code
Type-Style Feb 15, 2024
14ca99d
[CHANGE] #3 reconfigured nodemon to copy static files
Type-Style Feb 15, 2024
d077414
[Task] #18 replaced getRawBody with builtIn express urlEncoded
Type-Style Feb 16, 2024
6ebece8
[Temp, Task] #43 basic login page, not yet used as middleware
Type-Style Feb 16, 2024
5087ae2
[Temp] #43, create and validate json web token
Type-Style Mar 4, 2024
95b5322
[Task] #43, add slowDown and RateLimit for failed login attempts
Type-Style Mar 5, 2024
f01d579
[Task] #43, ratelimit for login page
Type-Style Mar 8, 2024
24506ac
[Task] #43, add global ratelimiter
Type-Style Mar 8, 2024
67d8ce0
[fix] #7, improve error handeling for express errors
Type-Style Mar 8, 2024
b022c31
[Task] #43 rework body limitations to be checked only appropiate methods
Type-Style Mar 10, 2024
81155fe
[Task] #43 added check for data before using it
Type-Style Mar 10, 2024
42d64a9
[Task] #43 check that body is ignored for GET in request
Type-Style Mar 10, 2024
e866047
[Task] #43 login test
Type-Style Mar 10, 2024
594aec9
[Task] #43 create tests for login
Type-Style Mar 12, 2024
b1572cd
[Task] #43 fine tune error handling
Type-Style Mar 13, 2024
32c9884
[Task] #43, finished login and jwt related tests
Type-Style Mar 13, 2024
eb51ec8
[Change] #34, no further need for test logging
Type-Style Mar 13, 2024
3ca5322
[Task] #43, fine tune jwt, middleware process improved
Type-Style Mar 13, 2024
4c94465
[CHANGE] #43 created new esLint to have clientside js without ts
Type-Style Mar 13, 2024
43e6db1
[Temp] #43 test to see new linter configuration
Type-Style Mar 13, 2024
5bbc1bf
[Change] #43 switched to bcrypt for passwords
Type-Style Mar 15, 2024
64c1201
[Task] #43 read return json in all cases
Type-Style Mar 15, 2024
f213d02
[Task] #43 introduced color classes
Type-Style Mar 18, 2024
dc745d0
Merge remote-tracking branch 'origin/dev' into 43-secure-output-route
Type-Style Mar 19, 2024
f76ca49
[Task] #43, prq feedback
Type-Style Mar 19, 2024
4ff8857
[Temp} #43 figuring out why tests dont run on github
Type-Style Mar 19, 2024
8a681ed
[Task] #43 code cleanup
Type-Style Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
//"@typescript-eslint/no-unused-vars": "warn"
"jest/no-conditional-expect": "off"
},
"ignorePatterns": ["dist", "jest.config.js"]
"ignorePatterns": ["dist", "jest.config.js", "httpdocs"]

}
9 changes: 4 additions & 5 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
with:
node-version: 16
- run: npm ci # or yarn install
- uses: sibiraj-s/action-eslint@v3
with:
eslint-args: '--ignore-path=.gitignore --quiet'
extensions: 'js,jsx,ts,tsx'
annotations: true
- name: Lint server-side code
run: npx eslint src/ --fix
- name: Lint client-side code
run: npx eslint httpdocs/js/ --fix
28 changes: 22 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node3
name: Tests

on:
workflow_dispatch:
Expand All @@ -10,7 +10,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest

env:
NODE_ENV: ${{ vars.NODE_ENV }}
LOCALHOST: ${{ vars.LOCALHOST }}
LOCALHOSTV6: ${{ vars.LOCALHOSTV6 }}
KEYA: ${{ secrets.KEYA }}
KEYB: ${{ secrets.KEYB }}
USER_TEST: ${{ secrets.USER_TEST }}

steps:
- uses: actions/checkout@v3
Expand All @@ -19,14 +25,24 @@ jobs:
with:
node-version: '20'
cache: 'npm'
- run: echo "NODE_ENV = $NODE_ENV"
- run: npm ci
- run: npm run build --if-present
- name: Start server
run: |
sudo npm start &
sleep 8 # Give server some time to start
sudo NODE_ENV=$NODE_ENV LOCALHOST=$LOCALHOST LOCALHOSTV6=$LOCALHOSTV6 KEYA=$KEYA KEYB=$KEYB USER_TEST=$USER_TEST npm start &
sleep 15 # Give server some time to start
- name: Check if server is running
run: |
curl --fail http://localhost:80 || exit 1
- name: Run tests
run: npm run test
- name: Run app tests
run: npm run test:app
- name: Run login tests
run: npm run test:login
- name: Run unit tests
run: npm run test:unit
- name: Run integration tests
run: npm run test:integration



159 changes: 159 additions & 0 deletions httpdocs/color-table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions httpdocs/css/colors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
created by atmos https://app.atmos.style/65cc9eaec76d443c0a796d4b

** base configuration colors **
Main: #f90
Info: #231aee
Danger: #ff0000
Success: #59ec04
Neutral: #131211
*/

[class*=color] {
--lightness: 67.66%;
--hue: 64.55;
--chroma: 0.007;
color: oklch(var(--lightness) var(--chroma) var(--hue));

&[class*=l1] {--lightness: 10%;}
&[class*=l2] {--lightness: 25%;}
&[class*=l3] {--lightness: 37.5%;}
&[class*=l4] {--lightness: 50%;}
&[class*=l5] {--lightness: 62.5%;}
&[class*=l6] {--lightness: 77.2%;}
&[class*=l7] {--lightness: 90%;}

&[class*=main] {
--lightness: 77.2%;
--chroma: 0.1738;
--hue: 64.55;

&[class*=l1] {--chroma: 0.02;}
&[class*=l2] {--chroma: 0.056;}
&[class*=l3] {--chroma: 0.085;}
&[class*=l4] {--chroma: 0.114;}
&[class*=l5] {--chroma: 0.142;}
&[class*=l6] {--chroma: 0.1738;} /* base */
&[class*=l7] {--chroma: 0.06;}
}

&[class*=info] {
--lightness: 44.87%;
--chroma: 0.2838;
--hue: 268.0;

&[class*=l1] {--chroma: 0.055;}
&[class*=l2] {--chroma: 0.158;}
&[class*=l3] {--chroma: 0.237;}
&[class*=l4] {--chroma: 0.2838;} /* base */
&[class*=l5] {--chroma: 0.19;}
&[class*=l6] {--chroma: 0.109;}
&[class*=l7] {--chroma: 0.04;}
}

&[class*=alert] {
--lightness: 62.8%;
--chroma: 0.2577;
--hue: 29.23;

&[class*=l1] {--chroma: 0.036;}
&[class*=l2] {--chroma: 0.103;}
&[class*=l3] {--chroma: 0.154;}
&[class*=l4] {--chroma: 0.195;}
&[class*=l5] {--chroma: 0.2577;} /* base */
&[class*=l6] {--chroma: 0.133;}
&[class*=l7] {--chroma: 0.045;}
}

&[class*=success] {
--lightness: 83%;
--chroma: 0.2607;
--hue: 138.96;

&[class*=l1] {--chroma: 0.029;}
&[class*=l2] {--chroma: 0.083;}
&[class*=l3] {--chroma: 0.124;}
&[class*=l4] {--chroma: 0.157;}
&[class*=l5] {--chroma: 0.208;}
&[class*=l6] {--chroma: 0.2607;} /* base */
&[class*=l7] {--chroma: 0.201;}
}

&[class*=neutral] {
--lightness: 18.3%;
--chroma: 0.0026;
--hue: 67.66;

&[class*=l1] {--chroma: 0.001;}
&[class*=l2] {--chroma: 0.0026;} /* base */
&[class*=l3] {--chroma: 0.006;}
&[class*=l4] {--chroma: 0.007;}
&[class*=l5] {--chroma: 0.009;}
&[class*=l6] {--chroma: 0.011;}
&[class*=l7] {--chroma: 0.004;}
}
}
20 changes: 20 additions & 0 deletions httpdocs/css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
form {
margin-inline: auto;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: 500px;
gap: 10px;
}
input, button {
flex-grow: 1;
}
textarea, h1 {
flex-basis: 100%;
}
textarea {
height: 50vh;
}
h1 {
text-align: center;
}
12 changes: 12 additions & 0 deletions httpdocs/js/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
}
}
1 change: 1 addition & 0 deletions httpdocs/js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions nodemon-static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"watch": [
"httpdocs"
],
"ext": "*",
"ignore": [],
"exec": "cp -R httpdocs/ dist/"
}
File renamed without changes.
Loading
Loading