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

Update minimum Bot Token length to 58 char #1204

Merged
merged 2 commits into from
Nov 30, 2018

Conversation

Chris-Johnston
Copy link
Collaborator

@Chris-Johnston Chris-Johnston commented Nov 30, 2018

As found by @moiph , some (older) bot tokens can be 58 characters. This incorrectly warns that the provided token is invalid. Conversation on DAPI

This PR updates this value to 58 char from 59, and updates the tests. In addition the length value was moved into a constant value, instead of being a magic number.

- Updates the minimum length of a bot token to be 58 characters. An older 58 char bot token was found by Moiph
- Makes this value an internal const instead of a magic number
@foxbot foxbot merged commit f6413ba into discord-net:dev Nov 30, 2018
brankin3 added a commit to brankin3/Discord.Net that referenced this pull request Dec 5, 2018
* fix: Fixed CommandExecuted firing twice for failed RuntimeResults (discord-net#1192)

* Fixed CommandExecuted firing twice for failed RuntimeResults

* Changed to just checking the result type

* Amendments

* Resolve Issue discord-net#1188 (Allow Users to specify position when creating a new channel) (discord-net#1196)

* Added ability to specify position when creating a channel

* Adjusted categories to include guildproperties and allow specifying position when creating channel categories

* fixed unimplemented methods (for CreateCategoryChannelAsync) and added appropriate documentation

* feature: add Format.Url, Format.EscapeUrl

Format.Url formats a URL into a markdown `[]()` masked URL.

Format.EscapeUrl formats a URL into a Discord `<>` escaped URL.

* feature: add extensions for bulk reactions

this is not api-level bulk reactions (!)

* fix: Update ChannelCreateAuditLogData.cs (discord-net#1195)

* feature: Implement Dispose for types which have disposable data (discord-net#1171)

* Initial set of dispose implementations

Not handled yet:
- Discord.Net.Websocket/Entities/SocketGuild
- Discord.Net.Tests

* Refactor DiscordSocketClient init into ctor

This way we remove an IDisposableAnalyzer warning for not disposing
the client when we set the client variable.

* Dispose of clients when disposing sharded client

* Finish implementing IDisposable where appropriate

I opted to use NoWarn in the Tests project as it wasn't really necessary
considering that our tests only run once

* Tweak samples after feedback

* fix: Added Msg.Content Null Check For Prefixes (discord-net#1200)

* Added Msg.Content Null Check

* Minor Change

* Grouped Params In If Statement

* Minor Change

* api: [brk] Move Invites-related Methods from IGuildChannel to INestedChannel (discord-net#1172)

* Move invites-related methods from IGuildChannel to INestedChannel

* Add missing implementation

...because I somehow forgot it the first time around

* fix: Solves AudioClient Lockup On Disconnect (discord-net#1203)

* Solves Audio Disconnect Lockup

* Execute Disconnected Event Before Logger & State

* fix: Solves UdpClient "ObjectDisposedException" (discord-net#1202)

* Solves "ObjectDisposedException"

* Corrected Spelling Error

* Fixed Spelling

* test: bump dependency versions

* fix: Update minimum Bot Token length to 58 char (discord-net#1204)

* Update the minimum bot token length to 58 char

- Updates the minimum length of a bot token to be 58 characters. An older 58 char bot token was found by Moiph
- Makes this value an internal const instead of a magic number

* update the TokenUtils tests for 58 char min

* fix: Fix after message remaining in MessageUpdated if message author wasn't in the payload (discord-net#1209)

* Fix leaving updated message as null when Discords doesn't include a message author in MESSAGE_UPDATE

* Name! That! Parameter!

* fix: Improve validation of Bot Tokens (discord-net#1206)

* improve bot token validation by trying to decode user id from token

Try to decode the user id from the supplied bot token as a way of validating the token. If this should fail, indicate that the token is invalid.

* Update the tokenutils tests to pass the new validation checks

* Add test case for CheckBotTokenValidity method

* lint: clean up whitespace

* Add check for null or whitespace string, lint whitespace

* fix userid conversion

* Add hint to user to check that token is not an oauth client secret

* Catch exception that can be thrown by GetString

* Refactor token conversion logic into it's own testable method

* feature: Allow setting custom error messages for preconditions (discord-net#1124)

* Rebase and use in all in-box preconditions

* Silly git....

* Add configurable 'NotAGuild' message

* Respond to feedback

* docs: add example of custom error message to sample

* feature: add DiscordSocketRestClient (discord-net#1198)

* feature: add DiscordSocketRestClient

this resolves discord-net#803.

Users can access a DiscordSocketRestClient from the new
`DiscordSocketClient.Rest` property.

DiscordSocketRestClient is a wrapper over DiscordRestClient with certain
state-modifying methods, such as Login/Logout disabled, to prevent users
from breaking the client state.

DiscordSocketRestClient uses the same API client as the
DiscordSocketClient, allowing for shared ratelimiting - meaning users
can now force HTTP requests without needing to wory about running into
429s.

* fix: disallow users from bypassing shadowed login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants