Commit Graph

321 Commits

Author SHA1 Message Date
supermario
b9b8335db9 Fixed CSRF vulnerability, CVE is being issued 2025-12-03 14:53:18 -05:00
AnthonyMarrongelli
15be927697 Removed unneeded cast to char, causing unpredictable invalid dereference 2025-11-11 22:38:31 -08:00
enp6s0
15231bace6 Local resource: add Roboto webfont 2025-10-29 20:25:34 -07:00
Thiago Alves
3e23926c90 Fix compilation issue 2025-10-22 10:18:30 -04:00
Thiago Alves
7b190d0708 Update release 2025-10-22 10:09:40 -04:00
Thiago Alves
ec3a29f28c Fix compilation issues 2025-10-22 09:58:45 -04:00
Devin AI
7ea8d717c5 Add FILE: line extraction logic to parse embedded C/C++ blocks from program.st
- Extract FILE: lines from program.st similar to DBG: line extraction
- Write extracted files to ./core directory with proper path handling
- Support subdirectories (e.g., FILE:test/abc.txt -> ./core/test/abc.txt)
- Remove FILE: and DBG: lines from program.st before MatIEC compilation
- No fallback .blank files needed for FILE: content

Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
2025-10-22 01:00:38 +00:00
Thiago Alves
7c61a3ad6b Fix file path validation logic 2025-10-09 14:42:55 -04:00
Thiago Alves
7b8e1afb4d Update release 2025-10-09 13:09:13 -04:00
Thiago Alves
82708866bf Merge pull request #300 from Autonomy-Logic/development
Add https REST API to communicate with OpenPLC Editor v4
2025-10-09 13:06:56 -04:00
Thiago Alves
c8ee03081d Add input validation to certificate generation 2025-10-09 13:03:37 -04:00
Thiago Alves
a67be6960b Fix raise identation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-09 12:34:31 -04:00
Thiago Alves
3ac32524a8 Fix https issue under Windows MSYS2 2025-10-09 11:59:45 -04:00
Thiago Alves
32dc75470b Small fixes 2025-10-08 16:55:23 -04:00
Devin AI
b3a1e65119 Add platform-conditional HTTPS: Linux only
Revert to Flask app.run() and add platform detection to conditionally
enable HTTPS with certificates only on Linux systems. Non-Linux systems
(Windows/MSYS2) skip certificate generation and run HTTP instead to avoid
SSL socket blocking issues.

Changes:
- Use platform.system() to detect Linux vs non-Linux
- Linux: Generate OpenSSL certificates and run HTTPS (unchanged behavior)
- Non-Linux: Skip certificate generation and run HTTP on same port
- Reverted make_server() changes back to app.run()

This provides a pragmatic workaround for Windows/MSYS2 SSL socket
compatibility issues while maintaining full HTTPS functionality on Linux.

Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
2025-10-08 20:44:10 +00:00
Devin AI
f01c1c05ba Force socket blocking mode for Windows/MSYS2 SSL compatibility
Replace Flask's app.run() with manual server creation using Werkzeug's
make_server(). This allows us to explicitly call socket.setblocking(True)
after SSL wrapping to fix errno 11 (EAGAIN) on Windows/MSYS2 where sockets
default to non-blocking mode.

Werkzeug never calls setblocking(True) after wrapping sockets with SSL,
which causes SSL operations to fail on platforms where sockets default to
non-blocking mode. This fix ensures blocking mode is enabled across all
platforms.

Changes:
- Use werkzeug.serving.make_server() instead of app.run()
- Explicitly call server.socket.setblocking(True) after server creation
- Maintain all existing functionality (threaded mode, SSL context, etc.)
- Add detailed comments explaining the Windows/MSYS2 compatibility fix

Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
2025-10-08 20:25:44 +00:00
Devin AI
e52d48c5cf Use explicit SSLContext for better socket handling on Windows/MSYS2
Replace tuple-based ssl_context with explicit ssl.SSLContext creation using
PROTOCOL_TLS_SERVER and load_cert_chain(). This follows Python ssl module
best practices and may handle socket configuration more robustly on MSYS2
where sockets may default to non-blocking mode.

The tuple shortcut (cert, key) internally creates an SSLContext, but using
an explicit SSLContext gives us better control and follows the documented
approach for server-side SSL. This may help with the errno 11 (Resource
temporarily unavailable) issue on Windows/MSYS2.

If this doesn't resolve the issue, we'll need to investigate more invasive
solutions like wrapping Werkzeug's socket creation.

Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
2025-10-08 20:12:41 +00:00
Devin AI
7b16afb69d Fix Windows/MSYS2 compatibility: convert Path to str for ssl_context
Flask/Werkzeug's ssl_context parameter expects string paths, not pathlib.Path
objects. On Windows/MSYS2, passing Path objects causes 'Resource temporarily
unavailable' error. Converting to strings maintains Linux compatibility while
fixing Windows support.

Fixes the error reported by user where context showed PosixPath objects
instead of strings, causing Flask to fail on Windows/MSYS2.

Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
2025-10-08 19:52:35 +00:00
Devin AI
1b82973556 Replace Python Cryptography with OpenSSL CLI for certificate generation
- Replace cryptography library with subprocess calls to openssl CLI
- Use RSA 4096-bit keys for stronger security (vs previous 2048-bit)
- Use SHA256 signature algorithm
- Set certificate validity to 36500 days (~100 years, effectively never expires)
- Maintain same CertGen class interface for backward compatibility
- Remove cryptography dependency from requirements.txt

The OpenSSL-based approach is more universally available across platforms
and doesn't require additional Python dependencies. The certificate is
self-signed and can be used for SSH-like validation of embedded PLC devices.

Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
2025-10-08 18:29:47 +00:00
Thiago Alves
228f60965d Fix REST API errors and make it conform with v4 API 2025-10-07 14:22:04 -04:00
Kristian Dueholm Hill
2bce18d4e4 Add -lrt flag to main compile. 2025-10-07 13:10:32 +02:00
Thiago Alves
cd369af331 Merge branch 'master' into development 2025-10-06 17:01:11 -04:00
Eyodav
004e0ced32 Update webserver.py 2025-09-26 14:06:08 +02:00
Eyodav
095ee09623 Update webserver.py 2025-09-26 11:03:06 +02:00
Thiago Alves
4d8d73f57c Fix python loader cmd stack variable 2025-09-11 13:15:12 -04:00
Thiago Alves
44ae21ae2e Fix compilation issues on Windows 2025-09-10 10:23:45 -04:00
Autonomy Server
4f0f435ea7 Merge branch 'master' into development 2025-09-08 12:09:16 -04:00
Autonomy Server
43ad8fb367 Update release version 2025-09-08 12:02:26 -04:00
Autonomy Server
a8b27f4d4a Include Python loader to execute Python-based FBs 2025-09-08 11:49:00 -04:00
renato
2048a262b4 Fixing EnipThread fucntion return 2025-09-03 00:52:28 -04:00
Thiago Alves
f06902fde3 Removed password logs for security purposes 2025-07-31 15:05:12 -03:00
lucasbutzke
c768c58f8f [RTOP-26] Creating webserver_program.st file 2025-07-31 14:59:23 -03:00
Thiago Alves
33d26f7dc2 Removed comments 2025-07-31 12:02:11 -03:00
lucasbutzke
de464918a8 [RTOP-26] Fix logging on restapi 2025-07-31 11:55:28 -03:00
lucasbutzke
3d041e2119 [RTOP-26] Update restapi .st file name to not conflict with webserver 2025-07-31 11:41:37 -03:00
lucasbutzke
22f170f0cb [RTOP-26] Removing snap7 program from database and descrition to not
delete webserver_program
2025-07-31 11:29:51 -03:00
lucasbutzke
aa097640bd [RTOP-26] Adding webserver_program to openplc.db 2025-07-31 11:20:32 -03:00
lucasbutzke
2eee01a5b8 [RTOP-26] Fix .env file management 2025-07-31 08:48:30 -04:00
lucasbutzke
223dd2c2e6 [RTOP-26] Fix config.py 2025-07-30 19:28:27 -04:00
lucasbutzke
2ca82fa00f [RTOP-26] Change .env variables generation to python and verifing if are valid at inicialization 2025-07-30 19:21:58 -04:00
lucasbutzke
2a1f3fb360 [RTOP-26] Adding routes names 2025-07-29 18:13:30 -04:00
lucasbutzke
b8623fb5b3 [RTOP-26] PR Review Fix 2025-07-29 18:10:59 -04:00
lucasbutzke
602866ad3a [RTOP-26] Fix webserver database and restapi minor fix 2025-07-29 09:43:59 -04:00
lucasbutzke
4998c3820f [RTOP-26] Getting return from compilation script 2025-07-28 23:01:56 -04:00
lucasbutzke
e548386824 [RTOP-26] Fix compilation status 2025-07-28 22:35:48 -04:00
lucasbutzke
e4355309ee [RTOP-26] validating file field and file size in POST request 2025-07-28 22:16:04 -04:00
lucasbutzke
31e987cd2b [RTOP-40] User check returnign if there were already created users if invalid JWT is used 2025-07-28 21:55:59 -04:00
lucasbutzke
469daf28ee [RTOP-40] Merged upload and compile program to one function 2025-07-28 21:30:52 -04:00
lucasbutzke
3492456cf4 [RTOP-40] compilation logs and status were merged to one funtion 2025-07-28 21:22:04 -04:00
lucasbutzke
8c63b0d368 [RTOP-26] Fix compilation_object error before compiling 2025-07-28 20:57:24 -04:00