Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

 

LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 04-24-2008, 06:09 PM
Peter H. Coffin
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Tue, 22 Apr 2008 12:29:28 -0700 (PDT), lawpoop@gmail.com wrote:
> On Apr 22, 5:46 am, "petethebl...@googlemail.com"
><petethebl...@googlemail.com> wrote:
>> On 21 Apr, 22:40, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
>>
>> > Confidential!!! It will be a list of fields with data types, sizes and field
>> > names. That is what all tables look like. How the !"!"££ can it be
>> > confidential!

>>
>> That's what I was trying to say, but more politely.

>
> Well, if we have a database that's available to the public through a
> website, and some entreprising hacker wants to do an SQL injection,
> they would get quite a leg up if they could look up the exact names of
> our fields and tables.


*cough* If said hacker can amanage and injection, she can ask the
database about the tables and column names. Your help isn't needed.

> Of course we are taking every precaution to prevent SQL injections and
> other hacking attemps, and not broadcasting table definitions on the
> internet is part of that


Maybe, but it appears that your every precaution is a bit fuzzier than
most people's every precaution.

> As far as confidential, saying that no table definition can be
> confidential because it's made up of the same parts ( tables and
> fields ) as any other database is like saying all programs are the
> same because they're all made up of vairable and operators. It's the
> arrangement of the parts that adds value. Surely, you would agree that
> certain database structures are better than others for particular
> problems. Or all they all the same? If they aren't the same, then a
> business person who invested money to get a better data model might
> want to protect their investment.


If it's that clever, you'll have it patented. If it's not patentable,
then it's too obvious to be a strategic advantage.

> Why couldn't Microsoft release the code for Windows? After all, it's
> made up of the same parts as any other program. And I'm not talking
> security wise, but competition-wise -- for example, not giving OS
> providers a leg up in creating platforms to run software written to
> run with the Windows API.


Easy answer. They'd end up with thousands of programmers falling over
laughing.

> Suppose we have a business model, expressed as a database, that is
> superior to our competitions', and that allows us to ship products
> faster for less money. Why would we want to then give our model to our
> competition? We spent a lot of time and money building it; it doesn't
> make business sense to give it to your competition for free.


The first sale to someone connected to your competition gives them the
model. You CANNOT enforce security on someone else's database. It
doesn't work like that.

--
73. I will not agree to let the heroes go free if they win a rigged contest,
even though my advisors assure me it is impossible for them to win.
--Peter Anspach's list of things to do as an Evil Overlord
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-24-2008, 06:09 PM
lawpoop@gmail.com
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Apr 23, 9:14 am, "Peter H. Coffin" <hell...@ninehells.com> wrote:
>
> > Well, if we have a database that's available to the public through a
> > website, and some entreprising hacker wants to do an SQL injection,
> > they would get quite a leg up if they could look up the exact names of
> > our fields and tables.

>
> *cough* If said hacker can amanage and injection, she can ask the
> database about the tables and column names. Your help isn't needed.


If said hacker is injecting using an account with limited permissions,
they can't ask general questions about the database structure. Well,
they can ask, but they won't get the answer they want. : )

They can only inject with the permissions that their account grants
them, unless they can escalate permission. So, if they don't have
permissions for "SHOW TABLES FROM database" or "DESCRIBE table", then
they would have to guess table and field names -- unless, say, we were
to tell them what they are in a usenet group.

>
> If it's that clever, you'll have it patented. If it's not patentable,
> then it's too obvious to be a strategic advantage.
>


The small business people I've dealt with have a pragmatic view of
legal protections, much like nuclear weapons. They like to have them,
and love threatening the other guy with them at the meeting, but to
actually use them is an expensive, risky proposition. It escalates a
situation to all out war ( whereas before you were doing business with
the party, now you are losing ) and has the serious potential to blow
up in your face.

"Instead of making me go to court and pay thousands of dollars to a
lawyer to defend the patents we got, and risk losing the case, how
about you just not post the work I'm paying you to do on the
internet?"

And if they are using our code or data structure, how would we even
find out about it to trigger the patent protections? It's much cheaper
to keep your programmers in line, than to go to court for months.

Even if it's not clever enough to be patentable, it still takes time
( read: money ) to do a job properly. "I'm paying you good money to
write code, and you say it's worth the money. So why are you giving
the work away for free on the internet?" So now

I'm not saying the competition, I'm just giving you the reasoning that
small business people employ. They can't afford patents and months-
long legal cases; the simple, affordable fix is simply not to give
away your investment. Money is worth more to the little guys than it
is to the big guys, because little guys have less of it. If they
surrender some of their hard earned cash to buy some code from you,
they have a real hard time understanding why you're willing to give it
away for free to "your buddies on the internet".

"You've already spent thousands of dollars on database application.
You should spend several more on patents and lawyers defending it in
court. What? Oh, I don't know how you would find out if someone is
infringing on your patent. Probably in the discovery process of the
court case, I guess." At this point, steam is coming out of their
ears.

>
> > Suppose we have a business model, expressed as a database, that is
> > superior to our competitions', and that allows us to ship products
> > faster for less money. Why would we want to then give our model to our
> > competition? We spent a lot of time and money building it; it doesn't
> > make business sense to give it to your competition for free.

>
> The first sale to someone connected to your competition gives them the
> model. You CANNOT enforce security on someone else's database. It
> doesn't work like that.
>


Straw man argument. We sell a service on the web, not a license to run
a program. The only interface the user has to our code and database
structure is through a web page. Given everything working properly,
they would never see a snippet of code or SQL. They never receive code
from us; only pdfs and web pages.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 04-24-2008, 06:09 PM
lawpoop@gmail.com
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Apr 22, 5:51 pm, Kees Nuyt <k.n...@nospam.demon.nl> wrote:
> On Tue, 22 Apr 2008 12:29:28 -0700 (PDT),
>
> lawp...@gmail.com wrote:
> >Well, if we have a database that's available to the public through a
> >website, and some entreprising hacker wants to do an SQL injection,
> >they would get quite a leg up if they could look up the exact names of
> >our fields and tables.

>
> They could try to query the INFORMATION_SCHEMA first,
> or use SHOW CREATE ... and explore from there.


If the MySQL user account they're connecting with does not have
permissions for that, then those queries will get them nowhere.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 04-24-2008, 06:09 PM
Captain Paralytic
 
Posts: n/a
Default Re: error with UNIQUE key length?

On 23 Apr, 14:22, lawp...@gmail.com wrote:
> On Apr 23, 9:14 am, "Peter H. Coffin" <hell...@ninehells.com> wrote:
>

And of course, it is totally beyond you to export the structure and
just rename the fields.

But I guess that takes a modicum of intelligence.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 04-24-2008, 06:09 PM
lawpoop@gmail.com
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Apr 22, 4:25 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Tue, 22 Apr 2008 21:29:28 +0200, <lawp...@gmail.com> wrote:


>
> If the data/table definition is THAT sensitive, and security necessarily
> THAT tight, I cannot imagine there is no money for an 'expert' reasonably
> savvy enough to troubleshoot a simple unique index problem. If there's an
> attempt at security at database level by people who can't even do this,
> I'd say it's almost certainly doomed to fail or at least have a few holes.


I deal with a lot of small business people. To them, a few thousands
dollars to develop an app is a lot of money . No, they don't have more
money to hire a consultant to trouble shoot a simple error, that's
what they hired me for. If I tell them that they need to pay X for
another consultant, or Y for patenting, or Z for this, then they will
tell me that I mislead them about the true cost of what they were
getting into at the beginning. they make very certain that I am
telling them the full story about all the costs of development from
the outset. They want to get a solid number on the total cost before
we start, and get very upset about putting in more money. It's like
after you closed a deal on a car, and then the salesperson says "You
need to buy rust protection. After all, you're spending X dollars on
this car. Don't you want to protect the investment? Also, you'll need
the extended warranty" . That's how they perceive it. It feels like a
bait and switch to them.

It's not that the table definition is that sensitive, it's just that
the small business people I work for have a hard time understand why
they pay me "all this money" in exchange for code, and then watch me
"turn around and give it away on the internet". "Why should I pay you
to write it then? Why can't you just copy and paste it from the other
people who are posting it?" They are more paranoid about protecting
their investment then the bigger guys, because it is more variable to
them. If a big company spends a few thousand dollars on a table
definition, they can afford to "lose it". A small business owner
cannot. Yes, I know they are not "losing it", and yes, i know you
cannot cut and paste from the internet and have a fully functional
database. But they don't. I try my best to explain it to them, but
they rarely see it from my perspective. So, I don't bite the hand
that feeds me. If it were up to me, I would probably post the table
definition. T

I don't know everything about MySQL; sometimes I get caught up in
simple error, or have a brain fart, or it's something I thought I knew
but was wrong. If it seems like a simple error that someone might know
of the top of the head, that a pair of fresh eyes could easily
recognize, then I post it on the list. I always get right to the
point, provide adequate information, and try to ask yes/no questions.
I am under certain constraints, so therefore I don't expect people to
do a complete troubleshooting. I'm sorry I could not bring this thread
beyond that point.


>
> In short, if you cannot 'broadcast' the table definition here, and my
> simple example demonstrated that MySQL has no problem with a UNIQUE key on
> multiple fields, we cannot help you any further, apart from wildly
> guessing.


That's exactly what I'm looking for. Thank you. I'm sorry I cannot
provide the additional information that you are looking for.

I haven't asked for any additional help beyond my original question. I
tried to explain why I couldn't post additional information for
further assistance; perhaps I did a lousy job communicating those
reasons, but that's water under the bridge now.

>
> My first guess (and almost certainly the correct one) is:
> - the UNIQUE is NOT defined properly, or there are more then 1 UNIQUE keys
> defined on the same table.
>
> My second and final farfetched guess is:
> - client-id is erroneously defined as float and there are float troubles
> (in which case not security but mere shame client-id was defined as a
> float would prevent me from posting the table definition).
>
> No more guesses will be made from here on by me. Without a table
> definition, I leave you to the people with better crystal balls.


Those are good guesses, and I appreciate your assistance. I'm probably
coming off as smarmy, but I'm just relaying information.

All I asked originally was if
"Am I getting the error because my UNIQUE key is too long? "
"Is there a way to actually look at the values for the keys in my
table? "

If you are choosing to answer more than "No, no", then I appreciate
your willingness to go the extra mile to help me troubleshoot me
troubleshoot my problem, and I apologize that I could not provide the
additional information. It's not my decision to make.

All the arguments that others have made on this list are valid and
reasonable to me as a programmer; the problem is, I don't work for a
programmer. I work for a business person, who has a different idea
about the value of code they've bought.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 04-24-2008, 06:09 PM
Peter H. Coffin
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Wed, 23 Apr 2008 07:22:12 -0700 (PDT), lawpoop@gmail.com wrote:
> On Apr 23, 9:14 am, "Peter H. Coffin" <hell...@ninehells.com> wrote:
>>
>> > Well, if we have a database that's available to the public through a
>> > website, and some entreprising hacker wants to do an SQL injection,
>> > they would get quite a leg up if they could look up the exact names of
>> > our fields and tables.

>>
>> *cough* If said hacker can amanage and injection, she can ask the
>> database about the tables and column names. Your help isn't needed.

>
> If said hacker is injecting using an account with limited permissions,
> they can't ask general questions about the database structure. Well,
> they can ask, but they won't get the answer they want. : )
>
> They can only inject with the permissions that their account grants
> them, unless they can escalate permission. So, if they don't have
> permissions for "SHOW TABLES FROM database" or "DESCRIBE table", then
> they would have to guess table and field names -- unless, say, we were
> to tell them what they are in a usenet group.


That is, unfortunately, not the case.

$ mysql -u altgothic -p altgothic
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 87511
Server version: 5.0.33-log OpenBSD port: mysql-server-5.0.33

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+---------------------+
| Tables_in_altgothic |
+---------------------+
| bids |
| c10vote |
| c11attend |
| c11vote |
| c12import |
| c12vote |
| c8vote |
| c9vote |
| foo |
| itemtype |
| news |
| pingbounce |
| pingbounce_copy |
| purchase |
| purchase_item |
| user_old |
| users |
| users_copy |
| vote |
+---------------------+
19 rows in set (0.00 sec)

mysql> describe users;
+---------------+-----------------------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key |
Default | Extra |
+---------------+-----------------------------------+------+-----+---------------------+----------------+
| user_seq | int(10) unsigned zerofill | NO | PRI | NULL
| auto_increment |
| id | varchar(19) | NO | MUL |
| |
| name | varchar(24) | YES | | NULL
| |
| password | varchar(32) | YES | | NULL
| |
| nick | varchar(24) | YES | | NULL
| |
| email | varchar(60) | YES | UNI | NULL
| |
| city | varchar(32) | YES | | NULL
| |
| locale | varchar(32) | YES | | NULL
| |
| country | varchar(32) | YES | | NULL
| |
| postal_code | varchar(24) | YES | | NULL
| |
| datasource | varchar(24) | YES | |
Self-registration | |
| validation | enum('valid','invalid','pending') | NO | |
pending | |
| admin_flag | enum('N','Y') | NO | | N
| |
| updated | timestamp | NO | |
CURRENT_TIMESTAMP | |
| created | timestamp | NO | |
0000-00-00 00:00:00 | |
| change_reason | varchar(80) | YES | | NULL
| |
+---------------+-----------------------------------+------+-----+---------------------+----------------+
16 rows in set (0.02 sec)

mysql> show grants for current_user;
+------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for altgothic@%
|
+------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'altgothic'@'%' IDENTIFIED BY PASSWORD
'xxxxxxxxxxxxxxxx'
|
| GRANT SELECT, INSERT, UPDATE, DELETE ON `altgothic`.* TO
'altgothic'@'%'
|
| GRANT SELECT, INSERT, UPDATE, DELETE ON `ag_wiki`.* TO 'altgothic'@'%'
|
+------------------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

mysql> quit
Bye
$

In case you're not sure about it, the GRANT USAGE means no privs except
those explicitly assigned [1]. This user can manipulate data only, not
structure, yet has no trouble using those functions you seem to think
would not be accessable to a restricted role user ID.

I am glad you posted here. You will have an opportunity to reassess some
of your security strategy.

[1] http://dev.mysql.com/doc/refman/5.0/en/grant.html

--
"I know it's a buzzword [...], but fsckit, 'Enterprise' editions of things
*should* come with the phasers and photon torpedos and all.
Of course, the first vendor freebie you'd get would be a red shirt..."
-- Anthony de Boer in the Monastery
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 04-24-2008, 06:09 PM
lawpoop@gmail.com
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Apr 23, 10:26 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 23 Apr, 14:22, lawp...@gmail.com wrote:> On Apr 23, 9:14 am, "Peter H. Coffin" <hell...@ninehells.com> wrote:
>
> And of course, it is totally beyond you to export the structure and
> just rename the fields.
>
> But I guess that takes a modicum of intelligence.


It's not *totally* beyond me, but it would be an extra, unnecessary
step. I got the answers I was asking for:

Steve Lefevre
"Am I getting the error because my UNIQUE key is too long? This is
MySQL 5.0.24a.

Is there a way to actually look at the values for the keys in my
table? "

Rik Wasmus:
"mysql> insert into unique_test value
('12345678912345678912345678912345',2);
Query OK, 1 row affected (0.01 sec)"

No problems here whatsoever. Your UNIQUE is not properly created.
The
fastest way to show the key is by issuing a SHOW CREATE TABLE
<tablename>;
query. "

Doing more work isn't going to change the answers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 04-24-2008, 06:09 PM
Peter H. Coffin
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Wed, 23 Apr 2008 07:53:35 -0700 (PDT), lawpoop@gmail.com wrote:
> On Apr 22, 4:25 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> My first guess (and almost certainly the correct one) is:
>> - the UNIQUE is NOT defined properly, or there are more then 1 UNIQUE keys
>> defined on the same table.
>>
>> My second and final farfetched guess is:
>> - client-id is erroneously defined as float and there are float troubles
>> (in which case not security but mere shame client-id was defined as a
>> float would prevent me from posting the table definition).
>>
>> No more guesses will be made from here on by me. Without a table
>> definition, I leave you to the people with better crystal balls.

>
> Those are good guesses, and I appreciate your assistance. I'm probably
> coming off as smarmy, but I'm just relaying information.
>
> All I asked originally was if
> "Am I getting the error because my UNIQUE key is too long? "
> "Is there a way to actually look at the values for the keys in my
> table? "
>
> If you are choosing to answer more than "No, no", then I appreciate


It's probably more "not in this case from the visible sample, no", but
that doesn't change this instance. Unique keys can get kind of funny
when you're dealing with large objects. But the hash you've chosen
indicates that you've probably intentionally sidestepped that issue.

> your willingness to go the extra mile to help me troubleshoot me
> troubleshoot my problem, and I apologize that I could not provide the
> additional information. It's not my decision to make.


See, now THAT is a fine reason not to share the structure. "Can't, for
internal political reasons. Thanks for your time" is always acceptable,
as are NDAs or even "don't feel like it". The price for those things is
that we can't give much help, and that's usually a pretty small price.
Very few folks here know anything that's not in the doco anyway; we
(collectively) just may be able to cross-corollate faster than one brain
does in a particular instance.

--
Revenge is an integral part of forgiving and forgetting.
-- The BOFH
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 04-24-2008, 06:09 PM
Captain Paralytic
 
Posts: n/a
Default Re: error with UNIQUE key length?

On 23 Apr, 15:06, lawp...@gmail.com wrote:
> On Apr 23, 10:26 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > On 23 Apr, 14:22, lawp...@gmail.com wrote:> On Apr 23, 9:14 am, "Peter H. Coffin" <hell...@ninehells.com> wrote:

>
> > And of course, it is totally beyond you to export the structure and
> > just rename the fields.

>
> > But I guess that takes a modicum of intelligence.

>
> It's not *totally* beyond me, but it would be an extra, unnecessary
> step. I got the answers I was asking for:
>
> Steve Lefevre
> "Am I getting the error because my UNIQUE key is too long? This is
> MySQL 5.0.24a.
>
> Is there a way to actually look at the values for the keys in my
> table? "
>
> Rik Wasmus:
> "mysql> insert into unique_test value
> ('12345678912345678912345678912345',2);
> Query OK, 1 row affected (0.01 sec)"
>
> No problems here whatsoever. Your UNIQUE is not properly created.
> The
> fastest way to show the key is by issuing a SHOW CREATE TABLE
> <tablename>;
> query. "
>
> Doing more work isn't going to change the answers.


But you didn't bother to tell anybody that you had solved it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 04-24-2008, 06:09 PM
lawpoop@gmail.com
 
Posts: n/a
Default Re: error with UNIQUE key length?

On Apr 23, 11:28 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:

> But you didn't bother to tell anybody that you had solved it.


I haven't solved it. Right now, I'm working on other parts of the
project where I'm getting more done. I'll come back to my bug later,
since it appears to be a timesink. Another poster demonstrated to me
that my simple suspicion of what was wrong could not be the case, so
now I know which avenues of attack not to pursue.

I didn't ask anybody to solve my problem. All that's happened is that
I asked a few questions about MySQL, and they got answered. Since I
could not post my specific table structure, I deliberately posted
general questions about MySQL that could be answered without knowing
the specific table structure. People wondered why I wouldn't post the
table structure, and I tried to answer the questions as best as I
could. In retrospect I probably could have done a better job
communicating those reasons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:56 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392