feat(harness): ingest OAuth storage and recover workflow write handling
Recover the OAuth storage slice from f6079e9d and the missing workflow persistence error handling from f07c314e, adapted to the current step contract. Require encryption for OAuth token storage and verify RPC round trips and task-grant denial.
This commit is contained in:
1 parent
b3e9159dce
commit
45cf3bc2c8
26 files changed
+2047
-935
No files matched your search
@@ -0,0 +1,54 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: harness_secrets.sql
|
||||
|
||||
package postgresdb
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const getHarnessSecret = `-- name: GetHarnessSecret :one
|
||||
|
||||
SELECT org, service, secret_enc, updated_at
|
||||
FROM harness_secrets WHERE org = $1 AND service = $2
|
||||
`
|
||||
|
||||
type GetHarnessSecretParams struct {
|
||||
Org string
|
||||
Service string
|
||||
}
|
||||
|
||||
// Harness OAuth secret queries (docs/prds/external-agent-harness.md,
|
||||
// Credentials). One row per org/service; secret_enc holds the whole token
|
||||
// set (access token, refresh token, token type, expiry) as one encrypted
|
||||
// envelope over a JSON payload, never separate plaintext columns.
|
||||
func (q *Queries) GetHarnessSecret(ctx context.Context, arg GetHarnessSecretParams) (HarnessSecret, error) {
|
||||
row := q.db.QueryRow(ctx, getHarnessSecret, arg.Org, arg.Service)
|
||||
var i HarnessSecret
|
||||
err := row.Scan(
|
||||
&i.Org,
|
||||
&i.Service,
|
||||
&i.SecretEnc,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const putHarnessSecret = `-- name: PutHarnessSecret :exec
|
||||
INSERT INTO harness_secrets (org, service, secret_enc, updated_at)
|
||||
VALUES ($1, $2, $3, now())
|
||||
ON CONFLICT (org, service) DO UPDATE SET secret_enc = EXCLUDED.secret_enc, updated_at = now()
|
||||
`
|
||||
|
||||
type PutHarnessSecretParams struct {
|
||||
Org string
|
||||
Service string
|
||||
SecretEnc string
|
||||
}
|
||||
|
||||
func (q *Queries) PutHarnessSecret(ctx context.Context, arg PutHarnessSecretParams) error {
|
||||
_, err := q.db.Exec(ctx, putHarnessSecret, arg.Org, arg.Service, arg.SecretEnc)
|
||||
return err
|
||||
}
|
||||
@@ -143,6 +143,13 @@ type EventType struct {
|
||||
WorkspaceID string
|
||||
}
|
||||
|
||||
type HarnessSecret struct {
|
||||
Org string
|
||||
Service string
|
||||
SecretEnc string
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type Identity struct {
|
||||
ID string
|
||||
Kind string
|
||||
|
||||
Reference in new issue
Block a user