Documentation
¶
Overview ¶
Package validate - canary test-setup mode for end-to-end validation. Creates a short-lived synthetic share record for the configured canary library, invokes the test lambda to confirm canary data is retrievable end-to-end, and cleans up the synthetic share on exit (best-effort).
Package validate implements the infrastructure validation (preflight) checks for the sharing infrastructure, including provider-side and researcher-side checks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CanaryOpts ¶
type CanaryOpts struct {
LambdaClient internalaws.LambdaClient
Config *config.CanaryConfig
// TargetVpcArn is the EC2 VPC ARN the synthetic share is keyed on, resolved from
// the canary account's researcher config. It is supplied rather than derived so the
// canary shares one source of truth with the share command: this is the identity
// VPC Lattice reports and the authorization callout matches on, and there is no
// value it can safely be guessed from.
TargetVpcArn string
}
CanaryOpts holds the dependencies for the canary test-setup mode.
type Check ¶
type Check struct {
Name string
Passed bool
Error string
// Skipped marks a check that could not meaningfully run in this context, as
// distinct from one that ran and failed. A skipped check is not a failure and
// must not gate the exit status. Error carries the reason.
Skipped bool
}
Check represents the result of a single validation check.
func RunCanaryTest ¶
func RunCanaryTest(ctx context.Context, opts CanaryOpts) Check
RunCanaryTest creates a short-lived synthetic ShareRecord for the configured canary library, invokes the test lambda to confirm canary data is retrievable end-to-end, and always cleans up the synthetic share (including on error, best-effort). Returns a Check indicating success/failure of the simulated share path.
func ValidateProvider ¶
func ValidateProvider(ctx context.Context, opts ValidateProviderOpts) []Check
ValidateProvider runs all provider-side checks and returns per-check results. It continues running all checks even if some fail.
func ValidateResearcher ¶
func ValidateResearcher(ctx context.Context, opts ValidateResearcherOpts) []Check
ValidateResearcher runs researcher-side validation checks and returns per-check results. It continues running all checks even if some fail.
type DatasetCopyLedger ¶
DatasetCopyLedger is the read this pass makes of the copies: every transfer recorded, whatever state each is in.
The failed and the purged are wanted as much as the staged. A copy that never delivered anything still named a bucket and a key, and a statement left deployed on that pair is access nothing accounts for -- which is exactly what a comparison that only looked at the healthy records would fail to notice.
type DatasetCopyTargets ¶
type DatasetCopyTargets struct {
// StateMachineARN is the orchestration a copy is started on.
StateMachineARN string
// AccountID is the account it is installed in. Empty means the account holding the
// dataset buckets.
AccountID string
// WorkingBucket is where it reads its instructions from and writes its own outputs
// to, and WorkingBucketPrefix the prefix within that bucket it was deployed with.
WorkingBucket string
WorkingBucketPrefix string
}
DatasetCopyTargets locates the copy orchestration and the bucket it works in. Both belong to a separate installation, so both are reported against that installation rather than against this one.
type DatasetGrantLedger ¶
DatasetGrantLedger is the same read of the grants.
It is deliberately the whole ledger rather than one account's grants, even when the pass has been narrowed to one researcher. The two documents are shared by every grant against a dataset, so a comparison made from one account's grants would be made against a rendered pair missing every other account's statements, and would report each of them as drift.
type DatasetSourceStore ¶
type DatasetSourceStore struct {
// EndpointURL is the store's custom S3 endpoint.
EndpointURL string
// CredentialsSecret names the secret the copy orchestration resolves the store's
// credentials from. Only the identifier is held here; the credentials themselves
// never pass through this tool.
CredentialsSecret string
}
DatasetSourceStore describes the external object store datasets are copied out of.
type DatasetValidation ¶
type DatasetValidation struct {
// Checks is every check that ran, in the order it ran.
Checks []Check
// Repairs is one result per dataset whose documents were re-applied, and is empty
// unless reconciliation was asked for. They are kept apart from Checks because they
// are not observations: each one wrote to a bucket or a key policy, and an operator
// reading the output should not have to work out which of the two a line is.
Repairs []Check
}
DatasetValidation is what one pass found, and what it changed.
func ValidateDataset ¶
func ValidateDataset(ctx context.Context, opts ValidateDatasetOpts) DatasetValidation
ValidateDataset checks the prerequisites a copy depends on, compares the access the ledger describes for each dataset against the access its deployed documents grant, and reports the state of every key a dataset is encrypted under. Where reconciliation was asked for, it also replaces the documents of every dataset that differs.
Nothing stops at the first failure. The ledger is read first because the comparisons and the key states all come from it, and because a copy that has already run is the best evidence available that the copy orchestration is the one configured.
func (DatasetValidation) Results ¶
func (v DatasetValidation) Results() []Check
Results returns every result the pass produced, for a caller summarising or deciding an exit status. A repair that failed counts as a failure like any other.
type HTTPClient ¶
HTTPClient is an interface for making HTTP requests (allows testing).
type ValidateDatasetOpts ¶
type ValidateDatasetOpts struct {
// Copies and Grants are the two halves of the ledger the intended access is read
// from, and LedgerTable the table they share, carried separately so an unreadable
// ledger can be reported by name.
Copies DatasetCopyLedger
Grants DatasetGrantLedger
LedgerTable string
S3Client internalaws.S3Client
KMSClient internalaws.KMSClient
StepFunctionsClient internalaws.StepFunctionsClient
// PolicySettings must be the settings the deployed documents were applied with. The
// documents each dataset is compared against are rendered rather than described, so a
// comparison made with different settings would report a difference in everything.
PolicySettings dataset.PolicySettings
Copy DatasetCopyTargets
Source DatasetSourceStore
// ResearcherAccountID narrows the comparison to the datasets one account holds a
// grant against. Empty covers every dataset, including those granted to nobody.
ResearcherAccountID string
// Reconcile replaces the deployed documents of every dataset whose access differs
// from the ledger's. It writes, so it is never implied: nothing here mutates unless
// the operator asked for it by name.
Reconcile bool
// Now is the clock expiry and scheduled key deletion are judged against. Zero means
// the current time.
Now time.Time
}
ValidateDatasetOpts holds the dependencies for the direct-read checks.
type ValidateProviderOpts ¶
type ValidateProviderOpts struct {
STSClient internalaws.STSClient
AthenaClient internalaws.AthenaClient
S3Client internalaws.S3Client
DynamoDBClient internalaws.DynamoDBClient
APIGatewayClient internalaws.APIGatewayClient
HTTPClient HTTPClient
Config *config.Config
ShareRecordsTableName string
}
ValidateProviderOpts holds the dependencies for provider-side validation.
type ValidateResearcherOpts ¶
type ValidateResearcherOpts struct {
RAMClient internalaws.RAMClient
LambdaClient internalaws.LambdaClient
S3Client internalaws.S3Client
AccountID string
// ManifestBucket is the Data Control manifest bucket whose cross-account policy
// is checked for the researcher's read grant.
ManifestBucket string
// ManifestPrefix is the account's manifest key prefix (e.g. manifests/<accountId>/*).
ManifestPrefix string
}
ValidateResearcherOpts holds the dependencies for researcher-side validation.