Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator should not report ucan/attest capability in unknown set #255

Open
Gozala opened this issue Mar 11, 2023 · 0 comments
Open

Validator should not report ucan/attest capability in unknown set #255

Gozala opened this issue Mar 11, 2023 · 0 comments
Assignees

Comments

@Gozala
Copy link
Collaborator

Gozala commented Mar 11, 2023

General validation pass only considers passed capability schema, and if capability been parsed does not match it is reported to the validator which includes it in the general error

if (descriptor.can !== capability.can) {
return new UnknownCapability(capability)
}

ucan/attest is only accessed in a specific code path

const verifySession = async (delegation, proofs, config) => {
// Create a schema that will match an authorization for this exact delegation
const attestation = capability({
with: Schema.literal(config.authority.did()),
can: 'ucan/attest',
nb: Schema.struct({
proof: Schema.link(delegation.cid),
}),
})
return await claim(
attestation,
// We omit the delegation otherwise we may end up in an infinite loop
proofs.filter(proof => proof != delegation),
config
)
}

We should update couple of code paths to exclude ucan/attest from the list of unknown capability reports

const select = (matcher, capabilities) => {
const unknown = []
const matches = []
const errors = []
for (const capability of capabilities) {
const result = matcher.match(capability)
if (result.error) {
switch (result.name) {
case 'UnknownCapability':
unknown.push(result.capability)
break

@Gozala Gozala self-assigned this Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant