@fabrika/auth-core 0.9.0-dev.47 → 0.9.0-dev.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/rpc.ts +64 -0
- package/types/src/rpc.d.ts +51 -0
package/package.json
CHANGED
package/src/rpc.ts
CHANGED
|
@@ -128,6 +128,70 @@ export interface IamGrantRpc {
|
|
|
128
128
|
mintFromGrant(input: MintFromGrantInput): Promise<MintFromGrantResult>
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
// ── Sign-in signals for Operations' security alerts ───────────────────────────
|
|
132
|
+
//
|
|
133
|
+
// Operations' maintenance pass asks IAM for a bounded summary of its `auth_log` over a time window. Only IAM's full
|
|
134
|
+
// entrypoint serves it (the Cloudflare default export and the management `/rpc/*`), never the entrypoint every
|
|
135
|
+
// application binds, so it is a contract of its own and not a member of `IamRpc`.
|
|
136
|
+
|
|
137
|
+
/** The longest window `signInSignals` answers: a reader that fell further behind reads the last day only. */
|
|
138
|
+
export const SIGN_IN_SIGNALS_MAX_WINDOW_SECONDS = 24 * 60 * 60
|
|
139
|
+
|
|
140
|
+
/** The most accounts and privileged sign-ins one answer lists; `accountsTruncated`/`privilegedTruncated` say a list was cut. */
|
|
141
|
+
export const SIGN_IN_SIGNALS_LIMIT = 500
|
|
142
|
+
|
|
143
|
+
export interface SignInSignalsInput {
|
|
144
|
+
/**
|
|
145
|
+
* Unix seconds, inclusive, by `auth_log.created_at`: where privileged sign-ins are listed from. The reader overlaps
|
|
146
|
+
* windows, never resumes from an id.
|
|
147
|
+
*/
|
|
148
|
+
since: number
|
|
149
|
+
/** Unix seconds, inclusive, by `auth_log.created_at`: where refusals are counted from, so a threshold has one window. */
|
|
150
|
+
refusalsSince: number
|
|
151
|
+
/** Unix seconds, inclusive. */
|
|
152
|
+
until: number
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface SignInAccountRefusals {
|
|
156
|
+
principalId: string
|
|
157
|
+
/** Refused password sign-ins of this known account from `refusalsSince`. */
|
|
158
|
+
refusals: number
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface SignInRefusalReason {
|
|
162
|
+
reason: string
|
|
163
|
+
refusals: number
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface PrivilegedSignIn {
|
|
167
|
+
/** The `auth_log` row id, as a string on both engines: the reader's deduplication key. */
|
|
168
|
+
id: string
|
|
169
|
+
principalId: string
|
|
170
|
+
reason: string | null
|
|
171
|
+
/** Unix seconds. */
|
|
172
|
+
at: number
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export type SignInSignalsResult =
|
|
176
|
+
| {
|
|
177
|
+
ok: true
|
|
178
|
+
/** Per known account, the most first. */
|
|
179
|
+
accounts: SignInAccountRefusals[]
|
|
180
|
+
/** Every counted refusal from `refusalsSince`, unknown accounts and refused `px_` keys included. */
|
|
181
|
+
refusals: number
|
|
182
|
+
reasons: SignInRefusalReason[]
|
|
183
|
+
/** Allowed sign-ins of a principal that administers at IAM from `since`, oldest first. */
|
|
184
|
+
privileged: PrivilegedSignIn[]
|
|
185
|
+
accountsTruncated: boolean
|
|
186
|
+
/** The list stops at its oldest `SIGN_IN_SIGNALS_LIMIT`; a reader resumes after the last one it got. */
|
|
187
|
+
privilegedTruncated: boolean
|
|
188
|
+
}
|
|
189
|
+
| { ok: false; reason: 'invalid_window' }
|
|
190
|
+
|
|
191
|
+
export interface IamSignInSignalsRpc {
|
|
192
|
+
signInSignals(input: SignInSignalsInput): Promise<SignInSignalsResult>
|
|
193
|
+
}
|
|
194
|
+
|
|
131
195
|
/**
|
|
132
196
|
* Where the proxy answers the handoff, on every app host it fronts. Reserved: an app route at this
|
|
133
197
|
* path is shadowed by the proxy and never reaches the upstream, so it is deliberately namespaced.
|
package/types/src/rpc.d.ts
CHANGED
|
@@ -95,6 +95,57 @@ export type MintFromGrantResult = {
|
|
|
95
95
|
export interface IamGrantRpc {
|
|
96
96
|
mintFromGrant(input: MintFromGrantInput): Promise<MintFromGrantResult>;
|
|
97
97
|
}
|
|
98
|
+
/** The longest window `signInSignals` answers: a reader that fell further behind reads the last day only. */
|
|
99
|
+
export declare const SIGN_IN_SIGNALS_MAX_WINDOW_SECONDS: number;
|
|
100
|
+
/** The most accounts and privileged sign-ins one answer lists; `accountsTruncated`/`privilegedTruncated` say a list was cut. */
|
|
101
|
+
export declare const SIGN_IN_SIGNALS_LIMIT = 500;
|
|
102
|
+
export interface SignInSignalsInput {
|
|
103
|
+
/**
|
|
104
|
+
* Unix seconds, inclusive, by `auth_log.created_at`: where privileged sign-ins are listed from. The reader overlaps
|
|
105
|
+
* windows, never resumes from an id.
|
|
106
|
+
*/
|
|
107
|
+
since: number;
|
|
108
|
+
/** Unix seconds, inclusive, by `auth_log.created_at`: where refusals are counted from, so a threshold has one window. */
|
|
109
|
+
refusalsSince: number;
|
|
110
|
+
/** Unix seconds, inclusive. */
|
|
111
|
+
until: number;
|
|
112
|
+
}
|
|
113
|
+
export interface SignInAccountRefusals {
|
|
114
|
+
principalId: string;
|
|
115
|
+
/** Refused password sign-ins of this known account from `refusalsSince`. */
|
|
116
|
+
refusals: number;
|
|
117
|
+
}
|
|
118
|
+
export interface SignInRefusalReason {
|
|
119
|
+
reason: string;
|
|
120
|
+
refusals: number;
|
|
121
|
+
}
|
|
122
|
+
export interface PrivilegedSignIn {
|
|
123
|
+
/** The `auth_log` row id, as a string on both engines: the reader's deduplication key. */
|
|
124
|
+
id: string;
|
|
125
|
+
principalId: string;
|
|
126
|
+
reason: string | null;
|
|
127
|
+
/** Unix seconds. */
|
|
128
|
+
at: number;
|
|
129
|
+
}
|
|
130
|
+
export type SignInSignalsResult = {
|
|
131
|
+
ok: true;
|
|
132
|
+
/** Per known account, the most first. */
|
|
133
|
+
accounts: SignInAccountRefusals[];
|
|
134
|
+
/** Every counted refusal from `refusalsSince`, unknown accounts and refused `px_` keys included. */
|
|
135
|
+
refusals: number;
|
|
136
|
+
reasons: SignInRefusalReason[];
|
|
137
|
+
/** Allowed sign-ins of a principal that administers at IAM from `since`, oldest first. */
|
|
138
|
+
privileged: PrivilegedSignIn[];
|
|
139
|
+
accountsTruncated: boolean;
|
|
140
|
+
/** The list stops at its oldest `SIGN_IN_SIGNALS_LIMIT`; a reader resumes after the last one it got. */
|
|
141
|
+
privilegedTruncated: boolean;
|
|
142
|
+
} | {
|
|
143
|
+
ok: false;
|
|
144
|
+
reason: 'invalid_window';
|
|
145
|
+
};
|
|
146
|
+
export interface IamSignInSignalsRpc {
|
|
147
|
+
signInSignals(input: SignInSignalsInput): Promise<SignInSignalsResult>;
|
|
148
|
+
}
|
|
98
149
|
/**
|
|
99
150
|
* Where the proxy answers the handoff, on every app host it fronts. Reserved: an app route at this
|
|
100
151
|
* path is shadowed by the proxy and never reaches the upstream, so it is deliberately namespaced.
|