Skip to content

Commit eac1651

Browse files
committed
Add variable inheritance and extended variable types
- vars.schema.json: Add refs array for inheritance chains, source/lines for origin tracking, layer/pattern/context types - CLI: Restore chain traversal logic, populate refs from call graph - Generate layer variables from file entries - Update CHANGELOG with new features
1 parent 5b270d2 commit eac1651

9 files changed

Lines changed: 689 additions & 83 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- **Variable Inheritance**: `refs` field for variable-to-variable references with chain traversal
12+
- **Extended Variable Types**: Added `layer`, `pattern`, `context` types to vars schema
13+
- **Variable Metadata**: Added `source` and `lines` fields to track variable origin in vars schema
1114
- **Formal Grammar**: W3C EBNF grammar for annotations with railroad diagrams (`spec/grammar/`)
1215
- **Specification Examples**: Minimal, complete, and edge-case examples (`spec/examples/`)
1316
- **CLI Implementation Guide**: Comprehensive Rust CLI development guide (`docs/rust-cli/`)

SECURITY.md

Lines changed: 142 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ We take security seriously. If you discover a security vulnerability in ACP, ple
1616

1717
Instead, please report them via one of these methods:
1818

19-
1. **Email**: security@acp-protocol.dev
20-
2. **GitHub Security Advisories**: [Report a vulnerability](https://github.com/acp-protocol/acp-spec/security/advisories/new)
19+
1. **GitHub Security Advisories** (preferred): [Report a vulnerability](https://github.com/acp-protocol/acp-spec/security/advisories/new)
20+
2. **Email**: security@acp-protocol.dev
21+
22+
### Encrypted Communication
23+
24+
For highly sensitive reports, you may encrypt your message using our PGP key:
25+
26+
- **Key ID**: `[TO BE ADDED]`
27+
- **Fingerprint**: `[TO BE ADDED]`
28+
- **Public Key**: Available at [https://acp-protocol.dev/.well-known/pgp-key.txt](https://acp-protocol.dev/.well-known/pgp-key.txt)
29+
30+
> **Note**: PGP encryption is optional. Unencrypted reports via GitHub Security Advisories are also secure.
2131
2232
### What to Include
2333

@@ -29,49 +39,124 @@ Please include the following information in your report:
2939
- Step-by-step instructions to reproduce the issue
3040
- Proof-of-concept or exploit code (if possible)
3141
- Impact of the issue, including how an attacker might exploit it
42+
- Suggested severity (see [Severity Classification](#severity-classification))
43+
44+
### Severity Classification
45+
46+
Please help us assess the severity using this guide:
47+
48+
| Severity | Description | Example |
49+
|----------|-------------|---------|
50+
| **Critical** | Direct exploitation possible; immediate risk | Cache injection leading to code execution in implementations |
51+
| **High** | Significant security impact; exploitable | Path traversal exposing sensitive files outside project |
52+
| **Medium** | Limited security impact; conditional exploit | Information disclosure requiring specific configuration |
53+
| **Low** | Minimal security impact; theoretical | Attack requiring unlikely conditions or extensive access |
54+
| **Informational** | Security improvement; no direct vulnerability | Hardening suggestion or defense-in-depth enhancement |
55+
56+
## Response Timeline
57+
58+
| Stage | Timeframe |
59+
|-------|-----------|
60+
| **Acknowledgment** | Within 48 hours |
61+
| **Initial Assessment** | Within 7 days |
62+
| **Resolution Target** | Within 30 days (depending on complexity) |
3263

33-
### Response Timeline
64+
### No Response?
3465

35-
- **Acknowledgment**: Within 48 hours
36-
- **Initial Assessment**: Within 7 days
37-
- **Resolution Target**: Within 30 days (depending on complexity)
66+
If you haven't received acknowledgment within 72 hours:
3867

39-
### What to Expect
68+
1. Check your spam/junk folder for our reply
69+
2. Try the alternative reporting method (email if you used GitHub, or vice versa)
70+
3. Reach out via hello@acp-protocol.dev with subject line "Security Report Follow-up"
71+
72+
## What to Expect
4073

4174
1. **Acknowledgment**: We'll confirm receipt of your report
4275
2. **Assessment**: We'll investigate and determine the severity
4376
3. **Communication**: We'll keep you informed of our progress
4477
4. **Resolution**: We'll develop and test a fix
4578
5. **Disclosure**: We'll coordinate public disclosure with you
4679

47-
### Security Considerations for ACP
80+
### Coordinated Disclosure
81+
82+
We follow a coordinated disclosure process:
83+
84+
- We request a **90-day disclosure window** from initial report to public disclosure
85+
- We will credit you in the security advisory (unless you prefer anonymity)
86+
- We will notify you before any public disclosure
87+
- If we are unable to resolve the issue within 90 days, we will negotiate an extended timeline
88+
89+
## Safe Harbor
90+
91+
We consider security research conducted in accordance with this policy to be:
92+
93+
- **Authorized** concerning any applicable anti-hacking laws (including CFAA)
94+
- **Authorized** concerning any relevant anti-circumvention laws (including DMCA)
95+
- **Exempt** from restrictions in our Terms of Service that would interfere with conducting security research
96+
- **Lawful** and we will not initiate or support legal action against you for accidental, good-faith violations
97+
98+
We will not pursue civil or criminal legal action, or send notices to law enforcement, against researchers who:
99+
100+
- Act in good faith to avoid privacy violations, data destruction, or service interruption
101+
- Only access data necessary to demonstrate the vulnerability
102+
- Do not exploit vulnerabilities beyond proof-of-concept
103+
- Report vulnerabilities promptly and provide reasonable time for remediation
104+
- Do not disclose the issue publicly before coordinated disclosure
48105

49-
#### Specification Security
106+
**If legal action is initiated by a third party against you** for activities conducted in accordance with this policy, we will take steps to make it known that your actions were authorized by us.
107+
108+
## Bug Bounty
109+
110+
ACP does not currently operate a paid bug bounty program.
111+
112+
We offer:
113+
- Public recognition and acknowledgment for valid reports (with your permission)
114+
- Inclusion in our Security Hall of Fame (if established)
115+
- Our sincere gratitude for helping keep the ACP ecosystem secure
116+
117+
We may consider monetary rewards for exceptional findings on a case-by-case basis, but this is not guaranteed.
118+
119+
## Security Considerations for ACP
120+
121+
### Specification Security
50122

51123
The ACP specification itself doesn't execute code, but implementations should consider:
52124

53-
- **Cache File Integrity**: Cache files could be tampered with
54-
- **Path Traversal**: File paths in cache should be validated
55-
- **Variable Injection**: Variable expansion should be sanitized
56-
- **Constraint Bypass**: Lock constraints are advisory, not enforced
125+
- **Cache File Integrity**: Cache files could be tampered with to mislead AI tools
126+
- **Path Traversal**: File paths in cache should be validated to prevent directory escape
127+
- **Variable Injection**: Variable expansion should be sanitized to prevent injection
128+
- **Constraint Bypass**: Lock constraints are advisory, not enforced—implementations must not rely on them for security
57129

58-
#### Implementation Recommendations
130+
### Implementation Recommendations
59131

60132
If you're implementing ACP:
61133

62-
1. **Validate all paths** - Don't trust paths in cache files blindly
63-
2. **Sanitize variable expansion** - Prevent injection attacks
64-
3. **Limit file access** - Respect project boundaries
65-
4. **Log constraint violations** - Track when constraints are overridden
134+
1. **Validate all paths** — Don't trust paths in cache files blindly; normalize and verify they're within project boundaries
135+
2. **Sanitize variable expansion** — Prevent injection attacks through variable values
136+
3. **Limit file access** — Respect project boundaries; never follow symlinks outside the project root
137+
4. **Verify cache integrity** — Consider signing or checksumming cache files in high-security environments
138+
5. **Log constraint violations** — Track when constraints are overridden for audit purposes
66139

67-
#### AI Tool Integration Security
140+
### AI Tool Integration Security
68141

69142
When integrating ACP with AI tools:
70143

71-
1. **Don't expose sensitive data** - Be careful what gets indexed
72-
2. **Respect lock constraints** - Even if advisory, honor them
73-
3. **Audit AI actions** - Log what AI tools modify
74-
4. **Review before commit** - Human review of AI changes
144+
1. **Don't expose sensitive data** — Be careful what gets indexed; exclude secrets, credentials, and PII
145+
2. **Respect lock constraints** — Even if advisory, honor them as indicators of sensitive code
146+
3. **Audit AI actions** — Log what AI tools query and modify
147+
4. **Review before commit** — Human review of AI-generated changes is essential
148+
5. **Limit AI scope** — Consider restricting AI access to specific domains or directories
149+
150+
### Out of Scope
151+
152+
The following are generally NOT considered security vulnerabilities:
153+
154+
- Vulnerabilities in third-party implementations (report to those maintainers)
155+
- Social engineering attacks against ACP maintainers
156+
- Physical security attacks
157+
- Denial of service through malformed input (unless causing resource exhaustion)
158+
- Issues requiring physical access to a user's machine
159+
- Issues in dependencies (report upstream, but let us know if it affects ACP)
75160

76161
## Scope
77162

@@ -80,16 +165,44 @@ This security policy covers:
80165
- The ACP specification (`spec/`)
81166
- JSON schemas (`schemas/`)
82167
- Reference CLI implementation (`cli/`)
83-
- Documentation (`docs/`)
168+
- Official documentation (`docs/`)
169+
- Official tooling (MCP server, VS Code extension when released)
84170

85-
Third-party implementations have their own security policies.
171+
**Not covered:**
172+
- Third-party ACP implementations (they have their own security policies)
173+
- Community-contributed extensions
174+
- Forks of this repository
86175

87176
## Recognition
88177

89-
We appreciate responsible disclosure and will acknowledge security researchers who report valid vulnerabilities (with their permission).
178+
We appreciate responsible disclosure and will acknowledge security researchers who report valid vulnerabilities.
179+
180+
### Security Hall of Fame
181+
182+
We maintain a list of researchers who have responsibly disclosed security issues:
183+
184+
<!--
185+
Add researchers here as:
186+
- **[Name/Handle](link)** - Brief description of finding (Month Year)
187+
-->
188+
189+
*No entries yet — be the first!*
190+
191+
If you'd like to be acknowledged:
192+
- Let us know your preferred name/handle and optional link
193+
- Indicate if you'd like to be mentioned in the security advisory
194+
- Specify any social media handles you'd like included
90195

91196
## Contact
92197

93-
- **Security Email**: security@acp-protocol.dev
94-
- **General Contact**: hello@acp-protocol.dev
95-
- **GitHub**: https://github.com/acp-protocol/acp-spec
198+
| Purpose | Contact |
199+
|---------|---------|
200+
| **Security Reports** | security@acp-protocol.dev |
201+
| **General Questions** | hello@acp-protocol.dev |
202+
| **GitHub** | https://github.com/acp-protocol/acp-spec |
203+
| **Security Advisories** | https://github.com/acp-protocol/acp-spec/security/advisories |
204+
205+
---
206+
207+
*This security policy is effective as of December 2024 and may be updated periodically.*
208+
*Last reviewed: December 2024*

cli/src/index/indexer.rs

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,35 @@ impl Indexer {
161161
pub fn generate_vars(&self, cache: &Cache) -> VarsFile {
162162
let mut vars_file = VarsFile::new();
163163

164-
// Generate symbol vars
164+
// Build a map of symbol names to var names for ref resolution
165+
let mut symbol_to_var: std::collections::HashMap<String, String> = std::collections::HashMap::new();
165166
for (name, symbol) in &cache.symbols {
166167
if symbol.exported {
167168
let var_name = format!("SYM_{}", name.to_uppercase().replace('.', "_"));
168-
vars_file.add_variable(
169-
var_name,
170-
VarEntry::symbol(
171-
symbol.qualified_name.clone(),
172-
symbol.summary.clone(),
173-
),
174-
);
169+
symbol_to_var.insert(name.clone(), var_name);
170+
}
171+
}
172+
173+
// Generate symbol vars with refs from call graph
174+
for (name, symbol) in &cache.symbols {
175+
if symbol.exported {
176+
let var_name = format!("SYM_{}", name.to_uppercase().replace('.', "_"));
177+
178+
// Build refs from symbols this one calls
179+
let refs: Vec<String> = symbol.calls.iter()
180+
.filter_map(|callee| symbol_to_var.get(callee).cloned())
181+
.collect();
182+
183+
let entry = VarEntry {
184+
var_type: crate::vars::VarType::Symbol,
185+
value: symbol.qualified_name.clone(),
186+
description: symbol.summary.clone(),
187+
refs,
188+
source: Some(symbol.file.clone()),
189+
lines: Some(symbol.lines),
190+
};
191+
192+
vars_file.add_variable(var_name, entry);
175193
}
176194
}
177195

@@ -205,6 +223,27 @@ impl Indexer {
205223
}
206224
}
207225

226+
// Generate layer vars from unique layers
227+
let mut layers: std::collections::HashSet<String> = std::collections::HashSet::new();
228+
for file in cache.files.values() {
229+
if let Some(layer) = &file.layer {
230+
layers.insert(layer.clone());
231+
}
232+
}
233+
for layer in layers {
234+
let var_name = format!("LAYER_{}", layer.to_uppercase().replace('-', "_"));
235+
let file_count = cache.files.values()
236+
.filter(|f| f.layer.as_ref() == Some(&layer))
237+
.count();
238+
vars_file.add_variable(
239+
var_name,
240+
VarEntry::layer(
241+
layer.clone(),
242+
Some(format!("Layer: {} ({} files)", layer, file_count)),
243+
),
244+
);
245+
}
246+
208247
vars_file
209248
}
210249
}

0 commit comments

Comments
 (0)