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

Add provisioning API #27

Merged
merged 6 commits into from
Feb 26, 2020
Merged

Add provisioning API #27

merged 6 commits into from
Feb 26, 2020

Conversation

tulir
Copy link
Contributor

@tulir tulir commented Feb 22, 2020

No description provided.

src/provisioningapi.ts Outdated Show resolved Hide resolved
@Sorunome
Copy link
Owner

How about, instead of just a shared secret, a JWT with that secret as key and as a claim it has the user id? That way you could give the user their key so that they could access the provisioning API without compromising security?

@Sorunome
Copy link
Owner

For JWTs soru would prolly use https://www.npmjs.com/package/jsonwebtoken

@tulir
Copy link
Contributor Author

tulir commented Feb 22, 2020

I'm not sure how useful that would be, since the integration manager is probably on the user's or bridge's server. mautrix-manager will at least just proxy everything.

Anyway, changed the request handling a bit so that the user ID is in a custom field and thus JWT support can be added easily

@Sorunome
Copy link
Owner

soru isn't sure how useful it is for now, either, but perhaps some other matrix feature or thelike is added down the road that the client would want to directly communicate with the bridge.

src/provisioningapi.ts Outdated Show resolved Hide resolved
const puppets = await this.bridge.provisioner.getForMxid(req.userId) as IPuppetWithDescription[];
if (this.bridge.hooks.getDesc) {
for (const data of puppets) {
data.description = await this.bridge.hooks.getDesc(data.puppetId, data.data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps add delete data.data as that object might contain rather sensitive information that someone using the API shouldn't be able to fetch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it always the integration manager or user themselves fetching the data?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soru is thinking of expanding this to e.g. have matrix-appservice-discord use it so that you can seemlessly start dms in mx-puppet-discord by inviting matrix-appservice-discord ghosts and it'd use that api, and you probably wouldn't want to allow access to that data, in that case.

Perhaps, to get back to the JWT idea, something with different secrets for different scopes? 🤔

@tulir tulir marked this pull request as ready for review February 23, 2020 21:58
@Sorunome Sorunome merged commit a8c3c52 into Sorunome:master Feb 26, 2020
@tulir tulir deleted the provisioning-api branch February 26, 2020 09:39
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

Successfully merging this pull request may close these issues.

None yet

2 participants