샘플
github.com/googleapis/enterprise-certificate-proxy v0.3.11
검증된 샘플 — golang github.com/googleapis/enterprise-certificate-proxy v0.3.11. go 1.26 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:e7b122d7a9e61e2065f938968d2f82caa3b6b33b6b29c5417b19df01543ebc52
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-10-11 |
케이스
HOW- 목표
- verify pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11
- 생성일
- 2026-10-11T10:02:46Z
컨트랙트
- util.LoadSignerBinaryPath extracts the signer binary path from valid JSON config
- util.LoadSignerBinaryPath expands ~ and $HOME placeholders using the home directory
- util.LoadSignerBinaryPath returns ErrConfigUnavailable when the configuration file does not exist
- util.LoadSignerBinaryPath returns ErrConfigUnavailable when the signer path is empty
- util.GetConfigFilePathFromEnv retrieves the configuration path from GOOGLE_API_CERTIFICATE_CONFIG
- util.GetDefaultConfigFilePath returns the platform-specific default enterprise certificate config path
- util.EnterpriseCertificateConfig parses JSON configuration with nested Libs specification
- client.Cred returns ErrCredUnavailable when the configuration file does not exist
- client.Cred returns ErrCredUnavailable when the configuration specifies an empty signer binary path
- client.Cred returns an error attempting to execute a non-existent signer binary
- client argument types SignArgs, EncryptArgs, and DecryptArgs hold valid parameter values
파일
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:e3ced2c2fc3b6280a4c3a1c487179d02c369f224bdafec7a9f0391cc7f758550","contract":["util.LoadSignerBinaryPath extracts the signer binary path from valid JSON config","util.LoadSignerBinaryPath expands ~ and $HOME placeholders using the home directory","util.LoadSignerBinaryPath returns ErrConfigUnavailable when the configuration file does not exist","util.LoadSignerBinaryPath returns ErrConfigUnavailable when the signer path is empty","util.GetConfigFilePathFromEnv retrieves the configuration path from GOOGLE_API_CERTIFICATE_CONFIG","util.GetDefaultConfigFilePath returns the platform-specific default enterprise certificate config path","util.EnterpriseCertificateConfig parses JSON configuration with nested Libs specification","client.Cred returns ErrCredUnavailable when the configuration file does not exist","client.Cred returns ErrCredUnavailable when the configuration specifies an empty signer binary path","client.Cred returns an error attempting to execute a non-existent signer binary","client argument types SignArgs, EncryptArgs, and DecryptArgs hold valid parameter values"],"goal":"verify pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11","kind":"HOW","packages":["pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11"],"schemaVersion":1,"subject":"pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11","verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/googleapis/enterprise-certificate-proxy v0.3.11
github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao=
github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8=
package main
import (
"fmt"
"os"
"github.com/googleapis/enterprise-certificate-proxy/client"
"github.com/googleapis/enterprise-certificate-proxy/client/util"
)
func main() {
defaultPath := util.GetDefaultConfigFilePath()
fmt.Printf("Default enterprise cert config path: %s\n", defaultPath)
envPath := util.GetConfigFilePathFromEnv()
if envPath != "" {
fmt.Printf("Config path from env: %s\n", envPath)
}
_, err := client.Cred(defaultPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Expected error with default path: %v\n", err)
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/googleapis/enterprise-certificate-proxy@v0.3.11"
]
}
package main
import (
"bytes"
"crypto"
"crypto/rsa"
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/googleapis/enterprise-certificate-proxy/client"
"github.com/googleapis/enterprise-certificate-proxy/client/util"
)
func main() {
if err := runContract(); err != nil {
fmt.Fprintf(os.Stderr, "Contract verification failed: %v\n", err)
os.Exit(1)
}
fmt.Println("All enterprise-certificate-proxy contract assertions passed successfully.")
}
func runContract() error {
tempDir, err := os.MkdirTemp("", "ecp-contract-*")
if err != nil {
return fmt.Errorf("failed to create temp directory: %w", err)
}
defer os.RemoveAll(tempDir)
// 1. util.LoadSignerBinaryPath extracts the signer binary path from valid JSON config
mockSignerRelPath := filepath.Join("relative", "bin", "signer")
validConfigPath := filepath.Join(tempDir, "valid_config.json")
validJSON := []byte(fmt.Sprintf(`{"libs":{"ecp":%q}}`, mockSignerRelPath))
if err := os.WriteFile(validConfigPath, validJSON, 0600); err != nil {
return fmt.Errorf("failed to write valid config: %w", err)
}
binaryPath, err := util.LoadSignerBinaryPath(validConfigPath)
if err != nil {
return fmt.Errorf("assertion 1 failed: expected nil error, got %v", err)
}
if binaryPath != mockSignerRelPath {
return fmt.Errorf("assertion 1 failed: expected %q, got %q", mockSignerRelPath, binaryPath)
}
// 2. util.LoadSignerBinaryPath expands ~ and $HOME placeholders using the home directory
homeDir := os.Getenv("HOME")
if homeDir == "" {
homeDir = tempDir
os.Setenv("HOME", homeDir)
}
tildeConfigPath := filepath.Join(tempDir, "tilde_config.json")
tildeJSON := []byte(`{"libs":{"ecp":"~/bin/signer"}}`)
if err := os.WriteFile(tildeConfigPath, tildeJSON, 0600); err != nil {
return fmt.Errorf("failed to write tilde config: %w", err)
}
tildePath, err := util.LoadSignerBinaryPath(tildeConfigPath)
if err != nil {
return fmt.Errorf("assertion 2 failed (tilde): expected nil error, got %v", err)
}
expectedTilde := filepath.Join(homeDir, "bin", "signer")
if tildePath != expectedTilde {
return fmt.Errorf("assertion 2 failed (tilde): expected %q, got %q", expectedTilde, tildePath)
}
envVarConfigPath := filepath.Join(tempDir, "envvar_config.json")
envVarJSON := []byte(`{"libs":{"ecp":"$HOME/bin/signer"}}`)
if err := os.WriteFile(envVarConfigPath, envVarJSON, 0600); err != nil {
return fmt.Errorf("failed to write envvar config: %w", err)
}
envVarResolved, err := util.LoadSignerBinaryPath(envVarConfigPath)
if err != nil {
return fmt.Errorf("assertion 2 failed ($HOME): expected nil error, got %v", err)
}
if envVarResolved != expectedTilde {
return fmt.Errorf("assertion 2 failed ($HOME): expected %q, got %q", expectedTilde, envVarResolved)
}
// 3. util.LoadSignerBinaryPath returns ErrConfigUnavailable when the configuration file does not exist
nonExistentPath := filepath.Join(tempDir, "does_not_exist.json")
_, err = util.LoadSignerBinaryPath(nonExistentPath)
if !errors.Is(err, util.ErrConfigUnavailable) {
return fmt.Errorf("assertion 3 failed: expected ErrConfigUnavailable, got %v", err)
}
// 4. util.LoadSignerBinaryPath returns ErrConfigUnavailable when the signer path is empty
emptyECPConfigPath := filepath.Join(tempDir, "empty_ecp.json")
emptyECPJSON := []byte(`{"libs":{"ecp":""}}`)
if err := os.WriteFile(emptyECPConfigPath, emptyECPJSON, 0600); err != nil {
return fmt.Errorf("failed to write empty ecp config: %w", err)
}
_, err = util.LoadSignerBinaryPath(emptyECPConfigPath)
if !errors.Is(err, util.ErrConfigUnavailable) {
return fmt.Errorf("assertion 4 failed: expected ErrConfigUnavailable, got %v", err)
}
// 5. util.GetConfigFilePathFromEnv retrieves the configuration path from GOOGLE_API_CERTIFICATE_CONFIG
origEnv := os.Getenv("GOOGLE_API_CERTIFICATE_CONFIG")
customEnvPath := filepath.Join(tempDir, "custom_cert_config.json")
os.Setenv("GOOGLE_API_CERTIFICATE_CONFIG", customEnvPath)
if got := util.GetConfigFilePathFromEnv(); got != customEnvPath {
os.Setenv("GOOGLE_API_CERTIFICATE_CONFIG", origEnv)
return fmt.Errorf("assertion 5 failed: expected %q, got %q", customEnvPath, got)
}
os.Setenv("GOOGLE_API_CERTIFICATE_CONFIG", origEnv)
// 6. util.GetDefaultConfigFilePath returns the platform-specific default enterprise certificate config path
defaultPath := util.GetDefaultConfigFilePath()
if !strings.HasSuffix(defaultPath, filepath.Join(".config", "gcloud", "certificate_config.json")) {
return fmt.Errorf("assertion 6 failed: unexpected default config path %q", defaultPath)
}
// 7. util.EnterpriseCertificateConfig parses JSON configuration with nested Libs specification
var parsedConfig util.EnterpriseCertificateConfig
rawJSON := `{"libs":{"ecp":"mock/signer/path"}}`
if err := json.Unmarshal([]byte(rawJSON), &parsedConfig); err != nil {
return fmt.Errorf("assertion 7 failed: json unmarshal error: %w", err)
}
if parsedConfig.Libs.ECP != "mock/signer/path" {
return fmt.Errorf("assertion 7 failed: expected 'mock/signer/path', got %q", parsedConfig.Libs.ECP)
}
// 8. client.Cred returns ErrCredUnavailable when the configuration file does not exist
_, err = client.Cred(nonExistentPath)
if !errors.Is(err, client.ErrCredUnavailable) {
return fmt.Errorf("assertion 8 failed: expected ErrCredUnavailable, got %v", err)
}
// 9. client.Cred returns ErrCredUnavailable when the configuration specifies an empty signer binary path
_, err = client.Cred(emptyECPConfigPath)
if !errors.Is(err, client.ErrCredUnavailable) {
return fmt.Errorf("assertion 9 failed: expected ErrCredUnavailable, got %v", err)
}
// 10. client.Cred returns an error attempting to execute a non-existent signer binary
badBinaryConfigPath := filepath.Join(tempDir, "bad_binary_config.json")
badBinaryJSON := []byte(fmt.Sprintf(`{"libs":{"ecp":%q}}`, filepath.Join(tempDir, "nonexistent_binary_exec")))
if err := os.WriteFile(badBinaryConfigPath, badBinaryJSON, 0600); err != nil {
return fmt.Errorf("failed to write bad binary config: %w", err)
}
_, err = client.Cred(badBinaryConfigPath)
if err == nil {
return fmt.Errorf("assertion 10 failed: expected execution error, got nil")
}
if errors.Is(err, client.ErrCredUnavailable) {
return fmt.Errorf("assertion 10 failed: expected process execution failure, not ErrCredUnavailable: %v", err)
}
// 11. client argument types SignArgs, EncryptArgs, and DecryptArgs hold valid parameter values
testDigest := []byte("sha256-sample-digest-bytes-32byt")
signArgs := client.SignArgs{
Digest: testDigest,
Opts: crypto.SHA256,
}
if !bytes.Equal(signArgs.Digest, testDigest) || signArgs.Opts.HashFunc() != crypto.SHA256 {
return fmt.Errorf("assertion 11 failed: invalid SignArgs values")
}
testPlaintext := []byte("test secret plaintext")
encryptArgs := client.EncryptArgs{
Plaintext: testPlaintext,
Opts: crypto.SHA256,
}
if !bytes.Equal(encryptArgs.Plaintext, testPlaintext) {
return fmt.Errorf("assertion 11 failed: invalid EncryptArgs values")
}
testCiphertext := []byte("test encrypted ciphertext")
oaepOpts := &rsa.OAEPOptions{Hash: crypto.SHA256}
decryptArgs := client.DecryptArgs{
Ciphertext: testCiphertext,
Opts: oaepOpts,
}
if !bytes.Equal(decryptArgs.Ciphertext, testCiphertext) || decryptArgs.Opts != oaepOpts {
return fmt.Errorf("assertion 11 failed: invalid DecryptArgs values")
}
return nil
}
오리진 시더
익명