Skip to content

Commit 0e94dcb

Browse files
authored
Merge pull request #1530 from netalertx/main
sync
2 parents 249d12d + a261378 commit 0e94dcb

File tree

118 files changed

+3106
-2788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3106
-2788
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ RUN apk add --no-cache \
3535
shadow \
3636
python3 \
3737
python3-dev \
38+
py3-psutil \
3839
gcc \
3940
musl-dev \
4041
libffi-dev \
@@ -136,7 +137,7 @@ ENV LANG=C.UTF-8
136137

137138
RUN apk add --no-cache bash mtr libbsd zip lsblk tzdata curl arp-scan iproute2 iproute2-ss nmap fping \
138139
nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
139-
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 envsubst \
140+
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 py3-psutil envsubst \
140141
nginx supercronic shadow su-exec jq && \
141142
rm -Rf /var/cache/apk/* && \
142143
rm -Rf /etc/nginx && \

.github/skills/code-standards/SKILL.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ description: NetAlertX coding standards and conventions. Use this when writing c
55

66
# Code Standards
77

8+
- ask me to review before going to each next step (mention n step out of x)
9+
- before starting, prepare implementation plan
10+
- ask me to review it and ask any clarifying questions first
11+
- add test creation as last step - follow repo architecture patterns - do not place in the root of /test
12+
- code has to be maintainable, no duplicate code
13+
- follow DRY principle
14+
- code files should be less than 500 LOC for better maintainability
15+
816
## File Length
917

1018
Keep code files under 500 lines. Split larger files into modules.
@@ -42,11 +50,18 @@ Nested subprocess calls need their own timeout—outer timeout won't save you.
4250
## Time Utilities
4351

4452
```python
45-
from utils.datetime_utils import timeNowDB
53+
from utils.datetime_utils import timeNowUTC
4654

47-
timestamp = timeNowDB()
55+
timestamp = timeNowUTC()
4856
```
4957

58+
This is the ONLY function that calls datetime.datetime.now() in the entire codebase.
59+
60+
⚠️ CRITICAL: ALL database timestamps MUST be stored in UTC
61+
This is the SINGLE SOURCE OF TRUTH for current time in NetAlertX
62+
Use timeNowUTC() for DB writes (returns UTC string by default)
63+
Use timeNowUTC(as_string=False) for datetime operations (scheduling, comparisons, logging)
64+
5065
## String Sanitization
5166

5267
Use sanitizers from `server/helper.py` before storing user input.

.github/skills/settings-management/SKILL.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,3 @@ Define in plugin's `config.json` manifest under the settings section.
3737
## Environment Override
3838

3939
Use `APP_CONF_OVERRIDE` environment variable for settings that must be set before startup.
40-
41-
## Backend API URL
42-
43-
For Codespaces, set `BACKEND_API_URL` to your Codespace URL:
44-
45-
```
46-
BACKEND_API_URL=https://something-20212.app.github.dev/
47-
```

.github/workflows/run-all-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
type: boolean
1313
default: false
1414
run_backend:
15-
description: '📂 backend/ (SQL Builder & Security)'
15+
description: '📂 backend/ & db/ (SQL Builder, Security & Migration)'
1616
type: boolean
1717
default: false
1818
run_docker_env:
@@ -43,9 +43,9 @@ jobs:
4343
run: |
4444
PATHS=""
4545
# Folder Mapping with 'test/' prefix
46-
if [ "${{ github.event.inputs.scan }}" == "true" ]; then PATHS="$PATHS test/scan/"; fi
46+
if [ "${{ github.event.inputs.run_scan }}" == "true" ]; then PATHS="$PATHS test/scan/"; fi
4747
if [ "${{ github.event.inputs.run_api }}" == "true" ]; then PATHS="$PATHS test/api_endpoints/ test/server/"; fi
48-
if [ "${{ github.event.inputs.run_backend }}" == "true" ]; then PATHS="$PATHS test/backend/"; fi
48+
if [ "${{ github.event.inputs.run_backend }}" == "true" ]; then PATHS="$PATHS test/backend/ test/db/"; fi
4949
if [ "${{ github.event.inputs.run_docker_env }}" == "true" ]; then PATHS="$PATHS test/docker_tests/"; fi
5050
if [ "${{ github.event.inputs.run_ui }}" == "true" ]; then PATHS="$PATHS test/ui/"; fi
5151

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ front/api/*
2525
**/plugins/**/*.log
2626
**/plugins/cloud_services/*
2727
**/plugins/cloud_connector/*
28+
**/plugins/heartbeat/*
2829
**/%40eaDir/
2930
**/@eaDir/
3031

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN apk add --no-cache \
3232
shadow \
3333
python3 \
3434
python3-dev \
35+
py3-psutil \
3536
gcc \
3637
musl-dev \
3738
libffi-dev \
@@ -133,7 +134,7 @@ ENV LANG=C.UTF-8
133134

134135
RUN apk add --no-cache bash mtr libbsd zip lsblk tzdata curl arp-scan iproute2 iproute2-ss nmap fping \
135136
nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
136-
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 envsubst \
137+
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 py3-psutil envsubst \
137138
nginx supercronic shadow su-exec jq && \
138139
rm -Rf /var/cache/apk/* && \
139140
rm -Rf /etc/nginx && \

Dockerfile.debian

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1010
python3 \
1111
python3-dev \
1212
python3-pip \
13+
python3-psutil \
1314
python3-venv \
1415
gcc \
1516
git \
@@ -193,7 +194,7 @@ RUN for vfile in .VERSION .VERSION_PREV; do \
193194
# setcap cap_net_raw,cap_net_admin+eip $(readlink -f ${VIRTUAL_ENV_BIN}/python) && \
194195
/bin/bash /build/init-nginx.sh && \
195196
/bin/bash /build/init-php-fpm.sh && \
196-
# /bin/bash /build/init-cron.sh && \
197+
# /bin/bash /build/init-cron.sh && \
197198
# Debian cron init might differ, skipping for now or need to check init-cron.sh content
198199
# Checking init-backend.sh
199200
/bin/bash /build/init-backend.sh && \

0 commit comments

Comments
 (0)