Closes the gaps and the one security finding from the second end-to-end
CLI test (E2E_STASH_REPORT.md), plus the H1 boot-regression found while
re-reviewing those fixes.
Security
- S6: reserved-path validation (`check_reserved`) now case-folds before
comparing, so `/API/v2/x`, `/HEALTHZ`, `/Admin/x` are rejected like
their lowercase forms. Request-time matching stays case-sensitive.
- S10: "public route != public data" callout in sdk-shape.md (script_gate
skips authz when the principal is anonymous).
Observability / features
- G1: trigger executions now write `execution_logs`. Migration 0043 adds
a `source` column (CHECK mirrors ExecutionSource/OutboxSourceKind,
DEFAULT 'http' backfills history); a shared `build_execution_log` helper
in executor-core; dispatcher logging for outbox triggers + queue
consumers (skips sync-HTTP rows the orchestrator already logs). `pic
logs` gains a source column + `--source` filter.
- G5: dev-only in-memory email capture under PICLOUD_DEV_MODE with no SMTP
(email::send succeeds locally), readable at GET /api/v1/admin/dev/emails
(Owner/Admin only; route mounted only in capture mode).
- G6: generalized the Rhai in-place-mutation footgun note (trim/replace/
make_upper/make_lower/crop/truncate/pad return ()).
- G2/G3/G4 (CLI): `pic members`, `pic files`, `pic queues`, read-only
`pic kv` (+ new kv_api.rs); `pic deploy --timeout/--memory/--kind/
--sandbox`; first-class `pic triggers create-{docs,files,pubsub,queue,
email}` wrappers. All new client path segments percent-encoded via seg().
H1 regression fix (found in re-review)
- The S6 change also runs in `compile_routes`, which compiles every stored
route at boot and on each route CRUD. A single stored route the new
validation rejects (creatable while the S6 gap existed) made the whole
compile Err and aborted startup. `compile_routes` is now lenient: it
skips an un-compilable row with a warning instead of bricking boot
(route creation still validates separately). Migration 0044 sweeps
pre-existing reserved-path routes on upgrade (WHERE mirrors
check_reserved exactly). Added regression tests for both.
Verified: cargo fmt, clippy --all-targets --all-features -D warnings, the
schema_snapshot test, and the new S6/lenient-compile unit tests all pass;
boot-resilience and G1/G5 confirmed live.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
95 lines
3.6 KiB
Rust
95 lines
3.6 KiB
Rust
//! Cross-cutting types used by every PiCloud crate.
|
|
//!
|
|
//! Keep this crate small. If something only one core needs, it belongs in
|
|
//! that core's crate. Things here must be genuinely shared (IDs, the Script
|
|
//! entity, error roots, transport DTOs).
|
|
|
|
pub mod app;
|
|
pub mod auth;
|
|
pub mod crypto;
|
|
pub mod dead_letters;
|
|
pub mod docs;
|
|
pub mod email;
|
|
pub mod error;
|
|
pub mod events;
|
|
pub mod exec_summary;
|
|
pub mod execution_log;
|
|
pub mod files;
|
|
pub mod http;
|
|
pub mod ids;
|
|
pub mod inbox;
|
|
pub mod invoke;
|
|
pub mod kv;
|
|
pub mod log_sink;
|
|
pub mod modules;
|
|
pub mod outbox_writer;
|
|
pub mod pubsub;
|
|
pub mod queue;
|
|
pub mod realtime;
|
|
pub mod realtime_authority;
|
|
pub mod route;
|
|
pub mod sandbox;
|
|
pub mod script;
|
|
pub mod sdk_cx;
|
|
pub mod secrets;
|
|
pub mod services;
|
|
pub mod subscriber_token;
|
|
pub mod trigger_event;
|
|
pub mod users;
|
|
pub mod validator;
|
|
pub mod version;
|
|
|
|
pub use app::{App, AppDomain, DomainShape};
|
|
pub use auth::{AppRole, InstanceRole, Principal, Scope, UserId};
|
|
pub use crypto::{decrypt, encrypt, CryptoError, EncryptResult, MasterKey, MasterKeyError};
|
|
pub use dead_letters::{DeadLetterError, DeadLetterId, DeadLetterService, NoopDeadLetterService};
|
|
pub use docs::{DocId, DocRow, DocsError, DocsListPage, DocsService, NoopDocsService};
|
|
pub use email::{EmailError, EmailService, NoopEmailService, OutboundEmail};
|
|
pub use error::Error;
|
|
pub use events::{EmitError, NoopEventEmitter, ServiceEvent, ServiceEventEmitter};
|
|
pub use exec_summary::ExecResponseSummary;
|
|
pub use execution_log::{ExecutionLog, ExecutionSource, ExecutionStatus};
|
|
pub use files::{
|
|
sanitize_stored_content_type, validate_collection as validate_files_collection, FileMeta,
|
|
FileUpdate, FilesError, FilesListPage, FilesService, NewFile, NoopFilesService,
|
|
SAFE_RENDER_FALLBACK,
|
|
};
|
|
pub use http::{HttpError, HttpRequest, HttpResponse, HttpService, NoopHttpService};
|
|
pub use ids::{
|
|
AdminUserId, ApiKeyId, AppId, AppUserId, ExecutionId, InvitationId, QueueMessageId, RequestId,
|
|
ScriptId, TriggerId,
|
|
};
|
|
pub use inbox::{
|
|
InboxDeliveryOutcome, InboxFailureKind, InboxResolver, InboxResult, NoopInboxResolver,
|
|
};
|
|
pub use invoke::{InvokeError, InvokeService, InvokeTarget, NoopInvokeService, ResolvedScript};
|
|
pub use kv::{KvError, KvListPage, KvService, NoopKvService};
|
|
pub use log_sink::{ExecutionLogSink, LogSinkError};
|
|
pub use modules::{ModuleScript, ModuleSource, ModuleSourceError, NoopModuleSource};
|
|
pub use outbox_writer::{HttpDispatchPayload, NewHttpOutbox, OutboxWriter, OutboxWriterError};
|
|
pub use pubsub::{
|
|
topic_matches, validate_topic_pattern, NoopPubsubService, PubsubError, PubsubService,
|
|
};
|
|
pub use queue::{EnqueueOpts, NoopQueueService, QueueError, QueueService};
|
|
pub use realtime::{BroadcasterError, NoopRealtimeBroadcaster, RealtimeBroadcaster, RealtimeEvent};
|
|
pub use realtime_authority::{DenyAllRealtimeAuthority, RealtimeAuthority, SubscribeDenied};
|
|
pub use route::{DispatchMode, HostKind, PathKind, Route};
|
|
pub use sandbox::ScriptSandbox;
|
|
pub use script::{Script, ScriptKind};
|
|
pub use sdk_cx::SdkCallCx;
|
|
pub use secrets::{
|
|
validate_secret_name, NoopSecretsService, SecretsError, SecretsListPage, SecretsService,
|
|
SECRET_NAME_MAX_BYTES,
|
|
};
|
|
pub use services::Services;
|
|
pub use trigger_event::{
|
|
DeadLetterEventDetail, DocsEventOp, FilesEventOp, KvEventOp, TriggerEvent,
|
|
};
|
|
pub use users::{
|
|
AppUser, CreateUserInput, EmailTemplateOpts, GeneratedAccept, GeneratedSession, Invitation,
|
|
InviteOpts, NoopUsersService, UpdateUserInput, UsersError, UsersListOpts, UsersListPage,
|
|
UsersService,
|
|
};
|
|
pub use validator::{ScriptValidator, ValidatedScript, ValidationError};
|
|
pub use version::{API_VERSION, PRODUCT_VERSION, SDK_VERSION, WIRE_VERSION};
|