Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
175aaec
feat(auth): authenticate workload controller
peterpeterparker Jan 25, 2026
071fd43
refactor: split modules user and workload for jwt verification
peterpeterparker Jan 25, 2026
2baab4a
feat: bubble error
peterpeterparker Jan 25, 2026
ae21dee
Merge branch 'main' into feat/authenticate-workload-controller
peterpeterparker Jan 28, 2026
8e7b6ef
feat: actions
peterpeterparker Jan 28, 2026
e43ac03
feat: set controller
peterpeterparker Jan 28, 2026
3164d87
feat: return result
peterpeterparker Jan 28, 2026
bde258c
feat: try_from
peterpeterparker Jan 28, 2026
da25168
feat: did
peterpeterparker Jan 28, 2026
0d069ca
feat: auth id provider
peterpeterparker Jan 28, 2026
7eb171c
feat: more and rename type
peterpeterparker Jan 28, 2026
9caae39
fea: rename better meaning
peterpeterparker Jan 28, 2026
660c09d
feat: expose
peterpeterparker Jan 28, 2026
8b8a74b
chore: redo include
peterpeterparker Jan 28, 2026
4706433
feat: generate did
peterpeterparker Jan 28, 2026
f87b61a
feat: actions in observatory
peterpeterparker Jan 28, 2026
ed29f56
feat: one time upgrade
peterpeterparker Jan 28, 2026
20c1f5f
feat: one time upgrade
peterpeterparker Jan 28, 2026
0ad8e61
feat: export auth
peterpeterparker Jan 28, 2026
235abb5
chore: fmt
peterpeterparker Jan 28, 2026
9bf3889
chore: merge main
peterpeterparker Jan 29, 2026
46fb0aa
chore: remove unused impl
peterpeterparker Jan 29, 2026
5f193fc
feat: rename
peterpeterparker Jan 29, 2026
1a2f7b7
refactor: move
peterpeterparker Jan 29, 2026
5af54b4
chore: merge main
peterpeterparker Jan 29, 2026
648538b
refactor: move automation
peterpeterparker Jan 29, 2026
f57efd5
Merge branch 'main' into feat/authenticate-workload-controller
peterpeterparker Jan 29, 2026
755e0b8
feat: automation config
peterpeterparker Jan 29, 2026
1c7a033
chore: merge main
peterpeterparker Jan 29, 2026
4319cb0
chore: fmt
peterpeterparker Jan 29, 2026
3201b64
feat: init automation to none
peterpeterparker Jan 29, 2026
8487ecf
feat: make unsafe_find_jwt_provider generic again
peterpeterparker Jan 29, 2026
f1f220b
chore: merge main
peterpeterparker Jan 29, 2026
5f5dd94
chore: merge main
peterpeterparker Jan 29, 2026
17524bd
feat: verify with providers
peterpeterparker Jan 29, 2026
46036ed
chore: merge main
peterpeterparker Jan 29, 2026
cc8713e
feat: rework for consistency and similar pattern plus integration in …
peterpeterparker Jan 29, 2026
a0319b5
feat: move in mod
peterpeterparker Jan 29, 2026
254af33
fix: deleted types
peterpeterparker Jan 29, 2026
dc8daee
chore: merge main
peterpeterparker Jan 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/declarations/observatory/observatory.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export interface OpenIdCertificate {
created_at: bigint;
version: [] | [bigint];
}
export type OpenIdProvider = { Google: null } | { GitHubAuth: null };
export type OpenIdProvider = { GitHubActions: null } | { Google: null } | { GitHubAuth: null };
export interface RateConfig {
max_tokens: bigint;
time_per_token_ns: bigint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const idlFactory = ({ IDL }) => {
failed: IDL.Nat64
});
const OpenIdProvider = IDL.Variant({
GitHubActions: IDL.Null,
Google: IDL.Null,
GitHubAuth: IDL.Null
});
Expand Down
1 change: 1 addition & 0 deletions src/declarations/observatory/observatory.factory.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const idlFactory = ({ IDL }) => {
failed: IDL.Nat64
});
const OpenIdProvider = IDL.Variant({
GitHubActions: IDL.Null,
Google: IDL.Null,
GitHubAuth: IDL.Null
});
Expand Down
1 change: 1 addition & 0 deletions src/declarations/observatory/observatory.factory.did.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const idlFactory = ({ IDL }) => {
failed: IDL.Nat64
});
const OpenIdProvider = IDL.Variant({
GitHubActions: IDL.Null,
Google: IDL.Null,
GitHubAuth: IDL.Null
});
Expand Down
27 changes: 27 additions & 0 deletions src/declarations/satellite/satellite.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export interface AssetNoContent {
export interface AssetsUpgradeOptions {
clear_existing_assets: [] | [boolean];
}
export type AuthenticateControllerArgs = {
OpenId: OpenIdAuthenticateControllerArgs;
};
export type AuthenticateControllerResultResponse =
| { Ok: null }
| { Err: AuthenticationControllerError };
export type AuthenticateResultResponse = { Ok: Authentication } | { Err: AuthenticationError };
export interface Authentication {
doc: Doc;
Expand All @@ -56,6 +62,9 @@ export interface AuthenticationConfigOpenId {
observatory_id: [] | [Principal];
providers: Array<[OpenIdDelegationProvider, OpenIdAuthProviderConfig]>;
}
export type AuthenticationControllerError =
| { RegisterController: string }
| { VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError };
export type AuthenticationError =
| {
PrepareDelegation: PrepareDelegationError;
Expand All @@ -64,6 +73,7 @@ export type AuthenticationError =
export interface AuthenticationRules {
allowed_callers: Array<Principal>;
}
export type AutomationScope = { Write: null } | { Submit: null };
export type CollectionType = { Db: null } | { Storage: null };
export interface CommitBatch {
batch_id: bigint;
Expand Down Expand Up @@ -267,6 +277,13 @@ export interface OpenIdAuthProviderDelegationConfig {
targets: [] | [Array<Principal>];
max_time_to_live: [] | [bigint];
}
export interface OpenIdAuthenticateControllerArgs {
jwt: string;
metadata: Array<[string, string]>;
scope: AutomationScope;
max_time_to_live: [] | [bigint];
controller_id: Principal;
}
export type OpenIdDelegationProvider = { GitHub: null } | { Google: null };
export interface OpenIdGetDelegationArgs {
jwt: string;
Expand Down Expand Up @@ -438,8 +455,18 @@ export interface UploadChunk {
export interface UploadChunkResult {
chunk_id: bigint;
}
export type VerifyOpenidAutomationCredentialsError =
| {
GetCachedJwks: null;
}
| { JwtVerify: JwtVerifyError }
| { GetOrFetchJwks: GetOrRefreshJwksError };
export interface _SERVICE {
authenticate: ActorMethod<[AuthenticationArgs], AuthenticateResultResponse>;
authenticate_controller: ActorMethod<
[AuthenticateControllerArgs],
AuthenticateControllerResultResponse
>;
commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
commit_proposal: ActorMethod<[CommitProposal], null>;
commit_proposal_asset_upload: ActorMethod<[CommitBatch], undefined>;
Expand Down
32 changes: 32 additions & 0 deletions src/declarations/satellite/satellite.factory.certified.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,33 @@ export const idlFactory = ({ IDL }) => {
Ok: Authentication,
Err: AuthenticationError
});
const AutomationScope = IDL.Variant({
Write: IDL.Null,
Submit: IDL.Null
});
const OpenIdAuthenticateControllerArgs = IDL.Record({
jwt: IDL.Text,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
scope: AutomationScope,
max_time_to_live: IDL.Opt(IDL.Nat64),
controller_id: IDL.Principal
});
const AuthenticateControllerArgs = IDL.Variant({
OpenId: OpenIdAuthenticateControllerArgs
});
const VerifyOpenidAutomationCredentialsError = IDL.Variant({
GetCachedJwks: IDL.Null,
JwtVerify: JwtVerifyError,
GetOrFetchJwks: GetOrRefreshJwksError
});
const AuthenticationControllerError = IDL.Variant({
RegisterController: IDL.Text,
VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError
});
const AuthenticateControllerResultResponse = IDL.Variant({
Ok: IDL.Null,
Err: AuthenticationControllerError
});
const CommitBatch = IDL.Record({
batch_id: IDL.Nat,
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
Expand Down Expand Up @@ -446,6 +473,11 @@ export const idlFactory = ({ IDL }) => {

return IDL.Service({
authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
authenticate_controller: IDL.Func(
[AuthenticateControllerArgs],
[AuthenticateControllerResultResponse],
[]
),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
Expand Down
32 changes: 32 additions & 0 deletions src/declarations/satellite/satellite.factory.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,33 @@ export const idlFactory = ({ IDL }) => {
Ok: Authentication,
Err: AuthenticationError
});
const AutomationScope = IDL.Variant({
Write: IDL.Null,
Submit: IDL.Null
});
const OpenIdAuthenticateControllerArgs = IDL.Record({
jwt: IDL.Text,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
scope: AutomationScope,
max_time_to_live: IDL.Opt(IDL.Nat64),
controller_id: IDL.Principal
});
const AuthenticateControllerArgs = IDL.Variant({
OpenId: OpenIdAuthenticateControllerArgs
});
const VerifyOpenidAutomationCredentialsError = IDL.Variant({
GetCachedJwks: IDL.Null,
JwtVerify: JwtVerifyError,
GetOrFetchJwks: GetOrRefreshJwksError
});
const AuthenticationControllerError = IDL.Variant({
RegisterController: IDL.Text,
VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError
});
const AuthenticateControllerResultResponse = IDL.Variant({
Ok: IDL.Null,
Err: AuthenticationControllerError
});
const CommitBatch = IDL.Record({
batch_id: IDL.Nat,
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
Expand Down Expand Up @@ -446,6 +473,11 @@ export const idlFactory = ({ IDL }) => {

return IDL.Service({
authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
authenticate_controller: IDL.Func(
[AuthenticateControllerArgs],
[AuthenticateControllerResultResponse],
[]
),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
Expand Down
32 changes: 32 additions & 0 deletions src/declarations/satellite/satellite.factory.did.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,33 @@ export const idlFactory = ({ IDL }) => {
Ok: Authentication,
Err: AuthenticationError
});
const AutomationScope = IDL.Variant({
Write: IDL.Null,
Submit: IDL.Null
});
const OpenIdAuthenticateControllerArgs = IDL.Record({
jwt: IDL.Text,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
scope: AutomationScope,
max_time_to_live: IDL.Opt(IDL.Nat64),
controller_id: IDL.Principal
});
const AuthenticateControllerArgs = IDL.Variant({
OpenId: OpenIdAuthenticateControllerArgs
});
const VerifyOpenidAutomationCredentialsError = IDL.Variant({
GetCachedJwks: IDL.Null,
JwtVerify: JwtVerifyError,
GetOrFetchJwks: GetOrRefreshJwksError
});
const AuthenticationControllerError = IDL.Variant({
RegisterController: IDL.Text,
VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError
});
const AuthenticateControllerResultResponse = IDL.Variant({
Ok: IDL.Null,
Err: AuthenticationControllerError
});
const CommitBatch = IDL.Record({
batch_id: IDL.Nat,
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
Expand Down Expand Up @@ -446,6 +473,11 @@ export const idlFactory = ({ IDL }) => {

return IDL.Service({
authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
authenticate_controller: IDL.Func(
[AuthenticateControllerArgs],
[AuthenticateControllerResultResponse],
[]
),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
Expand Down
27 changes: 27 additions & 0 deletions src/declarations/sputnik/sputnik.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export interface AssetNoContent {
export interface AssetsUpgradeOptions {
clear_existing_assets: [] | [boolean];
}
export type AuthenticateControllerArgs = {
OpenId: OpenIdAuthenticateControllerArgs;
};
export type AuthenticateControllerResultResponse =
| { Ok: null }
| { Err: AuthenticationControllerError };
export type AuthenticateResultResponse = { Ok: Authentication } | { Err: AuthenticationError };
export interface Authentication {
doc: Doc;
Expand All @@ -56,6 +62,9 @@ export interface AuthenticationConfigOpenId {
observatory_id: [] | [Principal];
providers: Array<[OpenIdDelegationProvider, OpenIdAuthProviderConfig]>;
}
export type AuthenticationControllerError =
| { RegisterController: string }
| { VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError };
export type AuthenticationError =
| {
PrepareDelegation: PrepareDelegationError;
Expand All @@ -64,6 +73,7 @@ export type AuthenticationError =
export interface AuthenticationRules {
allowed_callers: Array<Principal>;
}
export type AutomationScope = { Write: null } | { Submit: null };
export type CollectionType = { Db: null } | { Storage: null };
export interface CommitBatch {
batch_id: bigint;
Expand Down Expand Up @@ -267,6 +277,13 @@ export interface OpenIdAuthProviderDelegationConfig {
targets: [] | [Array<Principal>];
max_time_to_live: [] | [bigint];
}
export interface OpenIdAuthenticateControllerArgs {
jwt: string;
metadata: Array<[string, string]>;
scope: AutomationScope;
max_time_to_live: [] | [bigint];
controller_id: Principal;
}
export type OpenIdDelegationProvider = { GitHub: null } | { Google: null };
export interface OpenIdGetDelegationArgs {
jwt: string;
Expand Down Expand Up @@ -438,8 +455,18 @@ export interface UploadChunk {
export interface UploadChunkResult {
chunk_id: bigint;
}
export type VerifyOpenidAutomationCredentialsError =
| {
GetCachedJwks: null;
}
| { JwtVerify: JwtVerifyError }
| { GetOrFetchJwks: GetOrRefreshJwksError };
export interface _SERVICE {
authenticate: ActorMethod<[AuthenticationArgs], AuthenticateResultResponse>;
authenticate_controller: ActorMethod<
[AuthenticateControllerArgs],
AuthenticateControllerResultResponse
>;
commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
commit_proposal: ActorMethod<[CommitProposal], null>;
commit_proposal_asset_upload: ActorMethod<[CommitBatch], undefined>;
Expand Down
32 changes: 32 additions & 0 deletions src/declarations/sputnik/sputnik.factory.certified.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,33 @@ export const idlFactory = ({ IDL }) => {
Ok: Authentication,
Err: AuthenticationError
});
const AutomationScope = IDL.Variant({
Write: IDL.Null,
Submit: IDL.Null
});
const OpenIdAuthenticateControllerArgs = IDL.Record({
jwt: IDL.Text,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
scope: AutomationScope,
max_time_to_live: IDL.Opt(IDL.Nat64),
controller_id: IDL.Principal
});
const AuthenticateControllerArgs = IDL.Variant({
OpenId: OpenIdAuthenticateControllerArgs
});
const VerifyOpenidAutomationCredentialsError = IDL.Variant({
GetCachedJwks: IDL.Null,
JwtVerify: JwtVerifyError,
GetOrFetchJwks: GetOrRefreshJwksError
});
const AuthenticationControllerError = IDL.Variant({
RegisterController: IDL.Text,
VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError
});
const AuthenticateControllerResultResponse = IDL.Variant({
Ok: IDL.Null,
Err: AuthenticationControllerError
});
const CommitBatch = IDL.Record({
batch_id: IDL.Nat,
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
Expand Down Expand Up @@ -446,6 +473,11 @@ export const idlFactory = ({ IDL }) => {

return IDL.Service({
authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
authenticate_controller: IDL.Func(
[AuthenticateControllerArgs],
[AuthenticateControllerResultResponse],
[]
),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
Expand Down
32 changes: 32 additions & 0 deletions src/declarations/sputnik/sputnik.factory.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,33 @@ export const idlFactory = ({ IDL }) => {
Ok: Authentication,
Err: AuthenticationError
});
const AutomationScope = IDL.Variant({
Write: IDL.Null,
Submit: IDL.Null
});
const OpenIdAuthenticateControllerArgs = IDL.Record({
jwt: IDL.Text,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
scope: AutomationScope,
max_time_to_live: IDL.Opt(IDL.Nat64),
controller_id: IDL.Principal
});
const AuthenticateControllerArgs = IDL.Variant({
OpenId: OpenIdAuthenticateControllerArgs
});
const VerifyOpenidAutomationCredentialsError = IDL.Variant({
GetCachedJwks: IDL.Null,
JwtVerify: JwtVerifyError,
GetOrFetchJwks: GetOrRefreshJwksError
});
const AuthenticationControllerError = IDL.Variant({
RegisterController: IDL.Text,
VerifyOpenIdCredentials: VerifyOpenidAutomationCredentialsError
});
const AuthenticateControllerResultResponse = IDL.Variant({
Ok: IDL.Null,
Err: AuthenticationControllerError
});
const CommitBatch = IDL.Record({
batch_id: IDL.Nat,
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
Expand Down Expand Up @@ -446,6 +473,11 @@ export const idlFactory = ({ IDL }) => {

return IDL.Service({
authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
authenticate_controller: IDL.Func(
[AuthenticateControllerArgs],
[AuthenticateControllerResultResponse],
[]
),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
Expand Down
7 changes: 7 additions & 0 deletions src/libs/auth/src/automation/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const MINUTE_NS: u64 = 60 * 1_000_000_000;

// 10 minutes in nanoseconds
pub const DEFAULT_EXPIRATION_PERIOD_NS: u64 = 10 * MINUTE_NS;

// The maximum duration for a automation controller
pub const MAX_EXPIRATION_PERIOD_NS: u64 = 60 * MINUTE_NS;
Loading
Loading