Client security fixes (cmd/tailscale-tray/main.go): - SSRF protection in Add Server dialog (validateControlURL): reject private/loopback/link-local/cloud-metadata IPs via DNS resolution - RCE gate on AuthURL/BrowseToURL exec paths (validateAuthURL) - Sanitized URL logging (sanitizeURLForLog drops query auth tokens) - Error handling on exec.Command with user-facing showError() Admin panel security (web-admin): - Bcrypt password hashing (replaces SHA256) - Rate limiting: 5 failed logins → 15-min lockout - Session + login attempt cleanup goroutine (hourly) - url.QueryEscape / encodeURIComponent for all API params - Fail-hard startup when no TLS and non-loopback bind - ADMIN_PASSWORD required (no default), password min 12 chars - Username regex whitelist Installer hardening (Setup.wxs): - util:PermissionEx restricts SCM access: only Administrators + SYSTEM can start/stop/reconfigure service. Authenticated Users limited to QueryStatus/QueryConfig/Interrogate - Vital="yes" on ServiceInstall Docs & roadmap: - PRODUCTION_ROADMAP.md: 5-milestone plan (security + features + distribution + ops) with granular tasks, effort, done-when - CLIENT_SECURITY_AUDIT.md, SECURITY_FIXES.md, DEPLOYMENT.md - AI assistant rules (.cursorrules, .antigravityrules, etc.) Build & distribution: - build-msi.ps1, deploy-and-sign.ps1, sign-release.ps1 - redeploy.ps1, tray-deploy.ps1, test-msi.ps1 - installer/msi/ alternative WXS setup - Restored .github/workflows/ removed in mirror cleanup .gitignore hardened: *.pfx, *.p12, *.key, *.pem, .env*
4.7 KiB
description
| description |
|---|
| Workflow for preparing IFC models, standardizing filenames, and syncing with APIs & FTP across ATAD software modules |
Workflow: Prepare IFC Model Deployment
This workflow standardizes the IFC integration process across ATAD's software modules. It downloads raw IFC files from Autodesk Forge, unifies their syntax/naming conventions, uploads them via the new 3-step API, updates the database URNs, syncs with FTP, and handles dynamic routing.
Mức 0: Xác định Tiền Tố (Prefix)
Khi Agent bắt đầu chạy workflow này để ứng dụng cho một project khác, phải chủ động hỏi người dùng về tiền tố sẽ được áp dụng cho tên file IFC đối với dự án hiện tại (Ví dụ: atad-, ins-, swe-, v.v...).
🚫 TUYỆT ĐỐI KHÔNG fix cứng chữ atad- trong code mẫu. Luôn khai báo động và dùng tiền tố người dùng cung cấp vào tên file đầu ra.
1. Khởi tạo Razor Component
- Khởi tạo file Component View (thường sẽ là
PrepairIFC.razorhoặcPrepareIFC.razor) với route tương ứng cơ chế của project (VD:@page "/prepair-ifc/{unitid}"). - Bắt buộc gắn thuộc tính cấu hình
@attribute [Microsoft.AspNetCore.Authorization.AllowAnonymous]để cho phép việc trigger/webhook trích xuất tự động không cần xác thực User Auth. - Xây dựng UI Loading thể hiện các bước Process (Đang Authenticate, Đang Load Forge, Uploading API...).
- Inject các cấu phần Service: Base DbContext,
IHttpClientFactory, Service Forge (IForgeUploadServices), Service FTP (IFTPUploadServices).
2. Tiêu Chuẩn Hóa Tên File IFC (Naming Format)
Sau khi load dữ liệu DB chứa thông số của Model, tiến hành sinh chuỗi tên File IFC. Tên File tải từ Forge về có thể sai lệch hoặc không tuân thủ mẫu mới nhất.
Luôn thực thi cấu trúc: <Prefix><ProjectCode>_<AreaCode>_<UnitCode>_<Revision>.ifc
$Prefix: Truyền biến từ Mức 0.- Quy tắc Revision: Khi lấy code version từ DB (VD lấy
IfcModelVersion), kiểm tra định dạng chữR. Nếu format rỗng hoặc chỉ có số1, hệ thống bắt buộc tự convert thành chuẩn 2 charR01:
// Logic mẫu cho AI Agent áp dụng:
string rev = dbUnit.IfcModelVersion ?? "00";
if (!rev.StartsWith("R", StringComparison.OrdinalIgnoreCase)) {
rev = int.TryParse(rev, out int rInt) ? $"R{rInt:D2}" : $"R{rev}";
}
string desiredFilename = $"{prefix}{dbProject.Code}_{dbArea.Code}_{dbUnit.Code}_{rev}.ifc";
3. Tích hợp Autodesk Forge
- Gọi hàm Authenticate của Cấu phần Hệ Thống (Ví dụ
ForgeUploadServices.Forge_AuthenticateV2) để lấy access token. - Khởi tạo
ObjectsApigọiGetObjectsAsync(bucketKey)để trích xuất ObjectKey cho thư mục Bucket của Model. - Bỏ qua API SDK nếu Download Stream gặp hạn chế (Memory Stream Leak), hãy trực tiếp sử dụng lệnh
HttpClient.GetAsync()download File thông qua Url tĩnh của Forge (https://developer.api.autodesk.com/oss/v2/buckets/...) cùng header Bearer để ghi dữ liệu về một Temp Caching Directiory trong Thư mụcUploads.
4. Luồng API Upload IFC V2
- Truy xuất thông số từ bảng Cấu hình của dự án (Thường là
GLBSystemsvới các cột:ModelApiDomain,ModelUserId,ModelProjectId,ModelFolderId). - Đẩy File Temp ở Bước 3 qua Multipart Data vào Endpoints API
/api/files/upload. Đọc JSON trả về lấyitemId. (Lưu ý: StatusConflictvẫn cần bóc tách đọc ItemID bình thường). - Gọi tiếp sang API Endpoint Lấy
Urn(/api/Files/urn?itemId=...). Lấy ra giá trịobjectUrncủa File 3D. - Kết nối DbContext, Gọi hàm Raw SQL Update
Urnvà cờ View(IsModelReadyView = 1) gán qua cho Table chứa cấu trúc lưu trữ 3D tương ứng.
5. FTP Server Synchronization (Hệ thống File Server)
- Build định dạng đường dẫn lưu trên FTP:
${ProjectCode}/${AreaCode}/${UnitCode}/All/{desiredFilename}. - Gọi
UploadFilethao tác đẩy Cache File lên FTP để lưu trữ. - Nếu trả về FtpStatus Success, cập nhật trực tiếp biến Remote Path đó vào cột lưu trữ vật lý của DB.
6. Cleanup & Bypass Routing
- Xóa Temp Caching File bằng lệnh
File.Delete()an toàn để giải phóng cấu trúc vùng nhớ và không gian ổ đĩa. - Gọi NavigationManager.NavigateTo bay thẳng qua URL hiển thị mô hình (
/eview/{unit_id}). Có thể chèn hàm trễTask.Delay(2000)để hiển thị Message báo kết quả Upload xong trước khi đổi trang.