pub struct NewTransaction {
pub request_id: String,
pub request_hash: String,
pub action_name: String,
pub risk_level: RiskLevel,
pub summary: String,
pub warnings: Vec<String>,
pub caller_role: CallerRole,
pub caller_principal: CallerPrincipal,
}Expand description
Data provided by the caller when recording a new transaction.
The initial status is always Queued — it is not caller-controllable.
Hardcoding this in the store prevents callers from bypassing the state
machine by recording a transaction in a terminal state.
Fields§
§request_id: String§request_hash: String§action_name: String§risk_level: RiskLevel§summary: StringHuman-readable description of the planned action.
Chain-hashed at INSERT; intentionally not in the mutable field set.
summary is captured in crate::audit_chain::ChainContent and
baked into chain_hash = ed25519_sign(canonical(fields) || prev_hash, key)
at the moment the row is written. After that point the stored signature
is a one-time commitment.
Do not add an update_summary API (or any equivalent that modifies
this field in an existing row). Any such change will cause
sysknife audit verify to report VerifyOutcome::Broken for the
modified row, because the signature will no longer verify against the
stored chain_hash.
If a correction is genuinely needed, use one of the two safe strategies
documented on crate::audit_chain::ChainContent:
- Insert a corrective row that references the original
transaction_id. - Extend the chain protocol with a dedicated amendment record type.
warnings: Vec<String>§caller_role: CallerRoleRole the daemon resolved for the connection that asked for this action.
Chain-hashed at INSERT alongside summary. Before this field existed the
signed record could say what was authorised but not which privilege tier
asked; which account asked is caller_principal below. Not
caller-supplied over the wire: the dispatcher passes the role
it resolved from SO_PEERCRED (or the vsock token), never a value from
the request body.
caller_principal: CallerPrincipalWhich account asked, as opposed to what its role permitted.
Chain-hashed at INSERT alongside caller_role. The role alone cannot
separate two members of sysknife-admin, so a trail built only from it
answers “an Admin did this” and stops there. Like the role, this is
resolved by the dispatcher from the connection, never read from the
request body. See crate::auth::CallerPrincipal.
Trait Implementations§
Source§impl Clone for NewTransaction
impl Clone for NewTransaction
Source§impl Debug for NewTransaction
impl Debug for NewTransaction
impl Eq for NewTransaction
Source§impl PartialEq for NewTransaction
impl PartialEq for NewTransaction
impl StructuralPartialEq for NewTransaction
Auto Trait Implementations§
impl Freeze for NewTransaction
impl RefUnwindSafe for NewTransaction
impl Send for NewTransaction
impl Sync for NewTransaction
impl Unpin for NewTransaction
impl UnsafeUnpin for NewTransaction
impl UnwindSafe for NewTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more